diff options
author | Simon Rozman <simon@rozman.si> | 2019-06-18 13:59:27 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2019-06-20 11:54:58 +0200 |
commit | 7004db43a740c23c6457d697d4fd0e233afc0800 (patch) | |
tree | 4fdd2e133b17d49122fb73827663be8f32875c17 | |
parent | Replace PnP notifications with IRP_MJ_PNP dispatch handler (diff) | |
download | wintun-7004db43a740c23c6457d697d4fd0e233afc0800.tar.xz wintun-7004db43a740c23c6457d697d4fd0e233afc0800.zip |
Support surprise removal
WHLK 1903 CHAOS tests are reporting lots of issues regarding surprise
removal misbehavior:
WDTF_PNP: INFO : Result: TestSurpriseRemove operation timed out waiting
for IRP_MN_REMOVE_DEVICE..
WDTF_PNP: ERROR : Result: Failed to receive IRP_MN_REMOVE_DEVICE after
receiving IRP_MN_SURPRISE_REMOVAL. Ensure that there are no open
handles or references to the test device (in user mode or in kernel
mode) preventing IRP_MN_REMOVE_DEVICE from being sent. You may need
to terminate any processes or services that may have open user mode
handles to this device. ( 80004005 ).
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r-- | wintun.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -902,6 +902,7 @@ static NTSTATUS TunDispatchPnP(DEVICE_OBJECT *DeviceObject, IRP *Irp) switch (stack->MinorFunction) { case IRP_MN_QUERY_REMOVE_DEVICE: + case IRP_MN_SURPRISE_REMOVAL: KIRQL irql = ExAcquireSpinLockExclusive(&ctx->TransitionLock); InterlockedAnd(&ctx->Flags, ~TUN_FLAGS_PRESENT); ExReleaseSpinLockExclusive(&ctx->TransitionLock, irql); @@ -1089,7 +1090,7 @@ static NDIS_STATUS TunInitializeEx(NDIS_HANDLE MiniportAdapterHandle, NDIS_HANDL .Revision = NdisVersion < NDIS_RUNTIME_VERSION_630 ? NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1 : NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2, .Size = NdisVersion < NDIS_RUNTIME_VERSION_630 ? NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1 : NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2 }, - .AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND, + .AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND | NDIS_MINIPORT_ATTRIBUTES_SURPRISE_REMOVE_OK, .InterfaceType = NdisInterfaceInternal, .MiniportAdapterContext = ctx }; |