This commit is contained in:
DavidXanatos 2022-06-06 19:46:03 +02:00
parent 62baa1ed58
commit 25dede5734
8 changed files with 179 additions and 28 deletions

View File

@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- changed Move Box behaviour [#1879](https://github.com/sandboxie-plus/Sandboxie/issues/1879)
- improved implementation of the PreferExternalManifest option
- Win32k hooks are now by default only used for Edge and Chromium apps as they cause issues with other software [#1902](https://github.com/sandboxie-plus/Sandboxie/issues/1902) [#1912](https://github.com/sandboxie-plus/Sandboxie/issues/1912) [#1897](https://github.com/sandboxie-plus/Sandboxie/issues/1897)
- "AllowBoxedJobs=y" is not the default
### Fixed
- fixed Edge issue with Windows 11 after KB5014019

View File

@ -133,7 +133,7 @@ _FX BOOLEAN SysInfo_Init(void)
SysInfo_UseSbieJob = !Gui_OpenAllWinClasses && !SbieApi_QueryConfBool(NULL, L"NoAddProcessToJob", FALSE);
if (Dll_OsBuild >= 8400)
SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", FALSE);
SysInfo_CanUseJobs = SbieApi_QueryConfBool(NULL, L"AllowBoxedJobs", TRUE);
SBIEDLL_HOOK(SysInfo_, NtCreateJobObject);
SBIEDLL_HOOK(SysInfo_, NtOpenJobObject);

View File

@ -1348,7 +1348,7 @@ _FX BOOLEAN Process_NotifyProcess_Create(
// boxed job to a process will not interfere with the job assigned by SbieSvc
//
new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, FALSE);
new_proc->can_use_jobs = Conf_Get_Boolean(new_proc->box->name, L"AllowBoxedJobs", 0, TRUE);
}
//

View File

@ -1188,9 +1188,7 @@ void CSandMan::OnStatusChanged()
int WizardLevel = theConf->GetBool("Options/WizardLevel", 0);
if (WizardLevel == 0) {
if (CSetupWizard::ShowWizard())
UpdateSettings();
else // if user canceled mark that and not show again
if (!CSetupWizard::ShowWizard()) // if user canceled mark that and not show again
theConf->SetValue("Options/WizardLevel", -1);
}
}
@ -1748,8 +1746,7 @@ void CSandMan::OnMaintenance()
}
else if (sender() == m_pSetupWizard) {
if (CSetupWizard::ShowWizard())
UpdateSettings();
CSetupWizard::ShowWizard();
return;
}
@ -1926,6 +1923,8 @@ void CSandMan::UpdateSettings()
if (m_Language != theConf->GetString("Options/UiLanguage"))
{
theConf->SetBlob("MainWindow/Log_Splitter", m_pLogSplitter->saveState());
LoadLanguage();
QTreeViewEx::m_ResetColumns = tr("Reset Columns");
@ -1939,11 +1938,14 @@ void CSandMan::UpdateSettings()
m_pMainLayout->removeWidget(m_pLogSplitter);
m_pLogSplitter->deleteLater();
CreateView();
m_pBoxView->ReloadUserConfig();
m_pTrayMenu->deleteLater();
CreateTrayMenu();
UpdateLabel();
m_pLogSplitter->restoreState(theConf->GetBlob("MainWindow/Log_Splitter"));
}
}

View File

@ -61,6 +61,8 @@ public:
QIcon GetBoxIcon(int boxType, bool inUse = false, bool inBusy = false);
QString GetBoxDescription(int boxType);
void SetViewMode(bool bAdvanced);
bool CheckCertificate();
void UpdateTheme();

View File

