Elizabeth Figura (@zfigura) commented about dlls/setupapi/devinst.c:
DWORD len, j;
GUID prop_guid;
len = 39;
ls = RegEnumKeyExW( hkey, i, guid_str, &len, NULL, NULL, NULL, NULL );
if (ls)
{
if (ls == ERROR_NO_MORE_ITEMS)
ls = ERROR_SUCCESS;
else
ERR( "Could not enumerate subkeys for device %s: %lu\n",
debugstr_w( device->instanceId ), ls );
break;
}
swprintf( key_name, ARRAY_SIZE( key_name ), L"Properties\\%s", guid_str );
ls = RegOpenKeyExW( device->key, key_name, 0, KEY_ENUMERATE_SUB_KEYS, &propkey );
You already have the Properties key open here; you can skip concatenating the strings and instead just use "hkey" as a parent.