I'm working on a upper-filter driver that filters IOCTL requests to the "HidBatt" battery driver. As part of that I'm using a completion routine to modify the output from IOCTL requests to the underlying HidBatt driver. The completion routine "PWDF_REQUEST_COMPLETION_PARAMS Params" argument have been invalidated by WdfRequestFormatRequestUsingCurrentType
, so I need an alternative mechanism for accessing IOCTL buffers.
I'm currently using WdfRequestRetrieveInputBuffer
& WdfRequestRetrieveOutputBuffer
to access IOCTL buffers from the completion routine This seem to work, but I'm not sure if it's guaranteed safe, since the "Params" argument have been invalidated. I am therefore seeking advise on "best practice" in this area.
Questions:
- Is it safe to call
WdfRequestRetrieveInputBuffer
from a IOCTL completion routine? If not, does it help to move the call to theEvtIoDeviceControl
callback function and store the buffer pointer for later access by the completion routine? - Is it safe to call
WdfRequestRetrieveOutputBuffer
from a IOCTL completion routine? If not, does it help to move the call to theEvtIoDeviceControl
callback function and store the buffer pointer for later access by the completion routine?
Thanks in advance.