Dear,
I’d like to generate Read requests periodically from a filter driver in order to update a buffer. Could you tell me what’s the best way to setup a timer, and what’s the classic way to build read requests.
What I tried is the following (no timer for the moment) :
Creating the memory once in DeviceAdd :
KdPrint((“Creating memory”));
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.ParentObject = device;
WdfMemoryCreate(&attributes, NonPagedPool, 0, 21, &mem, NULL);
And creating read requests using :
WDFREQUEST rawRequest;
WDFIOTARGET rawIoTarget;
KdPrint((“Getting target.”));
rawIoTarget = WdfDeviceGetIoTarget(rawDevice);
KdPrint((“Creating raw read request.”));
WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, rawIoTarget, &rawRequest);
KdPrint((“Formating raw read request.”));
WdfIoTargetFormatRequestForRead(rawIoTarget, rawRequest, mem, NULL, 0);
KdPrint((“Sending raw read request.”));
FilterForwardRequestWithCompletionRoutine(rawRequest, rawIoTarget);
I’m doing some treatment in the completion routine, directly on “mem” which is a global (I read somewhere I couldn’t use WdfRequestRetrieveOutputMemory in case I’m creating the request myself).
buffer = WdfMemoryGetBuffer(mem, &buffer_size);
…
WdfRequestComplete(Request, CompletionParams->IoStatus.Status);
I end up with a bluescreen when calling WdfRequestComplete.
Any idea ? is this the correct way to do this ?
What about the timer ?
Regards,