RtlpHpRegisterEnvironment

NTSTATUS __stdcall RtlpHpRegisterEnvironment(INT128 *a1){
  __int128 v1; 
  NTSTATUS v2; 
  _RTL_RUN_ONCE *HeapManager; 
  int v5; 
  UINT64 v6; 
  NTSTATUS v7; 
  __int128 v9; 
  __int128 v10; 
  INT64 v11; 
  int v12; 
  int v13; 
  __int64 v14; 

  v1 = *(_OWORD *)a1;
  v2 = 0;
  v13 = 0;
  v9 = v1;
  if( BYTE3(v1) )
    LODWORD(v11) = BYTE3(v1) - 1;
  else
    LODWORD(v11) = -1;
  HIDWORD(v11) = BYTE1(v1);
  v12 = BYTE2(v1);
  if( (v1 & 8) != 0 )
    v13 = 1;
  v14 = *((_QWORD *)&v1 + 1);
  v10 = v1;
  HeapManager = RtlpHpEnvGetHeapManager(&v10);
  if( v5 )
  {
    v6 = 0x200000i64;
    if( BYTE1(v1) == 3 )
      v6 = 0x40000000i64;
    v7 = RtlpHpVaMgrCtxAllocatorReference((INT64)&HeapManager[11], (INT64)&v11, v6);
    if( v7 == -1 )
    {
      return -1073741670;
    }
    else
    {
      BYTE3(v9) = v7 + 1;
      *(_OWORD *)a1 = v9;
    }
  }
  else
  {
    RtlpHpVaMgrCtxAllocatorDereference((INT64)&HeapManager[11], (UINT64 *)&v11);
  }
  return v2;
}

Referenced by:

RtlpHpHeapCreate
RtlpHpHeapDestroy