USB or HID lower level filter drivers

My current goal is to develop a fairly simple filter driver for HID hardware. It is an HID device connected to the USB. I need to intercept the incoming reports from the device and modify them on the fly. Now I have not decided whether to implement on the USB level or the HID level but currently I am able to get my USB lower level filter driver up and running and am able to see USB_SUBMIT_URB IOCTLs being called.

Please advise,
Thanks in advance.
Safi

What type of modifications do you want to make? I would think a USB lower filter below usbhid would be the way to go given your initial description .

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@razerzone.com
Sent: Monday, March 21, 2011 9:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB or HID lower level filter drivers

My current goal is to develop a fairly simple filter driver for HID hardware. It is an HID device connected to the USB. I need to intercept the incoming reports from the device and modify them on the fly. Now I have not decided whether to implement on the USB level or the HID level but currently I am able to get my USB lower level filter driver up and running and am able to see USB_SUBMIT_URB IOCTLs being called.

Please advise,
Thanks in advance.
Safi


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I need to pass the pointer data from the packet/report to a black box function which gives me new coordinates which I need to write into the packet and send up the stack.

USB level is a bit too low level for me, so the question 1 is,
Why can’t I write a HID lower level filter and do the modifications there? And why not a USB Upper level filter for that matter?

And the question 2 is,
How do I access, read and modify the packets at the USB level?

I am under the impression, that since USB_SUBMIT_URB is METHOD_NEITHER, I ll write a try-except block with ProbeForRead and Probe for write calls. and then try to read the request buffers somehow (something which I have nt been able to nail down yet, and would greatly appreciate your help with.)

You read (on the way down) or modify (on the way back up in the completion routine) by looking in Parameters.Others.Argument1. don’t look at the encoding of USB_SUBMIT_URB since it is only sent by a KM driver, the normal encoding rules do not apply. Sending the packet to the black box and back to the driver is problematic as lower hid filter, hidusb/hidclass will fail any creates against your filter. Same goes as a lower filter below mouhid as a hid filter. You will need to use a control device or a raw PDO (as demonstrated in kbdfiltr or moufiltr) as the channel to talk to your black box

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@razerzone.com
Sent: Monday, March 21, 2011 10:04 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

I need to pass the pointer data from the packet/report to a black box function which gives me new coordinates which I need to write into the packet and send up the stack.

USB level is a bit too low level for me, so the question 1 is, Why can’t I write a HID lower level filter and do the modifications there? And why not a USB Upper level filter for that matter?

And the question 2 is,
How do I access, read and modify the packets at the USB level?

I am under the impression, that since USB_SUBMIT_URB is METHOD_NEITHER, I ll write a try-except block with ProbeForRead and Probe for write calls. and then try to read the request buffers somehow (something which I have nt been able to nail down yet, and would greatly appreciate your help with.)


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Am I to understand that I need to go down to IRP level to access the data? IAre n’t there any WDF methods to access the URB, say if it is enclosed in a WdfRequest should nt I be able to access it using WdfRequestRetrieveOutputBuffer or something?

Nope. KMDF does not have an API that understands how to pull a URB properly out of a WDFREQUEST, all of the buffer extraction APIs assume std encoding (since each bus which has a KM IOCTL submit interface like scsi (SRB), usb (URB), 1394 (IRB), Bluetooth (BRB) is custom, it makes little sense for KMDF to understand each one from the POV of pulling the request block out of the request)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@razerzone.com
Sent: Monday, March 21, 2011 11:37 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

Am I to understand that I need to go down to IRP level to access the data? IAre n’t there any WDF methods to access the URB, say if it is enclosed in a WdfRequest should nt I be able to access it using WdfRequestRetrieveOutputBuffer or something?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

VOID
DispatchPassThrough(
IN WDFREQUEST arg_objRequest,
IN WDFIOTARGET arg_objTarget
)
/*++
Routine Description:

Passes a request on to the lower driver.

–*/
{
//
// Pass the IRP to the target
//

WDF_REQUEST_SEND_OPTIONS options;
BOOLEAN ret;
NTSTATUS status = STATUS_SUCCESS;

//
// We are not interested in post processing the IRP so
// fire and forget.
//
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);

ret = WdfRequestSend(arg_objRequest, arg_objTarget, &options);

if (ret == FALSE) {
status = WdfRequestGetStatus (arg_objRequest);
KdPrint( (“WdfRequestSend failed: 0x%x\n”, status));
WdfRequestComplete(arg_objRequest, status);
}

return;
}

VOID
EvtIoInternalDeviceControl (
IN WDFQUEUE arg_objQueue,
IN WDFREQUEST arg_objRequest,
IN size_t arg_dOutputBufferLength,
IN size_t arg_dInputBufferLength,
IN ULONG arg_dIoControlCode
)
{
NTSTATUS status;
WDFDEVICE objDevice;
WDFIOTARGET objIoTarget;
WDFMEMORY objRequestMemory;
PDEVICE_CONTEXT pDeviceContext;
size_t dBytesTransferred = 0;

PURB pUrbBuffer = NULL;
WDF_REQUEST_PARAMETERS objRequestParameters;

UNREFERENCED_PARAMETER(arg_dInputBufferLength);
UNREFERENCED_PARAMETER(arg_dOutputBufferLength);

KdPrint((“TESTDRIVER: MESSAGE: —>EvtIoInternalDeviceControl\n”));

objDevice = WdfIoQueueGetDevice (arg_objQueue);
pDeviceContext = GetDeviceContext ( objDevice );

KdPrint((“TESTDRIVER: MESSAGE: Proceeding to handle I/O Control Request with code 0x%x”, arg_dIoControlCode));

switch (arg_dIoControlCode)
{
case IOCTL_INTERNAL_USB_SUBMIT_URB:

KdPrint((“TESTDRIVER: MESSAGE: IOCTL_INTERNAL_USB_SUBMIT_URB I/O Control Request.\n”));
KdPrint((“TESTDRIVER: MESSAGE: Input Buffer size = %d \n”, arg_dInputBufferLength));
KdPrint((“TESTDRIVER: MESSAGE: Output Buffer size = %d \n”, arg_dOutputBufferLength));

WDF_REQUEST_PARAMETERS_INIT(&objRequestParameters);
WdfRequestGetParameters ( arg_objRequest, &objRequestParameters );

pUrbBuffer = objRequestParameters.Parameters.Others.Arg1;
KdPrint((“TESTDRIVER: MESSAGE: Extracting URB data from the request. Request metadata as follows: \n”));
KdPrint((“TESTDRIVER: MESSAGE: Request Size = 0x%x \t Request Function = 0x%x \t Request Type = 0x%x \n”,
objRequestParameters.Size, objRequestParameters.MinorFunction, objRequestParameters.Type));

KdPrint((“TESTDRIVER: MESSAGE: URB data from the request. URB Header data as follows: \n”));
KdPrint((“TESTDRIVER: MESSAGE: URB Length = 0x%x \t URB Function = 0x%x \t URB Status = 0x%x \n”,
pUrbBuffer->UrbHeader.Length, pUrbBuffer->UrbHeader.Function, pUrbBuffer->UrbHeader.Status));

switch (pUrbBuffer->UrbHeader.Function)
{
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
KdPrint((“TESTDRIVER: MESSAGE: URB Function decoded to be BULK_OR_INTERRUPT_TRANSFER. \n”));

WdfRequestSetCompletionRoutine ( arg_objRequest, EvtInterruptTransferCompletionRoutine, NULL );

objIoTarget = WdfDeviceGetIoTarget ( objDevice );

if ( objIoTarget != NULL )
{
KdPrint((“TESTDRIVER: MESSAGE: Valid I/O Target. \n”));
DispatchPassThrough ( arg_objRequest, objIoTarget );
}
else
{
KdPrint((“TESTDRIVER: MESSAGE: Invalid Target. \n”));
WdfRequestComplete ( arg_objRequest, STATUS_NOT_IMPLEMENTED );
}

break;

case URB_FUNCTION_ABORT_PIPE:

break;

default:
break;
}

break;

default:
KdPrint ((“TESTDRIVER: MESSAGE: Unhandled I/O Control Request. Passing it to other stack drivers if any.\n”));
break;
}

objIoTarget = WdfDeviceGetIoTarget ( objDevice );
if ( objIoTarget != NULL )
{
KdPrint((“TESTDRIVER: MESSAGE: Valid I/O Target. \n”));
DispatchPassThrough ( arg_objRequest, objIoTarget );
}
else
{
KdPrint((“TESTDRIVER: MESSAGE: Invalid Target. \n”));
WdfRequestComplete ( arg_objRequest, STATUS_NOT_IMPLEMENTED );
}

KdPrint((“TESTDRIVER: MESSAGE: <—EvtIoInternalDeviceControl\n”));
}

VOID
EvtInterruptTransferCompletionRoutine (
IN WDFREQUEST arg_objRequest,
IN WDFIOTARGET arg_objTarget,
IN PWDF_REQUEST_COMPLETION_PARAMS arg_objReqComplnParams,
IN WDFCONTEXT arg_objContext
)
{
NTSTATUS status = STATUS_SUCCESS;
PURB pUrbBuffer = NULL;
size_t dBytesTranferred = 0;

WDF_REQUEST_PARAMETERS objRequestParameters;

UNREFERENCED_PARAMETER(arg_objContext);

KdPrint((“TESTDRIVER: MESSAGE: —>EvtInterruptTransferCompletionRoutine\n”));

WDF_REQUEST_PARAMETERS_INIT(&objRequestParameters);
WdfRequestGetParameters ( arg_objRequest, &objRequestParameters );

pUrbBuffer = objRequestParameters.Parameters.Others.Arg1;

if ( pUrbBuffer->UrbHeader.Function == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER )
if ( pUrbBuffer->UrbBulkOrInterruptTransfer.TransferBufferLength > 0 && pUrbBuffer->UrbBulkOrInterruptTransfer.TransferBuffer != NULL )
{
//MyCode Here
}

WdfRequestComplete ( arg_objRequest, status );

KdPrint((“TESTDRIVER: MESSAGE: <—EvtInterruptTransferCompletionRoutine\n”));
}

Here is the code that I wrote to read the URBs, I am able to look at the URB, but as soon as I send the request out, things go bad and I get a Blue screen. What am I doing wrong here?

Send the output of !analyze -v. god knows where it is blowing up without that. You are setting a completion routine, but always completing the request with failure. Did you mean to send the request down the stack instead?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@razerzone.com
Sent: Tuesday, March 22, 2011 10:45 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

VOID
DispatchPassThrough(
IN WDFREQUEST arg_objRequest,
IN WDFIOTARGET arg_objTarget
)
/*++
Routine Description:

Passes a request on to the lower driver.

–*/
{
//
// Pass the IRP to the target
//

WDF_REQUEST_SEND_OPTIONS options;
BOOLEAN ret;
NTSTATUS status = STATUS_SUCCESS;

//
// We are not interested in post processing the IRP so
// fire and forget.
//
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);

ret = WdfRequestSend(arg_objRequest, arg_objTarget, &options);

if (ret == FALSE) {
status = WdfRequestGetStatus (arg_objRequest);
KdPrint( (“WdfRequestSend failed: 0x%x\n”, status));
WdfRequestComplete(arg_objRequest, status);
}

return;
}

