From ab43d794a6812609803a0bf30838e72cce8b85c4 Mon Sep 17 00:00:00 2001 From: Ben Hamilton Date: Thu, 10 Mar 2022 13:27:13 -0700 Subject: [PATCH] win: Use `RegQueryValueExW()` instead of `RegQueryValueEx()` crrev.com/c/3434090 introduced a change that breaks the Windows build when the `UNICODE` preprocessor macro is not defined, as it passed a `wchar_t*` to `RegQueryValueEx()`. This fixes the build by explicitly using `RegQueryValueExW()` instead. Change-Id: Ic438bd982fdeffba05b4224051242b45e797ebd8 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3516536 Reviewed-by: Joshua Peraza Reviewed-by: Mark Mentovai Commit-Queue: Mark Mentovai --- snapshot/win/system_snapshot_win.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snapshot/win/system_snapshot_win.cc b/snapshot/win/system_snapshot_win.cc index ba1c1e75..6fc69458 100644 --- a/snapshot/win/system_snapshot_win.cc +++ b/snapshot/win/system_snapshot_win.cc @@ -76,12 +76,12 @@ bool ReadRegistryDWORD(HKEY key, const wchar_t* name, int* out_value) { DWORD type; DWORD local_value; DWORD size = sizeof(local_value); - if (RegQueryValueEx(key, - name, - nullptr, - &type, - reinterpret_cast(&local_value), - &size) == ERROR_SUCCESS && + if (RegQueryValueExW(key, + name, + nullptr, + &type, + reinterpret_cast(&local_value), + &size) == ERROR_SUCCESS && type == REG_DWORD) { *out_value = static_cast(local_value); return true;