RegRtlCreateKeyTransacted

NTSTATUS __stdcall RegRtlCreateKeyTransacted(
        VOID *hKey,
        const WCHAR *SubKey,
        INT64 RegOptions,
        INT64 DesiredAccess,
        VOID *pSecurityDescriptor,
        INT64 InheritHandle,
        VOID **phkResult,
        UINT64 *lpRegDisposition,
        VOID *hTransaction){
  VOID *v9; 
  unsigned int v10; 
  int v11; 
  void *v13; 
  int inited; 
  UINT64 v15; 
  int v16; 
  VOID *v18; 
  UINT64 *CreateOptions; 
  UINT64 *Disposition; 
  INT64 v21; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  VOID *phkPredef; 

  v9 = 0i64;
  v10 = DesiredAccess;
  phkPredef = 0i64;
  v11 = RegOptions;
  v13 = hKey;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  DestinationString = 0i64;
  if( (char *)hKey + 0x80000000 <= (char *)7 )
  {
    inited = RegRtlOpenPredefinedKey(
               hKey,
               &phkPredef,
               RegOptions,
               DesiredAccess,
               (INT64)v18,
               (INT64)CreateOptions,
               (INT64)Disposition,
               v21);
    if( inited < 0 )
      goto LABEL_9;
    v9 = phkPredef;
  }
  inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)SubKey);
  if( inited < 0 )
    goto LABEL_10;
  ObjectAttributes.Length = 48;
  v16 = (32 * (v11 & 8 | 6)) | 2;
  if( !(_BYTE)InheritHandle )
    v16 = 32 * (v11 & 8 | 6);
  if( v9 )
    v13 = v9;
  ObjectAttributes.ObjectName = &DestinationString;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  ObjectAttributes.Attributes = v16 | 0x200;
  ObjectAttributes.SecurityDescriptor = pSecurityDescriptor;
  ObjectAttributes.RootDirectory = v13;
  if( hTransaction )
  {
    LODWORD(CreateOptions) = v11;
    inited = NtCreateKeyTransacted_Stub(phkResult, v10, &ObjectAttributes, v15, v18, CreateOptions);
    if( inited == -1073741702 )
      inited = -1072103420;
  }
  else
  {
    LODWORD(CreateOptions) = v11;
    inited = ZwCreateKey(phkResult, v10, &ObjectAttributes, 0i64, 0i64, (UINT64)CreateOptions, lpRegDisposition);
  }
LABEL_9:
  v9 = phkPredef;
LABEL_10:
  if( v9 )
    ZwClose((_HANDLE)v9);
  return inited;
}

Referenced by:

PnpCtxRegCreateKey
RegRtlCopyTreeInternal
RegRtlCreateTreeTransacted
SysCtxOpenControlSet