PopDirectedDripsQueryRegistryValues

int __fastcall PopDirectedDripsQueryRegistryValues(__int64 a1, _DWORD *a2, WCHAR a3, INT64 a4){
  VOID **v4; 
  bool v5; 
  int result; 
  UINT64 Length; 
  UINT64 *ResultLength; 
  UINT64 *ResultLengtha; 
  UINT64 *Disposition; 
  INT64 v12; 
  UINT64 v13; 
  VOID *KeyHandle; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  __int128 KeyValueInformation; 
  int v18; 

  v13 = 0i64;
  v4 = (VOID **)(a1 + 544);
  KeyHandle = (VOID *)-1i64;
  *a2 = 3;
  v5 = *(_QWORD *)(a1 + 544) == -1i64;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  v18 = 0;
  DestinationString = 0i64;
  KeyValueInformation = 0i64;
  if( !v5 )
    goto LABEL_8;
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.Length = 48;
  ObjectAttributes.ObjectName = &CmRegistryMachineSystemCurrentControlSet;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  result = ZwOpenKey(
             &KeyHandle,
             0x20019ui64,
             &ObjectAttributes,
             a4,
             Length,
             (INT64)ResultLength,
             (INT64)Disposition,
             v12);
  if( result >= 0 )
  {
    RtlInitUnicodeString(&DestinationString, L"Control\\Power");
    ObjectAttributes.RootDirectory = KeyHandle;
    ObjectAttributes.Length = 48;
    ObjectAttributes.ObjectName = &DestinationString;
    ObjectAttributes.Attributes = 576;
    LODWORD(ResultLengtha) = 0;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    result = ZwCreateKey(v4, 0x20019ui64, &ObjectAttributes, 0i64, 0i64, (UINT64)ResultLengtha, &v13);
    if( result >= 0 )
    {
LABEL_8:
      RtlInitUnicodeString(&DestinationString, L"DirectedDripsAction");
      LODWORD(Length) = 20;
      result = ZwQueryValueKey(
                 *v4,
                 &DestinationString,
                 KeyValuePartialInformation,
                 &KeyValueInformation,
                 Length,
                 (UINT64 *)((char *)&v13 + 4));
      if( result >= 0 && DWORD2(KeyValueInformation) == 4 )
      {
        result = HIDWORD(KeyValueInformation);
        *a2 = HIDWORD(KeyValueInformation);
      }
    }
  }
  if( KeyHandle != (VOID *)-1i64 )
    return ZwClose((_HANDLE)KeyHandle);
  return result;
}

Referenced by:

PopDirectedDripsQueryEnabledMitigations