if (Irp->RequestorMode == KernelMode || Irp->AssociatedIrp.SystemBuffer)
{
+ if (Irp->RequestorMode == KernelMode)
+ {
+ /* no need to allocate stream header */
+ Irp->AssociatedIrp.SystemBuffer = Irp->UserBuffer;
+ }
AllocMdl:
/* check if alloc mdl flag is passed */
if (!(ProbeFlags & KSPROBE_ALLOCATEMDL))
return STATUS_INSUFFICIENT_RESOURCES;
}
+ /* mark irp as buffered so that changes the stream headers are propagated back */
+ Irp->Flags = IRP_DEALLOCATE_BUFFER | IRP_BUFFERED_IO;
+
_SEH2_TRY
{
if (ProbeFlags & KSPROBE_STREAMWRITE)
{
/* stream reads means writing */
ProbeForWrite(Irp->UserBuffer, Length, sizeof(UCHAR));
+
+ /* set input operation flags */
+ Irp->Flags |= IRP_INPUT_OPERATION;
}
/* copy stream buffer */