From ff6fc06f796ba5c2101cd5ffb14926cae455c015 Mon Sep 17 00:00:00 2001 From: Emma Malysz Date: Mon, 9 Mar 2020 14:29:32 +0000 Subject: [PATCH] Bug 1619317, ensure we set isWow64 to the correct value after taking it off the main thread r=aklotz Differential Revision: https://phabricator.services.mozilla.com/D65127 --HG-- extra : moz-landing-system : lando --- xpcom/base/nsSystemInfo.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index f4d1bcec923e..27dee909c9f2 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -570,20 +570,20 @@ nsresult CollectProcessInfo(ProcessInfo& info) { typedef BOOL(WINAPI * LPFN_IWP2)(HANDLE, USHORT*, USHORT*); LPFN_IWP2 iwp2 = reinterpret_cast( GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process2")); - BOOL isWow64 = false; + BOOL isWow64 = FALSE; USHORT processMachine = IMAGE_FILE_MACHINE_UNKNOWN; USHORT nativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; BOOL gotWow64Value; if (iwp2) { gotWow64Value = iwp2(GetCurrentProcess(), &processMachine, &nativeMachine); if (gotWow64Value) { - info.isWow64 = (processMachine != IMAGE_FILE_MACHINE_UNKNOWN); + isWow64 = (processMachine != IMAGE_FILE_MACHINE_UNKNOWN); } } else { gotWow64Value = IsWow64Process(GetCurrentProcess(), &isWow64); // The function only indicates a WOW64 environment if it's 32-bit x86 // running on x86-64, so emulate what IsWow64Process2 would have given. - if (gotWow64Value && info.isWow64) { + if (gotWow64Value && isWow64) { processMachine = IMAGE_FILE_MACHINE_I386; nativeMachine = IMAGE_FILE_MACHINE_AMD64; } @@ -591,6 +591,7 @@ nsresult CollectProcessInfo(ProcessInfo& info) { NS_WARNING_ASSERTION(gotWow64Value, "IsWow64Process failed"); if (gotWow64Value) { // Set this always, even for the x86-on-arm64 case. + info.isWow64 = !!isWow64; // Additional information if we're running x86-on-arm64 info.isWowARM64 = (processMachine == IMAGE_FILE_MACHINE_I386 && nativeMachine == IMAGE_FILE_MACHINE_ARM64);