I have a custom file system driver that has been mounted on a disk
device object created by a custom disk driver. I need to change the icon
of this drive in Explorer on Windows XP.
I have followed the instructions on MSDN about adding the DefaultIcon
registry key (e.g. key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Dr
iveIcons\X\DefaultIcon, default value = c:\temp\drive.ico). However,
this does not seem to affect the icon of my virtual drive. It still
displays the standard Local Disk icon.
What is interesting is that the above way of changing the icon works for
normal drives like A: (floppy), C: (hard disk), D: (DVD), as well as for
any mapped network drives. But it does not work for my “virtual” drive.
Also, it does not work for substed drives (e.g. “subst x: c:\temp”).
The related key DefaultLabel works fine for my virtual drive.
Using RegMon I can see that Explorer reads the DefaultIcon key for all
drives except my virtual drive (and substed drives). Does anyone know
how Explorer determines which drives’ icons it reads from the registry?
I’m using the following system to create my drive letter:
- The disk driver creates the disk device object.
- The file system driver creates the file system device object.
- I call DefineDosDevice in user mode to create a symbolic link (drive
letter -> disk device object name).
My virtual drive appears as a “local disk” in Explorer because I report
the same device type and characteristics as local hard drives (i.e.
FILE_DEVICE_DISK).
Thanks in advance!
Antti