阅读:2904回复:4
为什么磁盘图标有\"PC\"字样?
OS: OS9
设备:U盘 问题: 用系统自带的驱动,磁盘图标没有\"PC\"字样,用USB DDK的例子编译的驱动,磁盘图标有\"PC\"字样.是什么原因呢? 谢了. |
|
|
沙发#
发布于:2003-12-01 09:35
MacWin,你的联系方式是什么?给你写了信收到没有?
|
|
板凳#
发布于:2003-12-01 10:25
联系我,请加MSN: xinjian_chen@hotmail.com
|
|
|
地板#
发布于:2003-12-21 20:06
DDK里的图标都包含在源文件里,要修改图标,把UnitTableDriverIcons.c里的图标数据改一下,应该就可以了
|
|
地下室#
发布于:2003-12-22 10:31
Disk icon on OS 9
dear Chen, This message will help you with your recent questions. I will discuss two topics : hints on driver calls you asked about, and secondly a list of serious bugs in apples usb source code you need to know about. There is a mandatory Apple status call as of its October 20, 1994 draft rules : cs code 43, DRIVER_GESTALT and extending it there is a selector for color icons used in the finder (it will need to be cached in ram, because you cannot access resources during synchronous IO, so copy the color icon resources into a locked handle area in system heap location. you need to implement \'mics\' and \'dics\' dics : returns a pointer to a IconFamily (\'icns\') data structure for physical drive Disk Driver (formerly in csCode 21) in driverGestaltResponse \'mics\'is same as \'dics\' but formerly in csCode 22. this is meidia related color icon. There are bugs in some versions of apples finder : one major defect : does not allow you to clear undefined bytes in csParam field to zero, in many versions of apple finder, just leave undefined bytes alone because apple uses the bytes illegally in its cd-rom driver usage. There are other apple bug to worry about. You might want to check your list of gestalt calls, one is for media type and can return \'cdrm\' and \'disk\'. helpful rare gestalt call hints : kdgVMOptions , set correctly for SPEED, and make driver a ptr not hdl. you might want to simulate every feature of apples driver and all its gestalt responses in order to get the driver to do anything apples drivers do, including using the gestalt version of apples driver. if you support luns remember to support deviceident gestalt call so that the lun can be determined. I see you are trying to use usb mass storage device driver. the source code written by Apple\'s usb driver team is unusable unless you know how to locate and fix all the many bugs in the code. Amny of the bugs shipped in apples own drivers. Its horribly damaged code. To be nice, and to document a *FEW* of the many bugs in apples USB mass storage driver I will list *some* of them in this document to save you a lot of sad months of lost work. Apple does not pay enough salary to get the right people in the driver team (I know), and also has limits on contractor hourly $ rates, so that is how they end up with many of these bugs : USB BUG 1: in structure : \"StorageClassInfo\" used to hold Globals You need to add some safety space after \"Configuration block\" field \"USBPB usbPB\" 96 bytes are corrupted following the previous \"usbPB\" structure, USB 1.3 and earlier, the call to USBResetDevice would overwrite memory up to 96 bytes past the end of the \"usbPB\" parameter block damaging other vital globals in \"StorageClassInfo\". you need to ensure your compiler does not reorganize things on you or create a nested type. In 1.4 of USB Apple Fixed USBResetDevice so that it no longer corrupts memory past the parameter block, but I knew about the bug before apple fixed it. The bug is still in that code though that you are using I bet. USB BUG 2 : in call StorageClassDriverControl() with selector of kUSBStorageControlSetParentsRefNumber, apple\'s code returns an error with unititilized value for \"kUSBStorageControlSetParentsRefNumber\" status. \"status\" was random off stack. To fix it set \"status = noErr\" then only knock down if \"theDeviceRef != 0\" USB BUG 3 : In DriverControlCmd () Apple\'s buggy driver regularly is BLINDLY clearing the gTheDriverGlobals.drive_Internal_PB on unsupported control calls EVEN WHEN PARAM BLOCK BUSY!! when selector of kInitializeDeviceAccess or kTerminateDeviceAccess is called. gTheDriverGlobals.drive_Internal_PB.ioCommandID was getting zapped early. Perhaps the follwing hint may be of partial help : err = HandleControlRequest((UInt32) &gTheDriverGlobals.drive_Internal_PB, pbPtr, &InitializeDriveAccessDone); if (err != kRequestPending ) { gTheDriverGlobals.drive_Internal_PB.theIOPB = nil; gTheDriverGlobals.drive_Internal_PB.ioCommandID = 0; } USB BUG 4 : APPLE HAS A SERIOUS BUG AND NEEDED ANOTHER SPARE INTERNAL PARAMETER BLOCK. Otherwise control commands and other commands during interrupts caused havoc and wrote to Nil. The apple driver code did not check for write to nils and used address 0 for structure storage. Specifically, you need a scond block for ManualEjectPB, and add state logic. USB BUG 5 : uninitialized variable. in call ShimOpenDriver() called by notification routine to load a Unit Table driver at the start of the routine set : hDrvrResource = nil; USB BUG 6: Apple\'s code was resetting too many globals in a loop during removal deadlocks. So create global knock down flag to avoid unneeded work and then your \"StorageClassDriverInitialize()\" call can be a nop and return noErr if the global flag is set. I hate global flags but you need them at times. USB BUG 7 : In \"StorageDeviceInitiateConfiguration ()\" add auto repair code to \"kStorageConfigureInterface\" . usbReference Interface reference obtained from USBNewInterfaceRef as per required documentation rules. if (usbPB->usbReference != gStorageClassInfo.interface_Ref) { usbPB->usbReference = gStorageClassInfo.interface_Ref; } USB BUG 8 : InstallPB structure was not ansi C compliant. use the following : typedef struct { volatile OSStatus status; void *ourCompletion; UInt32 capacity; UInt32 blockSize; OSType currentMediaType; UInt8 currentState; UInt32 currentPartBlock; UInt32 lastPartBlock; DriveInstallCompletionProcPtr installCompletion; Boolean useNativeBlocks; UInt8 buffer[2048]; }InstallPB, *InstallPBPtr; USB BUG 9 : DriverGestaltDeviceModelInfoResponse Apple had a screwed up typedef. use : typedef struct { UInt32 infoStructVersion; StringPtr vendorName; StringPtr productName; StringPtr revisionNumber; StringPtr subRevisionNumber; StringPtr serialNumber; } DriverGestaltDeviceModelInfoResponse; I stopped keeping track of usb bugs I fixed and located in apples example mass storage class driver code, and ended up rewriting it all heavily. I also have not revealed all the apple usb bugs I know about deliberately. I was just trying to make a point. Apple\'s USB architecture is polled and slow and cannot handle a synch IO call from another storage driver during interrupts. Its more like a toy that emulates \"network\" storage. Firewire si no better. ATA IDE and SCSI work flawlessly on macs and have immediate IO, and even IOs while interrupts off. I am warning you though that you would be better off trying to write a perfect SCSI style DVD CD driver and then do the minimal low level support to make it work with minimal but proper USB code to function with USB devices of your choosing. I can be hired to fix driver issues on a variety of OSes. good luck, chen you will need a lot of luck, or a lot of skill. Ling Chao |
|
|