From 91a1f4e34b252e0531b3a341899aaf7d5423d0d7 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Nov 2016 16:40:39 +0100 Subject: [PATCH] Fixed: Compilation --HG-- branch : develop --- code/ryzom/common/src/game_share/login_registry.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/ryzom/common/src/game_share/login_registry.cpp b/code/ryzom/common/src/game_share/login_registry.cpp index 489c8b22b..7e0c68234 100644 --- a/code/ryzom/common/src/game_share/login_registry.cpp +++ b/code/ryzom/common/src/game_share/login_registry.cpp @@ -56,7 +56,12 @@ std::string CLoginRegistry::getProductInstallId() std::string id = NLMISC::toString(r); - if (RegSetValueExW(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *) utf8ToWice(id), (DWORD)(id.size())+1) == ERROR_SUCCESS) + // copy wide string to a buffer + const uint keyMaxLength = 16; + wchar_t buffer[keyMaxLength]; + wcscpy(buffer, utf8ToWide(id)); + + if (RegSetValueExW(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *) buffer, (DWORD)(wcslen(buffer)*2+2)) == ERROR_SUCCESS) { return id; }