From c6d4836737feff5a386a21117378b3f3b7d549d2 Mon Sep 17 00:00:00 2001 From: love-code-yeyixiao <188240888@qq.com> Date: Sun, 17 Mar 2024 11:14:03 +0800 Subject: [PATCH] Update Sandman --- SandboxiePlus/SandMan/Forms/OptionsWindow.ui | 391 +++++++++--------- SandboxiePlus/SandMan/SandMan.cpp | 7 +- .../SandMan/Windows/OptionsAdvanced.cpp | 9 +- 3 files changed, 211 insertions(+), 196 deletions(-) diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 8d450811..63360739 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -55,7 +55,7 @@ - 3 + 1 @@ -284,200 +284,203 @@ File Options - + - - - - - - 75 - true - true - - - - Disk/File access - - - - - - - Use volume serial numbers for drives, like: \drive\C~1234-ABCD - - - - - - - - 20 - 16777215 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - Encrypt sandbox content - - - - - - - Auto delete content when last sandboxed process terminates - - - - - - - When <a href="sbie://docs/boxencryption">Box Encryption</a> is enabled the box’s root folder, including its registry hive, is stored in an encrypted disk image, using <a href="https://diskcryptor.org">Disk Cryptor's</a> AES-XTS implementation. - - - true - - - true - - - - - - - - 75 - true - true - - - - Box Delete options - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Allow elevated sandboxed applications to read the harddrive - - - - - - - Partially checked means prevent box removal but not content deletion. - - - Protect this sandbox from deletion or emptying - - - true - - - - - - - <a href="addon://ImDisk">Install ImDisk</a> driver to enable Ram Disk and Disk Image support. - - - - - - - Separate user folders - - - false - - - - - - - - 75 - true - true - - - - Box Structure - - - - - - - Store the sandbox content in a Ram Disk - - - - - - - Warn when an application opens a harddrive handle - - - - - - - - - - Set Password - - - - - - - Virtualization scheme - - - - - - - The box structure can only be changed when the sandbox is empty - - - - + + + + 75 + true + true + + + + Box Structure + + + + + + + The box structure can only be changed when the sandbox is empty + + + + + + + Virtualization scheme + + + + + + + + + + Separate user folders + + + false + + + + + + + Use volume serial numbers for drives, like: \drive\C~1234-ABCD + + + + + + + Store the sandbox content in a Ram Disk + + + + + + + Encrypt sandbox content + + + + + + + Set Password + + + + + + + When <a href="sbie://docs/boxencryption">Box Encryption</a> is enabled the box’s root folder, including its registry hive, is stored in an encrypted disk image, using <a href="https://diskcryptor.org">Disk Cryptor's</a> AES-XTS implementation. + + + true + + + true + + + + + + + <a href="addon://ImDisk">Install ImDisk</a> driver to enable Ram Disk and Disk Image support. + + + + + + + + 75 + true + true + + + + Box Delete options + + + + + + + Auto delete content when last sandboxed process terminates + + + + + + + Partially checked means prevent box removal but not content deletion. + + + Protect this sandbox from deletion or emptying + + + true + + + + + + + Lock the encrypted sandbox when all processes in the sandbox terminate. + + + + + + + + 75 + true + true + + + + Disk/File access + + + + + + + Allow elevated sandboxed applications to read the harddrive + + + + + + + + 20 + 16777215 + + + + + + + + + + + Warn when an application opens a harddrive handle + + + + + + + Qt::Vertical + + + + 20 + 52 + + + + + + + + Qt::Horizontal + + + + 410 + 13 + + + diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 68e59801..c1c0e0f4 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -2283,7 +2283,12 @@ void CSandMan::OnBoxClosed(const CSandBoxPtr& pBox) AddAsyncOp(pProgress, true, tr("Executing OnBoxTerminate: %1").arg(Value2)); } } - + if (pBox->GetBool("LockWhenClose", false)) { + if (!pBox->GetMountRoot().isEmpty()) { + pBox->TerminateAll(); + pBox->ImBoxUnmount(); + } + } if (!pBox->GetBool("NeverDelete", false)) { if (pBox->GetBool("AutoDelete", false)) diff --git a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp index 072c716e..7700a740 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsAdvanced.cpp @@ -106,6 +106,7 @@ void COptionsWindow::CreateAdvanced() connect(ui.chkLessConfidential, SIGNAL(clicked(bool)), this, SLOT(OnLessConfidentialChanged())); connect(ui.chkProtectWindow, SIGNAL(clicked(bool)), this, SLOT(OnProtectChanged())); connect(ui.chkBlockCapture, SIGNAL(clicked(bool)), this, SLOT(OnCaptureChanged())); + connect(ui.chkLockWhenClose, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkNotifyProtect, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.treeInjectDll, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnToggleInjectDll(QTreeWidgetItem *, int))); @@ -265,7 +266,12 @@ void COptionsWindow::LoadAdvanced() ui.chkNotifyProtect->setChecked(m_pBox->GetBool("NotifyBoxProtected", false)); ui.chkProtectWindow->setChecked(m_pBox->GetBool("IsProtectScreen")); - ui.chkBlockCapture->setChecked(m_pBox->GetBool("IsBlockCapture")); + QString str = m_pBox->GetText("OpenWindowClass", ""); + ui.chkBlockCapture->setChecked(m_pBox->GetBool("IsBlockCapture")&& QString::compare(str, "*") != 0); + ui.chkBlockCapture->setCheckable(QString::compare(str, "*") != 0); + + ui.chkLockWhenClose->setChecked(m_pBox->GetBool("LockWhenClose", false)); + ui.chkLockWhenClose->setCheckable(m_pBox->GetBool("UseFileImage", false)); QStringList Users = m_pBox->GetText("Enabled").split(","); ui.lstUsers->clear(); @@ -471,6 +477,7 @@ void COptionsWindow::SaveAdvanced() WriteAdvancedCheck(ui.chkProtectWindow, "IsProtectScreen", "y", "n"); WriteAdvancedCheck(ui.chkBlockCapture, "IsBlockCapture", "y", "n"); + WriteAdvancedCheck(ui.chkLockWhenClose, "LockWhenClose", "y", "n"); QStringList Users; for (int i = 0; i < ui.lstUsers->count(); i++)