MmFlushSection
VOID __fastcall MmFlushSection(
_SECTION_OBJECT_POINTERS *SectionObjectPointer,
_LARGE_INTEGER *Offset,
UINT64 RegionSize,
_KEVENT *CallersEvent,
_IO_STATUS_BLOCK *IoStatus,
UINT64 Flags){
UINT64 v6;
LONGLONG QuadPart;
_IO_STATUS_BLOCK *v8;
_ETHREAD *CurrentThread;
_CONTROL_AREA *v10;
unsigned int v11;
_SUBSECTION *v12;
__int64 *v13;
int v14;
unsigned int v15;
_FILE_OBJECT *v16;
_FILE_OBJECT *v17;
unsigned int v18;
_CONTROL_AREA *ControlArea[2];
_SUBSECTION *Subsection[2];
_SUBSECTION *LastSubsection[2];
_ETHREAD *v22;
LONGLONG v24;
v24 = 0i64;
v6 = RegionSize;
*(_OWORD *)ControlArea = 0i64;
*(_OWORD *)Subsection = 0i64;
*(_OWORD *)LastSubsection = 0i64;
if( Offset )
{
QuadPart = Offset->QuadPart;
Offset = (_LARGE_INTEGER *)&v24;
v24 = QuadPart;
}
v8 = IoStatus;
IoStatus->Status = 0;
v8->Information = RegionSize;
if( (unsigned int)MiComputeFlushRange(
SectionObjectPointer,
(unsigned __int64 *)&Offset->QuadPart,
RegionSize,
0,
(__int64)ControlArea) )
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
v10 = ControlArea[0];
v22 = CurrentThread;
LOBYTE(v24) = *((_BYTE *)CurrentThread + 1308);
v11 = Flags;
*((_BYTE *)CurrentThread + 1308) = 1;
if( (v11 & 1) != 0 )
{
v15 = 0;
v16 = MiReferenceControlAreaFile(v10);
v12 = LastSubsection[0];
v17 = v16;
v13 = (__int64 *)Subsection[1];
v18 = Flags;
do
{
v14 = FsRtlAcquireFileForCcFlushEx(v17);
if( v14 < 0 )
break;
v14 = MiFlushSectionInternal(
(ULONG_PTR)ControlArea[1],
(__int64)Subsection[0],
v13,
(__int64)v12,
0i64,
v18,
(__int64)v8);
FsRtlReleaseFileForCcFlush(v17);
if( v14 != -1073741740 )
break;
++v15;
KeDelayExecutionThread(0, 0, (PLARGE_INTEGER)&MiShortTime);
}
while( v15 < 5 );
v10 = ControlArea[0];
MiDereferenceControlAreaFile((__int64)ControlArea[0], (unsigned __int64)v17);
CurrentThread = v22;
v6 = RegionSize;
}
else
{
v12 = LastSubsection[0];
v13 = (__int64 *)Subsection[1];
v14 = MiFlushSectionInternal(
(ULONG_PTR)ControlArea[1],
(__int64)Subsection[0],
(__int64 *)Subsection[1],
(__int64)LastSubsection[0],
0i64,
v11,
(__int64)v8);
}
if( v14 < 0 || v8->Information )
v8->Information += (unsigned int)(LODWORD(LastSubsection[1]) << 12);
else
v8->Information = v6;
*((_BYTE *)CurrentThread + 1308) = v24;
MiFlushRelease(v10, (_SUBSECTION *)v13, v12);
}
}Referenced by:
CcFlushCachePriv
CcMdlWriteComplete2
CcPurgeAndClearCacheSection
CcSetFileSizesEx
CcUnpinRepinnedBcb
MiFlushDataSection