PnpGetGenericStoreProperty

NTSTATUS __fastcall PnpGetGenericStoreProperty(
        HPNPCTX *hPnpCtx,
        VOID *BaseKeyHandle,
        WCHAR *PropertyLocaleName,
        _DEVPROPKEY *PropertyKey,
        UINT64 *PropertyType,
        UINT8 *PropertyBuffer,
        UINT64 BufferSize,
        UINT64 *PropertySize,
        UINT64 Flags){
  int v10; 
  HPNPCTX *v11; 
  int v12; 
  NTSTATUS v14; 
  NTSTATUS v15; 
  int v16; 
  UINT64 dwFlags; 
  int pszFormat; 
  char Indirected[4]; 
  UINT64 DataSize; 
  INT64 v21; 
  VOID *v22; 
  INT64 v23; 
  VOID *Data; 
  UINT64 *v25; 
  _SIZE_T pcchLength; 
  __int16 pszDest[48]; 

  v23 = (INT64)hPnpCtx;
  *(_DWORD *)PropertyType = 0;
  *(_DWORD *)PropertySize = 0;
  v22 = BaseKeyHandle;
  v25 = PropertyType;
  Data = PropertyBuffer;
  v21 = 0i64;
  DataSize = 0i64;
  Indirected[0] = 0;
  if( PropertyLocaleName )
  {
    v10 = RtlUnalignedStringCchLengthW(PropertyLocaleName, 85, &pcchLength);
    if( v10 < 0 )
      return v10;
  }
  LODWORD(dwFlags) = 2048;
  v10 = RtlStringCchPrintfExW(
          (WCHAR *)pszDest,
          0x30ui64,
          0i64,
          0i64,
          dwFlags,
          (WCHAR *)L"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\%04lX");
  if( v10 >= 0 )
  {
    v11 = (HPNPCTX *)v23;
    v12 = PnpOpenPropertiesKey(v23, v22, (wchar_t *)pszDest, 1u, 0, pszFormat, (INT64)&v21);
    v10 = v12;
    if( v12 == -1073741772 )
    {
LABEL_4:
      v10 = -1073741275;
      goto LABEL_5;
    }
    if( v12 >= 0 )
    {
      LODWORD(DataSize) = BufferSize;
      v14 = PnpCtxRegQueryValueIndirect(
              v11,
              (VOID *)v21,
              PropertyLocaleName,
              (UINT64 *)((char *)&DataSize + 4),
              Data,
              &DataSize,
              (UINT8 *)Indirected);
      v15 = v14;
      if( v14 != -1073741772 && v14 != -1073741444 )
      {
        if( !v14 || v14 == -1073741789 )
        {
          v16 = WORD2(DataSize);
          *(_DWORD *)v25 = WORD2(DataSize);
          if( v16 != 1 )
          {
            *(_DWORD *)PropertySize = DataSize;
            if( v15 || !(_DWORD)BufferSize )
              v10 = -1073741789;
          }
        }
        else
        {
          v10 = v14;
        }
        goto LABEL_5;
      }
      goto LABEL_4;
    }
  }
LABEL_5:
  if( v21 )
    ZwClose(v21);
  return v10;
}

Referenced by:

PiCreateDriverSwDeviceCallback
PiDevCfgCopyObjectProperties
PiDqPnPGetObjectProperty
PnpGetObjectPropertyWorker