WdfIoTargetSendIoctlSynchronously returns STATUS_BUFFER_TOO_SMALL
Driver Calling IOCTL
//Describe the input buffer
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&InputBuffer, &MyBuffer, sizeof(MyBuffer)); // size = 0x52
// Send the write request synchronously.
status = WdfIoTargetSendIoctlSynchronously(
IoTarget,
NULL,
(ULONG) IOCTL_XXXX, // BUFFERED_IO
&InputBuffer,
NULL,
NULL,
&BytesReturned);
if (!NT_SUCCESS(status)) {?} // status is STATUS_BUFFER_TOO_SMALL
Code on the IoTarget
- WdfRequestRetrieveInputBuffer (Request, 2, (PVOID *) &InputBuffer, &InputSize);
// InputSize is now 0x52 - I process the data and call WdfRequestSetInformation(Request, 0x28) before completing the request.
// 0x28 is what I want the Information to be.
When the WdfIoTargetSendIoctlSynchronously returns, I see that the BytesReturned = 0x28 as I expect, but I get an error STATUS_BUFFER_TOO_SMALL. I know that the framework is trying to copy from the SystemBuffer to my buffer, but why? I have specified the OutputBuffer as NULL when I called WdfIoTargetSendIoctlSynchronously.
Thanks
Umesh