I think for the supported part (DEVPKEY_Device_InstanceId) we have detailed tests already?
The only thing I'd change is error return here:
``` - if (!SetupDiEnumDeviceInfo( set, 0, &device )) - { - SetupDiDestroyDeviceInfoList( set ); - return CR_FAILURE; - } - ret = SetupDiGetDeviceInstanceIdW( set, &device, (WCHAR *)property_buffer, *property_buffer_size / sizeof(WCHAR), - property_buffer_size ); + + ret = SetupDiGetDeviceInterfacePropertyW( set, &iface, property_key, property_type, property_buffer, + *property_buffer_size, property_buffer_size, 0 ); err = ret ? 0 : GetLastError(); SetupDiDestroyDeviceInfoList( set ); ```
GetLastError() from SetupDiGetDeviceInterfacePropertyW() looks wrong, cfgmgr has its own constants. The line itself is pre-existing but before this change failing in SetupDiGetDeviceInstanceIdW() in this place was somewhat moot point and not expected under normal condition. Now with SetupDiGetDeviceInterfacePropertyW() we will be getting all sort of different errors. I'd suggest to add a trivial test for SetupDiGetDeviceInterfacePropertyW() with nonexistent property checking error code and then fix 'err =' in a way it returns CR_NO_SUCH_VALUE (probably, depending on the test) and CR_FAILURE for all the other errors.