Hi,

I'm writing NT Service that listens device notifications. I am
subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
(flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
The notification contains the string \\?\Description{GUID}. I find the
same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
cannot know how to get its drive letter?

Any help would be appreciated.

Ilia

Re: USB Device Interface by Ben

Ben
Mon Jun 04 12:54:33 CDT 2007


"Ilia Golubev" <golubev@gmail.com> wrote in message
news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I'm writing NT Service that listens device notifications. I am
> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
> The notification contains the string \\?\Description{GUID}. I find the
> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
> cannot know how to get its drive letter?

A mass storage device contains volumes. A volume may have a optional drive
letter, and may be mounted in a folder on an NTFS share.

You can use a function like GetVolumePathNamesForVolumeName to get the
mounted paths (reparse points) for the volume.

>
> Any help would be appreciated.
>
> Ilia



Re: USB Device Interface by Ilia

Ilia
Mon Jun 04 14:22:22 CDT 2007

Thank you, Ben for the reply.
But the problem is following:
I get the string like
\\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
and I know (e.g. from Explorer) that its drive letter is F. From
MountedDevices I have the following records:

\??\Volume{0659b74d-ed9f-11db-9adc-0019db09a5b9} - (46 c6 6a 5b 00 7e 00
00 00 00 00 00)

\DosDevices\F - the same binary.

I get from volume functions ONLY MountedDevices key contains (see MSDN).
The question again: how get drive letter from the string above
mentioned. All other GUIDs do not work in NT service or do not get the
information I want.

Regards, Ilia

Ben Voigt [C++ MVP] wrote:
> "Ilia Golubev" <golubev@gmail.com> wrote in message
> news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
>> Hi,
>>
>> I'm writing NT Service that listens device notifications. I am
>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
>> The notification contains the string \\?\Description{GUID}. I find the
>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>> cannot know how to get its drive letter?
>
> A mass storage device contains volumes. A volume may have a optional drive
> letter, and may be mounted in a folder on an NTFS share.
>
> You can use a function like GetVolumePathNamesForVolumeName to get the
> mounted paths (reparse points) for the volume.
>
>> Any help would be appreciated.
>>
>> Ilia
>
>

Re: USB Device Interface by Ben

Ben
Mon Jun 04 15:29:27 CDT 2007


"Ilia Golubev" <golubev@gmail.com> wrote in message
news:us6xw2tpHHA.2372@TK2MSFTNGP02.phx.gbl...
> Thank you, Ben for the reply.
> But the problem is following:
> I get the string like
> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> and I know (e.g. from Explorer) that its drive letter is F. From
> MountedDevices I have the following records:
>
> \??\Volume{0659b74d-ed9f-11db-9adc-0019db09a5b9} - (46 c6 6a 5b 00 7e 00
> 00 00 00 00 00)
>
> \DosDevices\F - the same binary.
>
> I get from volume functions ONLY MountedDevices key contains (see MSDN).
> The question again: how get drive letter from the string above mentioned.
> All other GUIDs do not work in NT service or do not get the information I
> want.

Have you also tried DEV_BROADCAST_VOLUME? That gives drive letters
(although very little else).

>
> Regards, Ilia
>
> Ben Voigt [C++ MVP] wrote:
>> "Ilia Golubev" <golubev@gmail.com> wrote in message
>> news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
>>> Hi,
>>>
>>> I'm writing NT Service that listens device notifications. I am
>>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
>>> The notification contains the string \\?\Description{GUID}. I find the
>>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>>> cannot know how to get its drive letter?
>>
>> A mass storage device contains volumes. A volume may have a optional
>> drive letter, and may be mounted in a folder on an NTFS share.
>>
>> You can use a function like GetVolumePathNamesForVolumeName to get the
>> mounted paths (reparse points) for the volume.
>>
>>> Any help would be appreciated.
>>>
>>> Ilia
>>


Re: USB Device Interface by Ilia

Ilia
Mon Jun 04 15:54:38 CDT 2007

Ben,

GetLastError() says "The data is invalid". As I said, I have tried all
device types...;(.
Maybe is there a setup function? SetupDiGetClassDevsEx or something
else...

Regards, Ilia

Ben Voigt [C++ MVP] wrote:
> "Ilia Golubev" <golubev@gmail.com> wrote in message
> news:us6xw2tpHHA.2372@TK2MSFTNGP02.phx.gbl...
>> Thank you, Ben for the reply.
>> But the problem is following:
>> I get the string like
>> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
>> and I know (e.g. from Explorer) that its drive letter is F. From
>> MountedDevices I have the following records:
>>
>> \??\Volume{0659b74d-ed9f-11db-9adc-0019db09a5b9} - (46 c6 6a 5b 00 7e 00
>> 00 00 00 00 00)
>>
>> \DosDevices\F - the same binary.
>>
>> I get from volume functions ONLY MountedDevices key contains (see MSDN).
>> The question again: how get drive letter from the string above mentioned.
>> All other GUIDs do not work in NT service or do not get the information I
>> want.
>
> Have you also tried DEV_BROADCAST_VOLUME? That gives drive letters
> (although very little else).
>
>> Regards, Ilia
>>
>> Ben Voigt [C++ MVP] wrote:
>>> "Ilia Golubev" <golubev@gmail.com> wrote in message
>>> news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
>>>> Hi,
>>>>
>>>> I'm writing NT Service that listens device notifications. I am
>>>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>>>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
>>>> The notification contains the string \\?\Description{GUID}. I find the
>>>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>>>> cannot know how to get its drive letter?
>>> A mass storage device contains volumes. A volume may have a optional
>>> drive letter, and may be mounted in a folder on an NTFS share.
>>>
>>> You can use a function like GetVolumePathNamesForVolumeName to get the
>>> mounted paths (reparse points) for the volume.
>>>
>>>> Any help would be appreciated.
>>>>
>>>> Ilia
>

Re: USB Device Interface by Ben

Ben
Mon Jun 04 16:24:42 CDT 2007

"Ilia Golubev" <golubev@gmail.com> wrote in message
news:%23KU4UqupHHA.4872@TK2MSFTNGP03.phx.gbl...
> Ben,
>
> GetLastError() says "The data is invalid". As I said, I have tried all
> device types...;(.
> Maybe is there a setup function? SetupDiGetClassDevsEx or something
> else...

I can't speak to services in particular, but user applications don't have to
call RegisterDeviceNotification to get volume event, DEV_BROADCAST_VOLUME is
sent to all top-level windows by default.

>
> Regards, Ilia
>
> Ben Voigt [C++ MVP] wrote:
>> "Ilia Golubev" <golubev@gmail.com> wrote in message
>> news:us6xw2tpHHA.2372@TK2MSFTNGP02.phx.gbl...
>>> Thank you, Ben for the reply.
>>> But the problem is following:
>>> I get the string like
>>> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
>>> and I know (e.g. from Explorer) that its drive letter is F. From
>>> MountedDevices I have the following records:
>>>
>>> \??\Volume{0659b74d-ed9f-11db-9adc-0019db09a5b9} - (46 c6 6a 5b 00 7e 00
>>> 00 00 00 00 00)
>>>
>>> \DosDevices\F - the same binary.
>>>
>>> I get from volume functions ONLY MountedDevices key contains (see MSDN).
>>> The question again: how get drive letter from the string above
>>> mentioned. All other GUIDs do not work in NT service or do not get the
>>> information I want.
>>
>> Have you also tried DEV_BROADCAST_VOLUME? That gives drive letters
>> (although very little else).
>>
>>> Regards, Ilia
>>>
>>> Ben Voigt [C++ MVP] wrote:
>>>> "Ilia Golubev" <golubev@gmail.com> wrote in message
>>>> news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
>>>>> Hi,
>>>>>
>>>>> I'm writing NT Service that listens device notifications. I am
>>>>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>>>>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL
>>>>> notification.
>>>>> The notification contains the string \\?\Description{GUID}. I find the
>>>>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>>>>> cannot know how to get its drive letter?
>>>> A mass storage device contains volumes. A volume may have a optional
>>>> drive letter, and may be mounted in a folder on an NTFS share.
>>>>
>>>> You can use a function like GetVolumePathNamesForVolumeName to get the
>>>> mounted paths (reparse points) for the volume.
>>>>
>>>>> Any help would be appreciated.
>>>>>
>>>>> Ilia
>>



Re: USB Device Interface by Ben

Ben
Mon Jun 04 16:35:44 CDT 2007


"Ilia Golubev" <golubev@gmail.com> wrote in message
news:us6xw2tpHHA.2372@TK2MSFTNGP02.phx.gbl...
> Thank you, Ben for the reply.
> But the problem is following:
> I get the string like
> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
> and I know (e.g. from Explorer) that its drive letter is F. From
> MountedDevices I have the following records:
>
> \??\Volume{0659b74d-ed9f-11db-9adc-0019db09a5b9} - (46 c6 6a 5b 00 7e 00
> 00 00 00 00 00)
>
> \DosDevices\F - the same binary.
>
> I get from volume functions ONLY MountedDevices key contains (see MSDN).
> The question again: how get drive letter from the string above mentioned.
> All other GUIDs do not work in NT service or do not get the information I
> want.


In my registry, there are devices listed under RemovableMedia which match
the values (\\?\STORAGE#RemovableMedia#7&...&RM#{...}), under
MountedDevices. These should come with ClassGuid
{71A27CDD-812A-11D0-BEC7-08002BE2092F} and each is a child of the actual USB
device in the plug and play tree, so you can match them up with the device
description, etc.

>
> Regards, Ilia
>
> Ben Voigt [C++ MVP] wrote:
>> "Ilia Golubev" <golubev@gmail.com> wrote in message
>> news:emGiB1rpHHA.2372@TK2MSFTNGP02.phx.gbl...
>>> Hi,
>>>
>>> I'm writing NT Service that listens device notifications. I am
>>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
>>> The notification contains the string \\?\Description{GUID}. I find the
>>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>>> cannot know how to get its drive letter?
>>
>> A mass storage device contains volumes. A volume may have a optional
>> drive letter, and may be mounted in a folder on an NTFS share.
>>
>> You can use a function like GetVolumePathNamesForVolumeName to get the
>> mounted paths (reparse points) for the volume.
>>
>>> Any help would be appreciated.
>>>
>>> Ilia
>>


Re: USB Device Interface by Uwe

Uwe
Tue Jun 05 02:10:09 CDT 2007

Ilia Golubev wrote:
> Thank you, Ben for the reply.
> But the problem is following:
> I get the string like
> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

Leave the registry alone. Just add a trailing backslash to this
string and call GetVolumeNameForVolumeMountPoint with it.
Then you have the volume name as
\\?\Volume{2525d0b8-01de-11dc-b4ef-000102b35cc3}\

Under XP you get the drive letters and NTFS mountpoints for
a volume name by GetVolumePathNamesForVolumeName.
Under W2K just call GetVolumeNameForVolumeMountPoint with
"A:\\" to "Z:\\" until you get a match for the volume name.
To deal with NTFS mount point is a bit harder...


Greetings from Germany

Uwe

Re: USB Device Interface by Maxim

Maxim
Tue Jun 05 10:19:35 CDT 2007

> Under W2K just call GetVolumeNameForVolumeMountPoint with
> "A:\\" to "Z:\\" until you get a match for the volume name.

No, not from A to Z, but using the result of GetLogicalDriveStrings.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: USB Device Interface by Uwe

Uwe
Tue Jun 05 11:13:32 CDT 2007

Maxim S. Shatskih wrote:
>> Under W2K just call GetVolumeNameForVolumeMountPoint with
>> "A:\\" to "Z:\\" until you get a match for the volume name.
>
> No, not from A to Z, but using the result of GetLogicalDriveStrings.

Yes, if the coder thinks that it's worth the effort. Calling
GetVolumeNameForVolumeMountPoint with an non existing drive
doesn't hurt, even on a checked build.

Uwe


Re: USB Device Interface by Ilia

Ilia
Tue Jun 05 15:08:50 CDT 2007

Thank you, Uwe
It works fine.

Regards,
Ilia

Uwe Sieber wrote:
> Ilia Golubev wrote:
>> Thank you, Ben for the reply.
>> But the problem is following:
>> I get the string like
>> \\?\STORAGE#Volume#1&30a96598&0&Signature70A970A9Offset946D85600Length95A73AA00#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
>
>
> Leave the registry alone. Just add a trailing backslash to this
> string and call GetVolumeNameForVolumeMountPoint with it.
> Then you have the volume name as
> \\?\Volume{2525d0b8-01de-11dc-b4ef-000102b35cc3}\
>
> Under XP you get the drive letters and NTFS mountpoints for
> a volume name by GetVolumePathNamesForVolumeName.
> Under W2K just call GetVolumeNameForVolumeMountPoint with
> "A:\\" to "Z:\\" until you get a match for the volume name.
> To deal with NTFS mount point is a bit harder...
>
>
> Greetings from Germany
>
> Uwe

RE: USB Device Interface by m4rk

m4rk
Thu Jun 07 01:49:00 CDT 2007

Hi,

Try this - the easiest way, It worked for me, I dont know if it will work
for you.
I also need other's help on this because i dont have all kinds of USB flash
storage device to test my service application. If it does work not for you,
pls send me an email coz we are on similar situation.

1> monitor for registry changes under the registry key:

HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR

2> Once a USB device is inserted onto the USB port, changes
on the registry will be notified thru RegNotifyChangeKeyValue() API
or ur service app will have DBT_DEVICEARRIVAL notification.

3> As soon as there were changes, your application should enumerate the
specified registry subkey and then check for the existence of "Control"
subkeyname.

4> The "Control" subkey, will have a "DeviceReference" valuename under it
with a DWORD value data that refers to that device. - what's the use of that
value data ? i really dont know.

5> Get the PARENT Subkey of this branch because it holds the
"ParentIdPrefix" valuename which has a REG_SZ type of value data.

6> We can use this "ParentIdPrefix" in determining the assigned drive of that
newly inserted USB device. We will then scan the value data under the
registry tree:

HKLM\System\MountedDevices

7> We will only search under those Value name starting with
\DosDevices\<drive letter>. Since this is a binary value, we will
get all of its string equivalent then we will search among those
string equivalent where we can find the valuedata of "ParentIdPrefix" which
refers to the inserted USB drive. The valuename which holds this value data
represent the Drive letter assigned to the USB drive. Remove the
"\DosDevices\" string
to produce the drive letter assignment.

8> Once you get the drive letter assignment, we can also get the
disk geometry: ( Disk size, tracks per cylinder, sectors per track, etc. )
of the USB device. - i tried this only on limited device samples.

9> As soon as the USB device is removed from the USB port, the
"DeviceReference" value is removed from that Registry tree.

10> The advantages of this technique is that you can enumerate the USB
device even if the flash drive is already inserted even before your service
application has started. - a little tweak will do it.

11> In Windows 2000, you can get the following important
information in the registry:

1> USB Friendly Name - the recognizable name for the USB.
2> Class GUID - The GUID for removable media
3> Device Description - the description for the USB, if this is a flash
drive then the description is "Disk Drive".
4> Driver - The generic driver used for this USB.
5> Manufacturer - this does not give accurate information - it usually gives
"(Standard disk drive)" value and not the actual manufacturer of the USB.
6> USB drive - drive letter assignment for this device.

12> if your devt platform is XP or higher, you can also get the serial number.

13> check this site:

http://www.osronline.com/lists_archive/ntdev/thread11983.html



"Ilia Golubev" wrote:

> Hi,
>
> I'm writing NT Service that listens device notifications. I am
> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
> The notification contains the string \\?\Description{GUID}. I find the
> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
> cannot know how to get its drive letter?
>
> Any help would be appreciated.
>
> Ilia
>

Re: USB Device Interface by Uwe

Uwe
Thu Jun 07 02:13:41 CDT 2007



All this can be done thru documented API calls, there
is absolutely no reason to play with the registry.


Uwe


m4rk.gm4il@gmail.com wrote:
> Hi,
>
> Try this - the easiest way, It worked for me, I dont know if it will work
> for you.
> I also need other's help on this because i dont have all kinds of USB flash
> storage device to test my service application. If it does work not for you,
> pls send me an email coz we are on similar situation.
>
> 1> monitor for registry changes under the registry key:
>
> HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR
>
> 2> Once a USB device is inserted onto the USB port, changes
> on the registry will be notified thru RegNotifyChangeKeyValue() API
> or ur service app will have DBT_DEVICEARRIVAL notification.
>
> 3> As soon as there were changes, your application should enumerate the
> specified registry subkey and then check for the existence of "Control"
> subkeyname.
>
> 4> The "Control" subkey, will have a "DeviceReference" valuename under it
> with a DWORD value data that refers to that device. - what's the use of that
> value data ? i really dont know.
>
> 5> Get the PARENT Subkey of this branch because it holds the
> "ParentIdPrefix" valuename which has a REG_SZ type of value data.
>
> 6> We can use this "ParentIdPrefix" in determining the assigned drive of that
> newly inserted USB device. We will then scan the value data under the
> registry tree:
>
> HKLM\System\MountedDevices
>
> 7> We will only search under those Value name starting with
> \DosDevices\<drive letter>. Since this is a binary value, we will
> get all of its string equivalent then we will search among those
> string equivalent where we can find the valuedata of "ParentIdPrefix" which
> refers to the inserted USB drive. The valuename which holds this value data
> represent the Drive letter assigned to the USB drive. Remove the
> "\DosDevices\" string
> to produce the drive letter assignment.
>
> 8> Once you get the drive letter assignment, we can also get the
> disk geometry: ( Disk size, tracks per cylinder, sectors per track, etc. )
> of the USB device. - i tried this only on limited device samples.
>
> 9> As soon as the USB device is removed from the USB port, the
> "DeviceReference" value is removed from that Registry tree.
>
> 10> The advantages of this technique is that you can enumerate the USB
> device even if the flash drive is already inserted even before your service
> application has started. - a little tweak will do it.
>
> 11> In Windows 2000, you can get the following important
> information in the registry:
>
> 1> USB Friendly Name - the recognizable name for the USB.
> 2> Class GUID - The GUID for removable media
> 3> Device Description - the description for the USB, if this is a flash
> drive then the description is "Disk Drive".
> 4> Driver - The generic driver used for this USB.
> 5> Manufacturer - this does not give accurate information - it usually gives
> "(Standard disk drive)" value and not the actual manufacturer of the USB.
> 6> USB drive - drive letter assignment for this device.
>
> 12> if your devt platform is XP or higher, you can also get the serial number.
>
> 13> check this site:
>
> http://www.osronline.com/lists_archive/ntdev/thread11983.html
>
>
>
> "Ilia Golubev" wrote:
>
>> Hi,
>>
>> I'm writing NT Service that listens device notifications. I am
>> subscribing on DEV_BROADCAST_DEVICEINTERFACE notifications. After USB
>> (flash drive or HDD) is connected, I get DBT_DEVICEARRIVAL notification.
>> The notification contains the string \\?\Description{GUID}. I find the
>> same string in the registry HKLM\CONFIG\...\DeviceClasses\... But I
>> cannot know how to get its drive letter?
>>
>> Any help would be appreciated.
>>
>> Ilia
>>

Re: USB Device Interface by Ilia

Ilia
Thu Jun 07 12:34:48 CDT 2007

Hi, Uwe,

And what is about DBT_DEVICEREMOVECOMPLETE? When I call
GetVolumeNameForVolumeMountPoint I obtain FALSE as the return value. It
means that this volume does not exist. I do not get
DBT_DEVICEQUERYREMOVE notification (it can help me because the drive is
not unplug).

Regards, Ilia

Uwe Sieber wrote:
>
>
> All this can be done thru documented API calls, there
> is absolutely no reason to play with the registry.
>
>
> Uwe
>
>
>

Re: USB Device Interface by Uwe

Uwe
Fri Jun 08 02:04:52 CDT 2007


Hi Ilia,

some information might be possible to get thru the
registry after removal, but important links are
already broken then, so, for instance, you will not
find a storage volume's disk device.

Registry or API, just save all required information
of present devices on startup of your application and
for new devices on DBT_DEVICEARRIVAL.


Uwe



Ilia Golubev wrote:
> Hi, Uwe,
>
> And what is about DBT_DEVICEREMOVECOMPLETE? When I call
> GetVolumeNameForVolumeMountPoint I obtain FALSE as the return value. It
> means that this volume does not exist. I do not get
> DBT_DEVICEQUERYREMOVE notification (it can help me because the drive is
> not unplug).
>
> Regards, Ilia
>
> Uwe Sieber wrote:
>>
>>
>> All this can be done thru documented API calls, there
>> is absolutely no reason to play with the registry.
>>
>>
>> Uwe
>>
>>
>>

Re: USB Device Interface by Ilia

Ilia
Sat Jun 09 02:58:34 CDT 2007

Hi,Uwe

Maybe enumerating all volume names and comparing them with the
previously saved volume name can solve this problem?

Ilia

Uwe Sieber wrote:
>
> Hi Ilia,
>
> some information might be possible to get thru the
> registry after removal, but important links are
> already broken then, so, for instance, you will not
> find a storage volume's disk device.
>
> Registry or API, just save all required information
> of present devices on startup of your application and
> for new devices on DBT_DEVICEARRIVAL.
>
>
> Uwe
>
>
>
> Ilia Golubev wrote:
>> Hi, Uwe,
>>
>> And what is about DBT_DEVICEREMOVECOMPLETE? When I call
>> GetVolumeNameForVolumeMountPoint I obtain FALSE as the return value.
>> It means that this volume does not exist. I do not get
>> DBT_DEVICEQUERYREMOVE notification (it can help me because the drive
>> is not unplug).
>>
>> Regards, Ilia
>>
>> Uwe Sieber wrote:
>>>
>>>
>>> All this can be done thru documented API calls, there
>>> is absolutely no reason to play with the registry.
>>>
>>>
>>> Uwe
>>>
>>>
>>>

Re: USB Device Interface by Uwe

Uwe
Mon Jun 11 05:59:05 CDT 2007


Hi Ilia,

yes, this would work even there are not too much useful
things to do with the gathered information when the volume
is gone.


Uwe


Ilia Golubev wrote:
> Hi,Uwe
>
> Maybe enumerating all volume names and comparing them with the
> previously saved volume name can solve this problem?
>
> Ilia
>
> Uwe Sieber wrote:
>>
>> Hi Ilia,
>>
>> some information might be possible to get thru the
>> registry after removal, but important links are
>> already broken then, so, for instance, you will not
>> find a storage volume's disk device.
>>
>> Registry or API, just save all required information
>> of present devices on startup of your application and
>> for new devices on DBT_DEVICEARRIVAL.
>>
>>
>> Uwe
>>
>>
>>
>> Ilia Golubev wrote:
>>> Hi, Uwe,
>>>
>>> And what is about DBT_DEVICEREMOVECOMPLETE? When I call
>>> GetVolumeNameForVolumeMountPoint I obtain FALSE as the return value.
>>> It means that this volume does not exist. I do not get
>>> DBT_DEVICEQUERYREMOVE notification (it can help me because the drive
>>> is not unplug).
>>>
>>> Regards, Ilia
>>>
>>> Uwe Sieber wrote:
>>>>
>>>>
>>>> All this can be done thru documented API calls, there
>>>> is absolutely no reason to play with the registry.
>>>>
>>>>
>>>> Uwe
>>>>
>>>>
>>>>