How to retrieve USB device serial number

Hello All,
I can retrieve Hard disk serial number(which is
unique)programmatically. Is it possible to determine serial number using
WMI? Is there any other way to determine serial number for USB?

Please help me out in above querries.

thanx,
sam

This link has a sample program…

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q259695

In this function,

// Create a HDEVINFO with all present devices.
hDevInfo = SetupDiGetClassDevs(NULL,
0, // Enumerator
0,
DIGCF_PRESENT | DIGCF_ALLCLASSES );

in this first parameter give the guid of the device…

and

while (!SetupDiGetDeviceRegistryProperty(
hDevInfo,
&DeviceInfoData,
SPDRP_DEVICEDESC,
&DataT,
(PBYTE)buffer,
buffersize,
&buffersize))

replace this SPDRP_DEVICEDESC, with SPDRP_HARDWAREID

or it has other information about the device you have enumerated…

hope this helps…

regds,

Shiva P

----- Original Message -----
From: “Varsha Kadam”
To: “NT Developers Interest List”
Sent: Friday, June 20, 2003 3:34 PM
Subject: [ntdev] How to retrieve USB device serial number

> Hello All,
> I can retrieve Hard disk serial number(which is
> unique)programmatically. Is it possible to determine serial number using
> WMI? Is there any other way to determine serial number for USB?
>
> Please help me out in above querries.
>
> thanx,
> sam
>
> —
> You are currently subscribed to ntdev as: xxxxx@rassit.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE
> and may contain confidential and privileged information. If the reader of
this message
> is not the intended recipient, you are notified that any dissemination,
distribution
> or copy of this communication is strictly Prohibited.If you have received
this message
> by error, please notify the sender immediately, return the original mail
to the sender
> and delete the message from your system.
>
>

THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE
and may contain confidential and privileged information. If the reader of this message
is not the intended recipient, you are notified that any dissemination, distribution
or copy of this communication is strictly Prohibited.If you have received this message
by error, please notify the sender immediately, return the original mail to the sender
and delete the message from your system.

Hi
Thanx for your immediate reply. I tried your code but I didn’t get
required information.
I need manufacturer information of the device (serial number which is
unique for the device) but I didn’t get it from your code.
Please reply me if you have any information about this.

Thanx
Varsha