From 4b9eb9e449045a6d08f96d73d32c0771786fea44 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sat, 10 Jul 2021 12:59:32 +0200 Subject: [PATCH] Build 0.8.7 --- CHANGELOG.md | 5 + SandboxiePlus/QSbieAPI/SbieAPI.cpp | 4 +- SandboxiePlus/SandMan/Forms/OptionsWindow.ui | 277 +++++++++--------- SandboxiePlus/SandMan/SandMan.cpp | 80 ++++- SandboxiePlus/SandMan/SandMan.h | 5 + SandboxiePlus/SandMan/Views/SbieView.cpp | 15 + SandboxiePlus/SandMan/Views/SbieView.h | 3 + .../SandMan/Windows/OptionsWindow.cpp | 5 + .../SandMan/Windows/SelectBoxWindow.cpp | 4 +- 9 files changed, 258 insertions(+), 140 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2998ad1..e57165a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - added option to always auto pick the DefautlBox sandbox [959](https://github.com/sandboxie-plus/Sandboxie/issues/959) -- when this option is enabled the normal behavioure with a box selection dialog can be achived holding down CTRL +- added option to hide boxed form the run in box dialog +-- usefull to avoidl listing for example insecure compatybility test boxes +- added box options to sys tray [#439](https://github.com/sandboxie-plus/Sandboxie/issues/439) [#272](https://github.com/sandboxie-plus/Sandboxie/issues/272) ### Changed - changed default terminate all boxed processes key from Ctrl+Break to Ctrl+Alt+Break [#974](https://github.com/sandboxie-plus/Sandboxie/issues/974) @@ -19,6 +22,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed issue with sbiectrl not being properly started after setup [#969](https://github.com/sandboxie-plus/Sandboxie/issues/969) - fixed issue with explore sandboxed shell option [#972](https://github.com/sandboxie-plus/Sandboxie/issues/972) - fixed issue when running sandman elevated [#932](https://github.com/sandboxie-plus/Sandboxie/issues/932) +- fixed new box selection dialog showing disabled boxes +- fixed issue updating box active status ### Removed - removed Online Armor support as this product is deprecated since 2016 diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index 79e62213..886b66e7 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1279,8 +1279,8 @@ SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep) foreach(const CSandBoxPtr& pBox, m_SandBoxes) { - bool WasBoxClosed = pBox->m_ActiveProcessCount > 0 && count == 0; - pBox->m_ActiveProcessCount = count; + bool WasBoxClosed = pBox->m_ActiveProcessCount > 0 && pBox->GetProcessList().count(); + pBox->m_ActiveProcessCount = pBox->GetProcessList().count(); if (WasBoxClosed) { pBox->CloseBox(); emit BoxClosed(pBox->GetName()); diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 479fc366..78123476 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -7,7 +7,7 @@ 0 0 660 - 449 + 456 @@ -45,7 +45,7 @@ QTabWidget::North - 6 + 0 @@ -64,13 +64,13 @@ - - + + - px Width + Sandbox Indicator in title: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -84,7 +84,7 @@ - + Qt::Horizontal @@ -97,7 +97,7 @@ - + @@ -113,17 +113,7 @@ - - - - Block network files and folders, unless specifically opened. - - - - - - - + @@ -139,75 +129,56 @@ - - - - - 75 - true - - - - Protect the system from sandboxed processes - - - Network restrictions - - - - + Drop rights from Administrators and Power Users groups - - + + - Sandbox Indicator in title: + px Width - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - 75 - true - - - - (Recommended) - - + + - + Make applications think they are running elevated (allows to run installers safely) - - - - - 75 - true - - + + - Appearance + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -227,30 +198,45 @@ - - - - Qt::Vertical + + + + + 75 + true + - - - 20 - 40 - - - - - - - + CAUTION: When running under the built in administrator, processes can not drop administrative privileges. + + + true - - + + + + + 75 + true + + - Prevent change to network and firewall parameters + Appearance + + + + + + + + 75 + true + + + + (Recommended) @@ -267,19 +253,10 @@ - - - - - 75 - true - - + + - CAUTION: When running under the built in administrator, processes can not drop administrative privileges. - - - true + Show this box in the 'run in box' selection prompt @@ -444,19 +421,19 @@ - Access Options + Access Restrictions - + Open Windows Credentials Store - + @@ -469,14 +446,14 @@ - + Remove spooler restriction, printers can be installed outside the sandbox - + Qt::Vertical @@ -489,21 +466,73 @@ - - + + - Block access to the printer spooler + Block read access to the clipboard - + Open System Protected Storage - + + + + Block access to the printer spooler + + + + + + + + 75 + true + + + + Protect the system from sandboxed processes + + + Other restrictions + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + Protect the system from sandboxed processes + + + Printing restrictions + + + + @@ -523,7 +552,7 @@ - + 75 @@ -534,43 +563,21 @@ Protect the system from sandboxed processes - Printing restrictions + Network restrictions - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 75 - true - - - - Protect the system from sandboxed processes - + + - Other restrictions + Block network files and folders, unless specifically opened. - - + + - Block read access to the clipboard + Prevent change to network and firewall parameters @@ -2095,8 +2102,8 @@ instead of "*". 0 0 - 98 - 28 + 63 + 16 @@ -2426,8 +2433,6 @@ Please note that this values are currently user specific and saved globally for cmbBoxBorder btnBorderColor spinBorderWidth - chkBlockNetShare - chkBlockNetParam treeRun btnAddCmd btnDelCmd diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 7ff68e87..e01c349f 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -197,10 +197,38 @@ CSandMan::CSandMan(QWidget *parent) m_bIconDisabled = false; m_pTrayMenu = new QMenu(); - QAction* pShowHide = m_pTrayMenu->addAction(tr("Show/Hide"), this, SLOT(OnShowHide())); + QAction* pShowHide = m_pTrayMenu->addAction(QIcon(":/SandMan.png"), tr("Show/Hide"), this, SLOT(OnShowHide())); QFont f = pShowHide->font(); f.setBold(true); pShowHide->setFont(f); + m_pTrayMenu->addSeparator(); + + QWidgetAction* pTrayList = new QWidgetAction(m_pTrayMenu); + + QWidget* pWidget = new CActionWidget(); + QHBoxLayout* pLayout = new QHBoxLayout(); + pLayout->setMargin(0); + pWidget->setLayout(pLayout); + + m_pTrayBoxes = new QTreeWidget(); + + m_pTrayBoxes->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum); + m_pTrayBoxes->setRootIsDecorated(false); + //m_pTrayBoxes->setHeaderLabels(tr(" Sandbox").split("|")); + m_pTrayBoxes->setHeaderHidden(true); + + pLayout->insertSpacing(0, 1);// 32); + pLayout->addWidget(m_pTrayBoxes); + + pTrayList->setDefaultWidget(pWidget); + m_pTrayMenu->addAction(pTrayList); + + + m_pTrayBoxes->setContextMenuPolicy(Qt::CustomContextMenu); + connect(m_pTrayBoxes, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnBoxMenu(const QPoint &))); + connect(m_pTrayBoxes, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnBoxDblClick(QTreeWidgetItem*))); + //m_pBoxMenu + m_pTrayMenu->addSeparator(); m_pTrayMenu->addAction(m_pEmptyAll); m_pDisableForce2 = m_pTrayMenu->addAction(tr("Disable Forced Programs"), this, SLOT(OnDisableForce2())); @@ -1091,6 +1119,22 @@ void CSandMan::OnNotAuthorized(bool bLoginRequired, bool& bRetry) LoginOpen = false; } +void CSandMan::OnBoxMenu(const QPoint & point) +{ + QTreeWidgetItem* pItem = m_pTrayBoxes->currentItem(); + if (!pItem) + return; + + m_pBoxView->PopUpMenu(pItem->data(0, Qt::UserRole).toString()); + + //m_pBoxMenu->popup(QCursor::pos()); +} + +void CSandMan::OnBoxDblClick(QTreeWidgetItem* pItem) +{ + m_pBoxView->ShowOptions(pItem->data(0, Qt::UserRole).toString()); +} + void CSandMan::OnNewBox() { m_pBoxView->AddNewBox(); @@ -1581,8 +1625,42 @@ void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason) switch(Reason) { case QSystemTrayIcon::Context: + { + QMap Boxes = theAPI->GetAllBoxes(); + + QMap OldBoxes; + for(int i = 0; i < m_pTrayBoxes->topLevelItemCount(); ++i) + { + QTreeWidgetItem* pItem = m_pTrayBoxes->topLevelItem(i); + QString Name = pItem->data(0, Qt::UserRole).toString(); + OldBoxes.insert(Name,pItem); + } + + foreach(const CSandBoxPtr & pBox, Boxes) + { + if (!pBox->IsEnabled()) + continue; + + CSandBoxPlus* pBoxEx = qobject_cast(pBox.data()); + + QTreeWidgetItem* pItem = OldBoxes.take(pBox->GetName()); + if(!pItem) + { + pItem = new QTreeWidgetItem(); + pItem->setData(0, Qt::UserRole, pBox->GetName()); + pItem->setText(0, " " + pBox->GetName().replace("_", " ")); + m_pTrayBoxes->addTopLevelItem(pItem); + } + + pItem->setData(0, Qt::DecorationRole, theGUI->GetBoxIcon(pBox->GetActiveProcessCount(), pBoxEx->GetType())); + } + + foreach(QTreeWidgetItem* pItem, OldBoxes) + delete pItem; + m_pTrayMenu->popup(QCursor::pos()); break; + } case QSystemTrayIcon::DoubleClick: if (isVisible()) { diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 03a53667..a285cdee 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -131,6 +131,9 @@ public slots: int ShowQuestion(const QString& question, const QString& checkBoxText, bool* checkBoxSetting, int buttons, int defaultButton); + void OnBoxMenu(const QPoint &); + void OnBoxDblClick(QTreeWidgetItem*); + private slots: void OnSelectionChanged(); @@ -242,6 +245,8 @@ private: QSystemTrayIcon* m_pTrayIcon; QMenu* m_pTrayMenu; + QTreeWidget* m_pTrayBoxes; + //QMenu* m_pBoxMenu; bool m_bIconEmpty; bool m_bIconDisabled; diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 19f35bd3..1b0ef191 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -970,6 +970,21 @@ void CSbieView::SelectBox(const QString& Name) QItemSelection SelectedItems; SelectedItems.append(QItemSelectionRange(ModelL, ModelR)); + m_pSbieTree->setCurrentIndex(ModelIndex); m_pSbieTree->scrollTo(ModelL); m_pSbieTree->selectionModel()->select(SelectedItems, QItemSelectionModel::ClearAndSelect); +} + +void CSbieView::PopUpMenu(const QString& Name) +{ + SelectBox(Name); + OnMenu(QCursor::pos()); +} + +void CSbieView::ShowOptions(const QString& Name) +{ + QModelIndex Index = m_pSbieModel->FindIndex(Name); + QModelIndex ModelIndex = m_pSortProxy->mapFromSource(Index); + + OnDoubleClicked(ModelIndex); } \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index 6808a9ea..64db9c32 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -21,6 +21,9 @@ public: virtual QString AddNewBox(); virtual void SelectBox(const QString& Name); + virtual void PopUpMenu(const QString& Name); + virtual void ShowOptions(const QString& Name); + signals: void RecoveryRequested(const QString& BoxName); diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 00b3942f..fd6ef3ae 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -122,6 +122,7 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.cmbBoxBorder, SIGNAL(currentIndexChanged(int)), this, SLOT(OnGeneralChanged())); connect(ui.btnBorderColor, SIGNAL(clicked(bool)), this, SLOT(OnPickColor())); connect(ui.spinBorderWidth, SIGNAL(valueChanged(int)), this, SLOT(OnGeneralChanged())); + connect(ui.chkShowForRun, SIGNAL(clicked(bool)), this, SLOT(OnGeneralChanged())); connect(ui.chkBlockNetShare, SIGNAL(clicked(bool)), this, SLOT(OnGeneralChanged())); connect(ui.chkBlockNetParam, SIGNAL(clicked(bool)), this, SLOT(OnGeneralChanged())); @@ -423,6 +424,8 @@ void COptionsWindow::LoadConfig() if (!BorderWidth) BorderWidth = 6; ui.spinBorderWidth->setValue(BorderWidth); + ui.chkShowForRun->setChecked(m_pBox->GetBool("ShowForRunIn", true)); + ui.chkBlockNetShare->setChecked(m_pBox->GetBool("BlockNetworkFiles", true)); ui.chkBlockNetParam->setChecked(m_pBox->GetBool("BlockNetParam", true)); ui.chkDropRights->setChecked(m_pBox->GetBool("DropAdminRights", false)); @@ -629,6 +632,8 @@ void COptionsWindow::SaveConfig() BorderCfg.append(QString::number(ui.spinBorderWidth->value())); WriteText("BorderColor", BorderCfg.join(",")); + WriteAdvancedCheck(ui.chkShowForRun, "ShowForRunIn", "", "n"); + WriteAdvancedCheck(ui.chkBlockNetShare, "BlockNetworkFiles", "", "n"); WriteAdvancedCheck(ui.chkBlockNetParam, "BlockNetParam", "", "n"); WriteAdvancedCheck(ui.chkDropRights, "DropAdminRights", "y", ""); diff --git a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp index 121fea70..3e246f80 100644 --- a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp @@ -41,9 +41,11 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, QWidget *parent) QMap Boxes = theAPI->GetAllBoxes(); - foreach(const CSandBoxPtr & pBox, Boxes) { + if (!pBox->IsEnabled() || !pBox->GetBool("ShowForRunIn", true)) + continue; + CSandBoxPlus* pBoxEx = qobject_cast(pBox.data()); QTreeWidgetItem* pItem = new QTreeWidgetItem();