how to read and write usb device

Hi All,

My device is a USB mass storage device, ( use native disk.sys and
usbstor.sys under W2k) .I want to read and write the device,
I plan to use SetupDiGetClassDevs(…),SetupDiEnumDeviceInterfaces(),
SetupDiGetDeviceInterfaceDetail(…),CreateFile(…).But
SetupDiEnumDeviceInterfaces()return zero;
In the list people said “USB mass storage device is not belong to HID
device ,so SetupDi… can’t be used”.
that’s ture?
if that,how i CreateFile.
thanks!!

Disk.sys will create a device interface of type GUID_TYPE_DISK, make sure
that is the GUID you are enumerating. This has nothing at all to do with HID
devices. The list is frequently wrong. I just verified that my usb pen-disk
is happy to be enumerated using this technique, just like any other device
that supports a GUID_TYPE_DISK interface.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of sunjinlong
Sent: Monday, December 01, 2003 3:35 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] how to read and write usb device

Hi All,

My device is a USB mass storage device, ( use native disk.sys
and usbstor.sys under W2k) .I want to read and write the
device, I plan to use
SetupDiGetClassDevs(…),SetupDiEnumDeviceInterfaces(),
SetupDiGetDeviceInterfaceDetail(…),CreateFile(…).But
SetupDiEnumDeviceInterfaces()return zero; In the list people
said “USB mass storage device is not belong to HID device ,so
SetupDi… can’t be used”.
that’s ture?
if that,how i CreateFile.
thanks!!


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Mark Roddy:
thanks you first.later
I heard that the guid used in the apply program is the same that used in
driver program.
Because my system is windows2000,so i think i can
don’t write the driver program.I use DDK’s usbview and find my device’s
Vid0ea0 and Pid6803.
But i don’t know the guid,so I find guid in the register.
I tested some guid in the register
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\
USBSTOR\Disk&Vid0ea0&Pid6803\classguid{4D36E967-E325-11CE-BFC1-08002BE10318}
I used the guid ,the result is that SetupDiEnumDeviceInterfaces()return
zero;
later I tested the guid in the register
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_0ea0&Pid_6803\FA_#F
DB03TUZS\Device Parameters\
symbolicName:REG_SZ??\USB#Vid_0ea0&Pid_6803#FA_#FDB03TUZS#{a5dcbf10-6530-11
d2-901f-00c04fb951ed}
I used the
{a5dcbf10-6530-11d2-901f-00c04fb951ed},SetupDiEnumDeviceInterfaces(…)retur
n true,but SetupDiGetDeviceInterfaceDetail(…)
return false then i can’t get the DevicePath.