summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Benditovich <yuri.benditovich@daynix.com>2020-01-25 19:57:57 +0200
committerYan Vugenfirer <yan@daynix.com>2020-01-27 19:49:45 +0200
commitc736f5d8be38d1a6ccc24dfbc21eeffc89dadc88 (patch)
treeded1409d2408d61a406660f773af1c1967c2a7a9
parent617f89695ed23c59c035d198c8a72fe7b2d782c2 (diff)
driver: fix driver verifier assertion in FileCreate callback
Previous commit 4de57a9ff causes driver verifier assertion with latest Windows builds. Note that this assertion is not in latest WDF sources on GitHub. The verifier does not allow to forward the MJ_CREATE requestto local IO target using "send-and-forget". It requires the request to set completion callback. There is an option to remove the file create callback at all, but we prefer to have printout on file open for better diagnostics. So we add completion callback for forwarded request and complete the request in it. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
-rw-r--r--UsbDk/FilterDevice.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/UsbDk/FilterDevice.cpp b/UsbDk/FilterDevice.cpp
index 8fe016e..22d4383 100644
--- a/UsbDk/FilterDevice.cpp
+++ b/UsbDk/FilterDevice.cpp
@@ -481,11 +481,19 @@ bool CUsbDkChildDevice::AttachToDeviceStack()
void CUsbDkFilterDevice::OnFileCreate(WDFREQUEST Request)
{
- WDF_REQUEST_SEND_OPTIONS options;
- WDF_REQUEST_SEND_OPTIONS_INIT(&options, WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
+ CWdfRequest r(Request);
+ WdfRequestFormatRequestUsingCurrentType(Request);
// in the log we'll see which process created the file
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%!FUNC!");
- WdfRequestSend(Request, IOTarget(), &options);
+ r.SendWithCompletion(IOTarget(), [](WDFREQUEST Request, WDFIOTARGET Target, PWDF_REQUEST_COMPLETION_PARAMS Params, WDFCONTEXT Context)
+ {
+ UNREFERENCED_PARAMETER(Target);
+ CWdfRequest r(Request);
+ TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%s: completed", (LPCSTR)Context);
+ r.SetStatus(Params->IoStatus.Status);
+ r.SetBytesWritten(Params->IoStatus.Information);
+ },
+ __FUNCTION__);
}
NTSTATUS CUsbDkFilterDevice::AttachToStack(WDFDRIVER Driver)