getting explorer to see drive letters

Hi all,

I have created a device of type FILE_DEVICE_DISK, and I have
integrated with the mount manager to get a drive letter assigned to
it. The problem I experienced (and solved) is one that has been
discussed many times on this list and NTFSD: that Explorer does not
see my drive letter, but with a minor twist, so I have decided to post
here in case others may also be experiencing this problem.

After reading all the threads and posts I found, the solution seems to
be the following: after the disk driver has interacted with the mount
manager to create the symbolic link for the drive letter, a user-mode
application needs to do this following:

DEV_BROADCAST_VOLUME dbv;
dbv.dbcv_size = sizeof( dbv );
dbv.dbcv_devicetype = DBT_DEVTYP_VOLUME;
dbv.dbcv_reserved = 0;
dbv.dbcv_unitmask = 1 << ( towupper( wchLetter ) - L’A’ );
dbv.dbcv_flags = DBTF_NET;
SendMessage( HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVICEARRIVAL, (LPARAM)&dbv );

where wchLetter is a unicode character holding the drive letter the
mount manager assigned to the disk. For me, this works just fine if
that user-mode application is console app running as the logged in
user. (Some people say DBFT_NET is needed, and others don’t mention
it, but using it works for me.)

However, if that user-mode application is a service running as
LocalSystem, it does not work, that is, Explorer does not see the
drive letter. To get it to work, I had to turn on “allow service to
interact with desktop”. Note that changing the service to login as
the same user as was logged in did not seem to make it work for me.

Hope this helps.

=================================================
Roger Tawa
http://tawacentral.net/
[One thing about paradigms: shift happens.]
[When you stop, you’re done.]