CmpCreateControlSetOverride

INT64 __fastcall CmpCreateControlSetOverride(){
  NTSTATUS v0; 
  INT64 v1; 
  _UNICODE_STRING *Class; 
  INT64 CreateOptions; 
  UINT64 CreateOptionsa; 
  UINT64 *Disposition; 
  INT64 v7; 
  VOID *KeyHandle; 
  VOID *Handle; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  char v12; 

  *(_QWORD *)&DestinationString.Length = 0x1000000i64;
  KeyHandle = 0i64;
  DestinationString.Buffer = (wchar_t *)&v12;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  Handle = 0i64;
  v0 = RtlUnicodeStringPrintf(&DestinationString, (WCHAR *)L"\\REGISTRY\\%ws\\%ws");
  if( v0 >= 0 )
  {
    ObjectAttributes.Length = 48;
    ObjectAttributes.ObjectName = &DestinationString;
    ObjectAttributes.RootDirectory = 0i64;
    ObjectAttributes.Attributes = 576;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    v0 = ZwOpenKey(&KeyHandle, 0x20006ui64, &ObjectAttributes, v1, (INT64)Class, CreateOptions, (INT64)Disposition, v7);
    if( v0 >= 0 )
    {
      ObjectAttributes.RootDirectory = KeyHandle;
      LODWORD(CreateOptionsa) = 0;
      ObjectAttributes.ObjectName = (_UNICODE_STRING *)L"$&";
      ObjectAttributes.Length = 48;
      ObjectAttributes.Attributes = 576;
      *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
      v0 = ZwCreateKey(&Handle, 0x20006ui64, &ObjectAttributes, 0i64, 0i64, CreateOptionsa, 0i64);
      if( v0 >= 0 )
        v0 = 0;
    }
  }
  if( Handle )
    ZwClose((_HANDLE)Handle);
  if( KeyHandle )
    ZwClose((_HANDLE)KeyHandle);
  return(unsigned int)v0;
}

Referenced by:

CmpCreateExtendedControlSets