Static Driver Verifier reports 2xWARNING StartDeviceWait and StartDeviceWait3 whilst Verifier.exe runs the test and passes without any errors or warning.
In an DispatchPnp IRP_MN_START_DEVICE routine you do the typical send the IRP down synchronously (KeInitializeEvent, IoCopyCurrentIrpStackLocationToNext, IoSetCompletionRoutine, IoCallDriver) and wait for the lower device, and complete the request. With the event waiting on STATUS_PENDING recommended by MSDN.
KeInitializeEvent(&event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp, SendIrpSyncCompletionRoutine, &event, TRUE, TRUE, TRUE);
status = IoCallDriver(TargetDeviceObject, Irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); // SDV doesn't like this inside IRP_MN_START_DEVICE
status = Irp->IoStatus.Status;
}
return status;
However this runs all fine and dandy, and even verifier.exe enabled with [X] (0x00000010) I/O verification
and [X] (0x00000200) Force pending I/O requests
we can see in WinDbg !verifier 40
, all the “pending” I/O requests that are thrown are fine, and I see all the relevant dbgprints in the completion routine/status_pending statements which never hit apart from in these tests.
So which is correct? SDV or Verifier? And how does one resolve the SDV warnings, since most driver code related to this I’ve checked online all do it this way, even MSDN docs say this is the recommended method