HalpRecordSecondaryGsivRange

VOID __fastcall HalpRecordSecondaryGsivRange(INT64 a1, INT64 a2, INT64 a3){
  UINT64 CreateOptions; 
  UINT64 CreateOptionsa; 
  __int64 v5[2]; 
  __int64 v6[2]; 
  struct _UNICODE_STRING ValueName; 
  UNICODE_STRING v8; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  HANDLE Handle; 
  void *KeyHandle; 
  *(&ObjectAttributes.Length + 1) = 0;
  memset(&ObjectAttributes.Attributes + 1, 0, 20);
  ObjectAttributes.RootDirectory = 0i64;
  KeyHandle = 0i64;
  Handle = 0i64;
  ValueName.Buffer = L"SecondaryGsivBase";
  v8.Buffer = L"SecondaryGsivSize";
  v5[1] = (__int64)L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\Control\\HAL";
  v6[1] = (__int64)L"SecondaryInterrupts";
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)v5;
  *(_QWORD *)&ValueName.Length = 2359330i64;
  *(_QWORD *)&v8.Length = 2359330i64;
  v5[0] = 7209068i64;
  v6[0] = 2621478i64;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  if( ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes) >= 0 )
  {
    ObjectAttributes.RootDirectory = KeyHandle;
    ObjectAttributes.Length = 48;
    ObjectAttributes.ObjectName = (_UNICODE_STRING *)v6;
    ObjectAttributes.Attributes = 576;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    if( ZwOpenKey(&Handle, 2u, &ObjectAttributes) >= 0
      || (LODWORD(CreateOptions) = 1,
          ZwCreateKey(&Handle, 2ui64, &ObjectAttributes, 0i64, 0i64, CreateOptions, 0i64) >= 0) )
    {
      LODWORD(CreateOptions) = 4;
      if( ZwSetValueKey(Handle, &ValueName, 0i64, 4ui64, &SecondaryGsivRangeStart, CreateOptions) >= 0 )
      {
        LODWORD(CreateOptionsa) = 4;
        ZwSetValueKey(Handle, &v8, 0i64, 4ui64, &SecondaryGsivRangeSize, CreateOptionsa);
      }
    }
  }
  if( Handle )
    ZwClose(Handle);
  if( KeyHandle )
    ZwClose(KeyHandle);
}

Referenced by:

HalpInitializeSecondaryInterruptServices