PnpGetObjectPropertyKeysWorker

NTSTATUS __stdcall PnpGetObjectPropertyKeysWorker(
        HPNPCTX *hPnpCtx,
        WCHAR *ObjectName,
        PNP_OBJECT_TYPE ObjectType,
        VOID *ObjectBaseKey,
        WCHAR *PropertyLocaleName,
        UINT8 IncludeAllLocales,
        _DEVPROPKEY *PropertyKeys,
        UINT64 BufferLength,
        UINT64 *PropertyCount,
        UINT64 Flags){
  NTSTATUS MappedPropertyKeysDispatch; 
  _DEVPROPKEY *v15; 
  int v16; 
  VOID *v17; 
  unsigned int v18; 
  INT64 v20; 
  INT64 v21; 
  VOID *Handle; 

  Handle = 0i64;
  v21 = 0i64;
  if( (_WORD)Flags )
    return -1073741811;
  *(_DWORD *)PropertyCount = 0;
  if( ObjectBaseKey
    || (MappedPropertyKeysDispatch = PnpOpenObjectRegKey(
                                       (__int64)hPnpCtx,
                                       (__int64)ObjectName,
                                       ObjectType,
                                       33554433,
                                       0,
                                       (__int64)&Handle),
        MappedPropertyKeysDispatch >= 0) )
  {
    LODWORD(v20) = BufferLength;
    MappedPropertyKeysDispatch = PnpGetMappedPropertyKeysDispatch(
                                   hPnpCtx,
                                   ObjectName,
                                   ObjectType,
                                   ObjectBaseKey,
                                   PropertyLocaleName,
                                   IncludeAllLocales,
                                   PropertyKeys,
                                   v20,
                                   (UINT64 *)&v21);
    if( (unsigned int)(MappedPropertyKeysDispatch + 1073741790) <= 1 || !MappedPropertyKeysDispatch )
    {
      if( (unsigned int)v21 >= (unsigned int)BufferLength )
      {
        v15 = 0i64;
        v16 = 0;
      }
      else
      {
        v15 = &PropertyKeys[(unsigned int)v21];
        v16 = BufferLength - v21;
      }
      v17 = Handle;
      if( ObjectBaseKey )
        v17 = ObjectBaseKey;
      MappedPropertyKeysDispatch = PnpGetGenericStorePropertyKeys(
                                     (__int64)hPnpCtx,
                                     v17,
                                     PropertyLocaleName,
                                     IncludeAllLocales,
                                     (__int64)v15,
                                     v16,
                                     (__int64)&v21 + 4);
      if( (unsigned int)(MappedPropertyKeysDispatch + 1073741790) <= 1 || !MappedPropertyKeysDispatch )
      {
        v18 = v21 + HIDWORD(v21);
        *(_DWORD *)PropertyCount = v21 + HIDWORD(v21);
        MappedPropertyKeysDispatch = (unsigned int)BufferLength < v18 ? 0xC0000023 : 0;
      }
    }
  }
  if( Handle )
    ZwClose((_HANDLE)Handle);
  return MappedPropertyKeysDispatch;
}

Referenced by:

PnpGetObjectPropertyKeys