Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Write an usb filter driver

1,246 views
Skip to first unread message

Starring_Night

unread,
Sep 3, 2009, 9:51:01 PM9/3/09
to
Hi! I want to write a filter driver to filter and modify the descriptors
which returns from the usb device to windows OS.
For example, USB will return Vender ID and Product ID when OS request. I
want this filter driver get the Vender ID and Product ID, then change the
values and return them to OS.
I registered the major function [ IRP_MJ__INTERNAL_DEVICE_CONTROL] and
checked a UrbHeader function in urb which is
URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE.
Then monitor the two descriptor types: USB_DEVICE_DESCRIPTOR_TYPE &
USB_STRING_DESCRIPTOR_TYPE
I can get the right descriptors. However, I can't change them.
For example, I changed them, but the regedit shows the original descriptors.
I can show the changed descriptors on debug window, but useless for regedit.
How should I do to catch the right time, get value, then change and return
to OS finally, whenever OS request for the descriptors?

Tim Roberts

unread,
Sep 4, 2009, 12:36:23 AM9/4/09
to
Starring_Night <Starrin...@discussions.microsoft.com> wrote:
>
>Hi! I want to write a filter driver to filter and modify the descriptors
>which returns from the usb device to windows OS.
>For example, USB will return Vender ID and Product ID when OS request. I
>want this filter driver get the Vender ID and Product ID, then change the
>values and return them to OS.

Sorry, that is impossible. The enumeration is done by the USB host
controller driver. The HCD talks directly to the hardware, and it's the
HCD that creates the PDO with the device ID. There is no other driver
below that or between those two steps, so there's no place to insert a
filter.

You can change the device descriptor and lie to whatever driver was
defined, but you cannot change the VID/PID at a point where it affects the
assignment of a driver.

>For example, I changed them, but the regedit shows the original descriptors.
>I can show the changed descriptors on debug window, but useless for regedit.
>How should I do to catch the right time, get value, then change and return
>to OS finally, whenever OS request for the descriptors?

Can't be done.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Doron Holan [MSFT]

unread,
Sep 8, 2009, 2:36:05 PM9/8/09
to
why do you want to do this?

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"Tim Roberts" <ti...@probo.com> wrote in message
news:c461a5dudgd0v83sd...@4ax.com...

0 new messages