[NTOSKRNL:CC] Fixed Probing code
This commit is contained in:
parent
2300440e3d
commit
5a5ebcae89
@ -302,6 +302,8 @@ CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,
|
|||||||
ULONG ZeroOpsFlags = {0};
|
ULONG ZeroOpsFlags = {0};
|
||||||
PVACB Vacb = nullptr;
|
PVACB Vacb = nullptr;
|
||||||
BOOL MapFlag = false;
|
BOOL MapFlag = false;
|
||||||
|
PKTHREAD currentThread = nullptr;
|
||||||
|
UCHAR SavedState ={0};
|
||||||
if ((FileObject->Flags & 0x10) == 0)
|
if ((FileObject->Flags & 0x10) == 0)
|
||||||
{
|
{
|
||||||
if (IoIsFileOriginRemote(FileObject) && !CcCanIWriteStream(FileObject, Length, 0, 0))
|
if (IoIsFileOriginRemote(FileObject) && !CcCanIWriteStream(FileObject, Length, 0, 0))
|
||||||
@ -352,14 +354,13 @@ CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,
|
|||||||
Mdl = IoAllocateMdl(VirtualAddress, ReceivedLength, FALSE, FALSE, NULL);
|
Mdl = IoAllocateMdl(VirtualAddress, ReceivedLength, FALSE, FALSE, NULL);
|
||||||
if (!Mdl)
|
if (!Mdl)
|
||||||
RtlRaiseStatus(STATUS_INSUFFICIENT_RESOURCES );
|
RtlRaiseStatus(STATUS_INSUFFICIENT_RESOURCES );
|
||||||
/*Save the current state of the UserIdealProcessor field & Then Performe Probing and locking of pages*/
|
|
||||||
PKTHREAD currentThread = KeGetCurrentThread();
|
currentThread = KeGetCurrentThread();
|
||||||
PULONG userIdealProcessorByte = (PULONG)((ULONG_PTR)currentThread + userIdealProcessorOffset);
|
SavedState = currentThread->UserIdealProcessor + 2;
|
||||||
ULONG savedState = *(userIdealProcessorByte + 1) + 2;
|
currentThread->UserIdealProcessor = 1;
|
||||||
*(userIdealProcessorByte + 1) = 1;
|
MmProbeAndLockPages(Mdl, KernelMode, IoWriteAccess);
|
||||||
MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess);
|
currentThread->UserIdealProcessor = SavedState - 2;
|
||||||
/*Restore the saved state of the UserIdealProcessor field*/
|
SavedState
|
||||||
*(userIdealProcessorByte + 1) = savedState - 2;
|
|
||||||
/* Update the Read Aheas Stats*/
|
/* Update the Read Aheas Stats*/
|
||||||
KeAcquireInStackQueuedSpinLock(&SharedCacheMap->BcbSpinLock, &LockHandle);
|
KeAcquireInStackQueuedSpinLock(&SharedCacheMap->BcbSpinLock, &LockHandle);
|
||||||
if ( ReadAhead_Length.QuadPart > SharedCacheMap->ValidDataGoal.QuadPart )
|
if ( ReadAhead_Length.QuadPart > SharedCacheMap->ValidDataGoal.QuadPart )
|
||||||
|
Loading…
Reference in New Issue
Block a user