Connor McAdams (@cmcadams) commented about dlls/setupapi/devinst.c:
+ *prop_type = DEVPROP_TYPE_STRING_LIST; + if (req_size) + *req_size = size; + } + } + else if (IsEqualDevPropKey( *prop_key, DEVPKEY_Device_ContainerId )) + { + WCHAR id_str[39]; + if (!SetupDiGetDeviceRegistryPropertyW( devinfo, device_data, SPDRP_BASE_CONTAINERID, NULL, (BYTE *)id_str, + sizeof(id_str), NULL )) + return GetLastError() == ERROR_INVALID_DATA ? ERROR_NOT_FOUND : GetLastError(); + *prop_type = DEVPROP_TYPE_GUID; + if (buf_size >= sizeof( GUID )) + { + GUID guid = {0}; + id_str[37] = 0; Is it ever possible for this function to return an empty string, or a string not representing a GUID? Elsewhere in setupapi it seems there are checks to ensure the correct characters are there, i.e:
if (szKeyName[0] == '{' && szKeyName[37] == '}')
If it's something that is only ever handled by us I guess we could do an assert to make sure it never gets messed up. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8515#note_109129