ArbAddMmConfigRangeAsBootReserved

INT64 __fastcall ArbAddMmConfigRangeAsBootReserved(_ARBITER_INSTANCE *Arbiter, _RTL_RANGE_LIST *RangeList){
  KEY_VALUE_FULL_INFORMATION *v2; 
  char *v3; 
  unsigned int v4; 
  INT64 result; 
  NTSTATUS v8; 
  int RegistryValue; 
  int v10; 
  UINT64 v11; 
  UINT8 *PoolWithTag; 
  char *i; 
  int v14; 
  int ResourceType; 
  int v16; 
  HANDLE Handle; 
  __int128 v18; 
  __int128 v19; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  KEY_VALUE_FULL_INFORMATION *Information; 
  void *KeyHandle; 
  KeyHandle = 0i64;
  Handle = 0i64;
  v2 = 0i64;
  v3 = (char *)ArbMmConfigRange;
  v4 = 0;
  Information = 0i64;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  v18 = 0i64;
  v19 = 0i64;
  if( ArbMmConfigRange )
  {
LABEL_9:
    for( i = v3 + 8; i < &v3[32 * *((unsigned int *)v3 + 1) + 8]; i += 32 )
    {
      v14 = (unsigned __int8)i[1];
      ResourceType = Arbiter->ResourceType;
      if( v14 == ResourceType || (_BYTE)v14 == 7 && ResourceType == 3 )
      {
        RtlAddRange((volatile INT64 *)RangeList);
        v4 = v16;
        if( v16 < 0 )
          break;
      }
    }
    goto LABEL_14;
  }
  ObjectAttributes.RootDirectory = 0i64;
  *((_QWORD *)&v18 + 1) = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Arbiters";
  LODWORD(v18) = 7733366;
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v18;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  LODWORD(result) = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
  if( (int)result < 0 )
    return result;
  LODWORD(v19) = 2228258;
  *((_QWORD *)&v19 + 1) = L"ReservedResources";
  ObjectAttributes.RootDirectory = KeyHandle;
  ObjectAttributes.Length = 48;
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v19;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v8 = ZwOpenKey(&Handle, 0x2001Fu, &ObjectAttributes);
  if( v8 < 0 )
  {
    ZwClose(KeyHandle);
    return(unsigned int)v8;
  }
  RegistryValue = ArbpGetRegistryValue(Handle, (WCHAR *)L"MmConfigRange", &Information);
  v2 = Information;
  v4 = RegistryValue;
  if( RegistryValue < 0 )
  {
    if( RegistryValue != -1073741670 )
      v4 = 0;
    goto LABEL_14;
  }
  if( Information->Type == 10 )
  {
    v3 = (char *)&Information[1].DataOffset + Information->DataOffset;
    v10 = *((_DWORD *)v3 + 1);
    if( v10 )
    {
      v11 = (unsigned int)(32 * v10 + 8);
      PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(NonPagedPoolNx, v11, 0x4E627241ui64);
      ArbMmConfigRange = (__int64)PoolWithTag;
      if( PoolWithTag )
        memmove(PoolWithTag, (UINT8 *)v3, (unsigned int)v11);
    }
    goto LABEL_9;
  }
  v4 = -1073741811;
LABEL_14:
  if( v2 )
    ExFreePoolWithTag(v2, 0);
  ZwClose(Handle);
  ZwClose(KeyHandle);
  return v4;
}

Referenced by:

No references.