Anyone can shed some lights on the following problem:
In user mode, I can use the Setupxxx APIs to enumerate all USB devices.
In kernel mode, how to do that?
For example, if I have a GUID or have the name “USB Mass Storage Device”,
is there a way to get the related device objects?
What are you trying to accomplish? If you’re planning on attaching to
them or something, you’d be better off properly installing yourself as a
filter in the first place, for example…
AFei wrote:
Hi,
Anyone can shed some lights on the following problem:
In user mode, I can use the Setupxxx APIs to enumerate all USB devices.
In kernel mode, how to do that?
For example, if I have a GUID or have the name “USB Mass Storage Device”,
is there a way to get the related device objects?
thanks in advance,
AFei
–
…/ray..
Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.
Actually I want to issue IRPs to the specified USB class devices, I need
the DeviceObject to use IoCallDriver(…) stuff. Any ideas?
Thanks for the reply.
“Ray Trent” wrote in message news:xxxxx@ntdev… > What are you trying to accomplish? If you’re planning on attaching to > them or something, you’d be better off properly installing yourself as a > filter in the first place, for example… > > AFei wrote: > > > Hi, > > > > Anyone can shed some lights on the following problem: > > In user mode, I can use the Setupxxx APIs to enumerate all USB devices. > > In kernel mode, how to do that? > > For example, if I have a GUID or have the name “USB Mass Storage Device”, > > is there a way to get the related device objects? > > > > thanks in advance, > > > > AFei > > > > > > > > – > …/ray.. > > Please remove “.spamblock” from my email address if you need to contact > me outside the newsgroup. >
Installing yourself as a filter on those devices might save you trouble,
though…
AFei wrote:
Actually I want to issue IRPs to the specified USB class devices, I need
the DeviceObject to use IoCallDriver(…) stuff. Any ideas?
Thanks for the reply.
“Ray Trent” wrote in message > news:xxxxx@ntdev… > >>What are you trying to accomplish? If you’re planning on attaching to >>them or something, you’d be better off properly installing yourself as a >>filter in the first place, for example… >> >>AFei wrote: >> >> >>>Hi, >>> >>>Anyone can shed some lights on the following problem: >>>In user mode, I can use the Setupxxx APIs to enumerate all USB devices. >>>In kernel mode, how to do that? >>>For example, if I have a GUID or have the name “USB Mass Storage > > Device”, > >>>is there a way to get the related device objects? >>> >>>thanks in advance, >>> >>>AFei >>> >>> >>> >> >>– >>…/ray.. >> >>Please remove “.spamblock” from my email address if you need to contact >>me outside the newsgroup. >> > > > >
– …/ray..
Please remove “.spamblock” from my email address if you need to contact me outside the newsgroup.
You are right, the filter driver should work, just don't want to build a new
driver for this small feature.
Because it's not difficult to enumurate devices in user mode, I thought
there must be some method in
kernel mode as well.
You could try IoRegisterPlugPlayNotification (passing the
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES flag since you
probably care about existing devices and not just ones that appear later).
AFei wrote:
Have tried it, return success but the returned symlist was empty, following
is the codes:
You are right, the filter driver should work, just don’t want to build a new
driver for this small feature.
Because it’s not difficult to enumurate devices in user mode, I thought
there must be some method in
kernel mode as well.
thanks.
–
…/ray..
Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.
Problem solved.
The device object can be get from the object name, I have
to translate GUID to object name in user mode, anyway it works.
“Ray Trent” wrote in message news:xxxxx@ntdev… > Hmmm. No idea why that’s failing. > > You could try IoRegisterPlugPlayNotification (passing the > PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES flag since you > probably care about existing devices and not just ones that appear later). > > AFei wrote: > > Have tried it, return success but the returned symlist was empty, following > > is the codes: > > ----------------------------- > > static GUID guid_USB_MASS_STORAGE = { 0x36fc9e60, 0xc465, 0x11cf, { 0x80, > > 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } }; > > PWSTR symList = NULL; > > ntStatus = IoGetDeviceInterfaces( &guid_USB_MASS_STORAGE, NULL, > > DEVICE_INTERFACE_INCLUDE_NONACTIVE, &symList ); > > ----------------------------- > > You are right, the filter driver should work, just don’t want to build a new > > driver for this small feature. > > Because it’s not difficult to enumurate devices in user mode, I thought > > there must be some method in > > kernel mode as well. > > > > thanks. > > > > > > > > – > …/ray.. > > Please remove “.spamblock” from my email address if you need to contact > me outside the newsgroup. >