WdfRequestRetrieveInputBuffer returns STATUS_BUFFER_TOO_SMALL

I am writing a sample kmdf driver for learning purposes.

void myEvtIoWrite(WDFQUEUE Q, WDFREQUEST R, size_t L)
{

PVOID buf;
WdfRequestRetrieveInputBuffer(R, 1000,buf, NULL); //returns STATUS_BUFFER_TOO_SMALL
}

My test program calls writefile as

TCHAR DataBuffer = “This is some test data to write to the file.”;
DWORD dwBytesToWrite = (DWORD)strlen(DataBuffer);
WriteFile(hFile, DataBuffer, dwBytesToWrite,
&dwBytesWritten, NULL);

What is the correct way to call WdfRequestRetrieveInputBuffer?

I got it.
WdfRequestRetrieveInputBuffer(R, L,buf, NULL);

You are computing the size of the string incorrectly if it is Unicode. Number of bytes !=string length. And you are not sending the NULL character either.

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Sunday, November 19, 2017 2:21:08 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfRequestRetrieveInputBuffer returns STATUS_BUFFER_TOO_SMALL

I am writing a sample kmdf driver for learning purposes.

void myEvtIoWrite(WDFQUEUE Q, WDFREQUEST R, size_t L)
{

PVOID buf;
WdfRequestRetrieveInputBuffer(R, 1000,buf, NULL); //returns STATUS_BUFFER_TOO_SMALL
}

My test program calls writefile as

TCHAR DataBuffer = “This is some test data to write to the file.”;
DWORD dwBytesToWrite = (DWORD)strlen(DataBuffer);
WriteFile(hFile, DataBuffer, dwBytesToWrite,
&dwBytesWritten, NULL);

What is the correct way to call WdfRequestRetrieveInputBuffer?


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>