Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: app.runningUnderARM64Translation() always returning true on Windows ARM64 #39930

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 2 additions & 16 deletions shell/browser/api/electron_api_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "base/path_service.h"
#include "base/system/sys_info.h"
#include "base/values.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/common/chrome_features.h"
Expand Down Expand Up @@ -1519,23 +1520,8 @@ void App::SetUserAgentFallback(const std::string& user_agent) {
}

#if BUILDFLAG(IS_WIN)

bool App::IsRunningUnderARM64Translation() const {
USHORT processMachine = 0;
USHORT nativeMachine = 0;

auto IsWow64Process2 = reinterpret_cast<decltype(&::IsWow64Process2)>(
GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process2"));

if (IsWow64Process2 == nullptr) {
return false;
}

if (!IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine)) {
return false;
}

return nativeMachine == IMAGE_FILE_MACHINE_ARM64;
return base::win::OSInfo::IsRunningEmulatedOnArm64();
}
#endif

Expand Down