sys: FspIrpContext*

This commit is contained in:
Bill Zissimopoulos 2015-12-07 13:19:17 -08:00
parent 6fcab43120
commit 253de21708
5 changed files with 17 additions and 14 deletions

View File

@ -346,7 +346,7 @@ NTSTATUS FspFsvolCreatePrepare(
}
/* send the user-mode handle to the user-mode file system */
Irp->Tail.Overlay.DriverContext[1] = UserModeAccessToken;
FspIrpContextHandle(Irp) = UserModeAccessToken;
Request->Req.Create.AccessToken = (UINT_PTR)UserModeAccessToken;
FSP_LEAVE_IOP();
@ -388,8 +388,7 @@ VOID FspFsvolCreateComplete(
ULONG Flags = IrpSp->Flags;
KPROCESSOR_MODE RequestorMode =
FlagOn(Flags, SL_FORCE_ACCESS_CHECK) ? UserMode : Irp->RequestorMode;
BOOLEAN HasTrailingBackslash =
0 != ((FSP_FSCTL_TRANSACT_REQ *)Irp->Tail.Overlay.DriverContext[0])->Req.Create.HasTrailingBackslash;
BOOLEAN HasTrailingBackslash = 0 != FspIrpContextRequest(Irp)->Req.Create.HasTrailingBackslash;
FSP_FILE_CONTEXT *FsContext = FileObject->FsContext;
ACCESS_MASK GrantedAccess;
BOOLEAN Inserted = FALSE;

View File

@ -263,6 +263,10 @@ PIRP FspIoqEndProcessingIrp(FSP_IOQ *Ioq, UINT_PTR IrpHint);
/* I/O processing */
#define FSP_FSCTL_WORK \
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'W', METHOD_NEITHER, FILE_ANY_ACCESS)
#define FspIrpContextRequest(Irp) \
(*(FSP_FSCTL_TRANSACT_REQ **)&(Irp)->Tail.Overlay.DriverContext[0])
#define FspIrpContextHandle(Irp) \
(*(HANDLE *)&(Irp)->Tail.Overlay.DriverContext[1])
NTSTATUS FspIopCreateRequest(
PIRP Irp, PUNICODE_STRING FileName, ULONG ExtraSize, FSP_FSCTL_TRANSACT_REQ **PRequest);
NTSTATUS FspIopPostWorkRequest(PDEVICE_OBJECT DeviceObject, FSP_FSCTL_TRANSACT_REQ *Request);

View File

@ -391,7 +391,7 @@ retry:
ASSERT((PUINT8)Request + FSP_FSCTL_TRANSACT_REQ_SIZEMAX <= SystemBufferEnd);
for (;;)
{
PendingIrpRequest = PendingIrp->Tail.Overlay.DriverContext[0];
PendingIrpRequest = FspIrpContextRequest(PendingIrp);
Result = FspIopDispatchPrepare(PendingIrp, PendingIrpRequest);
if (!NT_SUCCESS(Result))

View File

@ -42,7 +42,7 @@ static NTSTATUS FspFsvolInternalDeviceControl(
/* associate the passed Request with our Irp; acquire ownership of the Request */
Request->Hint = (UINT_PTR)Irp;
Irp->Tail.Overlay.DriverContext[0] = Request;
FspIrpContextRequest(Irp) = Request;
if (!FspIoqPostIrp(&FsvrtDeviceExtension->Ioq, Irp))
{
@ -51,7 +51,7 @@ static NTSTATUS FspFsvolInternalDeviceControl(
/* disocciate the Request from our Irp; release ownership back to caller */
Request->Hint = 0;
Irp->Tail.Overlay.DriverContext[0] = 0;
FspIrpContextRequest(Irp) = 0;
Result = STATUS_CANCELLED;
goto exit;

View File

@ -58,7 +58,7 @@ NTSTATUS FspIopCreateRequest(
}
if (0 != Irp)
Irp->Tail.Overlay.DriverContext[0] = Request;
FspIrpContextRequest(Irp) = Request;
*PRequest = Request;
return STATUS_SUCCESS;
@ -125,24 +125,24 @@ VOID FspIopCompleteIrpEx(PIRP Irp, NTSTATUS Result, BOOLEAN DeviceRelease)
ASSERT(STATUS_PENDING != Result);
ASSERT(0 == Irp->Tail.Overlay.DriverContext[3]);
if (0 != Irp->Tail.Overlay.DriverContext[0])
if (0 != FspIrpContextRequest(Irp))
{
FspIopDeleteRequest(Irp->Tail.Overlay.DriverContext[0]);
Irp->Tail.Overlay.DriverContext[0] = 0;
FspIopDeleteRequest(FspIrpContextRequest(Irp));
FspIrpContextRequest(Irp) = 0;
}
if (0 != Irp->Tail.Overlay.DriverContext[1])
if (0 != FspIrpContextHandle(Irp))
{
#if DBG
NTSTATUS Result0;
Result0 = ObCloseHandle(Irp->Tail.Overlay.DriverContext[1], KernelMode);
Result0 = ObCloseHandle(FspIrpContextHandle(Irp), KernelMode);
if (!NT_SUCCESS(Result0))
DEBUGLOG("ObCloseHandle() = %s", NtStatusSym(Result0));
#else
ObCloseHandle(Irp->Tail.Overlay.DriverContext[1], KernelMode);
ObCloseHandle(FspIrpContextHandle(Irp), KernelMode);
#endif
Irp->Tail.Overlay.DriverContext[1] = 0;
FspIrpContextHandle(Irp) = 0;
}
PDEVICE_OBJECT DeviceObject = IoGetCurrentIrpStackLocation(Irp)->DeviceObject;