VirtualBox

Changeset 107100 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 22, 2024 2:22:42 AM (2 months ago)
Author:
vboxsync
Message:

FE/Qt,VBoxManage,VBoxHeadless: Refuse to run in WoW64 to prevent mixing up amd64 and arm64 builds in the out directory. jiraref:VBP-1466

Location:
trunk/src/VBox/Frontends
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r106061 r107100  
    4343#include <VBox/log.h>
    4444#include <VBox/version.h>
     45#include <iprt/arch.h>
    4546#include <iprt/buildconfig.h>
    4647#include <iprt/ctype.h>
     
    5556#include <iprt/errcore.h>
    5657#include <iprt/thread.h>
     58#include <iprt/system.h>
    5759#include <VBoxVideo.h>
    5860
     
    11521154    }
    11531155
     1156    /* Before we try to initialize COM, make sure we're not running inside
     1157       an emulator (these days, running amd64 code in an emulator on arm64). */
     1158    uint32_t const uNativeArch = RTSystemGetNativeArch();
     1159    if (uNativeArch != RT_ARCH_VAL && uNativeArch != 0)
     1160    {
     1161        RTMsgError("Binary (%s) doesn't match the host CPU (%s)!",
     1162                   RTArchValToString(RT_ARCH_VAL), RTArchValToString(uNativeArch));
     1163        return RTEXITCODE_FAILURE;
     1164    }
     1165
    11541166    HRESULT hrc;
    11551167    int vrc;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r106061 r107100  
    4747#include <VBox/version.h>
    4848
     49#include <iprt/arch.h>
    4950#include <iprt/asm.h>
    5051#include <iprt/buildconfig.h>
     
    5758#include <iprt/stream.h>
    5859#include <iprt/string.h>
     60#include <iprt/system.h>
    5961
    6062#include <signal.h>
     
    787789    {
    788790        /*
     791         * Before we try to initialize COM, make sure we're not running inside
     792         * an emulator (these days, running amd64 code in an emulator on arm64).
     793         */
     794        uint32_t const uNativeArch = RTSystemGetNativeArch();
     795        if (uNativeArch != RT_ARCH_VAL && uNativeArch != 0)
     796        {
     797            RTMsgError("Binary (%s) doesn't match the host CPU (%s)!",
     798                       RTArchValToString(RT_ARCH_VAL), RTArchValToString(uNativeArch));
     799            return RTEXITCODE_FAILURE;
     800        }
     801
     802        /*
    789803         * Initialize COM.
    790804         */
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r106350 r107100  
    4949
    5050/* Other VBox includes: */
     51#include <iprt/arch.h>
    5152#include <iprt/buildconfig.h>
    5253#include <iprt/stream.h>
     54#include <iprt/system.h>
    5355#include <VBox/err.h>
    5456#include <VBox/version.h>
     
    554556#endif /* VBOX_WS_NIX */
    555557
     558        /* Make sure we're not running inside an emulator (these days,
     559         * running amd64 code in an emulator on arm64). */
     560        uint32_t const uNativeArch = RTSystemGetNativeArch();
     561        if (uNativeArch != RT_ARCH_VAL && uNativeArch != 0)
     562        {
     563            QString strMsg = QApplication::tr("This VirtualBox application was built for a different CPU architecture (<b>%1</b>) than the host (<b>%2</b>). Please reinstall.")
     564                                              .arg(RTArchValToString(RT_ARCH_VAL))
     565                                              .arg(RTArchValToString(uNativeArch));
     566            QMessageBox::critical(0, QApplication::tr("Mismatching CPU Architecture"),
     567                                  strMsg, QMessageBox::Abort, QMessageBox::NoButton);
     568            break;
     569        }
     570
    556571        /* Create modal-window manager: */
    557572        UIModalWindowManager::create();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette