Substitute Original HID Read

Hi

I am trying to substitute the original read request of an HID device with my own read (I am an upper filter of HID class). The way i do it is as follows:

  1. Create a new WDFMEMORY object with length same as passed in Length argument in Read callback

  2. Create a new request and format it for Read

  3. I am filtering above HID, so had to assign FileObject after step 2) as per Doron suggestion

  4. Park the original read request

On completion routine though, the status

status = Params->IoStatus.Status;

This returns

0xc00000e8

Seems like my newly created request does not get the data from the device.

Any ideas what i am doing wrong?

Are you filtering the hid pdo or hid parent stack? You can’t be an upper filter on the parent

Thx
d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?9/?23/?2013 7:08 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Substitute Original HID Read

Hi

I am trying to substitute the original read request of an HID device with my own read (I am an upper filter of HID class). The way i do it is as follows:

1. Create a new WDFMEMORY object with length same as passed in Length argument in Read callback

2. Create a new request and format it for Read

3. I am filtering above HID, so had to assign FileObject after step 2) as per Doron suggestion

4. Park the original read request

On completion routine though, the status

status = Params->IoStatus.Status;

This returns

0xc00000e8

Seems like my newly created request does not get the data from the device.

Any ideas what i am doing wrong?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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</mailto:xxxxx></mailto:xxxxx>

Hi Doron

I am filtering the HID PDO. I explicitly look for the enumerator to be HID (if not, I just return success on AddDevice). I get the reads working fine (i.e. I get the request flowing through the filter), but cannot seem to get my own requests to complete successfully. Any ideas?

Hi Doron, Hi Guys

I am posting my code here on this issue. I am getting (STATUS_PRIVILEGE_NOT_HELD) error on completion routine even though is added

IoGetNextIrpStackLocation(WdfRequestWdmGetIrp(RequestCopy))->FileObject = IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(Request))->FileObject;

Your help is very much appreciated.

ScIoRead(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t Length
)
{

WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.ParentObject = device;

status = WdfRequestCreate(NULL,context->TargetToSendRequestsTo,&RequestCopy);

WDF_OBJECT_ATTRIBUTES_INIT(&attributes);

attributes.ParentObject = device;

status = WdfMemoryCreate(
NULL,
NonPagedPool,
DRIVER_TAG,
Length,
&memory,
NULL
);

status = WdfIoTargetFormatRequestForRead(context->TargetToSendRequestsTo,
RequestCopy,
memory,
NULL,
NULL);

IoGetNextIrpStackLocation(WdfRequestWdmGetIrp(RequestCopy))->FileObject = IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(Request))->FileObject;

//
// Park the request into the InFlightReadRequests queue
//
status = WdfRequestForwardToIoQueue(Request, context->InFlightReadRequestsQueue);

WdfRequestSetCompletionRoutine(RequestCopy,RequestCopyCompletionRoutine,context);

WdfRequestSend(RequestCopy,context->TargetToSendRequestsTo,WDF_NO_SEND_OPTIONS));

return;
}

On Completion routine, I do

VOID
RequestCopyCompletionRoutine(
IN WDFREQUEST Request,
IN WDFIOTARGET Target,
IN PWDF_REQUEST_COMPLETION_PARAMS Params,
IN WDFCONTEXT Context
)
{

status = WdfRequestGetStatus(Request);

//
// The status above returns STATUS_PRIVILEGE_NOT_HELD
//

}