KiInitializeReservedCpuSets

INT64 __stdcall KiInitializeReservedCpuSets(){
  INT64 result; 
  unsigned int v1; 
  int i; 
  ULONG ResultLength; 
  void *KeyHandle; 
  __int64 v5[2]; 
  struct _UNICODE_STRING ValueName; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  char KeyValueInformation[4]; 
  int v9; 
  unsigned int v10; 
  UINT64 Src[20]; 
  memset((INT64)KeyValueInformation, 0i64);
  *(&ObjectAttributes.Length + 1) = 0;
  memset(&ObjectAttributes.Attributes + 1, 0, 20);
  ResultLength = 0;
  KeyHandle = 0i64;
  v5[1] = (__int64)L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\kernel";
  ValueName.Buffer = L"ReservedCpuSets";
  v5[0] = 9699474i64;
  *(_QWORD *)&ValueName.Length = 2097182i64;
  memset((INT64)&KiReservedCpuSets, 0i64);
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)v5;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  LODWORD(result) = ZwOpenKey(&KeyHandle, 1u, &ObjectAttributes);
  if( (int)result >= 0 )
  {
    LODWORD(result) = ZwQueryValueKey(
                        KeyHandle,
                        &ValueName,
                        KeyValuePartialInformation,
                        KeyValueInformation,
                        0xB0u,
                        &ResultLength);
    if( (int)result >= 0 && v9 == 3 && (v10 & 7) == 0 )
    {
      LODWORD(result) = KiValidateCpuSetMasks(Src, v10 >> 3);
      if( (int)result >= 0 )
      {
        if( v1 >= 0x14 )
          v1 = 20;
        if( v1 )
          memmove((UINT8 *)&KiReservedCpuSets, (UINT8 *)Src, 8i64 * v1);
        for( i = 0; i < 2; ++i )
          LODWORD(result) = KeSetSystemAllowedCpuSets(0i64, 0i64);
      }
    }
  }
  if( KeyHandle )
    LODWORD(result) = ZwClose(KeyHandle);
  return result;
}

Referenced by:

KeInitSystem
Phase1InitializationIoReady