HvpBuildMapForMemoryBackedHive

INT64 __stdcall HvpBuildMapForMemoryBackedHive(PVOID BugCheckParameter2){
  INT64 v1; 
  unsigned int v2; 
  INT64 v3; 
  unsigned int v4; 
  char v6; 
  unsigned int inited; 
  unsigned int v8; 
  unsigned int v9; 
  _HBIN *v10; 
  INT8 v11; 
  char v12; 
  int v13; 
  INT64 v15; 
  INT64 v16; 
  INT64 v17; 
  v17 = v1;
  v3 = *((_QWORD *)BugCheckParameter2 + 7);
  v4 = v2;
  v6 = 0;
  inited = HvpInitMap((INT64)BugCheckParameter2, v1);
  if( (inited & 0x80000000) != 0 )
    return inited;
  v8 = 0;
  v9 = *(_DWORD *)(*((_QWORD *)BugCheckParameter2 + 8) + 40i64);
  if( !v9 )
    return 0;
  inited = 1073741833;
  do
  {
    v10 = (_HBIN *)(v17 + v8);
    if( !(unsigned __int8)HvpValidateLoadedBin(v10, v8, v9) )
    {
      if( (v4 & 0x20000) != 0 || !BYTE3(NlsMbCodePageTag) && (CmpBootType & 6) == 0 )
      {
        LODWORD(v16) = 0;
        v15 = 3221225804i64;
        inited = -1073741492;
        goto LABEL_20;
      }
      LODWORD(v16) = 0;
      v10->Signature = 1852400232;
      v10->FileOffset = v8;
      v10->Size = 4096;
      v6 = 1;
      *(_DWORD *)(*((_QWORD *)BugCheckParameter2 + 8) + 4088i64) |= 4u;
      SetFailureLocation(v3, 1i64, 4i64, 1073741833i64, v16);
    }
    CmpClaimGlobalQuota(v10->Size, v11);
    if( !v12 )
    {
      inited = -1073741670;
      LODWORD(v16) = 16;
      v15 = 3221225626i64;
LABEL_20:
      SetFailureLocation(v3, 0i64, 4i64, v15, v16);
      *(_DWORD *)(v3 + 296) = v9;
      *(_DWORD *)(v3 + 300) = v8;
      goto LABEL_22;
    }
    HvpPointMapEntriesToBuffer((UINT64)BugCheckParameter2, (INT64)v10, v10->Size, v8, 0, 0i64);
    if( (*((_BYTE *)BugCheckParameter2 + 140) & 2) != 0 )
      goto LABEL_9;
    v13 = HvpEnlistFreeCells((INT64)BugCheckParameter2, (INT64)v10, v8, v4);
    if( v13 != 1073741833 )
    {
      if( v13 >= 0 )
        goto LABEL_9;
      LODWORD(v16) = 32;
      inited = -1073741492;
      SetFailureLocation(v3, 0i64, 4i64, 3221225804i64, v16);
      *(_DWORD *)(v3 + 296) = v10->Size;
      *(_DWORD *)(v3 + 300) = v10->FileOffset;
LABEL_22:
      *(_QWORD *)(v3 + 304) = v10;
      return inited;
    }
    v6 = 1;
LABEL_9:
    v8 += v10->Size;
  }
  while( v8 < v9 );
  if( v6 )
    return inited;
  return 0;
}

Referenced by:

HvHiveStartMemoryBacked