diff options
| author | 2026-05-14 09:20:55 +0200 | |
|---|---|---|
| committer | 2026-07-20 15:39:58 +0200 | |
| commit | 9ca153916cc4d6ed8c6728681c33148f0137b091 (patch) | |
| tree | 7db713e2036669b3b69f0f01f3053827f470d743 /driver | |
| parent | api: rundll32: manage replies from worker process better (diff) | |
| download | wireguard-nt-master.tar.xz wireguard-nt-master.zip | |
Otherwise a vetoed query-remove leaves the adapter permanently
inaccessible via ioctl, even though NDIS keeps the miniport alive and
operational.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'driver')
| -rw-r--r-- | driver/ioctl.c | 18 |
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); |
