MmEnoughMemoryForWrite

UINT8 __stdcall MmEnoughMemoryForWrite(_SECTION_OBJECT_POINTERS *SectionObjectPointer){
  __int64 v1; 
  bool v2; 
  KIRQL v3; 
  __int64 v4; 
  ULONG_PTR *v5; 
  KIRQL v7; 
  v1 = 0i64;
  v2 = 0;
  v3 = 17;
  v7 = 17;
  if( SectionObjectPointer )
  {
    v4 = MiLockSectionControlArea(SectionObjectPointer, 1, &v7);
    v1 = v4;
    if( !v4 )
      return 1;
    v3 = v7;
    v5 = *(ULONG_PTR **)(qword_140C4E388 + 8i64 * (*(_WORD *)(v4 + 60) & 0x3FF));
  }
  else
  {
    v5 = &MiSystemPartition;
  }
  if( (unsigned int)MiSufficientAvailablePages((INT64)v5, (_BYTE)dword_140CFA19C != 0 ? 0x4000i64 : 450i64) )
  {
    v2 = 1;
  }
  else if( v5[936] < v5[950] + 800 )
  {
    v2 = (unsigned int)MiSufficientAvailablePages((INT64)v5, 0x50ui64) != 0;
  }
  if( v3 != 17 )
  {
    ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v1 + 72));
    __writecr8(v3);
  }
  return v2;
}

Referenced by:

CcCanIWriteStreamEx