RtlpHpMetadataCommit

INT64 __fastcall RtlpHpMetadataCommit(UINT64 a1, int a2, unsigned __int64 a3, __int128 *a4, int a5){
  __int128 *v8; 
  union _RTL_RUN_ONCE *v9; 
  int v10; 
  INT64 v11; 
  __int64 v12; 
  unsigned __int64 v13; 
  INT64 v14; 
  union _RTL_RUN_ONCE *HeapManager; 
  INT64 v17; 
  INT64 v18; 
  __int128 v19; 
  v19 = *a4;
  v9 = RtlpHpMetadataHeapCtxGet(&v19);
  if( (_WORD)a1 )
  {
    v10 = 0;
  }
  else
  {
    v19 = *v8;
    HeapManager = RtlpHpEnvGetHeapManager(&v19);
    v17 = RtlCSparseBitmapBitmaskRead((INT64)&HeapManager[2], 2 * ((a1 - HeapManager[1].Value) >> 20));
    if( v17 )
      v10 = v17 - 1;
    else
      v10 = 2;
  }
  v11 = RtlpHpSegDescriptorValidate(v9->Value + 192i64 * v10 + 256, a1);
  v13 = a3 >> 12;
  v14 = (unsigned int)-(int)v13;
  if( a5 )
    v14 = (unsigned int)v13;
  LODWORD(v18) = 0;
  return RtlpHpSegPageRangeCommit(v12 + 256, v11, (unsigned int)(a2 - a1) >> 12, v14, v18, 0i64);
}

Referenced by:

RtlpHpHeapAllocate
RtlpHpHeapExtendContext