Search code examples
windowsfilterkerneldriverwdf

How to preprocess buffer and pass through


how to send the request to the next driver in the stack to further completion?

In my filter driver driver I register a queue for EventWrite with callback EvtDeviceIoWrite as follows:

VOID
EvtDeviceIoWrite(
    IN WDFQUEUE  Queue,
    IN WDFREQUEST  Request,
    IN size_t Length
)
{
    WDFMEMORY memory;
    NTSTATUS status;
    PUCHAR characters;
    UCHAR currentChar;
    UNREFERENCED_PARAMETER(Queue);

    status = WdfRequestRetrieveInputMemory(Request, &memory);
    if (!NT_SUCCESS(status)) {
        KdPrint(("RetreiveInputMemo:  failed 0x%x\n", status));
        return;
    }
    characters = (PUCHAR)WdfMemoryGetBuffer(memory, NULL);
    while (Length != 0) {
        Length--;
        currentChar = *(characters++);
        // Here I would like to edit the buffer
        // copy it to output buffer WdfMemoryCopyFromBuffer
    }
  **// what should be here for send** 
}

I just want do something like this, but for the request.

Sorry I am newbiee in kernel developing, and it will be greatful if someone could point me to the right way to achieve this. Any sugestions will be appreciated.


Solution

  • in Windows-driver-samples exist huge count of examples how do Forwarding I/O Requests. take for example first simply code like in filter.c - here this done by FilterForwardRequest or FilterForwardRequestWithCompletionRoutine - so in general called

    WdfRequestSend(Request, WdfDeviceGetIoTarget(WdfIoQueueGetDevice(Queue)),WDF_NO_SEND_OPTIONS);