@ -69,7 +69,7 @@ void COptionsWindow::CreateAdvanced()
void COptionsWindow::LoadAdvanced()
{
ui.chkPreferExternalManifest->setChecked(m_pBox->GetBool("PreferExternalManifest", false));
ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", false));
ui.chkNestedJobs->setChecked(m_pBox->GetBool("AllowBoxedJobs", true));
ui.chkUseSbieWndStation->setChecked(m_pBox->GetBool("UseSbieWndStation", true));
ui.chkAddToJob->setChecked(!m_pBox->GetBool("NoAddProcessToJob", false));
@ -179,7 +179,7 @@ void COptionsWindow::SaveAdvanced()
WriteAdvancedCheck(ui.chkAddToJob, "NoAddProcessToJob", "", "y");
WriteAdvancedCheck(ui.chkProtectSCM, "UnrestrictedSCM", "", "y");
WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "y", "");
WriteAdvancedCheck(ui.chkNestedJobs, "AllowBoxedJobs", "", "n");
WriteAdvancedCheck(ui.chkRestrictServices, "RunServicesAsSystem", "", "y");
WriteAdvancedCheck(ui.chkElevateRpcss, "RunRpcssAsSystem", "y", "");
WriteAdvancedCheck(ui.chkProtectSystem, "ExposeBoxedSystem", "", "y");

View File

@ -5,6 +5,7 @@
#include "../Windows/SettingsWindow.h"
#include "../SandMan.h"
#include "Helpers/WinAdmin.h"
#include <QButtonGroup>
QString emailRegExp = QStringLiteral(".+@.+");
@ -13,6 +14,7 @@ CSetupWizard::CSetupWizard(QWidget *parent)
{
setPage(Page_Intro, new CIntroPage);
setPage(Page_Certificate, new CCertificatePage);
setPage(Page_UI, new CUIPage);
setPage(Page_Shell, new CShellPage);
setPage(Page_WFP, new CWFPPage);
setPage(Page_Finish, new CFinishPage);
@ -58,6 +60,16 @@ bool CSetupWizard::ShowWizard()
//QString Certificate = wizard.field("useCertificate").toString();
//bool isEvaluate = wizard.field("isEvaluate").toBool();
if (wizard.field("useAdvanced").toBool())
theConf->SetValue("Options/AdvancedView", true);
else if (wizard.field("useSimple").toBool())
theConf->SetValue("Options/AdvancedView", false);
if (wizard.field("useBrightMode").toInt())
theConf->SetValue("Options/UseDarkTheme", 0);
else if (wizard.field("useDarkMode").toInt())
theConf->SetValue("Options/UseDarkTheme", 1);
AutorunEnable(wizard.field("isAutoStart").toBool());
if (wizard.field("useContecxtMenu").toBool())
@ -77,6 +89,10 @@ bool CSetupWizard::ShowWizard()
theConf->SetValue("Options/WizardLevel", 1);
theGUI->SetViewMode(theConf->GetBool("Options/AdvancedView", true));
theGUI->UpdateSettings();
return true;
}
@ -105,15 +121,15 @@ CIntroPage::CIntroPage(QWidget *parent)
m_pLabel = new QLabel(tr("Select how you would like to use Sandboxie-Plus"));
layout->addWidget(m_pLabel);
m_pPersonalRadio = new QRadioButton(tr("&Personally, for private non-commercial use"));
layout->addWidget(m_pPersonalRadio);
connect(m_pPersonalRadio, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
registerField("usePersonal", m_pPersonalRadio);
m_pPersonal = new QRadioButton(tr("&Personally, for private non-commercial use"));
layout->addWidget(m_pPersonal);
connect(m_pPersonal, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
registerField("usePersonal", m_pPersonal);
m_pBusinessRadio = new QRadioButton(tr("&Commercially, for business or enterprise use"));
layout->addWidget(m_pBusinessRadio);
connect(m_pBusinessRadio, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
registerField("useBusiness", m_pBusinessRadio);
m_pBusiness = new QRadioButton(tr("&Commercially, for business or enterprise use"));
layout->addWidget(m_pBusiness);
connect(m_pBusiness, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
registerField("useBusiness", m_pBusiness);
QLabel* pNote = new QLabel(tr("Note: this option is immutable"));
layout->addWidget(pNote);
@ -121,10 +137,10 @@ CIntroPage::CIntroPage(QWidget *parent)
if (BusinessUse != 2) {
m_pLabel->setEnabled(false);
m_pPersonalRadio->setChecked(BusinessUse == 0);
m_pPersonalRadio->setEnabled(false);
m_pBusinessRadio->setChecked(BusinessUse == 1);
m_pBusinessRadio->setEnabled(false);
m_pPersonal->setChecked(BusinessUse == 0);
m_pPersonal->setEnabled(false);
m_pBusiness->setChecked(BusinessUse == 1);
m_pBusiness->setEnabled(false);
pNote->setEnabled(false);
}
@ -135,12 +151,12 @@ int CIntroPage::nextId() const
{
if(g_Certificate.isEmpty())
return CSetupWizard::Page_Certificate;
return CSetupWizard::Page_Shell;
return CSetupWizard::Page_UI;
}
bool CIntroPage::isComplete() const
{
if (m_pLabel->isEnabled() && !m_pPersonalRadio->isChecked() && !m_pBusinessRadio->isChecked())
if (m_pLabel->isEnabled() && !m_pPersonal->isChecked() && !m_pBusiness->isChecked())
return false;
return QWizardPage::isComplete();
}
@ -217,7 +233,7 @@ void CCertificatePage::initializePage()
int CCertificatePage::nextId() const
{
return CSetupWizard::Page_Shell;
return CSetupWizard::Page_UI;
}
bool CCertificatePage::isComplete() const
@ -240,6 +256,111 @@ bool CCertificatePage::validatePage()
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////
// CUIPage
//
CUIPage::CUIPage(QWidget* parent)
: QWizardPage(parent)
{
setTitle(tr("Configure <b>Sandboxie-Plus</b> UI"));
setSubTitle(tr("Sellect what UI style you preffer"));
QGridLayout* layout = new QGridLayout;
m_pAdvanced = new QRadioButton(tr("&Advanced UI for experts"));
m_pAdvanced->setChecked(theConf->GetBool("Options/AdvancedView", true));
layout->addWidget(m_pAdvanced, 0, 0);
registerField("useAdvanced", m_pAdvanced);
m_pSimple = new QRadioButton(tr("&Simple UI for beginners"));
m_pSimple->setChecked(!theConf->GetBool("Options/AdvancedView", true));
layout->addWidget(m_pSimple, 1, 0);
registerField("useSimple", m_pSimple);
QButtonGroup *buttonGroup1 = new QButtonGroup();
buttonGroup1->addButton(m_pAdvanced, 0);
buttonGroup1->addButton(m_pSimple, 1);
connect(buttonGroup1, SIGNAL(buttonClicked(int)), this, SLOT(UpdatePreview()));
QLabel* pDummy = new QLabel();
pDummy->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
layout->addWidget(pDummy, 0, 1, 5, 4);
pDummy->setStyleSheet("QLabel { background-color : " + QApplication::palette().color(QPalette::Base).name() + "; }");
m_pPreview = new QLabel();
m_pPreview->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
m_pPreview->setAlignment(Qt::AlignLeft | Qt::AlignTop);
layout->addWidget(m_pPreview, 0, 1, 5, 4);
QWidget* pSpacer = new QWidget();
pSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout->addWidget(pSpacer, 2, 0);
m_pBrightMode = new QRadioButton(tr("Use Bright Mode"));
layout->addWidget(m_pBrightMode, 3, 0);
registerField("useBrightMode", m_pBrightMode);
m_pDarkMode = new QRadioButton(tr("Use Dark Mode"));
layout->addWidget(m_pDarkMode, 4, 0);
registerField("useDarkMode", m_pDarkMode);
QButtonGroup *buttonGroup2 = new QButtonGroup();
buttonGroup2->addButton(m_pBrightMode, 0);
buttonGroup2->addButton(m_pDarkMode, 1);
connect(buttonGroup2, SIGNAL(buttonClicked(int)), this, SLOT(UpdatePreview()));
layout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1, 1, 1);
layout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2, 1, 1);
layout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 3, 1, 1);
layout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 4, 1, 1);
setLayout(layout);
}
void CUIPage::initializePage()
{
QTimer::singleShot(10, this, SLOT(UpdatePreview()));
}
void CUIPage::UpdatePreview()
{
bool bDark;
if (m_pDarkMode->isChecked())
bDark = true;
else if (m_pBrightMode->isChecked())
bDark = false;
else { // same as os
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
bDark = (settings.value("AppsUseLightTheme") == 0);
}
QPixmap preview;
if(m_pAdvanced->isChecked() && !bDark)
preview = QPixmap::fromImage(QImage(":/Assets/Advanced.png"));
else if(m_pAdvanced->isChecked() && bDark)
preview = QPixmap::fromImage(QImage(":/Assets/AdvancedD.png"));
else if(m_pSimple->isChecked() && !bDark)
preview = QPixmap::fromImage(QImage(":/Assets/Simple.png"));
else if(m_pSimple->isChecked() && bDark)
preview = QPixmap::fromImage(QImage(":/Assets/SimpleD.png"));
//QRect rect(0, 0, m_pPreview->width(), m_pPreview->height());
//m_pPreview->setPixmap(preview.scaled(preview.width()*5/10, preview.height()*5/10, Qt::KeepAspectRatio, Qt::SmoothTransformation).copy(rect));
//m_pPreview->setPixmap(preview.scaled(min(m_pPreview->width(), preview.width()), min(m_pPreview->height(), preview.height()), Qt::KeepAspectRatio, Qt::SmoothTransformation));
//m_pPreview->setPixmap(preview);
//m_pPreview->setPixmap(preview.scaled(preview.width()*7/10, preview.height()*7/10, Qt::KeepAspectRatio, Qt::SmoothTransformation));
m_pPreview->setPixmap(preview.scaled(min(preview.width(), max(preview.width()*7/10, m_pPreview->width())),
min(preview.height(),max(preview.height()*7/10, m_pPreview->height())), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
int CUIPage::nextId() const
{
return CSetupWizard::Page_Shell;
}
//////////////////////////////////////////////////////////////////////////////////////////
// CShellPage
//
@ -299,7 +420,7 @@ CWFPPage::CWFPPage(QWidget *parent)
layout->addWidget(pLabel);
m_pUseWFP = new QCheckBox(tr("Enable Windows Filtering Platform (WFP) support"));
m_pUseWFP->setChecked(false);
m_pUseWFP->setChecked(theAPI->GetGlobalSettings()->GetBool("NetworkEnableWFP", false));
layout->addWidget(m_pUseWFP);
registerField("useWFP", m_pUseWFP);

View File

@ -14,7 +14,7 @@ class CSetupWizard : public QWizard
Q_OBJECT
public:
enum { Page_Intro, Page_Certificate, Page_Shell, Page_WFP, Page_Finish };
enum { Page_Intro, Page_Certificate, Page_UI, Page_Shell, Page_WFP, Page_Finish };
CSetupWizard(QWidget *parent = nullptr);
@ -40,8 +40,8 @@ public:
private:
QLabel* m_pLabel;
QRadioButton *m_pPersonalRadio;
QRadioButton *m_pBusinessRadio;
QRadioButton *m_pPersonal;
QRadioButton *m_pBusiness;
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -66,6 +66,31 @@ private:
QCheckBox* m_pEvaluate;
};
//////////////////////////////////////////////////////////////////////////////////////////
// CUIPage
//
class CUIPage : public QWizardPage
{
Q_OBJECT
public:
CUIPage(QWidget *parent = nullptr);
void initializePage() override;
int nextId() const override;
private slots:
void UpdatePreview();
private:
QRadioButton *m_pSimple;
QRadioButton *m_pAdvanced;
QLabel* m_pPreview;
QRadioButton* m_pBrightMode;
QRadioButton* m_pDarkMode;
};
//////////////////////////////////////////////////////////////////////////////////////////
// CShellPage
//