Hi,
I am pretty new at writing windows device driver. So to start easy, I wrote a simple WDF lower filter driver that sits under the USB class driver. I created a EvtIoDefault function that gets all the IRP going through.
Now I’d like to be able to recognize for which USB device an IRP belongs to. I tried to figure it out using WdfIoTargetQueryTargetProperty but I am not convince if it is the right way to do it.
Could someone point out to me how to easily find out where a particular IRP is going to? (which device).
Thanks
Fred
Easy? Not easy but the ddk usbview USERMODE sample shows how to figure
out which USB device is which.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Monday, April 16, 2007 3:51 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WDF Filter Driver
Hi,
I am pretty new at writing windows device driver. So to start easy, I
wrote a simple WDF lower filter driver that sits under the USB class
driver. I created a EvtIoDefault function that gets all the IRP going
through.
Now I’d like to be able to recognize for which USB device an IRP belongs
to. I tried to figure it out using WdfIoTargetQueryTargetProperty but I
am not convince if it is the right way to do it.
Could someone point out to me how to easily find out where a particular
IRP is going to? (which device).
Thanks
Fred
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
xxxxx@gmail.com wrote:
I am pretty new at writing windows device driver. So to start easy, I wrote a simple WDF lower filter driver that sits under the USB class driver. I created a EvtIoDefault function that gets all the IRP going through.
Now I’d like to be able to recognize for which USB device an IRP belongs to. I tried to figure it out using WdfIoTargetQueryTargetProperty but I am not convince if it is the right way to do it.
Could someone point out to me how to easily find out where a particular IRP is going to? (which device).
What do you mean by “which device”? The question is not silly. The URB
header includes a UsbdDeviceHandle that identifies this particular
device to USBD, and that’s enough for the lower layers. If you are
trying to associate that with some human-readable information, like the
VID and PID, then you will need to monitor the URBs looking for a
get_descriptor request for the device descriptor. On its way back from
USBD, this will include the VID and PID. You can then tuck that away
somewhere along with the UsbdDeviceHandle.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thanks for the replies.
I mean by “which device” that I will get a request from a user-mode
application to block all requests for a particular USB device. For
instance, the user-mode app could send me down a request to block all
Keyboard request or (better example) all request for a flash drive.
On 4/16/07, Tim Roberts wrote:
>
> xxxxx@gmail.com wrote:
> > I am pretty new at writing windows device driver. So to start easy, I
> wrote a simple WDF lower filter driver that sits under the USB class
> driver. I created a EvtIoDefault function that gets all the IRP going
> through.
> >
> > Now I’d like to be able to recognize for which USB device an IRP belongs
> to. I tried to figure it out using WdfIoTargetQueryTargetProperty but I am
> not convince if it is the right way to do it.
> >
> > Could someone point out to me how to easily find out where a particular
> IRP is going to? (which device).
> >
>
> What do you mean by “which device”? The question is not silly. The URB
> header includes a UsbdDeviceHandle that identifies this particular
> device to USBD, and that’s enough for the lower layers. If you are
> trying to associate that with some human-readable information, like the
> VID and PID, then you will need to monitor the URBs looking for a
> get_descriptor request for the device descriptor. On its way back from
> USBD, this will include the VID and PID. You can then tuck that away
> somewhere along with the UsbdDeviceHandle.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Frederic Regis wrote:
Thanks for the replies.
I mean by “which device” that I will get a request from a user-mode
application to block all requests for a particular USB device. For
instance, the user-mode app could send me down a request to block all
Keyboard request or (better example) all request for a flash drive.
That doesn’t really answer the question. How do you expect the user to
identify “a particular USB device”? Do you expect him to tell you the
VID and PID?
Where have you inserted your filter? Below usbhub.sys?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Well in certain cases I expect to see the VID and PID coming my way. But
the user-mode guys want to pass down some sort of global request such as
“block all USB storage devices” using some custom IOCTL (if that makes any
sense).
Since I am still learning this driver stuff, it may just be impossible (I
have no idea at this point) and I am still doing research about this.
Yes my filter sits below usbhub.sys.
On 4/16/07, Tim Roberts wrote:
>
> Frederic Regis wrote:
> > Thanks for the replies.
> >
> > I mean by “which device” that I will get a request from a user-mode
> > application to block all requests for a particular USB device. For
> > instance, the user-mode app could send me down a request to block all
> > Keyboard request or (better example) all request for a flash drive.
>
> That doesn’t really answer the question. How do you expect the user to
> identify “a particular USB device”? Do you expect him to tell you the
> VID and PID?
>
> Where have you inserted your filter? Below usbhub.sys?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
The solution in your driver depends on what you want to do. If you want
to block all storage devices, you should keep track of the device’s
configuration and interface descriptors. The class fields in either or
both will give you generic functionality like storage. The device’s
device descriptor will give you the VID/PID. Keep track of all this
info and you can block by specific device as well as by class of device.
d
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Frederic Regis
Sent: Monday, April 16, 2007 2:52 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] WDF Filter Driver
Well in certain cases I expect to see the VID and PID coming my way.
But the user-mode guys want to pass down some sort of global request
such as “block all USB storage devices” using some custom IOCTL (if that
makes any sense).
Since I am still learning this driver stuff, it may just be impossible
(I have no idea at this point) and I am still doing research about this.
Yes my filter sits below usbhub.sys.
On 4/16/07, Tim Roberts wrote:
Frederic Regis wrote:
> Thanks for the replies.
>
> I mean by “which device” that I will get a request from a user-mode
> application to block all requests for a particular USB device. For
> instance, the user-mode app could send me down a request to block all
> Keyboard request or (better example) all request for a flash drive.
That doesn’t really answer the question. How do you expect the user to
identify “a particular USB device”? Do you expect him to tell you the
VID and PID?
Where have you inserted your filter? Below usbhub.sys?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer