Commit dc54224944 for openssl.org
commit dc5422494490d5ac9385384ec2078d0f43504e1d
Author: Dmitry Misharov <dmitry@openssl.org>
Date: Thu Aug 27 11:05:54 2026 +0200
Fix the VS2013 build of crypto/defaults.c
TEXT(REGISTRY_KEY) widens only the first literal of the concatenation and
leaves the rest narrow, which MSVC 12.0 rejects with C2308. Open the key
with RegOpenKeyExA instead; the value is still read wide.
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Aug 28 16:18:05 2026
(Merged from https://github.com/openssl/openssl/pull/32537)
diff --git a/crypto/defaults.c b/crypto/defaults.c
index b98d5eaabc..d096d00c03 100644
--- a/crypto/defaults.c
+++ b/crypto/defaults.c
@@ -61,8 +61,12 @@ static char *get_windows_regdirs(char *dst, DWORD dstsizebytes, LPCWSTR valuenam
DWORD index = 0;
LPCWSTR tempstr = NULL;
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- TEXT(REGISTRY_KEY), KEY_WOW64_32KEY,
+ /*
+ * Narrow call: TEXT(REGISTRY_KEY) would widen only the first literal of the
+ * concatenation, which MSVC 12.0 rejects. The subkey path is ASCII.
+ */
+ ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
+ REGISTRY_KEY, KEY_WOW64_32KEY,
KEY_QUERY_VALUE, &hkey);
if (ret != ERROR_SUCCESS)
goto out;