PiGetStateRootPath

NTSTATUS __stdcall PiGetStateRootPath(PCWSTR SourceString){
  _WORD *v1; 
  unsigned int v2; 
  _UNICODE_STRING *v3; 
  _UNICODE_STRING *v4; 
  unsigned int v5; 
  _WORD *v6; 
  NTSTATUS PersistedStateLocation; 
  int inited; 
  int v11; 
  VOID **a5; 
  NTSTATUS v13; 
  INT64 a6; 
  INT64 a6a; 
  UINT64 NumberOfBytes; 

  v4 = v3;
  v5 = v2;
  v6 = v1;
  if( !v3 )
    return -1073741811;
  LODWORD(NumberOfBytes) = 0;
  LODWORD(a6) = 0;
  PersistedStateLocation = RtlGetPersistedStateLocation(
                             (WCHAR *)SourceString,
                             0i64,
                             v1,
                             v2,
                             0i64,
                             a6,
                             (INT64)&NumberOfBytes);
  inited = PersistedStateLocation;
  if( PersistedStateLocation >= 0 )
    return -1073741823;
  if( PersistedStateLocation == -2147483643 )
  {
    v11 = NumberOfBytes;
    a5 = ExAllocatePoolWithTag(1ui64, (unsigned int)NumberOfBytes, 1869181008i64);
    if( a5 )
    {
      LODWORD(a6a) = v11;
      v13 = RtlGetPersistedStateLocation((WCHAR *)SourceString, 0i64, v6, v5, a5, a6a, (INT64)&NumberOfBytes);
      inited = v13;
      if( v13 == -1073741772 )
      {
        inited = -1073741595;
      }
      else if( v13 >= 0 )
      {
        inited = RtlInitUnicodeStringEx(v4, (WCHAR *)a5);
        if( inited >= 0 )
          a5 = 0i64;
      }
      if( a5 )
        ExFreePoolWithTag(a5, 0);
    }
    else
    {
      return -1073741670;
    }
  }
  return inited;
}

Referenced by:

IoGetDeviceDirectory
PiCreateDriverDataDirectoryRoot
PiCreateDriverRedirectedStateKey
PiGetDriverMutableStateDirectory
PiOpenDriverRedirectedStateKey
PiOpenDriverRedirectedStateRootKey