PiOpenDriverRedirectedStateRootKey

__int64 __fastcall PiOpenDriverRedirectedStateRootKey(__int64 a1, _QWORD *a2, WCHAR a3){
  NTSTATUS StateRootPath; 
  INT64 v5; 
  VOID *v6; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  VOID *KeyHandle; 

  KeyHandle = 0i64;
  memset(&ObjectAttributes, 0, sizeof(ObjectAttributes));
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, 0i64);
  if( a2 )
  {
    StateRootPath = PiGetStateRootPath(L"DriverStatePath");
    if( StateRootPath >= 0 )
    {
      ObjectAttributes.ObjectName = &DestinationString;
      ObjectAttributes.Length = 48;
      ObjectAttributes.Attributes = 576;
      *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
      StateRootPath = ZwOpenKey(
                        &KeyHandle,
                        0x20019ui64,
                        &ObjectAttributes,
                        v5,
                        *(INT64 *)&DestinationString.Length,
                        (INT64)DestinationString.Buffer,
                        *(INT64 *)&ObjectAttributes.Length,
                        0i64);
      if( StateRootPath == -1073741772 )
        StateRootPath = -1073741275;
      if( StateRootPath >= 0 )
      {
        v6 = KeyHandle;
        KeyHandle = 0i64;
        *a2 = v6;
      }
    }
  }
  else
  {
    StateRootPath = -1073741811;
  }
  RtlFreeAnsiString(&DestinationString);
  if( KeyHandle )
    ZwClose((_HANDLE)KeyHandle);
  return(unsigned int)StateRootPath;
}

Referenced by:

No references.