FIX: fix studio not launch issue on windows-7

jira: no-jira
Change-Id: I531e009c0547d3a5d86d48e990d930eb8fa6ba00
This commit is contained in:
lane.wei 2025-04-16 14:50:18 +08:00 committed by Lane.Wei
parent 7d2fb185d5
commit 3d02f03ef4
1 changed files with 21 additions and 13 deletions

View File

@ -2770,23 +2770,31 @@ bool GUI_App::on_init_inner()
BOOST_LOG_TRIVIAL(info) << boost::format("gui mode, Current BambuStudio Version %1%")%SLIC3R_VERSION;
BOOST_LOG_TRIVIAL(info) << get_system_info();
#if defined(__WINDOWS__)
HMODULE hKernel32 = GetModuleHandleW(L"kernel32.dll");
m_is_arm64 = false;
if (hKernel32) {
auto fnIsWow64Process2 = (decltype(&IsWow64Process2))GetProcAddress(hKernel32, "IsWow64Process2");
if (fnIsWow64Process2) {
USHORT processMachine = 0;
USHORT nativeMachine = 0;
if (IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine)) {
switch (nativeMachine) {
case IMAGE_FILE_MACHINE_ARM64:
if (nativeMachine == IMAGE_FILE_MACHINE_ARM64) {
m_is_arm64 = true;
break;
case IMAGE_FILE_MACHINE_AMD64:
default:
m_is_arm64 = false;
break;
}
BOOST_LOG_TRIVIAL(info) << boost::format("processMachine architecture %1%, nativeMachine %2% m_is_arm64 %3%")%(int)(processMachine) %(int) nativeMachine %m_is_arm64;
}
else {
BOOST_LOG_TRIVIAL(info) << boost::format("IsWow64Process2 failed, m_is_arm64 %1%") %m_is_arm64;
BOOST_LOG_TRIVIAL(info) << boost::format("IsWow64Process2 failed, set m_is_arm64 to %1%") %m_is_arm64;
}
}
else {
BOOST_LOG_TRIVIAL(info) << boost::format("can not find IsWow64Process2, set m_is_arm64 to %1%") %m_is_arm64;
}
}
else {
BOOST_LOG_TRIVIAL(info) << boost::format("can not find kernel32, set m_is_arm64 to %1%") %m_is_arm64;
}
#endif
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.