Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Windows filter driver BSOD on WDFREQUEST duplication

$
0
0

I am currently trying to write a serial filter driver that would be able to modify the data on read wdf requests.

The idea is to create a new WDFREQUEST object in the read callback function, here is what I do :

  1. Create a new request
WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &newRequest);
  1. Create new WDFMEMORY
WdfMemoryCreate(WDF_NO_OBJECT_ATTRIBUTES, NonPagedPool, 'MyPi', Length, &newMemory, &newBuffer);
  1. Get the request memory and buffer
WdfRequestRetrieveOutputMemory(Request, &outputMemory);outputBuffer = WdfMemoryGetBuffer(outputMemory, NULL);
  1. Copy the data
WdfMemoryCopyFromBuffer(newMemory, 0, outputBuffer, Length);
  1. Format the new request with the new memory
WdfIoTargetFormatRequestForRead(target, newRequest, newMemory, NULL, NULL);
  1. Finally, set completion routine and send the new request
WdfRequestSetCompletionRoutine(newRequest, FilterEvtIoReadCompletionRoutine, filterContext);WdfRequestSend(newRequest, target, WDF_NO_SEND_OPTIONS);

But this code yields me a BSOD...If I replace newRequest by Request and newMemory by outputMemory in 5) and 6) the data is correclty transmitted and no error is produced.

Does anyone know where could be the problem ?Thank you in advance,Axel


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>