RegRtlCreateKeyTransacted

__int64 __fastcall RegRtlCreateKeyTransacted(
        __int64 a1,
        const WCHAR *a2,
        ULONG a3,
        ACCESS_MASK a4,
        void *a5,
        char a6,
        PHANDLE KeyHandle,
        PULONG Disposition,
        __int64 a9){
  void *v9; 
  void *v13; 
  int inited; 
  UINT64 v15; 
  ULONG v16; 
  void *v18; 
  UINT64 *CreateOptions; 
  struct _UNICODE_STRING DestinationString; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  void *v22; 
  v9 = 0i64;
  v22 = 0i64;
  v13 = (void *)a1;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  DestinationString = 0i64;
  if( (unsigned __int64)(a1 - 0x80000000i64) <= 7 )
  {
    inited = RegRtlOpenPredefinedKey(a1, &v22);
    if( inited < 0 )
      goto LABEL_9;
    v9 = v22;
  }
  inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)a2);
  if( inited < 0 )
    goto LABEL_10;
  ObjectAttributes.Length = 48;
  v16 = (32 * (a3 & 8 | 6)) | 2;
  if( !a6 )
    v16 = 32 * (a3 & 8 | 6);
  if( v9 )
    v13 = v9;
  ObjectAttributes.ObjectName = &DestinationString;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  ObjectAttributes.Attributes = v16 | 0x200;
  ObjectAttributes.SecurityDescriptor = a5;
  ObjectAttributes.RootDirectory = v13;
  if( a9 )
  {
    LODWORD(CreateOptions) = a3;
    inited = NtCreateKeyTransacted_Stub(KeyHandle, a4, &ObjectAttributes, v15, v18, CreateOptions);
    if( inited == -1073741702 )
      inited = -1072103420;
  }
  else
  {
    LODWORD(CreateOptions) = a3;
    inited = ZwCreateKey(KeyHandle, a4, &ObjectAttributes, 0i64, 0i64, (UINT64)CreateOptions, (UINT64 *)Disposition);
  }
LABEL_9:
  v9 = v22;
LABEL_10:
  if( v9 )
    ZwClose(v9);
  return(unsigned int)inited;
}

Referenced by:

PnpCtxRegCreateKey
RegRtlCopyTreeInternal
RegRtlCreateTreeTransacted
SysCtxOpenControlSet