How to change drive icon on Windows XP

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

XP’s Shell sucks big time. The only extension that works within
reasonable limits is context menu. Everything else - just pain in the
ass. I had the same problem as you have and I couldn’t figure out how to
fix it. Finally I decided that changing disk label is good enough
distinctive feature. But if you ever find the solution I would
appreciate if you share that knowledge :slight_smile:

Good luck!

Vladimir

-----Original Message-----
From: Antti Nivala [mailto:xxxxx@motivesys.com]
Sent: Sunday, August 01, 2004 10:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] How to change drive icon on Windows XP

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


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as:
xxxxx@borland.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes pls share the info. I found two places where XP shell icon behavior little inconsistent, one is of getting root icon thru autoconfig.ini, and another is with Name space extension. For the name space extension I just wanted to have it on My Computer instead of DeskTop, and magic goes on the air, some xp machine shows it perfectly and other does not show at all. Then again, when it is My Computer it shows on some XP+sp1 and it does not show on other…

-pro