VOID
EvtIoInternalDeviceControl (
IN WDFQUEUE arg_objQueue,
IN WDFREQUEST arg_objRequest,
IN size_t arg_dOutputBufferLength,
IN size_t arg_dInputBufferLength,
IN ULONG arg_dIoControlCode
)
{
NTSTATUS status;
WDFDEVICE objDevice;
WDFIOTARGET objIoTarget;
WDFMEMORY objRequestMemory;
PDEVICE_CONTEXT pDeviceContext;
size_t dBytesTransferred = 0;

PURB pUrbBuffer = NULL;
WDF_REQUEST_PARAMETERS objRequestParameters;

UNREFERENCED_PARAMETER(arg_dInputBufferLength);
UNREFERENCED_PARAMETER(arg_dOutputBufferLength);

KdPrint((“TESTDRIVER: MESSAGE: —>EvtIoInternalDeviceControl\n”));

objDevice = WdfIoQueueGetDevice (arg_objQueue);
pDeviceContext = GetDeviceContext ( objDevice );

KdPrint((“TESTDRIVER: MESSAGE: Proceeding to handle I/O Control Request with code 0x%x”, arg_dIoControlCode));

switch (arg_dIoControlCode)
{
case IOCTL_INTERNAL_USB_SUBMIT_URB:

KdPrint((“TESTDRIVER: MESSAGE: IOCTL_INTERNAL_USB_SUBMIT_URB I/O Control Request.\n”));
KdPrint((“TESTDRIVER: MESSAGE: Input Buffer size = %d \n”, arg_dInputBufferLength));
KdPrint((“TESTDRIVER: MESSAGE: Output Buffer size = %d \n”, arg_dOutputBufferLength));

WDF_REQUEST_PARAMETERS_INIT(&objRequestParameters);
WdfRequestGetParameters ( arg_objRequest, &objRequestParameters );

pUrbBuffer = objRequestParameters.Parameters.Others.Arg1;
KdPrint((“TESTDRIVER: MESSAGE: Extracting URB data from the request. Request metadata as follows: \n”));
KdPrint((“TESTDRIVER: MESSAGE: Request Size = 0x%x \t Request Function = 0x%x \t Request Type = 0x%x \n”,
objRequestParameters.Size, objRequestParameters.MinorFunction, objRequestParameters.Type));

KdPrint((“TESTDRIVER: MESSAGE: URB data from the request. URB Header data as follows: \n”));
KdPrint((“TESTDRIVER: MESSAGE: URB Length = 0x%x \t URB Function = 0x%x \t URB Status = 0x%x \n”,
pUrbBuffer->UrbHeader.Length, pUrbBuffer->UrbHeader.Function, pUrbBuffer->UrbHeader.Status));

switch (pUrbBuffer->UrbHeader.Function)
{
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
KdPrint((“TESTDRIVER: MESSAGE: URB Function decoded to be BULK_OR_INTERRUPT_TRANSFER. \n”));

WdfRequestSetCompletionRoutine ( arg_objRequest, EvtInterruptTransferCompletionRoutine, NULL );

objIoTarget = WdfDeviceGetIoTarget ( objDevice );

if ( objIoTarget != NULL )
{
KdPrint((“TESTDRIVER: MESSAGE: Valid I/O Target. \n”));
DispatchPassThrough ( arg_objRequest, objIoTarget );
}
else
{
KdPrint((“TESTDRIVER: MESSAGE: Invalid Target. \n”));
WdfRequestComplete ( arg_objRequest, STATUS_NOT_IMPLEMENTED );
}

break;

case URB_FUNCTION_ABORT_PIPE:

break;

default:
break;
}

break;

default:
KdPrint ((“TESTDRIVER: MESSAGE: Unhandled I/O Control Request. Passing it to other stack drivers if any.\n”));
break;
}

objIoTarget = WdfDeviceGetIoTarget ( objDevice );
if ( objIoTarget != NULL )
{
KdPrint((“TESTDRIVER: MESSAGE: Valid I/O Target. \n”));
DispatchPassThrough ( arg_objRequest, objIoTarget );
}
else
{
KdPrint((“TESTDRIVER: MESSAGE: Invalid Target. \n”));
WdfRequestComplete ( arg_objRequest, STATUS_NOT_IMPLEMENTED );
}

KdPrint((“TESTDRIVER: MESSAGE: <—EvtIoInternalDeviceControl\n”));
}

VOID
EvtInterruptTransferCompletionRoutine (
IN WDFREQUEST arg_objRequest,
IN WDFIOTARGET arg_objTarget,
IN PWDF_REQUEST_COMPLETION_PARAMS arg_objReqComplnParams,
IN WDFCONTEXT arg_objContext
)
{
NTSTATUS status = STATUS_SUCCESS;
PURB pUrbBuffer = NULL;
size_t dBytesTranferred = 0;

WDF_REQUEST_PARAMETERS objRequestParameters;

UNREFERENCED_PARAMETER(arg_objContext);

KdPrint((“TESTDRIVER: MESSAGE: —>EvtInterruptTransferCompletionRoutine\n”));

WDF_REQUEST_PARAMETERS_INIT(&objRequestParameters);
WdfRequestGetParameters ( arg_objRequest, &objRequestParameters );

pUrbBuffer = objRequestParameters.Parameters.Others.Arg1;

if ( pUrbBuffer->UrbHeader.Function == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER )
if ( pUrbBuffer->UrbBulkOrInterruptTransfer.TransferBufferLength > 0 && pUrbBuffer->UrbBulkOrInterruptTransfer.TransferBuffer != NULL )
{
//MyCode Here
}

WdfRequestComplete ( arg_objRequest, status );

KdPrint((“TESTDRIVER: MESSAGE: <—EvtInterruptTransferCompletionRoutine\n”));
}

Here is the code that I wrote to read the URBs, I am able to look at the URB, but as soon as I send the request out, things go bad and I get a Blue screen. What am I doing wrong here?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@razerzone.com wrote:

