Connor McAdams (@cmcadams) commented about dlls/setupapi/devinst.c:
+ DWORD reg_prop = prop_key->pid - 2, size, type; + + if (prop_key->pid < 2 || reg_prop >= ARRAY_SIZE(PropertyMap)) + return get_device_reg_property( device->key, prop_key, prop_type, buf, buf_size, req_size, flags ); + + ret = ERROR_SUCCESS; + switch (reg_prop) + { + /* DEVPROP_TYPE_STRING */ + case SPDRP_DEVICEDESC: + case SPDRP_SERVICE: + case SPDRP_CLASS: + case SPDRP_DRIVER: + case SPDRP_MFG: + case SPDRP_LOCATION_INFORMATION: + case SPDRP_PHYSICAL_DEVICE_OBJECT_NAME: Rather than have a big switch statement here, would it be feasible to add a `DEVPROPTYPE` member to `struct PropertyMapEntry` and then define it in `PropertyMap`? Then you could default to something like
type = PropertyMap[reg_prop].prop_type;
if (!SetupDiGetDeviceRegistryPropertyW( devinfo, device_data, reg_prop, NULL, buf, buf_size, &size ))
ret = GetLastError();
and only require special casing for the `DEVPROP_TYPE_GUID` type. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8515#note_109486