Hi everyone,
I am trying to modify the data my KMDF driver gets before it sends it up during a WDFREQUEST read.
After reading this https://community.osr.com/discussion/273945/replacing-wdfmemory-and-or-buffer-in-write-callback and this https://community.osr.com/discussion/216562, I decided to create a new request.
This is what I do :
In the FilterEvtIoRead function :
-
Create a new request
→ WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &newRequest); -
Create new WDFMEMORY
→ WdfMemoryCreate(WDF_NO_OBJECT_ATTRIBUTES, NonPagedPool, ‘MyPi’, Length, &newMemory, &newBuffer); -
Get the request memory and buffer
→ WdfRequestRetrieveOutputMemory(Request, &outputMemory);
→ outputBuffer = WdfMemoryGetBuffer(outputMemory, NULL); -
Copy the data
→ WdfMemoryCopyFromBuffer(newMemory, 0, outputBuffer, Length); -
Format the new request with the new memory
→ WdfIoTargetFormatRequestForRead(target, newRequest, newMemory, NULL, NULL); -
Set completion routine and send the new request
→ WdfRequestSetCompletionRoutine(newRequest, FilterEvtIoReadCompletionRoutine, filterContext);
->WdfRequestSend(newRequest, target, WDF_NO_SEND_OPTIONS);
But this yields me a BSOD… Has anyone any idea of why ?
Thanks for your help,
Axel.