On Mon Jun 16 11:45:58 2025 +0000, Vibhav Pant wrote:
From my current understanding of `Windows.Devices.Enumeration`, I plan to use it in two ways:
- The `DeviceInformation` interface allows accessing a device node's
properties with `get_Properties`, which returns an `IMap<HSTRING, IInspectable *>` object. The string keys are the property IDs, as opposed to `DEVPROPKEY` types that you'd see in Win32 device enumeration. Once we have a list of device properties (either from `SetupDiGetDevicePropertyKeys` or `DevGetObjectProperties`), the idea is to use `IPropertySystem::GetPropertyDescription` or `PSGetNameFromPropertyKey` to get the canonical name associated with the PROPKEY value.
- While parsing AQS filter strings, we need a way to do the reverse,
i.e, go from canonical names to a `DEVPROPKEY` value. For that, `PSGetPropertyKeyFromName` exists. The WinRT docs for `Windows.Devices.Enumeration` also does suggest that these names are from `propsys` [here](https://learn.microsoft.com/en-us/uwp/api/windows.devices.enumeration.device...):
System.Devices.Aep.ProtocolId is the protocol's name in propsys; and
DEVPKEY_Aep_ProtocolId is the Win32 DEVPKEY.
Then let's limit this only to changes you're going to need. So PSGetPropertyKeyFromName and PSGetNameFromPropertyKey, and maybe GetPropertyDescription() if you really need it.
If you're not sure if propsys is enough for your case, you can always prototype on Windows using setupapi directly + those propsys functions, and see if results are the same as what you get from Devices.Enumeration.