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>
This commit is contained in:
parent
85b4a769cf
commit
7004db43a7
3
wintun.c
3
wintun.c
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user