VirtualBox

Changeset 73193 in vbox


Ignore:
Timestamp:
Jul 17, 2018 8:48:41 PM (6 years ago)
Author:
vboxsync
Message:

Fe/Qt: Complain if a VM runner option is used with the selector. Also, complain about unknown option on windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r73128 r73193  
    38263826        const QByteArray &argBytes = arguments.at(i).toUtf8();
    38273827        const char *arg = argBytes.constData();
     3828        enum { OptType_Unknown, OptType_VMRunner, OptType_VMSelector } enmOptType = OptType_Unknown;
    38283829        /* NOTE: the check here must match the corresponding check for the
    38293830         * options to start a VM in main.cpp and hardenedmain.cpp exactly,
     
    38323833            || !::strcmp(arg, "-startvm"))
    38333834        {
     3835            enmOptType = OptType_VMRunner;
    38343836            if (++i < argc)
    38353837            {
     
    38403842        else if (!::strcmp(arg, "-separate") || !::strcmp(arg, "--separate"))
    38413843        {
     3844            enmOptType = OptType_VMRunner;
    38423845            fSeparateProcess = true;
    38433846        }
     
    39063909            ++i;
    39073910        else if (!::strcmp(arg, "--no-startvm-errormsgbox"))
     3911        {
     3912            enmOptType = OptType_VMRunner;
    39083913            m_fShowStartVMErrors = false;
     3914        }
    39093915        else if (!::strcmp(arg, "--aggressive-caching"))
    39103916            m_fAgressiveCaching = true;
     
    39123918            m_fAgressiveCaching = false;
    39133919        else if (!::strcmp(arg, "--restore-current"))
     3920        {
     3921            enmOptType = OptType_VMRunner;
    39143922            m_fRestoreCurrentSnapshot = true;
     3923        }
    39153924        /* Ad hoc VM reconfig options: */
    39163925        else if (!::strcmp(arg, "--fda"))
    39173926        {
     3927            enmOptType = OptType_VMRunner;
    39183928            if (++i < argc)
    39193929                m_strFloppyImage = arguments.at(i);
     
    39213931        else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom"))
    39223932        {
     3933            enmOptType = OptType_VMRunner;
    39233934            if (++i < argc)
    39243935                m_strDvdImage = arguments.at(i);
     
    39263937        /* VMM Options: */
    39273938        else if (!::strcmp(arg, "--disable-patm"))
     3939        {
     3940            enmOptType = OptType_VMRunner;
    39283941            m_fDisablePatm = true;
     3942        }
    39293943        else if (!::strcmp(arg, "--disable-csam"))
     3944        {
     3945            enmOptType = OptType_VMRunner;
    39303946            m_fDisableCsam = true;
     3947        }
    39313948        else if (!::strcmp(arg, "--recompile-supervisor"))
     3949        {
     3950            enmOptType = OptType_VMRunner;
    39323951            m_fRecompileSupervisor = true;
     3952        }
    39333953        else if (!::strcmp(arg, "--recompile-user"))
     3954        {
     3955            enmOptType = OptType_VMRunner;
    39343956            m_fRecompileUser = true;
     3957        }
    39353958        else if (!::strcmp(arg, "--recompile-all"))
     3959        {
     3960            enmOptType = OptType_VMRunner;
    39363961            m_fDisablePatm = m_fDisableCsam = m_fRecompileSupervisor = m_fRecompileUser = true;
     3962        }
    39373963        else if (!::strcmp(arg, "--execute-all-in-iem"))
     3964        {
     3965            enmOptType = OptType_VMRunner;
    39383966            m_fDisablePatm = m_fDisableCsam = m_fExecuteAllInIem = true;
     3967        }
    39393968        else if (!::strcmp(arg, "--warp-pct"))
    39403969        {
     3970            enmOptType = OptType_VMRunner;
    39413971            if (++i < argc)
    39423972                m_uWarpPct = RTStrToUInt32(arguments.at(i).toLocal8Bit().constData());
     
    39453975        /* Debugger/Debugging options: */
    39463976        else if (!::strcmp(arg, "-dbg") || !::strcmp(arg, "--dbg"))
     3977        {
     3978            enmOptType = OptType_VMRunner;
    39473979            setDebuggerVar(&m_fDbgEnabled, true);
     3980        }
    39483981        else if (!::strcmp( arg, "-debug") || !::strcmp(arg, "--debug"))
    39493982        {
     3983            enmOptType = OptType_VMRunner;
    39503984            setDebuggerVar(&m_fDbgEnabled, true);
    39513985            setDebuggerVar(&m_fDbgAutoShow, true);
     
    39553989        else if (!::strcmp(arg, "--debug-command-line"))
    39563990        {
     3991            enmOptType = OptType_VMRunner;
    39573992            setDebuggerVar(&m_fDbgEnabled, true);
    39583993            setDebuggerVar(&m_fDbgAutoShow, true);
     
    39613996        else if (!::strcmp(arg, "--debug-statistics"))
    39623997        {
     3998            enmOptType = OptType_VMRunner;
    39633999            setDebuggerVar(&m_fDbgEnabled, true);
    39644000            setDebuggerVar(&m_fDbgAutoShow, true);
     
    39674003        else if (!::strcmp(arg, "-no-debug") || !::strcmp(arg, "--no-debug"))
    39684004        {
     4005            enmOptType = OptType_VMRunner;
    39694006            setDebuggerVar(&m_fDbgEnabled, false);
    39704007            setDebuggerVar(&m_fDbgAutoShow, false);
     
    39744011        /* Not quite debug options, but they're only useful with the debugger bits. */
    39754012        else if (!::strcmp(arg, "--start-paused"))
     4013        {
     4014            enmOptType = OptType_VMRunner;
    39764015            m_enmLaunchRunning = LaunchRunning_No;
     4016        }
    39774017        else if (!::strcmp(arg, "--start-running"))
     4018        {
     4019            enmOptType = OptType_VMRunner;
    39784020            m_enmLaunchRunning = LaunchRunning_Yes;
     4021        }
    39794022#endif
    3980         /** @todo add an else { msgbox(syntax error); exit(1); } here, pretty please... */
     4023#ifdef RT_OS_WINDOWS /** @todo add more here, please... */
     4024        else
     4025            msgCenter().error(0, MessageType_Error, tr("Unknown option <b>%1</b>.").arg(arguments.at(i)), "");
     4026#endif
     4027#ifdef VBOX_GUI_WITH_SHARED_LIBRARY
     4028        if (enmOptType == OptType_VMRunner && m_enmType != UIType_RuntimeUI)
     4029            msgCenter().error(0, MessageType_Error,
     4030                              tr("<b>%1</b> is an option for the VirtualBox VM runner (VirtualBoxVM) application, not the selector")
     4031                              .arg(arg), "");
     4032#endif
     4033
    39814034        i++;
    39824035    }
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