mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
sys: ProcessBuffer: improvements
This commit is contained in:
parent
28f97c2619
commit
7911f1354f
@ -89,6 +89,7 @@ enum
|
||||
/* DirectoryControlComplete retry */
|
||||
RequestDirInfoChangeNumber = 0,
|
||||
};
|
||||
FSP_FSCTL_STATIC_ASSERT(RequestCookie == RequestMdl, "");
|
||||
|
||||
static NTSTATUS FspFsvolQueryDirectoryCopy(
|
||||
PUNICODE_STRING DirectoryPattern, BOOLEAN CaseInsensitive,
|
||||
@ -851,7 +852,7 @@ NTSTATUS FspFsvolDirectoryControlPrepare(
|
||||
|
||||
Request->Req.QueryDirectory.Address = (UINT64)(UINT_PTR)Address;
|
||||
|
||||
FspIopRequestContext(Request, RequestCookie) = Cookie;
|
||||
FspIopRequestContext(Request, RequestCookie) = (PVOID)((UINT_PTR)Cookie | 1);
|
||||
FspIopRequestContext(Request, RequestAddress) = Address;
|
||||
FspIopRequestContext(Request, RequestProcess) = Process;
|
||||
|
||||
@ -937,7 +938,7 @@ NTSTATUS FspFsvolDirectoryControlComplete(
|
||||
|
||||
if (FspFsctlTransactQueryDirectoryKind == Request->Kind)
|
||||
{
|
||||
if (FspQueryDirectoryIrpShouldUseProcessBuffer(Irp, Request->Req.QueryDirectory.Length))
|
||||
if ((UINT_PTR)FspIopRequestContext(Request, RequestCookie) & 1)
|
||||
{
|
||||
PVOID Address = FspIopRequestContext(Request, RequestAddress);
|
||||
|
||||
@ -1055,9 +1056,9 @@ static VOID FspFsvolQueryDirectoryRequestFini(FSP_FSCTL_TRANSACT_REQ *Request, P
|
||||
|
||||
PIRP Irp = Context[RequestIrp];
|
||||
|
||||
if (0 != Irp && FspQueryDirectoryIrpShouldUseProcessBuffer(Irp, Request->Req.QueryDirectory.Length))
|
||||
if ((UINT_PTR)Context[RequestCookie] & 1)
|
||||
{
|
||||
PVOID Cookie = Context[RequestCookie];
|
||||
PVOID Cookie = (PVOID)((UINT_PTR)Context[RequestCookie] & ~1);
|
||||
PVOID Address = Context[RequestAddress];
|
||||
PEPROCESS Process = Context[RequestProcess];
|
||||
|
||||
|
@ -49,6 +49,7 @@ enum
|
||||
RequestAddress = 2,
|
||||
RequestProcess = 3,
|
||||
};
|
||||
FSP_FSCTL_STATIC_ASSERT(RequestCookie == RequestSafeMdl, "");
|
||||
|
||||
static NTSTATUS FspFsvolRead(
|
||||
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
||||
@ -367,7 +368,7 @@ NTSTATUS FspFsvolReadPrepare(
|
||||
|
||||
Request->Req.Read.Address = (UINT64)(UINT_PTR)Address;
|
||||
|
||||
FspIopRequestContext(Request, RequestCookie) = Cookie;
|
||||
FspIopRequestContext(Request, RequestCookie) = (PVOID)((UINT_PTR)Cookie | 1);
|
||||
FspIopRequestContext(Request, RequestAddress) = Address;
|
||||
FspIopRequestContext(Request, RequestProcess) = Process;
|
||||
|
||||
@ -430,7 +431,7 @@ NTSTATUS FspFsvolReadComplete(
|
||||
if (Response->IoStatus.Information > Request->Req.Read.Length)
|
||||
FSP_RETURN(Result = STATUS_INTERNAL_ERROR);
|
||||
|
||||
if (FspReadIrpShouldUseProcessBuffer(Irp, Request->Req.Read.Length))
|
||||
if ((UINT_PTR)FspIopRequestContext(Request, RequestCookie) & 1)
|
||||
{
|
||||
PVOID Address = FspIopRequestContext(Request, RequestAddress);
|
||||
PVOID SystemAddress = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
|
||||
@ -494,9 +495,9 @@ static VOID FspFsvolReadNonCachedRequestFini(FSP_FSCTL_TRANSACT_REQ *Request, PV
|
||||
|
||||
PIRP Irp = Context[RequestIrp];
|
||||
|
||||
if (0 != Irp && FspReadIrpShouldUseProcessBuffer(Irp, Request->Req.Read.Length))
|
||||
if ((UINT_PTR)Context[RequestCookie] & 1)
|
||||
{
|
||||
PVOID Cookie = Context[RequestCookie];
|
||||
PVOID Cookie = (PVOID)((UINT_PTR)Context[RequestCookie] & ~1);
|
||||
PVOID Address = Context[RequestAddress];
|
||||
PEPROCESS Process = Context[RequestProcess];
|
||||
|
||||
|
@ -50,6 +50,7 @@ enum
|
||||
RequestAddress = 2,
|
||||
RequestProcess = 3,
|
||||
};
|
||||
FSP_FSCTL_STATIC_ASSERT(RequestCookie == RequestSafeMdl, "");
|
||||
|
||||
static NTSTATUS FspFsvolWrite(
|
||||
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
||||
@ -453,7 +454,7 @@ NTSTATUS FspFsvolWritePrepare(
|
||||
|
||||
Request->Req.Write.Address = (UINT64)(UINT_PTR)Address;
|
||||
|
||||
FspIopRequestContext(Request, RequestCookie) = Cookie;
|
||||
FspIopRequestContext(Request, RequestCookie) = (PVOID)((UINT_PTR)Cookie | 1);
|
||||
FspIopRequestContext(Request, RequestAddress) = Address;
|
||||
FspIopRequestContext(Request, RequestProcess) = Process;
|
||||
|
||||
@ -571,9 +572,9 @@ static VOID FspFsvolWriteNonCachedRequestFini(FSP_FSCTL_TRANSACT_REQ *Request, P
|
||||
|
||||
PIRP Irp = Context[RequestIrp];
|
||||
|
||||
if (0 != Irp && FspWriteIrpShouldUseProcessBuffer(Irp, Request->Req.Write.Length))
|
||||
if ((UINT_PTR)Context[RequestCookie] & 1)
|
||||
{
|
||||
PVOID Cookie = Context[RequestCookie];
|
||||
PVOID Cookie = (PVOID)((UINT_PTR)Context[RequestCookie] & ~1);
|
||||
PVOID Address = Context[RequestAddress];
|
||||
PEPROCESS Process = Context[RequestProcess];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user