MmHardFaultBytesRequired

UINT64 __stdcall MmHardFaultBytesRequired(FILE_OBJECT *FileObject, LARGE_INTEGER SectionOffset, UINT64 a3){
  _CONTROL_AREA **SectionObjectPointer; 
  UINT64 v4; 
  UINT8 v5; 
  _SUBSECTION *v6; 
  __int64 v7; 
  UNICODE_STRING *v8; 
  UNICODE_STRING *v9; 
  _MMPTE *Pml4eBase; 
  _MMPTE *PxeUserLimit; 
  __int64 v12; 
  UINT64 PteOffset; 
  SectionObjectPointer = (_CONTROL_AREA **)FileObject->SectionObjectPointer;
  PteOffset = 0i64;
  v4 = ((SectionOffset.LowPart & 0xFFF) + a3 + 4095) >> 12;
  v6 = MiOffsetToProtos(*SectionObjectPointer, SectionOffset.QuadPart, &PteOffset);
  v7 = *((_QWORD *)v6 + 1);
  v8 = (UNICODE_STRING *)(v7 + 8 * PteOffset);
  v9 = (UNICODE_STRING *)(v7 + 8i64 * *((unsigned int *)v6 + 11));
  if( !v4 )
    return 0i64;
  Pml4eBase = MmGetPml4eBase();
  PxeUserLimit = MmGetPxeUserLimit();
  while( 1 )
  {
    if( v8 >= v9 )
    {
      v6 = (_SUBSECTION *)*((_QWORD *)v6 + 2);
      v8 = (UNICODE_STRING *)*((_QWORD *)v6 + 1);
      v9 = (UNICODE_STRING *)((char *)v8 + 8 * *((unsigned int *)v6 + 11));
    }
    v12 = *(_QWORD *)&v8->Length;
    if( v8 >= (UNICODE_STRING *)Pml4eBase && v8 <= (UNICODE_STRING *)PxeUserLimit )
      LOWORD(v12) = MiReadPteShadow(v8, *(UNICODE_STRING **)&v8->Length, v5, &v8->Length);
    if( (v12 & 1) == 0 && ((v12 & 0x400) != 0 || (v12 & 0x800) == 0 && IS_PTE_NOT_DEMAND_ZERO(v12)) )
      break;
    v8 = (UNICODE_STRING *)((char *)v8 + 8);
    if( !--v4 )
      return 0i64;
  }
  return 1i64;
}

Referenced by:

CcFetchDataForRead