diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e32e43e..6f9ad382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - added "get_cert SBIEX-XXXXX-XXXXX-XXXXX-XXXXX" command to UpdUtil.exe allowing to get a cert by serial using command line - added mechanism to revoke leaked or refunded certificates - added new global hot key to bring sandman in fron as top most ALT+Break [#3320](https://github.com/sandboxie-plus/Sandboxie/issues/3320) +- added Exclude specific boxes from 'Terminate all processes' [#3108](https://github.com/sandboxie-plus/Sandboxie/issues/3108) + - Note: press the panic button hot key 3 times with less then 1 second between clicks to Terminate All with NO exceptions ### Changed - improved suspend process ahndling [#3375](https://github.com/sandboxie-plus/Sandboxie/issues/3375) diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index ee7678fd..68650ba5 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1636,14 +1636,19 @@ SB_STATUS CSbieAPI::TerminateAll(const QString& BoxName) return Status; } -SB_STATUS CSbieAPI::TerminateAll() +SB_STATUS CSbieAPI::TerminateAll(bool bNoExceptions) { - SB_STATUS Status = SB_OK; +#ifdef _DEBUG + qDebug() << "TerminateAll" << bNoExceptions; +#endif + bool bFailed = false; foreach(const CSandBoxPtr& pBox, m_SandBoxes) { + if (!bNoExceptions && pBox->GetBool("ExcludeFromTerminateAll", false)) + continue; if (!pBox->TerminateAll()) - Status = SB_ERR(SB_FailedKillAll); + bFailed = true; } - return Status; + return bFailed ? SB_ERR(SB_FailedKillAll) : SB_OK; } SB_STATUS CSbieAPI::Terminate(quint32 ProcessId) diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.h b/SandboxiePlus/QSbieAPI/SbieAPI.h index 7a34d77a..5024c364 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.h +++ b/SandboxiePlus/QSbieAPI/SbieAPI.h @@ -73,7 +73,7 @@ public: virtual CSandBoxPtr GetBoxByName(const QString &BoxName) const { return m_SandBoxes.value(BoxName.toLower()); } virtual CBoxedProcessPtr GetProcessById(quint32 ProcessId) const; - virtual SB_STATUS TerminateAll(); + virtual SB_STATUS TerminateAll(bool bNoExceptions = false); virtual SB_STATUS SetProcessExemption(quint32 process_id, quint32 action_id, bool NewState); virtual bool GetProcessExemption(quint32 process_id, quint32 action_id); diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 1c3fd9e3..0a56243c 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -3470,45 +3470,24 @@ The process match level has a higher priority than the specificity and describes - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + Apply ElevateCreateProcess Workaround (legacy behaviour) - - - - Force usage of custom dummy Manifest files (legacy behaviour) - - - - + Emulate sandboxed window station for all processes - + - 75 true true @@ -3518,14 +3497,28 @@ The process match level has a higher priority than the specificity and describes - - + + - Allow use of nested job objects (works on Windows 8 and later) + Disable the use of RpcMgmtSetComTimeout by default (this may resolve compatibility issues) - + + + + Force usage of custom dummy Manifest files (legacy behaviour) + + + + + + + Use desktop object workaround for all processes + + + + Qt::Vertical @@ -3538,17 +3531,33 @@ The process match level has a higher priority than the specificity and describes - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - Disable the use of RpcMgmtSetComTimeout by default (this may resolve compatibility issues) + Allow use of nested job objects (works on Windows 8 and later) - - + + + + When the global hotkey is pressed 3 times in short succession this exception will be ignored. + - Use desktop object workaround for all processes + Exclude this sandbox from being terminated when "Terminate All Processes" is invoked. diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 39130fee..8f981f69 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -2576,9 +2576,19 @@ void CSandMan::OnHotKey(size_t id) { switch (id) { - case HK_PANIC: - theAPI->TerminateAll(); + case HK_PANIC: + { + // terminate with no exceptions when clicked 3 times + static quint64 LastClickTick = 0; + static int LastClickCount = 0; + if (GetCurTick() - LastClickTick > 1000) + LastClickCount = 0; + LastClickCount++; + if(LastClickCount != 2) // skip second click as it may take more than a second + theAPI->TerminateAll(LastClickCount >= 3); + LastClickTick = GetCurTick(); break; + } case HK_TOP: if (this->isActiveWindow() && m_bOnTop) diff --git a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp index aa27d1df..516d9e63 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp @@ -11,6 +11,8 @@ void COptionsWindow::CreateAdvanced() { + connect(ui.chkNoPanic, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); + connect(ui.chkPreferExternalManifest, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkElevateCreateProcessFix, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkNoWindowRename, SIGNAL(clicked(bool)), this, SLOT(OnNoWindowRename())); @@ -115,6 +117,8 @@ void COptionsWindow::CreateAdvanced() void COptionsWindow::LoadAdvanced() { + ui.chkNoPanic->setChecked(m_pBox->GetBool("ExcludeFromTerminateAll", false)); + ui.chkPreferExternalManifest->setChecked(m_pBox->GetBool("PreferExternalManifest", false)); ui.chkElevateCreateProcessFix->setChecked(m_pBox->GetBool("ApplyElevateCreateProcessFix", false)); @@ -309,6 +313,8 @@ void COptionsWindow::ShowTriggersTmpl(bool bUpdate) void COptionsWindow::SaveAdvanced() { + WriteAdvancedCheck(ui.chkNoPanic, "ExcludeFromTerminateAll", "y", ""); + WriteAdvancedCheck(ui.chkPreferExternalManifest, "PreferExternalManifest", "y", ""); WriteAdvancedCheck(ui.chkElevateCreateProcessFix, "ApplyElevateCreateProcessFix", "y", "");