VOID
DispatchPassThrough(

//
// We are not interested in post processing the IRP so
// fire and forget.
//
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
… {
case IOCTL_INTERNAL_USB_SUBMIT_URB:

switch (pUrbBuffer->UrbHeader.Function)
{
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
KdPrint((“TESTDRIVER: MESSAGE: URB Function decoded to be BULK_OR_INTERRUPT_TRANSFER. \n”));

WdfRequestSetCompletionRoutine ( arg_objRequest, EvtInterruptTransferCompletionRoutine, NULL );

objIoTarget = WdfDeviceGetIoTarget ( objDevice );

if ( objIoTarget != NULL )
{
KdPrint((“TESTDRIVER: MESSAGE: Valid I/O Target. \n”));
DispatchPassThrough ( arg_objRequest, objIoTarget );
}

You cannot set a completion routine when you use SEND_AND_FORGET. You
need to choose one or the other.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (7e)
This is a very common bugcheck. Usually the exception address pinpoints
the driver/function that caused the problem. Always note this address
as well as the link date of the driver/image that contains this address.
Arguments:
Arg1: ffffffffc0000005, The exception code that was not handled
Arg2: fffff88000e3210f, The address that the exception occurred at
Arg3: fffff880031a0dc8, Exception Record Address
Arg4: fffff880031a0630, Context Record Address

Debugging Details:

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

FAULTING_IP:
Wdf01000!FxRequest::PreProcessSendAndForget+153
fffff880`00e3210f 488b90b8000000 mov rdx,qword ptr [rax+0B8h]

EXCEPTION_RECORD: fffff880031a0dc8 – (.exr 0xfffff880031a0dc8)
ExceptionAddress: fffff88000e3210f (Wdf01000!FxRequest::PreProcessSendAndForget+0x0000000000000153)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 00000000000000b8
Attempt to read from address 00000000000000b8

CONTEXT: fffff880031a0630 – (.cxr 0xfffff880031a0630)
rax=0000000000000000 rbx=0000000000000000 rcx=fffffa8008b19580
rdx=0000000000000000 rsi=fffffa8008b19580 rdi=fffffa8006695020
rip=fffff88000e3210f rsp=fffff880031a1000 rbp=0000057ff991c568
r8=0000000000000038 r9=fffff880031a1100 r10=fffffa80069cbcc0
r11=000000000000000c r12=0000000000000000 r13=0000000000220003
r14=0000000000000000 r15=0000057ff996afd8
iopl=0 nv up ei pl zr na po nc
cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b efl=00010246
Wdf01000!FxRequest::PreProcessSendAndForget+0x153:
fffff88000e3210f 488b90b8000000 mov rdx,qword ptr [rax+0B8h] ds:002b:00000000000000b8=???
Resetting default scope

PROCESS_NAME: System

CURRENT_IRQL: 0

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

EXCEPTION_PARAMETER1: 0000000000000000

EXCEPTION_PARAMETER2: 00000000000000b8

READ_ADDRESS: 00000000000000b8

FOLLOWUP_IP:
Cobra!WdfRequestSend+2f [c:\winddk\7600.16385.1\inc\wdf\kmdf\1.9\wdfrequest.h @ 661]
fffff880`06fc72bf 4883c428 add rsp,28h

BUGCHECK_STR: 0x7E

DEFAULT_BUCKET_ID: NULL_CLASS_PTR_DEREFERENCE

LOCK_ADDRESS: fffff800030bd400 – (!locks fffff800030bd400)

Resource @ nt!PiEngineLock (0xfffff800030bd400) Exclusively owned
Contention Count = 136
NumberOfExclusiveWaiters = 1
Threads: fffffa8005546040-01<*>
Threads Waiting On Exclusive Access:
fffffa8005544b60

1 total locks, 1 locks currently held

PNP_TRIAGE:
Lock address : 0xfffff800030bd400
Thread Count : 1
Thread address: 0xfffffa8005546040
Thread wait : 0x549a79

LAST_CONTROL_TRANSFER: from fffff800032295a4 to fffff80002eb9740

STACK_TEXT:
fffff880031a1000 fffff88000e236b2 : 0000000000000000 0000057ff991c568 fffffa8008b19580 fffff880031a1100 : Wdf01000!FxRequest::PreProcessSendAndForget+0x153
fffff880031a1060 fffff88006fc72bf : fffffa8008b196d0 fffffa8006695020 fffffa80069cbcc0 fffffa8006695020 : Wdf01000!imp_WdfRequestSend+0x35e
fffff880031a10b0 fffff88006fc7939 : 0000057ff996afd8 0000057ff9634338 fffff880031a1100 fffff88006fc716b : Cobra!WdfRequestSend+0x2f [c:\winddk\7600.16385.1\inc\wdf\kmdf\1.9\wdfrequest.h @ 661]
fffff880031a10e0 fffff88006fc7b9c : 0000057ff996afd8 0000057ff9634338 0000057ff74bcfd8 0000000000001030 : Cobra!DispatchPassThrough+0x39 [d:\drvdev\drvwork\cobra\testdriver.c @ 308]
fffff880031a1130 fffff88000e49047 : 0000057ff991c568 0000057ff996afd8 0000000009f32010 0000000000000000 : Cobra!EvtIoInternalDeviceControl+0x21c [d:\drvdev\drvwork\cobra\testdriver.c @ 412]
fffff880031a11d0 fffff88000e4899f : 0000000000000000 fffffa8006695020 fffffa80066e3a90 fffffa80066e3a90 : Wdf01000!FxIoQueue::DispatchRequestToDriver+0x56f
fffff880031a1250 fffff88000e47f98 : 0000000000000000 0000000000000000 0000000000000000 fffffa8006695172 : Wdf01000!FxIoQueue::DispatchEvents+0x4df
fffff880031a12c0 fffff88000e4d558 : fffffa80085a6300 fffffa8006695020 fffffa80085a6010 fffffa8006695020 : Wdf01000!FxIoQueue::QueueRequest+0x2bc
fffff880031a1330 fffff88000e37245 : fffffa8006695020 fffffa80085a6010 fffffa80093c5640 fffffa80093c5a00 : Wdf01000!FxPkgIo::Dispatch+0x37c
fffff880031a13b0 fffff88006fd148f : fffffa80054884a0 fffffa80085a6010 fffffa8007a7000a 00000000000007ff : Wdf01000!FxDevice::Dispatch+0xa9
fffff880031a13e0 fffff88006fd0f5b : fffffa80085a63b0 fffffa80093c5701 fffff880031a14a0 fffffa80093c5640 : hidusb!HumReadReport+0x13f
fffff880031a1430 fffff88005b2f65d : fffffa8008a37a01 fffffa8008a37a60 fffffa80085a6010 fffffa80093c57b0 : hidusb!HumInternalIoctl+0x137
fffff880031a14a0 fffff88005b2ff89 : 0000000000000000 0000000000000000 0000000000000000 fffff880031a1550 : HIDCLASS!HidpSubmitInterruptRead+0xdd
fffff880031a1500 fffff88005b3e30e : 0000000000000000 fffffa8007a7e820 fffffa80065ded30 0000000000000000 : HIDCLASS!HidpStartAllPingPongs+0xb9
fffff880031a1550 fffff88005b3b83f : fffff88005b38301 fffffa80093c5790 fffffa80085a49a0 fffff88005b3ec00 : HIDCLASS!HidpStartCollectionPDO+0xfa
fffff880031a1590 fffff88005b3b643 : fffff88005b38301 fffff88005b3ec00 fffffa8007a7e800 fffffa80085a49a0 : HIDCLASS!HidpPdoPnp+0x19b
fffff880031a15f0 fffff88005b2d90d : fffff88005b383a8 fffff88005b373b0 fffffa8007a7e800 fffff88005b5c16e : HIDCLASS!HidpIrpMajorPnp+0x83
fffff880031a1660 fffff88005b63d13 : fffff88005b60260 fffffa80085a4dd0 0000000000000000 fffffa80084dbde0 : HIDCLASS!HidpMajorHandler+0xf5
fffff880031a16d0 fffff880050eb4eb : 0000000000000103 fffffa8008214170 fffffa8009f39ab0 fffffa8009f39ab0 : mouhid+0x8d13
fffff880031a1730 fffff800032788fe : fffffa80085a49a0 fffffa8006f18160 fffffa8009f39960 fffffa8007a7e6b0 : mouclass!MousePnP+0x337
fffff880031a1790 fffff80002fb30ed : fffffa8007a7e6b0 fffffa8006f18160 fffff80002fb8d50 0000000000000000 : nt!PnpAsynchronousCall+0xce
fffff880031a17d0 fffff800032836e6 : fffff800030bd1c0 fffffa80068095d0 fffffa8006f18160 fffffa8006809778 : nt!PnpStartDevice+0x11d
fffff880031a1890 fffff80003283984 : fffffa80068095d0 fffffa8009730028 fffffa8009735d90 0000000000000001 : nt!PnpStartDeviceNode+0x156
fffff880031a1920 fffff800032a6c76 : fffffa80068095d0 fffffa8009735d90 0000000000000002 0000000000000000 : nt!PipProcessStartPhase1+0x74
fffff880031a1950 fffff800032a7067 : fffffa8009735d90 0000000000000000 0000000000000001 fffff80003125d30 : nt!PipProcessDevNodeTree+0x296
fffff880031a1bc0 fffff80002fbb3b3 : 0000000100000003 0000000000000000 0000000000000001 0000000000000000 : nt!PiRestartDevice+0xc7
fffff880031a1c10 fffff80002ec6961 : fffff80002fbb0a0 fffff80002fbb001 fffffa8005546000 0000000000000000 : nt!PnpDeviceActionWorker+0x313
fffff880031a1cb0 fffff8000315c7c6 : 0017f45900125901 fffffa8005546040 0000000000000080 fffffa80054884a0 : nt!ExpWorkerThread+0x111
fffff880031a1d40 fffff80002e97c26 : fffff88002fd5180 fffffa8005546040 fffff88002fdffc0 0019d4440018e454 : nt!PspSystemThreadStartup+0x5a
fffff880031a1d80 0000000000000000 : fffff880031a2000 fffff8800319c000 fffff880031a11c0 0000000000000000 : nt!KxStartSystemThread+0x16

FAULTING_SOURCE_CODE:
657: PWDF_REQUEST_SEND_OPTIONS Options
658: )
659: {
660: return ((PFN_WDFREQUESTSEND) WdfFunctions[WdfRequestSendTableIndex])(WdfDriverGlobals, Request, Target, Options);

661: }
662:
663: //
664: // WDF Function: WdfRequestGetStatus
665: //
666: typedef

SYMBOL_STACK_INDEX: 2

SYMBOL_NAME: Cobra!WdfRequestSend+2f

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: Cobra

IMAGE_NAME: Cobra.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 4d8875c2

STACK_COMMAND: .cxr 0xfffff880031a0630 ; kb

FAILURE_BUCKET_ID: X64_0x7E_Cobra!WdfRequestSend+2f

BUCKET_ID: X64_0x7E_Cobra!WdfRequestSend+2f

Followup: MachineOwner

This is the !analyze -v output that I get. Why would it be completing the request with a failure???

Oh crap, How the heck did I miss that! Thanks man, I ll give it another whirl.

Hey guys, I tried it out, At least now my driver is able to go through my completion routine without any problems, but my driver is unable to stop once it installs and it sometimes hangs up the installation process. I am assuming it has to do with it not handling the URB_FUNCTION_ABORT_PIPE or URB_FUNCTION_REQUEST_PIPE events. Is this the case? If so, what do I need to handle in these events?

Also are there any other drivers underneath the USB lower level filter driver? Also I forgot to tell you one other symptom of the failure. All other USB devices stop working.

Depending where you installed your filter it could have that effect. Uninstall should just work, instead of failing URBs you don’t handle, just leave them alone.

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@razerzone.com
Sent: Wednesday, March 23, 2011 8:55 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

Also are there any other drivers underneath the USB lower level filter driver? Also I forgot to tell you one other symptom of the failure. All other USB devices stop working.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I am installing the driver at the USB lower level as a filter driver. I should explain further, the my installation process hangs up, and then when I pull out my device its halts a) either all other USB devices or b) the whole comp.

"leaving them alone"would entail Sending them down the yellow brick road a.k.a driver stack?

Also do I need to handle EvtReleaseHardware?

You are hanging remove somewhere. You need to debug it with a live debugger . You are too new to use euphemisms, just getting it working before you try to be cute .

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@razerzone.com
Sent: Wednesday, March 23, 2011 9:15 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

I am installing the driver at the USB lower level as a filter driver. I should explain further, the my installation process hangs up, and then when I pull out my device its halts a) either all other USB devices or b) the whole comp.

"leaving them alone"would entail Sending them down the yellow brick road a.k.a driver stack?

Also do I need to handle EvtReleaseHardware?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Ok, I ll do a live debug for the remove, but why wont my Installation process not quit?

Probably because you are hanging the start irp to. Attach a debugger, check the active threads and see what is going on

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@razerzone.com
Sent: Wednesday, March 23, 2011 9:29 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB or HID lower level filter drivers

Ok, I ll do a live debug for the remove, but why wont my Installation process not quit?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks for all your help, It was a mistake on my part, I did nt format the request before sending it and thats what was causing the problem. I have fixed that issue now. Thanks again!