PnpGetGenericStoreProperty

__int64 __fastcall PnpGetGenericStoreProperty(
        __int64 a1,
        char *a2,
        const wchar_t *a3,
        __int64 a4,
        _DWORD *a5,
        __int64 a6,
        int a7,
        _DWORD *a8){
  int v8; 
  NTSTATUS v9; 
  __int64 v10; 
  int v11; 
  NTSTATUS ValueIndirect; 
  UINT64 dwFlags; 
  NTSTRSAFE_PCWSTR pszFormat; 
  HANDLE Handle; 
  char *v17; 
  __int64 v18; 
  __int64 v19; 
  _DWORD *v20; 
  size_t pcchLength; 
  wchar_t pszDest[48]; 
  v18 = a1;
  *a5 = 0;
  *a8 = 0;
  v17 = a2;
  v20 = a5;
  v19 = a6;
  Handle = 0i64;
  if( a3 )
  {
    v9 = RtlUnalignedStringCchLengthW(a3, 0x55ui64, &pcchLength);
    if( v9 < 0 )
      return(unsigned int)v9;
  }
  LODWORD(dwFlags) = 2048;
  RtlStringCchPrintfExW(
    pszDest,
    0x30ui64,
    0i64,
    0i64,
    dwFlags,
    L"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\%04lX");
  v9 = v8;
  if( v8 >= 0 )
  {
    v10 = v18;
    v11 = PnpOpenPropertiesKey(v18, v17, pszDest, 1u, 0, (__int64)pszFormat, &Handle);
    v9 = v11;
    if( v11 == -1073741772 )
    {
LABEL_4:
      v9 = -1073741275;
      goto LABEL_5;
    }
    if( v11 >= 0 )
    {
      ValueIndirect = PnpCtxRegQueryValueIndirect(v10, (__int64)Handle);
      if( ValueIndirect != -1073741772 && ValueIndirect != -1073741444 )
      {
        if( !ValueIndirect || ValueIndirect == -1073741789 )
        {
          *v20 = 0;
          *a8 = a7;
          if( ValueIndirect || !a7 )
            v9 = -1073741789;
        }
        else
        {
          v9 = ValueIndirect;
        }
        goto LABEL_5;
      }
      goto LABEL_4;
    }
  }
LABEL_5:
  if( Handle )
    ZwClose(Handle);
  return(unsigned int)v9;
}

Referenced by:

PiCreateDriverSwDeviceCallback
PiDevCfgCopyObjectProperties
PiDqPnPGetObjectProperty
PnpGetObjectPropertyWorker