This commit is contained in:
DavidXanatos 2024-03-23 12:14:25 +01:00
parent 7844ac848e
commit 3c86286bf5
7 changed files with 126 additions and 35 deletions

View File

@ -10,6 +10,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added option to prevent sandboxed processes from accessing the images of the window outside the sandbox [#1985](https://github.com/sandboxie-plus/Sandboxie/issues/1985) (thanks Yeyixiao)
- it can be enabled with "IsBlockCapture=y"
- see the sandbox option "Prevent sandboxed processes from using public methods to capture window images" in SandMan UI
- added "LingerExemptWnds=n" to make the lingering process monitor mechanism no longer exempt lingering processes with windows from termination
### Changed
- option "LingerLeniency=n" now also disabled the 5 sec grace period for freshly started lingerers [#1892](https://github.com/sandboxie-plus/Sandboxie/issues/1892)
### Fixed
- fixed issue with symlinks related to startmenu folders

View File

@ -538,7 +538,7 @@ int DoLingerLeader(void)
// don't terminate if a lingering process has an open window
//
if (terminate_and_stop) {
if (terminate_and_stop && SbieApi_QueryConfBool(NULL, L"LingerExemptWnds", TRUE)) {
//
// if a process in the PID list has a window LingerEnumWindowsProc will return FALSE
@ -554,7 +554,7 @@ int DoLingerLeader(void)
// don't terminate if a lingering process has just started recently
//
if (terminate_and_stop) {
if (terminate_and_stop && SbieApi_QueryConfBool(NULL, L"LingerLeniency", TRUE)) {
for (i = 0; i < process_count; ++i) {
HANDLE hProcess = NULL;
ULONG64 ProcessFlags = SbieApi_QueryProcessInfo(

View File

@ -2076,7 +2076,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabsStop">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabLingerer">
<attribute name="title">
@ -2097,33 +2097,6 @@
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_14">
<item row="3" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="btnDelStopProg">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="chkShowStopTmpl">
<property name="text">
<string>Show Templates</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="btnAddLingering">
<property name="text">
@ -2143,6 +2116,13 @@
</column>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="chkShowStopTmpl">
<property name="text">
<string>Show Templates</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
@ -2153,6 +2133,26 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="btnDelStopProg">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -2236,6 +2236,73 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabStopOpt">
<attribute name="title">
<string>Stop Options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_82">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_37">
<item row="0" column="0">
<widget class="QLabel" name="lblStopOpt">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Stop Behavioure</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="chkLingerLeniency">
<property name="text">
<string>Use Linger Leniency</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="chkNoStopWnd">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Don't stop lingering processes with windows</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_40">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -25,6 +25,9 @@ void COptionsWindow::LoadStop()
AddLeaderEntry(Value, true);
LoadLeaderTmpl();
ui.chkNoStopWnd->setChecked(m_pBox->GetBool("LingerExemptWnds", true));
ui.chkLingerLeniency->setChecked(m_pBox->GetBool("LingerLeniency", true));
m_StopChanged = false;
}
@ -134,6 +137,9 @@ void COptionsWindow::SaveStop()
WriteTextList("LeaderProcess", LeaderProcess);
WriteTextList("LeaderProcessDisabled", LeaderProcessDisabled);
WriteAdvancedCheck(ui.chkNoStopWnd, "LingerExemptWnds", "", "n");
WriteAdvancedCheck(ui.chkLingerLeniency, "LingerLeniency", "", "n");
m_StopChanged = false;
}

View File

@ -222,6 +222,7 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
ui.tabsStop->setCurrentIndex(0);
ui.tabsStop->setTabIcon(0, CSandMan::GetIcon("Fail"));
ui.tabsStop->setTabIcon(1, CSandMan::GetIcon("Pass"));
ui.tabsStop->setTabIcon(2, CSandMan::GetIcon("Policy"));
ui.tabsInternet->setCurrentIndex(0);
ui.tabsInternet->setTabIcon(0, CSandMan::GetIcon("Program"));
@ -306,6 +307,13 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
QWidget* pWidget2 = new QWidget();
pWidget2->setLayout(ui.gridLayout_61);
ui.gridLayout_17->addWidget(pWidget2, 2, 0);
QWidget* pWidget3 = new QWidget();
pWidget3->setLayout(ui.gridLayout_82);
ui.gridLayout_82->setContentsMargins(3, 3, 3, 3);
ui.verticalSpacer_40->changeSize(0, 0);
ui.lblStopOpt->setVisible(false);
ui.lblStopOpt->setProperty("hidden", true);
ui.gridLayout_17->addWidget(pWidget3, 3, 0);
delete ui.tabsStop;
ui.gridLayout_17->setContentsMargins(0, 0, 0, 0);
@ -364,6 +372,8 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
AddIconToLabel(ui.lblPrinting, CSandMan::GetIcon("Printer").pixmap(size,size));
AddIconToLabel(ui.lblOther, CSandMan::GetIcon("NoAccess").pixmap(size,size));
AddIconToLabel(ui.lblStopOpt, CSandMan::GetIcon("Stop").pixmap(size,size));
AddIconToLabel(ui.lblMode, CSandMan::GetIcon("Anon").pixmap(size,size));
AddIconToLabel(ui.lblPolicy, CSandMan::GetIcon("Policy").pixmap(size,size));
@ -476,13 +486,16 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
connect(ui.btnDelStopProg, SIGNAL(clicked(bool)), this, SLOT(OnDelStopProg()));
connect(ui.chkShowStopTmpl, SIGNAL(clicked(bool)), this, SLOT(OnShowStopTmpl()));
ui.treeStop->setItemDelegateForColumn(0, new ProgramsDelegate(this, ui.treeStop, -1, this));
connect(ui.treeStop, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnStopChanged(QTreeWidgetItem *, int)));
connect(ui.treeStop, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnStopChanged()));
connect(ui.btnAddLeader, SIGNAL(clicked(bool)), this, SLOT(OnAddLeader()));
connect(ui.btnDelLeader, SIGNAL(clicked(bool)), this, SLOT(OnDelLeader()));
connect(ui.chkShowLeaderTmpl, SIGNAL(clicked(bool)), this, SLOT(OnShowLeaderTmpl()));
ui.treeLeader->setItemDelegateForColumn(0, new ProgramsDelegate(this, ui.treeLeader, -1, this));
connect(ui.treeLeader, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnStopChanged(QTreeWidgetItem *, int)));
connect(ui.treeLeader, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnStopChanged()));
connect(ui.chkNoStopWnd, SIGNAL(clicked(bool)), this, SLOT(OnStopChanged()));
connect(ui.chkLingerLeniency, SIGNAL(clicked(bool)), this, SLOT(OnStopChanged()));
//
// Start

View File

@ -101,7 +101,7 @@ private slots:
void OnAddLingering();
void OnDelStopProg();
void OnShowStopTmpl() { LoadStopTmpl(true); }
void OnStopChanged(QTreeWidgetItem* pItem, int Index) { m_StopChanged = true; OnOptChanged(); }
void OnStopChanged() { m_StopChanged = true; OnOptChanged(); }
void OnAddLeader();
void OnDelLeader();
void OnShowLeaderTmpl() { LoadLeaderTmpl(true); }

View File

@ -49,6 +49,7 @@ void FixTriStateBoxPallete(QWidget* pWidget)
void AddIconToLabel(QLabel* pLabel, const QPixmap& Pixmap)
{
if (pLabel->property("hidden").toBool()) return;
QWidget* pParent = pLabel->parentWidget();
QWidget* pWidget = new QWidget(pParent);
pParent->layout()->replaceWidget(pLabel, pWidget);
@ -480,6 +481,7 @@ CSettingsWindow::CSettingsWindow(QWidget* parent)
connect(ui.lblSupport, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
connect(ui.lblSupportCert, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
connect(ui.lblCertExp, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
connect(ui.lblCertGuide, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
connect(ui.lblInsiderInfo, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
m_CertChanged = false;
@ -925,7 +927,7 @@ void CSettingsWindow::LoadSettings()
ui.keyPauseForce->setKeySequence(QKeySequence(theConf->GetString("Options/PauseForceKeySequence", "Ctrl+Alt+F")));
ui.chkSuspend->setChecked(theConf->GetBool("Options/EnableSuspendKey", false));
ui.keySuspend->setKeySequence(QKeySequence(theConf->GetString("Options/SuspendKeySequence", "Ctrl+Pause")));
ui.keySuspend->setKeySequence(QKeySequence(theConf->GetString("Options/SuspendKeySequence", "Shift+Alt+Pause")));
ui.chkMonitorSize->setChecked(theConf->GetBool("Options/WatchBoxSize", false));
@ -1664,7 +1666,6 @@ void CSettingsWindow::SaveSettings()
WriteAdvancedCheck(ui.chkAdminOnlyFP, "ForceDisableAdminOnly", "y", "");
WriteAdvancedCheck(ui.chkClearPass, "ForgetPassword", "y", "");
}
if (m_WarnProgsChanged)