mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 14:25:52 +00:00
[RDBSS] Start defining the RxCapture* macros and start using them (to be continued)
This commit is contained in:
parent
b840f65362
commit
2511ba8f8f
2 changed files with 53 additions and 41 deletions
|
@ -6,6 +6,22 @@
|
||||||
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
|
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MINIRDR__NAME
|
||||||
|
#define RxCaptureFcb PFCB __C_Fcb = (PFCB)(RxContext->pFcb)
|
||||||
|
#define RxCaptureFobx PFOBX __C_Fobx = (PFOBX)(RxContext->pFobx)
|
||||||
|
#else
|
||||||
|
#define RxCaptureFcb PMRX_FCB __C_Fcb = (RxContext->pFcb)
|
||||||
|
#define RxCaptureFobx PMRX_FOBX __C_Fobx = (RxContext->pFobx)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define RxCaptureParamBlock PIO_STACK_LOCATION __C_IrpSp = RxContext->CurrentIrpSp
|
||||||
|
#define RxCaptureFileObject PFILE_OBJECT __C_FileObject = __C_IrpSp-> FileObject
|
||||||
|
|
||||||
|
#define capFcb __C_Fcb
|
||||||
|
#define capFobx __C_Fobx
|
||||||
|
#define capPARAMS __C_IrpSp
|
||||||
|
#define capFileObject __C_FileObject
|
||||||
|
|
||||||
#define RxAllocatePoolWithTag ExAllocatePoolWithTag
|
#define RxAllocatePoolWithTag ExAllocatePoolWithTag
|
||||||
#define RxFreePool ExFreePool
|
#define RxFreePool ExFreePool
|
||||||
|
|
||||||
|
|
|
@ -643,6 +643,8 @@ VOID
|
||||||
CheckForLoudOperations(
|
CheckForLoudOperations(
|
||||||
PRX_CONTEXT RxContext)
|
PRX_CONTEXT RxContext)
|
||||||
{
|
{
|
||||||
|
RxCaptureFcb;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
#define ALLSCR_LENGTH (sizeof(L"all.scr") - sizeof(UNICODE_NULL))
|
#define ALLSCR_LENGTH (sizeof(L"all.scr") - sizeof(UNICODE_NULL))
|
||||||
|
@ -650,11 +652,9 @@ CheckForLoudOperations(
|
||||||
/* Are loud operations enabled? */
|
/* Are loud operations enabled? */
|
||||||
if (RxLoudLowIoOpsEnabled)
|
if (RxLoudLowIoOpsEnabled)
|
||||||
{
|
{
|
||||||
PFCB Fcb;
|
|
||||||
|
|
||||||
/* If so, the operation will be loud only if filename ends with all.scr */
|
/* If so, the operation will be loud only if filename ends with all.scr */
|
||||||
Fcb = (PFCB)RxContext->pFcb;
|
if (RtlCompareMemory(Add2Ptr(capFcb->PrivateAlreadyPrefixedName.Buffer,
|
||||||
if (RtlCompareMemory(Add2Ptr(Fcb->PrivateAlreadyPrefixedName.Buffer, (Fcb->PrivateAlreadyPrefixedName.Length - ALLSCR_LENGTH)),
|
(capFcb->PrivateAlreadyPrefixedName.Length - ALLSCR_LENGTH)),
|
||||||
L"all.scr", ALLSCR_LENGTH) == ALLSCR_LENGTH)
|
L"all.scr", ALLSCR_LENGTH) == ALLSCR_LENGTH)
|
||||||
{
|
{
|
||||||
SetFlag(RxContext->LowIoContext.Flags, LOWIO_CONTEXT_FLAG_LOUDOPS);
|
SetFlag(RxContext->LowIoContext.Flags, LOWIO_CONTEXT_FLAG_LOUDOPS);
|
||||||
|
@ -701,14 +701,12 @@ __RxWriteReleaseResources(
|
||||||
PCSTR FileName,
|
PCSTR FileName,
|
||||||
ULONG SerialNumber)
|
ULONG SerialNumber)
|
||||||
{
|
{
|
||||||
PFCB Fcb;
|
RxCaptureFcb;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT(RxContext != NULL);
|
ASSERT(RxContext != NULL);
|
||||||
|
ASSERT(capFcb != NULL);
|
||||||
Fcb = (PFCB)RxContext->pFcb;
|
|
||||||
ASSERT(Fcb != NULL);
|
|
||||||
|
|
||||||
/* If FCB resource was acquired, release it */
|
/* If FCB resource was acquired, release it */
|
||||||
if (RxContext->FcbResourceAcquired)
|
if (RxContext->FcbResourceAcquired)
|
||||||
|
@ -716,11 +714,11 @@ __RxWriteReleaseResources(
|
||||||
/* Taking care of owner */
|
/* Taking care of owner */
|
||||||
if (ResourceOwnerSet)
|
if (ResourceOwnerSet)
|
||||||
{
|
{
|
||||||
RxReleaseFcbForThread(RxContext, Fcb, RxContext->LowIoContext.ResourceThreadId);
|
RxReleaseFcbForThread(RxContext, capFcb, RxContext->LowIoContext.ResourceThreadId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RxReleaseFcb(RxContext, Fcb);
|
RxReleaseFcb(RxContext, capFcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
RxContext->FcbResourceAcquired = FALSE;
|
RxContext->FcbResourceAcquired = FALSE;
|
||||||
|
@ -732,11 +730,11 @@ __RxWriteReleaseResources(
|
||||||
/* Taking care of owner */
|
/* Taking care of owner */
|
||||||
if (ResourceOwnerSet)
|
if (ResourceOwnerSet)
|
||||||
{
|
{
|
||||||
RxReleasePagingIoResourceForThread(RxContext, Fcb, RxContext->LowIoContext.ResourceThreadId);
|
RxReleasePagingIoResourceForThread(RxContext, capFcb, RxContext->LowIoContext.ResourceThreadId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RxReleasePagingIoResource(RxContext, Fcb);
|
RxReleasePagingIoResource(RxContext, capFcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No need to release boolean here, RxReleasePagingIoResource() takes care of it */
|
/* No need to release boolean here, RxReleasePagingIoResource() takes care of it */
|
||||||
|
@ -774,14 +772,13 @@ RxAddToWorkque(
|
||||||
ULONG Queued;
|
ULONG Queued;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
WORK_QUEUE_TYPE Queue;
|
WORK_QUEUE_TYPE Queue;
|
||||||
PIO_STACK_LOCATION Stack;
|
RxCaptureParamBlock;
|
||||||
|
|
||||||
Stack = RxContext->CurrentIrpSp;
|
|
||||||
RxContext->PostRequest = FALSE;
|
RxContext->PostRequest = FALSE;
|
||||||
|
|
||||||
/* First of all, select the appropriate queue - delayed for prefix claim, critical for the rest */
|
/* First of all, select the appropriate queue - delayed for prefix claim, critical for the rest */
|
||||||
if (RxContext->MajorFunction == IRP_MJ_DEVICE_CONTROL &&
|
if (RxContext->MajorFunction == IRP_MJ_DEVICE_CONTROL &&
|
||||||
Stack->Parameters.DeviceIoControl.IoControlCode == IOCTL_REDIR_QUERY_PATH)
|
capPARAMS->Parameters.DeviceIoControl.IoControlCode == IOCTL_REDIR_QUERY_PATH)
|
||||||
{
|
{
|
||||||
Queue = DelayedWorkQueue;
|
Queue = DelayedWorkQueue;
|
||||||
SetFlag(RxContext->Flags, RX_CONTEXT_FLAG_FSP_DELAYED_OVERFLOW_QUEUE);
|
SetFlag(RxContext->Flags, RX_CONTEXT_FLAG_FSP_DELAYED_OVERFLOW_QUEUE);
|
||||||
|
@ -793,7 +790,7 @@ RxAddToWorkque(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
if (Stack->FileObject != NULL)
|
if (capPARAMS->FileObject != NULL)
|
||||||
{
|
{
|
||||||
KeAcquireSpinLock(&RxFileSystemDeviceObject->OverflowQueueSpinLock, &OldIrql);
|
KeAcquireSpinLock(&RxFileSystemDeviceObject->OverflowQueueSpinLock, &OldIrql);
|
||||||
|
|
||||||
|
@ -821,22 +818,23 @@ RxAddToWorkque(
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
RxAdjustFileTimesAndSize(
|
RxAdjustFileTimesAndSize(
|
||||||
PRX_CONTEXT Context)
|
PRX_CONTEXT RxContext)
|
||||||
{
|
{
|
||||||
PFCB Fcb;
|
|
||||||
PFOBX Fobx;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFILE_OBJECT FileObject;
|
|
||||||
LARGE_INTEGER CurrentTime;
|
LARGE_INTEGER CurrentTime;
|
||||||
FILE_BASIC_INFORMATION FileBasicInfo;
|
FILE_BASIC_INFORMATION FileBasicInfo;
|
||||||
FILE_END_OF_FILE_INFORMATION FileEOFInfo;
|
FILE_END_OF_FILE_INFORMATION FileEOFInfo;
|
||||||
BOOLEAN FileModified, SetLastChange, SetLastAccess, SetLastWrite, NeedUpdate;
|
BOOLEAN FileModified, SetLastChange, SetLastAccess, SetLastWrite, NeedUpdate;
|
||||||
|
|
||||||
|
RxCaptureFcb;
|
||||||
|
RxCaptureFobx;
|
||||||
|
RxCaptureParamBlock;
|
||||||
|
RxCaptureFileObject;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FileObject = Context->CurrentIrpSp->FileObject;
|
|
||||||
/* If Cc isn't initialized, the file was not read nor written, nothing to do */
|
/* If Cc isn't initialized, the file was not read nor written, nothing to do */
|
||||||
if (FileObject->PrivateCacheMap == NULL)
|
if (capFileObject->PrivateCacheMap == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -844,17 +842,16 @@ RxAdjustFileTimesAndSize(
|
||||||
/* Get now */
|
/* Get now */
|
||||||
KeQuerySystemTime(&CurrentTime);
|
KeQuerySystemTime(&CurrentTime);
|
||||||
|
|
||||||
Fobx = (PFOBX)Context->pFobx;
|
|
||||||
/* Was the file modified? */
|
/* Was the file modified? */
|
||||||
FileModified = BooleanFlagOn(FileObject->Flags, FO_FILE_MODIFIED);
|
FileModified = BooleanFlagOn(capFileObject->Flags, FO_FILE_MODIFIED);
|
||||||
/* We'll set last write if it was modified and user didn't update yet */
|
/* We'll set last write if it was modified and user didn't update yet */
|
||||||
SetLastWrite = FileModified && !BooleanFlagOn(Fobx->Flags, FOBX_FLAG_USER_SET_LAST_WRITE);
|
SetLastWrite = FileModified && !BooleanFlagOn(capFobx->Flags, FOBX_FLAG_USER_SET_LAST_WRITE);
|
||||||
/* File was accessed if: written or read (fastio), we'll update last access if user didn't */
|
/* File was accessed if: written or read (fastio), we'll update last access if user didn't */
|
||||||
SetLastAccess = SetLastWrite ||
|
SetLastAccess = SetLastWrite ||
|
||||||
(BooleanFlagOn(FileObject->Flags, FO_FILE_FAST_IO_READ) &&
|
(BooleanFlagOn(capFileObject->Flags, FO_FILE_FAST_IO_READ) &&
|
||||||
!BooleanFlagOn(Fobx->Flags, FOBX_FLAG_USER_SET_LAST_ACCESS));
|
!BooleanFlagOn(capFobx->Flags, FOBX_FLAG_USER_SET_LAST_ACCESS));
|
||||||
/* We'll set last change if it was modified and user didn't update yet */
|
/* We'll set last change if it was modified and user didn't update yet */
|
||||||
SetLastChange = FileModified && !BooleanFlagOn(Fobx->Flags, FOBX_FLAG_USER_SET_LAST_CHANGE);
|
SetLastChange = FileModified && !BooleanFlagOn(capFobx->Flags, FOBX_FLAG_USER_SET_LAST_CHANGE);
|
||||||
|
|
||||||
/* Nothing to update? Job done */
|
/* Nothing to update? Job done */
|
||||||
if (!FileModified && !SetLastWrite && !SetLastAccess && !SetLastChange)
|
if (!FileModified && !SetLastWrite && !SetLastAccess && !SetLastChange)
|
||||||
|
@ -862,7 +859,6 @@ RxAdjustFileTimesAndSize(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fcb = (PFCB)Context->pFcb;
|
|
||||||
/* By default, we won't issue any MRxSetFileInfoAtCleanup call */
|
/* By default, we won't issue any MRxSetFileInfoAtCleanup call */
|
||||||
NeedUpdate = FALSE;
|
NeedUpdate = FALSE;
|
||||||
RtlZeroMemory(&FileBasicInfo, sizeof(FileBasicInfo));
|
RtlZeroMemory(&FileBasicInfo, sizeof(FileBasicInfo));
|
||||||
|
@ -871,7 +867,7 @@ RxAdjustFileTimesAndSize(
|
||||||
if (SetLastWrite)
|
if (SetLastWrite)
|
||||||
{
|
{
|
||||||
NeedUpdate = TRUE;
|
NeedUpdate = TRUE;
|
||||||
Fcb->LastWriteTime.QuadPart = CurrentTime.QuadPart;
|
capFcb->LastWriteTime.QuadPart = CurrentTime.QuadPart;
|
||||||
FileBasicInfo.LastWriteTime.QuadPart = CurrentTime.QuadPart;
|
FileBasicInfo.LastWriteTime.QuadPart = CurrentTime.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +875,7 @@ RxAdjustFileTimesAndSize(
|
||||||
if (SetLastAccess)
|
if (SetLastAccess)
|
||||||
{
|
{
|
||||||
NeedUpdate = TRUE;
|
NeedUpdate = TRUE;
|
||||||
Fcb->LastAccessTime.QuadPart = CurrentTime.QuadPart;
|
capFcb->LastAccessTime.QuadPart = CurrentTime.QuadPart;
|
||||||
FileBasicInfo.LastAccessTime.QuadPart = CurrentTime.QuadPart;
|
FileBasicInfo.LastAccessTime.QuadPart = CurrentTime.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,31 +883,31 @@ RxAdjustFileTimesAndSize(
|
||||||
if (SetLastChange)
|
if (SetLastChange)
|
||||||
{
|
{
|
||||||
NeedUpdate = TRUE;
|
NeedUpdate = TRUE;
|
||||||
Fcb->LastChangeTime.QuadPart = CurrentTime.QuadPart;
|
capFcb->LastChangeTime.QuadPart = CurrentTime.QuadPart;
|
||||||
FileBasicInfo.ChangeTime.QuadPart = CurrentTime.QuadPart;
|
FileBasicInfo.ChangeTime.QuadPart = CurrentTime.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If one of the date was modified, issue a call to mini-rdr */
|
/* If one of the date was modified, issue a call to mini-rdr */
|
||||||
if (NeedUpdate)
|
if (NeedUpdate)
|
||||||
{
|
{
|
||||||
Context->Info.FileInformationClass = FileBasicInformation;
|
RxContext->Info.FileInformationClass = FileBasicInformation;
|
||||||
Context->Info.Buffer = &FileBasicInfo;
|
RxContext->Info.Buffer = &FileBasicInfo;
|
||||||
Context->Info.Length = sizeof(FileBasicInfo);
|
RxContext->Info.Length = sizeof(FileBasicInfo);
|
||||||
|
|
||||||
MINIRDR_CALL(Status, Context, Fcb->MRxDispatch, MRxSetFileInfoAtCleanup, (Context));
|
MINIRDR_CALL(Status, RxContext, capFcb->MRxDispatch, MRxSetFileInfoAtCleanup, (RxContext));
|
||||||
(void)Status;
|
(void)Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the file was modified, update its EOF */
|
/* If the file was modified, update its EOF */
|
||||||
if (FileModified)
|
if (FileModified)
|
||||||
{
|
{
|
||||||
FileEOFInfo.EndOfFile.QuadPart = Fcb->Header.FileSize.QuadPart;
|
FileEOFInfo.EndOfFile.QuadPart = capFcb->Header.FileSize.QuadPart;
|
||||||
|
|
||||||
Context->Info.FileInformationClass = FileEndOfFileInformation;
|
RxContext->Info.FileInformationClass = FileEndOfFileInformation;
|
||||||
Context->Info.Buffer = &FileEOFInfo;
|
RxContext->Info.Buffer = &FileEOFInfo;
|
||||||
Context->Info.Length = sizeof(FileEOFInfo);
|
RxContext->Info.Length = sizeof(FileEOFInfo);
|
||||||
|
|
||||||
MINIRDR_CALL(Status, Context, Fcb->MRxDispatch, MRxSetFileInfoAtCleanup, (Context));
|
MINIRDR_CALL(Status, RxContext, capFcb->MRxDispatch, MRxSetFileInfoAtCleanup, (RxContext));
|
||||||
(void)Status;
|
(void)Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue