Author: mjmartin
Date: Fri Jan 9 05:04:11 2009
New Revision: 38662
URL:
http://svn.reactos.org/svn/reactos?rev=38662&view=rev
Log:
- Dont call KeWaitForSingleObject with WaitMode of KernelMode, as threads cannot be
terminated if request was made from user mode. Use Ipr->RequestorMode instead.
Modified:
trunk/reactos/drivers/filesystems/npfs/fsctrl.c
trunk/reactos/drivers/filesystems/npfs/rw.c
Modified: trunk/reactos/drivers/filesystems/npfs/fsctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] Fri Jan 9 05:04:11 2009
@@ -169,7 +169,7 @@
{
KeWaitForSingleObject(&Ccb->ConnectEvent,
UserRequest,
- KernelMode,
+ Irp->RequestorMode,
FALSE,
NULL);
}
Modified: trunk/reactos/drivers/filesystems/npfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] Fri Jan 9 05:04:11 2009
@@ -357,9 +357,15 @@
ExReleaseFastMutex(&Ccb->DataListLock);
Status = KeWaitForSingleObject(&Event,
Executive,
- KernelMode,
+ Irp->RequestorMode,
FALSE,
NULL);
+
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC))
+ {
+ Status = STATUS_CANCELLED;
+ goto done;
+ }
if (!NT_SUCCESS(Status))
{
ASSERT(FALSE);
@@ -439,17 +445,28 @@
DPRINT("Waiting for readable data (%wZ)\n",
&Ccb->Fcb->PipeName);
Status = KeWaitForSingleObject(&Ccb->ReadEvent,
UserRequest,
- KernelMode,
+ Irp->RequestorMode,
FALSE,
NULL);
DPRINT("Finished waiting (%wZ)! Status: %x\n",
&Ccb->Fcb->PipeName, Status);
ExAcquireFastMutex(&Ccb->DataListLock);
+
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC))
+ {
+ Status = STATUS_CANCELLED;
+ break;
+ }
+ if (!NT_SUCCESS(Status))
+ {
+ ASSERT(FALSE);
+ }
}
else
{
Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
Context->WaitEvent = &Ccb->ReadEvent;
+
Status = NpfsAddWaitingReadWriteRequest(DeviceObject, Irp);
if (NT_SUCCESS(Status))
@@ -735,11 +752,20 @@
DPRINT("Waiting for buffer space (%S)\n", Fcb->PipeName.Buffer);
Status = KeWaitForSingleObject(&Ccb->WriteEvent,
UserRequest,
- KernelMode,
+ Irp->RequestorMode,
FALSE,
NULL);
DPRINT("Finished waiting (%S)! Status: %x\n", Fcb->PipeName.Buffer,
Status);
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC))
+ {
+ Status = STATUS_CANCELLED;
+ break;
+ }
+ if (!NT_SUCCESS(Status))
+ {
+ ASSERT(FALSE);
+ }
/*
* It's possible that the event was signaled because the
* other side of pipe was closed.