aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver/ioctl.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/driver/ioctl.c b/driver/ioctl.c
index 00400ee..203bf41 100644
--- a/driver/ioctl.c
+++ b/driver/ioctl.c
@@ -677,14 +677,26 @@ static NTSTATUS
DispatchPnp(DEVICE_OBJECT *DeviceObject, IRP *Irp)
{
IO_STACK_LOCATION *Stack = IoGetCurrentIrpStackLocation(Irp);
- if (Stack->MinorFunction != IRP_MN_QUERY_REMOVE_DEVICE && Stack->MinorFunction != IRP_MN_SURPRISE_REMOVAL)
+ BOOLEAN Removing;
+ switch (Stack->MinorFunction)
+ {
+ case IRP_MN_QUERY_REMOVE_DEVICE:
+ case IRP_MN_SURPRISE_REMOVAL:
+ Removing = TRUE;
+ break;
+ case IRP_MN_CANCEL_REMOVE_DEVICE:
+ Removing = FALSE;
+ break;
+ default:
goto ndisDispatch;
+ }
WG_DEVICE *Wg = WgDeviceFromFdo(DeviceObject);
if (!Wg)
goto ndisDispatch;
- WriteBooleanNoFence(&Wg->IsDeviceRemoving, TRUE);
- KeSetEvent(&Wg->Log.NewEntry, IO_NO_INCREMENT, FALSE);
+ WriteBooleanNoFence(&Wg->IsDeviceRemoving, Removing);
+ if (Removing)
+ KeSetEvent(&Wg->Log.NewEntry, IO_NO_INCREMENT, FALSE);
ndisDispatch:
return PriorDispatchPnp(DeviceObject, Irp);