From bd6cc0f7ad3a49bb0839b3bf7bc7bd2e4f049bb3 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 18 May 2024 10:49:20 +0200 Subject: [PATCH] fixes --- Sandboxie/msgs/Sbie-English-1033.txt | 21 +++--- SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp | 2 +- SandboxiePlus/QSbieAPI/SbieAPI.cpp | 66 +++++++++--------- SandboxiePlus/QSbieAPI/SbieAPI.h | 10 ++- SandboxiePlus/QSbieAPI/SbieUtils.cpp | 2 +- SandboxiePlus/SandMan/Engine/BoxObject.cpp | 2 +- .../SandMan/Forms/SelectBoxWindow.ui | 67 ++++++++++--------- SandboxiePlus/SandMan/SandMan.cpp | 16 ++--- SandboxiePlus/SandMan/SandMan.h | 5 +- SandboxiePlus/SandMan/SandManRecovery.cpp | 2 +- SandboxiePlus/SandMan/SbiePlusAPI.cpp | 9 +-- SandboxiePlus/SandMan/SbiePlusAPI.h | 3 +- SandboxiePlus/SandMan/Views/SbieView.cpp | 6 +- .../SandMan/Windows/SelectBoxWindow.cpp | 37 +++++----- .../SandMan/Windows/SelectBoxWindow.h | 2 + .../SandMan/Wizards/NewBoxWizard.cpp | 4 +- 16 files changed, 128 insertions(+), 126 deletions(-) diff --git a/Sandboxie/msgs/Sbie-English-1033.txt b/Sandboxie/msgs/Sbie-English-1033.txt index 5013dcf8..adbd3ca8 100644 --- a/Sandboxie/msgs/Sbie-English-1033.txt +++ b/Sandboxie/msgs/Sbie-English-1033.txt @@ -920,6 +920,15 @@ Desktop Programs . +3198;txt;01 +Do you want to start a new program into the sandbox %s? +You received this message because you set AlertBeforeStart=y. +. + +3199;txt;01 +This startup request does not appear to be invoked by the SANDBOXIE component. Are you sure you want to run it? If this is your action, you can ignore it and choose yes. +. + 3202;txt;01 Invalid command line parameter: %2 . @@ -4238,14 +4247,4 @@ This is the third and last retry. 8106;txt;02 The following programs must be closed before the installation can continue. Click OK to close these programs and continue. Click Cancel to abort the installation. -. - -3198;txt;01 -Do you want to start a new program into the sandbox %s? -You received this message because you set AlertBeforeStart=y. - -. - -3199;txt;01 -This startup request does not appear to be invoked by the SANDBOXIE component. Are you sure you want to run it? If this is your action, you can ignore it and choose yes. -. +. \ No newline at end of file diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp index 738647b4..09e824a8 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp @@ -147,7 +147,7 @@ SB_STATUS CSandBox::RunStart(const QString& Command, bool Elevated) if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0) return RunSandboxed(Command); #endif - return m_pAPI->RunStart(m_Name, Command, Elevated); + return m_pAPI->RunStart(m_Name, Command, Elevated ? CSbieAPI::eStartElevated : CSbieAPI::eStartDefault); } SB_STATUS CSandBox::RunSandboxed(const QString& Command) diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index c9731338..393f2ef8 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1029,22 +1029,19 @@ QString CSbieAPI::GetUserSection(QString* pUserName, bool* pIsAdmin) const return UserSection; } -SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess) -{ - return RunStartWithFCP(BoxName, Command,false, Elevated, WorkingDir, pProcess); -} -SB_RESULT(quint32) CSbieAPI::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated, const QString& WorkingDir, QProcess* pProcess) +SB_RESULT(quint32) CSbieAPI::RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags, const QString& WorkingDir, QProcess* pProcess) { if (m_SbiePath.isEmpty()) return SB_ERR(SB_PathFail); QString StartArgs; - if (Elevated) + if (Flags & eStartElevated) StartArgs += "/elevated "; + if (Flags & eStartFCP) + StartArgs += "/fcp "; + if (!BoxName.isEmpty()) StartArgs += "/box:" + BoxName + " "; - if (isFCP) - StartArgs += "/fcp "; else StartArgs += "/disable_force "; @@ -1075,41 +1072,42 @@ SB_RESULT(quint32) CSbieAPI::RunStartWithFCP(const QString& BoxName, const QStri /* QString CommandLine = "\"" + GetStartPath() + "\" " + StartArgs; - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); + STARTUPINFO si; + PROCESS_INFORMATION pi; + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); - // Start the child process. - if( !CreateProcessW( NULL, // No module name (use command line) - (wchar_t*)CommandLine.toStdWString().c_str(), // Command line - NULL, // Process handle not inheritable - NULL, // Thread handle not inheritable - FALSE, // Set handle inheritance to FALSE - 0, // No creation flags - NULL, // Use parent's environment block - NULL, // Use parent's starting directory - &si, // Pointer to STARTUPINFO structure - &pi ) // Pointer to PROCESS_INFORMATION structure - ) - { - printf( "CreateProcess failed (%d).\n", GetLastError() ); + // Start the child process. + if( !CreateProcessW( NULL, // No module name (use command line) + (wchar_t*)CommandLine.toStdWString().c_str(), // Command line + NULL, // Process handle not inheritable + NULL, // Thread handle not inheritable + FALSE, // Set handle inheritance to FALSE + 0, // No creation flags + NULL, // Use parent's environment block + NULL, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi ) // Pointer to PROCESS_INFORMATION structure + ) + { + printf( "CreateProcess failed (%d).\n", GetLastError() ); return SB_ERR(); - } + } - // Wait until child process exits. - //WaitForSingleObject( pi.hProcess, INFINITE ); + // Wait until child process exits. + //WaitForSingleObject( pi.hProcess, INFINITE ); - // Close process and thread handles. - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); + // Close process and thread handles. + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); */ - if (pid == 0) + if(pid == 0) return SB_ERR(); return CSbieResult((quint32)pid); } + QString CSbieAPI::GetStartPath() const { return m_SbiePath + "\\" + QString::fromWCharArray(SBIESTART_EXE); diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.h b/SandboxiePlus/QSbieAPI/SbieAPI.h index ba0b4516..c1b83e4f 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.h +++ b/SandboxiePlus/QSbieAPI/SbieAPI.h @@ -153,8 +153,14 @@ public: virtual QString GetSbieMsgStr(quint32 code, quint32 Lang = 1033); - virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); - virtual SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL); + enum EStartFlags + { + eStartDefault = 0, + eStartElevated = 1, + eStartFCP = 2 + }; + + virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags = eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); virtual QString GetStartPath() const; virtual quint32 GetSessionID() const; diff --git a/SandboxiePlus/QSbieAPI/SbieUtils.cpp b/SandboxiePlus/QSbieAPI/SbieUtils.cpp index 04e36e06..0466b92c 100644 --- a/SandboxiePlus/QSbieAPI/SbieUtils.cpp +++ b/SandboxiePlus/QSbieAPI/SbieUtils.cpp @@ -564,7 +564,7 @@ bool CSbieUtils::GetStartMenuShortcut(CSbieAPI* pApi, QString &BoxName, QString QString Command = "start_menu:" + QString::fromWCharArray(MapName); if (!LinkPath.isEmpty()) Command += ":" + LinkPath; - pApi->RunStart(BoxName, Command, false, QString(), &Process); + pApi->RunStart(BoxName, Command, CSbieAPI::eStartDefault, QString(), &Process); //Process.waitForFinished(-1); while(Process.state() != QProcess::NotRunning) QCoreApplication::processEvents(); // keep UI responsive diff --git a/SandboxiePlus/SandMan/Engine/BoxObject.cpp b/SandboxiePlus/SandMan/Engine/BoxObject.cpp index d9fc7a77..3a2b672a 100644 --- a/SandboxiePlus/SandMan/Engine/BoxObject.cpp +++ b/SandboxiePlus/SandMan/Engine/BoxObject.cpp @@ -8,7 +8,7 @@ quint32 CBoxObject::StartTask(const QString& Command, const QVariantMap& Options) { - SB_RESULT(quint32) result = theGUI->RunStart(getName(), Command, Options["elevalted"].toBool(), Options["directory"].toString()); + SB_RESULT(quint32) result = theGUI->RunStart(getName(), Command, Options["elevalted"].toBool() ? CSbieAPI::eStartElevated : CSbieAPI::eStartDefault, Options["directory"].toString()); return result.IsError() ? -1 : result.GetValue(); } diff --git a/SandboxiePlus/SandMan/Forms/SelectBoxWindow.ui b/SandboxiePlus/SandMan/Forms/SelectBoxWindow.ui index 7034a91d..d87673df 100644 --- a/SandboxiePlus/SandMan/Forms/SelectBoxWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SelectBoxWindow.ui @@ -32,7 +32,24 @@ SandboxiePlus select box - + + + + Run Outside the Sandbox + + + + + + + Force child processes to be sandboxed + + + Force Children + + + + @@ -41,31 +58,7 @@ - - - - Run Outside the Sandbox - - - - - - - Qt::Horizontal - - - - - - - Select the sandbox in which to start the program, installer or document. - - - true - - - - + Run in a new Sandbox @@ -75,21 +68,28 @@ - + + + + Qt::Horizontal + + + + Run As UAC Administrator - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + Run Sandboxed @@ -99,10 +99,13 @@ - - + + - Run Unsandboxed with ForceChildProcess + Select the sandbox in which to start the program, installer or document. + + + true diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index d8c9a93a..43fcdb41 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1671,9 +1671,9 @@ void CSandMan::OnMessage(const QString& MsgData) BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox"); if (!BoxName.isEmpty()) - RunStart(BoxName == "*DFP*" ? "" : BoxName, CmdLine, false, WrkDir); + RunStart(BoxName == "*DFP*" ? "" : BoxName, CmdLine, CSbieAPI::eStartDefault, WrkDir); else - RunSandboxed(QStringList(CmdLine), BoxName, WrkDir); + RunSandboxed(QStringList(CmdLine), BoxName, WrkDir, true); } else if (Message.left(3) == "Op:") { @@ -1702,21 +1702,18 @@ void CSandMan::dragEnterEvent(QDragEnterEvent* e) } } -bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const QString& WrkDir) +bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const QString& WrkDir, bool bShowFCP) { if (BoxName.isEmpty()) BoxName = theAPI->GetGlobalSettings()->GetText("DefaultBox", "DefaultBox"); CSelectBoxWindow* pSelectBoxWindow = new CSelectBoxWindow(Commands, BoxName, WrkDir, g_GUIParent); + if (bShowFCP) pSelectBoxWindow->ShowFCP(); connect(this, SIGNAL(Closed()), pSelectBoxWindow, SLOT(close())); //pSelectBoxWindow->show(); return SafeExec(pSelectBoxWindow) == 1; } -SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess) -{ - return RunStartWithFCP(BoxName, Command, false, Elevated, WorkingDir, pProcess); -} -SB_RESULT(quint32) CSandMan::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated, const QString& WorkingDir, QProcess* pProcess) +SB_RESULT(quint32) CSandMan::RunStart(const QString& BoxName, const QString& Command, CSbieAPI::EStartFlags Flags, const QString& WorkingDir, QProcess* pProcess) { auto pBoxEx = theAPI->GetBoxByName(BoxName).objectCast(); if (pBoxEx && pBoxEx->UseImageFile() && pBoxEx->GetMountRoot().isEmpty()) { @@ -1726,8 +1723,9 @@ SB_RESULT(quint32) CSandMan::RunStartWithFCP(const QString& BoxName, const QStri return Status; } - return theAPI->RunStartWithFCP(BoxName, Command, isFCP, Elevated, WorkingDir, pProcess); + return theAPI->RunStart(BoxName, Command, Flags, WorkingDir, pProcess); } + SB_STATUS CSandMan::ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount) { auto pBoxEx = pBox.objectCast(); diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 3c24da7b..04a8df18 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -91,9 +91,8 @@ public: static void SafeShow(QWidget* pWidget); int SafeExec(QDialog* pDialog); - bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString()); - SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); - SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL); + bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString(), bool bShowFCP = false); + SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, CSbieAPI::EStartFlags Flags = CSbieAPI::eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); SB_STATUS ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount = false); void EditIni(const QString& IniPath, bool bPlus = false); diff --git a/SandboxiePlus/SandMan/SandManRecovery.cpp b/SandboxiePlus/SandMan/SandManRecovery.cpp index ccfd98a3..8f7fbf9e 100644 --- a/SandboxiePlus/SandMan/SandManRecovery.cpp +++ b/SandboxiePlus/SandMan/SandManRecovery.cpp @@ -357,6 +357,6 @@ void CSandMan::OnRecoveryLog() { if (!m_pRecoveryLogWnd->isVisible()) { m_pRecoveryLogWnd->setWindowFlag(Qt::WindowStaysOnTopHint, theGUI->IsAlwaysOnTop()); - SafeShow(m_pRecoveryLogWnd); + CSandMan::SafeShow(m_pRecoveryLogWnd); } } diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 8a2913f0..fec969de 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -92,16 +92,11 @@ void CSbiePlusAPI::StopMonitor() m_BoxMonitor->Stop(); } -SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, bool Elevated, const QString& WorkingDir, QProcess* pProcess) -{ - - return RunStartWithFCP(BoxName,Command,false,Elevated,WorkingDir,pProcess); -} -SB_RESULT(quint32) CSbiePlusAPI::RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP, bool Elevated, const QString& WorkingDir,QProcess* pProcess) +SB_RESULT(quint32) CSbiePlusAPI::RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags, const QString& WorkingDir,QProcess* pProcess) { if (!pProcess) pProcess = new QProcess(this); - SB_RESULT(quint32) Status = CSbieAPI::RunStartWithFCP(BoxName, Command,isFCP, Elevated, WorkingDir, pProcess); + SB_RESULT(quint32) Status = CSbieAPI::RunStart(BoxName, Command, Flags, WorkingDir, pProcess); if (pProcess->parent() == this) { if (!Status.IsError()) { connect(pProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(OnStartFinished())); diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h index 9aab05e5..da3dc4f6 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.h +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -31,8 +31,7 @@ public: virtual void StopMonitor(); - virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, bool Elevated = false, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); - virtual SB_RESULT(quint32) RunStartWithFCP(const QString& BoxName, const QString& Command, bool isFCP,bool Elevated = false, const QString& WorkingDir = QString(),QProcess* pProcess = NULL); + virtual SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, EStartFlags Flags = eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL); virtual bool IsStarting(qint64 pid) const { return m_PendingStarts.contains(pid); } private slots: diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 61e7e9d3..de200d62 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -1216,7 +1216,7 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList& SandB else if (Action == m_pMenuRunCmd) Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe")); else if (Action == m_pMenuRunCmdAdmin) - Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe", true)); + Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "cmd.exe", CSbieAPI::eStartElevated)); #ifdef _WIN64 else if (Action == m_pMenuRunCmd32) Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "C:\\WINDOWS\\SysWOW64\\cmd.exe")); @@ -1576,10 +1576,10 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList& SandB QString Command = Action->data().toString(); QString WorkingDir = Action->property("WorkingDir").toString(); if (Command.isEmpty()) - Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "start_menu", false, WorkingDir)); + Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), "start_menu", CSbieAPI::eStartDefault, WorkingDir)); else { auto pBoxEx = SandBoxes.first().objectCast(); - Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), pBoxEx->GetFullCommand(Command), false, pBoxEx->GetFullCommand(WorkingDir))); + Results.append(theGUI->RunStart(SandBoxes.first()->GetName(), pBoxEx->GetFullCommand(Command), CSbieAPI::eStartDefault, pBoxEx->GetFullCommand(WorkingDir))); } } diff --git a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp index bb46002a..2c721dcd 100644 --- a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp @@ -184,7 +184,9 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B connect(ui.radBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType())); connect(ui.radBoxedNew, SIGNAL(clicked(bool)), this, SLOT(OnBoxType())); connect(ui.radUnBoxed, SIGNAL(clicked(bool)), this, SLOT(OnBoxType())); - connect(ui.radFCPRuned, SIGNAL(clicked(bool)), this, SLOT(OnBoxType())); + connect(ui.chkFCP, SIGNAL(clicked(bool)), this, SLOT(OnBoxType())); + ui.chkFCP->setEnabled(false); + ui.chkFCP->setVisible(false); connect(ui.buttonBox, SIGNAL(accepted()), SLOT(OnRun())); connect(ui.buttonBox, SIGNAL(rejected()), SLOT(reject())); @@ -204,6 +206,11 @@ CSelectBoxWindow::~CSelectBoxWindow() theConf->SetBlob("SelectBoxWindow/Window_Geometry", saveGeometry()); } +void CSelectBoxWindow::ShowFCP() +{ + ui.chkFCP->setVisible(true); +} + void CSelectBoxWindow::closeEvent(QCloseEvent *e) { //emit Closed(); @@ -212,19 +219,22 @@ void CSelectBoxWindow::closeEvent(QCloseEvent *e) void CSelectBoxWindow::OnBoxType() { - m_pBoxPicker->setEnabled(ui.radBoxed->isChecked()||ui.radFCPRuned->isChecked()); + ui.chkFCP->setEnabled(ui.radUnBoxed->isChecked()); + m_pBoxPicker->setEnabled(ui.radBoxed->isChecked() || (ui.chkFCP->isEnabled() && ui.chkFCP->isChecked())); } void CSelectBoxWindow::OnRun() { QString BoxName; - bool isFCP = false; + int Flags = CSbieAPI::eStartDefault; + if (ui.chkAdmin->isChecked()) + Flags |= CSbieAPI::eStartElevated; if (ui.radUnBoxed->isChecked()) { if (QMessageBox("Sandboxie-Plus", tr("Are you sure you want to run the program outside the sandbox?"), QMessageBox::Question, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton, this).exec() != QMessageBox::Yes) return; } - else if (ui.radBoxedNew->isChecked()) + if (ui.radBoxedNew->isChecked()) { BoxName = theGUI->GetBoxView()->AddNewBox(true); if (BoxName.isEmpty()) { @@ -232,17 +242,10 @@ void CSelectBoxWindow::OnRun() return; } } - else if (ui.radFCPRuned->isChecked()) - { - isFCP = true; - BoxName = m_pBoxPicker->GetBoxName(); - if (BoxName.isEmpty()) { - QMessageBox("Sandboxie-Plus", tr("Please select a sandbox."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec(); - return; - } - } - else + else if (!ui.radUnBoxed->isChecked() || ui.chkFCP->isChecked()) { + if (ui.chkFCP->isChecked()) + Flags |= CSbieAPI::eStartFCP; BoxName = m_pBoxPicker->GetBoxName(); if (BoxName.isEmpty()) { QMessageBox("Sandboxie-Plus", tr("Please select a sandbox."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec(); @@ -250,9 +253,9 @@ void CSelectBoxWindow::OnRun() } } - foreach(const QString & Command, m_Commands) - theGUI->RunStartWithFCP(BoxName, Command, isFCP, ui.chkAdmin->isChecked(), m_WrkDir,0); + foreach(const QString& Command, m_Commands) + theGUI->RunStart(BoxName, Command, (CSbieAPI::EStartFlags)Flags, m_WrkDir); setResult(1); close(); -} +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.h b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.h index 1b07c01d..ab71a61d 100644 --- a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.h +++ b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.h @@ -44,6 +44,8 @@ public: CSelectBoxWindow(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString(), QWidget *parent = Q_NULLPTR); ~CSelectBoxWindow(); + void ShowFCP(); + private slots: void OnBoxType(); void OnRun(); diff --git a/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp b/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp index 3a5d1aa9..92064988 100644 --- a/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp +++ b/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp @@ -270,8 +270,8 @@ SB_STATUS CNewBoxWizard::TryToCreateBox() if(field("imagesProtection").toBool()) pBox->SetBool("ProtectHostImages", true); - if (field("coverBoxedWindows").toBool()) - pBox->SetBool("CoverBoxedWindows", true); + if (field("coverBoxedWindows").toBool()) + pBox->SetBool("CoverBoxedWindows", true); if (!Password.isEmpty()) pBox->ImBoxCreate(ImageSize / 1024, Password);