IO control read buffer update not reflecting in user space after ioctl call is finished

Hi,

In my driver IO control code use METHOD_OUT_DIRECT with FILE_READ_ACCESS | FILE_WRITE_ACCESS.
My usecase is readbuffer passed from user space needs to be updated by driver before ioctl is complete

In ioctl handler WdfRequestRetrieveInputBuffer is used to retrieve input buffer. It is received properly. This buffer is sent to pcie device and response from pcie device needs to be copied in same input buffer. From windbg I can see buffer returned by WdfRequestRetrieveInputBuffer is properly updated before wdfrequestcomplete but in user space input buffer is reading the same values.

Please let me know if I am missing something here.

If you want a two-way buffer, use the second buffer in the ioctl call and use “WdfRequestRetrieveOutputBuffer”. The first ioctl buffer is copied into kernel mode, but the second buffer is mapped, so the bytes you write are the same bytes the user app sees.

Thanks Tim. That worked like a charm.