From 4995df02c5609b76c1eccfc5a1e71433e888f9a3 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 29 Oct 2010 00:41:06 +0000 Subject: [PATCH] - Fix mdl probe access rights svn path=/trunk/; revision=49336 --- reactos/drivers/ksfilter/ks/irp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/ksfilter/ks/irp.c b/reactos/drivers/ksfilter/ks/irp.c index 32ba84d9fd1..5ff56c9a0f8 100644 --- a/reactos/drivers/ksfilter/ks/irp.c +++ b/reactos/drivers/ksfilter/ks/irp.c @@ -724,7 +724,16 @@ ProbeMdl: Mdl = Irp->MdlAddress; /* determine operation */ - Operation = (ProbeFlags & KSPROBE_STREAMWRITE) ? IoWriteAccess : IoReadAccess; + if (!(ProbeFlags & KSPROBE_STREAMWRITE) || (ProbeFlags & KSPROBE_MODIFY)) + { + /* operation is read / modify stream, need write access */ + Operation = IoWriteAccess; + } + else + { + /* operation is write to device, so we need read access */ + Operation = IoReadAccess; + } do { @@ -859,7 +868,8 @@ ProbeMdl: if (StreamHeader->FrameExtent) { /* allocate an mdl */ - Mdl = IoAllocateMdl(StreamHeader->Data, StreamHeader->FrameExtent, Irp->MdlAddress != NULL, TRUE, Irp); + ASSERT(Irp->MdlAddress == NULL); + Mdl = IoAllocateMdl(StreamHeader->Data, StreamHeader->FrameExtent, FALSE, TRUE, Irp); if (!Mdl) { /* not enough memory */ @@ -880,10 +890,10 @@ ProbeMdl: /* now probe the allocated mdl's */ if (!NT_SUCCESS(Status)) - { + { DPRINT("Status %x\n", Status); return Status; - } + } else goto ProbeMdl; } -- 2.17.1