Paul Gofman (@gofman) commented about programs/wineboot/wineboot.c:
+{ + HKEY hkey; + LONG r; + + r = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\SQMClient", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkey, NULL ); + if (r) return; + + r = RegQueryValueExW( hkey, L"MachineId", NULL, NULL, NULL, NULL ); + if (r == ERROR_FILE_NOT_FOUND) + { + UUID uuid; + + if (UuidCreate( &uuid ) == S_OK) + { + RPC_WSTR guid_str; No need to scope each variable. In previous variant it was just one sub-scope but now it feels like too much. I'd suggest to define everything at function start. Also while we are here strictly speaking this is not guid so I'd suggest to rename to uuid_str or just str. And we can remove some unneeded nesting, like this:
```` ``` if (r == ERROR_FILE_NOT_FOUND && !UuidCreate( &uuid ) && !UuidToStringW( &uuid, &str )) { set_reg_value( hkey, L"MachineId", str ); RpcStringFreeW( &str ); } ```` The patch subject is now obsolete, should be something like "wineboot: Create SQMClient registry key". -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11055#note_142023