Revise I/O errors
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
d3cc0570de
commit
ca79fd1368
10
wintun.c
10
wintun.c
@ -703,7 +703,7 @@ static NTSTATUS TunDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
|
|||||||
switch (stack->MajorFunction) {
|
switch (stack->MajorFunction) {
|
||||||
case IRP_MJ_READ:
|
case IRP_MJ_READ:
|
||||||
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
||||||
status = STATUS_INVALID_HANDLE;
|
status = STATUS_FILE_FORCED_CLOSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ static NTSTATUS TunDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
|
|||||||
|
|
||||||
case IRP_MJ_WRITE:
|
case IRP_MJ_WRITE:
|
||||||
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
||||||
status = STATUS_INVALID_HANDLE;
|
status = STATUS_FILE_FORCED_CLOSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ static NTSTATUS TunDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
|
|||||||
|
|
||||||
case IRP_MJ_CREATE:
|
case IRP_MJ_CREATE:
|
||||||
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
if (InterlockedGet((LONG *)&ctx->State) < TUN_STATE_PAUSED) {
|
||||||
status = STATUS_INVALID_HANDLE;
|
status = STATUS_DELETE_PENDING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,9 +1099,9 @@ static void TunHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltA
|
|||||||
|
|
||||||
InterlockedExchange((LONG *)&ctx->State, TUN_STATE_HALTING);
|
InterlockedExchange((LONG *)&ctx->State, TUN_STATE_HALTING);
|
||||||
|
|
||||||
/* Cancel pending IRPs to unblock waiting clients. */
|
/* Complete pending IRPs to unblock waiting clients. */
|
||||||
for (IRP *pending_irp; (pending_irp = IoCsqRemoveNextIrp(&ctx->Device.ReadQueue.Csq, NULL)) != NULL;)
|
for (IRP *pending_irp; (pending_irp = IoCsqRemoveNextIrp(&ctx->Device.ReadQueue.Csq, NULL)) != NULL;)
|
||||||
TunCompleteRequest(pending_irp, 0, STATUS_CANCELLED);
|
TunCompleteRequest(pending_irp, 0, STATUS_FILE_FORCED_CLOSED);
|
||||||
|
|
||||||
NdisFreeNetBufferListPool(ctx->NBLPool);
|
NdisFreeNetBufferListPool(ctx->NBLPool);
|
||||||
ctx->NBLPool = NULL;
|
ctx->NBLPool = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user