PiGetStateRootPath

INT64 __stdcall PiGetStateRootPath(PCWSTR SourceString){
  _WORD *v1; 
  unsigned int v2; 
  UNICODE_STRING *v3; 
  UNICODE_STRING *v4; 
  unsigned int v5; 
  _WORD *v6; 
  int PersistedStateLocation; 
  int inited; 
  int v11; 
  VOID *PoolWithTag; 
  int v13; 
  UINT64 v14; 
  UINT64 v15; 
  SIZE_T NumberOfBytes; 
  v4 = v3;
  v5 = v2;
  v6 = v1;
  if( v3 )
  {
    LODWORD(NumberOfBytes) = 0;
    LODWORD(v14) = 0;
    PersistedStateLocation = RtlGetPersistedStateLocation(
                               (WCHAR *)SourceString,
                               0i64,
                               v1,
                               v2,
                               0i64,
                               v14,
                               &NumberOfBytes);
    inited = PersistedStateLocation;
    if( PersistedStateLocation >= 0 )
    {
      return(unsigned int)-1073741823;
    }
    else if( PersistedStateLocation == -2147483643 )
    {
      v11 = NumberOfBytes;
      PoolWithTag = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x6F697050ui64);
      if( PoolWithTag )
      {
        LODWORD(v15) = v11;
        v13 = RtlGetPersistedStateLocation((WCHAR *)SourceString, 0i64, v6, v5, PoolWithTag, v15, &NumberOfBytes);
        inited = v13;
        if( v13 == -1073741772 )
        {
          inited = -1073741595;
        }
        else if( v13 >= 0 )
        {
          inited = RtlInitUnicodeStringEx(v4, (WCHAR *)PoolWithTag);
          if( inited >= 0 )
            PoolWithTag = 0i64;
        }
        if( PoolWithTag )
          ExFreePoolWithTag(PoolWithTag, 0);
      }
      else
      {
        return(unsigned int)-1073741670;
      }
    }
  }
  else
  {
    return(unsigned int)-1073741811;
  }
  return(unsigned int)inited;
}

Referenced by:

IoGetDeviceDirectory
PiCreateDriverDataDirectoryRoot
PiCreateDriverRedirectedStateKey
PiGetDriverMutableStateDirectory
PiOpenDriverRedirectedStateKey
PiOpenDriverRedirectedStateRootKey