HalpPutAcpiHacksInRegistry

NTSTATUS __stdcall HalpPutAcpiHacksInRegistry(){
  INT64 v0; 
  NTSTATUS result; 
  NTSTATUS v2; 
  VOID *Data; 
  INT64 CreateOptions; 
  UINT64 CreateOptionsa; 
  UINT64 CreateOptionsb; 
  UINT64 CreateOptionsc; 
  UINT64 CreateOptionsd; 
  UINT64 CreateOptionse; 
  UINT64 *Disposition; 
  INT64 v11; 
  __int64 v12[2]; 
  __int64 v13[2]; 
  _UNICODE_STRING ValueName; 
  _UNICODE_STRING v15; 
  _UNICODE_STRING v16; 
  _UNICODE_STRING v17; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  ULONG v19; 
  UINT64 v20; 
  VOID *Handle; 
  VOID *KeyHandle; 

  KeyHandle = 0i64;
  LODWORD(v20) = 0;
  Handle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  memset(&ObjectAttributes.Attributes + 1, 0, 20);
  ObjectAttributes.RootDirectory = 0i64;
  v12[1] = (__int64)L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\Control\\HAL";
  v13[1] = (__int64)L"CStateHacks";
  ValueName.Buffer = L"Piix4";
  v15.Buffer = L"440BX";
  v16.Buffer = L"Piix4Slot";
  v17.Buffer = L"Piix4DevActB";
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)v12;
  v12[0] = 7209068i64;
  v13[0] = 1572886i64;
  *(_QWORD *)&ValueName.Length = 786442i64;
  *(_QWORD *)&v15.Length = 786442i64;
  *(_QWORD *)&v16.Length = 1310738i64;
  *(_QWORD *)&v17.Length = 1703960i64;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 64;
  result = ZwOpenKey(
             &KeyHandle,
             0x20019ui64,
             &ObjectAttributes,
             v0,
             (INT64)Data,
             CreateOptions,
             (INT64)Disposition,
             v11);
  if( result >= 0 )
  {
    ObjectAttributes.RootDirectory = KeyHandle;
    ObjectAttributes.Length = 48;
    ObjectAttributes.ObjectName = (_UNICODE_STRING *)v13;
    ObjectAttributes.Attributes = 64;
    LODWORD(CreateOptionsa) = 1;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    v2 = ZwCreateKey(&Handle, 0x20019ui64, &ObjectAttributes, 0i64, 0i64, CreateOptionsa, &v20);
    result = ZwClose((_HANDLE)KeyHandle);
    if( v2 >= 0 )
    {
      v19 = (unsigned __int8)byte_140C49D48;
      LODWORD(CreateOptionsb) = 4;
      ZwSetValueKey(Handle, &ValueName, 0i64, 4ui64, &v19, CreateOptionsb);
      v19 = (unsigned __int8)byte_140C49D28;
      LODWORD(CreateOptionsc) = 4;
      ZwSetValueKey(Handle, &v15, 0i64, 4ui64, &v19, CreateOptionsc);
      v19 = SlotNumber | (BusNumber << 16);
      LODWORD(CreateOptionsd) = 4;
      ZwSetValueKey(Handle, &v16, 0i64, 4ui64, &v19, CreateOptionsd);
      v19 = *(_DWORD *)&dword_140C49D44;
      LODWORD(CreateOptionse) = 4;
      ZwSetValueKey(Handle, &v17, 0i64, 4ui64, &v19, CreateOptionse);
      return ZwClose((_HANDLE)Handle);
    }
  }
  return result;
}

Referenced by:

HaliInitPowerManagement