From: Rose Hellsing <rose@pinkro.se> On Windows the key HKLM\SOFTWARE\Microsoft\SQMClient is populated with a random UUID when SQM is first used to identify each device. In wine this is now done on wineboot initialization. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54021 --- programs/wineboot/Makefile.in | 2 +- programs/wineboot/wineboot.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/programs/wineboot/Makefile.in b/programs/wineboot/Makefile.in index d346b8984b1..2d3b4dc2bde 100644 --- a/programs/wineboot/Makefile.in +++ b/programs/wineboot/Makefile.in @@ -1,5 +1,5 @@ MODULE = wineboot.exe -IMPORTS = uuid advapi32 ws2_32 kernelbase +IMPORTS = uuid rpcrt4 advapi32 ws2_32 kernelbase DELAYIMPORTS = shell32 shlwapi version user32 gdi32 setupapi newdev wininet EXTRADLLFLAGS = -mconsole diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 6ffcbe1266c..c7744300567 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -912,6 +912,35 @@ static void create_volatile_environment_registry_key(void) RegCloseKey( hkey ); } +static void create_sqmclient_registry_key(void) +{ + 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; + WCHAR buf[37]; + + if (UuidCreate(&uuid) == S_OK) + { + swprintf(buf, ARRAY_SIZE(buf), + L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + uuid.Data1, uuid.Data2, uuid.Data3, + uuid.Data4[0], uuid.Data4[1], uuid.Data4[2], uuid.Data4[3], + uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7]); + set_reg_value(hkey, L"MachineId", buf); + } + } + RegCloseKey(hkey); +} + static const WCHAR *get_known_dll_ntdir( WORD machine ) { switch (machine) @@ -1900,6 +1929,7 @@ int __cdecl main( int argc, char *argv[] ) start_services_process(); } if (init || update) update_wineprefix( update ); + create_sqmclient_registry_key(); create_volatile_environment_registry_key(); create_known_dlls(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11055