win: Use RegOpenKeyExW() instead of RegOpenKeyEx()

Similar to crrev.com/c/3516536, this CL fixes the Windows build
when the UNICODE preprocessor macro is not defined where
code passes Unicode string literals with L"..." to non-Unicode
APIs like RegOpenKeyEx().

This fixes the build by explicitly using RegOpenKeyExW() instead.

Change-Id: I14a827357b9cbd42452e0e5eb13a3430569559a5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3516538
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Ben Hamilton 2022-03-10 14:35:02 -07:00 committed by Crashpad LUCI CQ
parent ab43d794a6
commit 9476a76dc0

View File

@ -158,7 +158,7 @@ void SystemSnapshotWin::Initialize(ProcessReaderWin* process_reader) {
bool version_data_found = false;
int os_version_build = 0;
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
0,
KEY_QUERY_VALUE,
@ -282,7 +282,7 @@ std::string SystemSnapshotWin::CPUVendor() const {
#elif defined(ARCH_CPU_ARM64)
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
0,
KEY_QUERY_VALUE,