IopCreateUmdfDirectory

INT64 __stdcall IopCreateUmdfDirectory(UINT8 *SeLocalSystemSid, INT8 *a2){
  unsigned __int8 *v2; 
  unsigned int v3; 
  CHAR *Pool_1; 
  UINT64 v5; 
  CHAR *v6; 
  int Acl; 
  UINT32 v8; 
  struct _ACL *v9; 
  ACL *v10; 
  WCHAR v11; 
  struct _UNICODE_STRING DestinationString; 
  __int128 SecurityDescriptor[2]; 
  __int64 v15; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  struct _SID_IDENTIFIER_AUTHORITY IdentifierAuthority; 
  void *DirectoryHandle; 
  *(_WORD *)&IdentifierAuthority.Value[4] = 1280;
  DirectoryHandle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  v15 = 0i64;
  *(_DWORD *)IdentifierAuthority.Value = 0;
  memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
  DestinationString = 0i64;
  v2 = (unsigned __int8 *)SeExports->SeLocalSystemSid;
  v3 = RtlLengthRequiredSid(6ui64);
  Pool_1 = IopVerifierExAllocatePool_1(PagedPool, v3);
  v6 = Pool_1;
  if( Pool_1 )
  {
    LOBYTE(v5) = 6;
    Acl = RtlInitializeSid(Pool_1, &IdentifierAuthority, v5);
    if( Acl >= 0 )
    {
      *((_DWORD *)v6 + 2) = 80;
      *((_DWORD *)v6 + 3) = -1642288911;
      *((_DWORD *)v6 + 4) = 582572993;
      *((_DWORD *)v6 + 5) = 1835434367;
      *((_DWORD *)v6 + 6) = 1344795993;
      *((_DWORD *)v6 + 7) = 749280709;
      v8 = 4 * (v2[1] + (unsigned __int8)v6[1]) + 40;
      v9 = (struct _ACL *)IopVerifierExAllocatePool_1(PagedPool, v8);
      v10 = v9;
      if( v9 )
      {
        Acl = RtlCreateAcl(v9, v8, 2u);
        if( Acl >= 0 )
        {
          Acl = RtlAddAccessAllowedAce(v10, 2u, 0x10000000u, v2);
          if( Acl >= 0 )
          {
            Acl = RtlAddAccessAllowedAce(v10, 2u, 0x10000000u, v6);
            if( Acl >= 0 )
            {
              Acl = RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64);
              if( Acl >= 0 )
              {
                Acl = RtlSetDaclSecurityDescriptor(SecurityDescriptor, 1u, v10, 0);
                if( Acl >= 0 )
                {
                  RtlInitUnicodeString(&DestinationString, L"\\UMDFCommunicationPorts", v11);
                  ObjectAttributes.RootDirectory = 0i64;
                  ObjectAttributes.SecurityQualityOfService = 0i64;
                  ObjectAttributes.ObjectName = &DestinationString;
                  ObjectAttributes.Length = 48;
                  ObjectAttributes.SecurityDescriptor = SecurityDescriptor;
                  ObjectAttributes.Attributes = 528;
                  Acl = NtCreateDirectoryObject(&DirectoryHandle, 0xF000Fui64, &ObjectAttributes);
                  if( Acl >= 0 )
                    ObCloseHandle(DirectoryHandle, 0);
                }
              }
            }
          }
        }
        ExFreePoolWithTag(v10, 0);
      }
      else
      {
        Acl = -1073741670;
      }
    }
    ExFreePoolWithTag(v6, 0);
  }
  else
  {
    return(unsigned int)-1073741670;
  }
  return(unsigned int)Acl;
}

Referenced by:

IopCreateRootDirectories