RtlpHpMetadataCommit

NTSTATUS __fastcall RtlpHpMetadataCommit(UINT64 a1, int a2, unsigned __int64 a3, __int128 *a4, int a5){
  _QWORD *v8; 
  __int128 *v9; 
  _QWORD *v10; 
  int v11; 
  UINT64 v12; 
  __int64 v13; 
  unsigned __int64 v14; 
  int v15; 
  _RTL_RUN_ONCE *HeapManager; 
  __int64 v18; 
  __int128 v19; 

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

Referenced by:

RtlpHpHeapAllocate
RtlpHpHeapExtendContext