Update NewBoxWizard

- added checkbox for PromptForInternetAccess option
- improved boxToken checkbox
This commit is contained in:
offhub 2024-06-14 19:09:00 +03:00
parent 7a2a6e1728
commit 7b771c35a8
No known key found for this signature in database
GPG Key ID: 7B12A8941851DA59
3 changed files with 60 additions and 20 deletions

View File

@ -12,6 +12,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed issue with "UseCreateToken=y" when using a MSFT online account - fixed issue with "UseCreateToken=y" when using a MSFT online account
- fixed Export sandbox not containing hidden files [#3980](https://github.com/sandboxie-plus/Sandboxie/issues/3980) (thanks L4cache) - fixed Export sandbox not containing hidden files [#3980](https://github.com/sandboxie-plus/Sandboxie/issues/3980) (thanks L4cache)
### Added
- added checkbox for PromptForInternetAccess option to the New Box Wizard

View File

@ -247,7 +247,12 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
} }
pBox->SetBool("BlockNetworkFiles", !field("shareAccess").toBool()); pBox->SetBool("BlockNetworkFiles", !field("shareAccess").toBool());
bool bAllowNetwork = field("blockNetwork").toInt() == 0;
if (field("promptAccess").toBool() && !bAllowNetwork)
pBox->SetBool("PromptForInternetAccess", true);
bool bHardened = (BoxType == CSandBoxPlus::eHardenedPlus || BoxType == CSandBoxPlus::eHardened); bool bHardened = (BoxType == CSandBoxPlus::eHardenedPlus || BoxType == CSandBoxPlus::eHardened);
bool bAppBox = (BoxType == CSandBoxPlus::eAppBoxPlus || BoxType == CSandBoxPlus::eAppBox);
bool bDropAdmin = field("dropAdmin").toBool(); bool bDropAdmin = field("dropAdmin").toBool();
if (field("dropAdmin").toBool() && !bHardened) if (field("dropAdmin").toBool() && !bHardened)
pBox->SetBool("DropAdminRights", true); pBox->SetBool("DropAdminRights", true);
@ -258,7 +263,7 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
if(field("msiServer").toBool() && !bDropAdmin && !bHardened) if(field("msiServer").toBool() && !bDropAdmin && !bHardened)
pBox->SetBool("MsiInstallerExemptions", true); pBox->SetBool("MsiInstallerExemptions", true);
if(field("boxToken").toBool()) if(field("boxToken").toBool() && !bAppBox)
pBox->SetBool("SandboxieLogon", true); pBox->SetBool("SandboxieLogon", true);
if(field("imagesProtection").toBool()) if(field("imagesProtection").toBool())
@ -729,6 +734,7 @@ CIsolationPage::CIsolationPage(QWidget *parent)
pNetAccess->addItem(tr("Block network/internet using Windows Filtering Platform")); pNetAccess->addItem(tr("Block network/internet using Windows Filtering Platform"));
pNetAccess->setCurrentIndex(theConf->GetInt("BoxDefaults/BlockNetwork", 0)); pNetAccess->setCurrentIndex(theConf->GetInt("BoxDefaults/BlockNetwork", 0));
layout->addWidget(pNetAccess, row++, 1, 1, 3); layout->addWidget(pNetAccess, row++, 1, 1, 3);
connect(pNetAccess, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBlockNetworkChanged(int)));
registerField("blockNetwork", pNetAccess); registerField("blockNetwork", pNetAccess);
m_pShareAccess = new QCheckBox(tr("Allow access to network files and folders")); m_pShareAccess = new QCheckBox(tr("Allow access to network files and folders"));
@ -737,6 +743,11 @@ CIsolationPage::CIsolationPage(QWidget *parent)
layout->addWidget(m_pShareAccess, row++, 1, 1, 3); layout->addWidget(m_pShareAccess, row++, 1, 1, 3);
registerField("shareAccess", m_pShareAccess); registerField("shareAccess", m_pShareAccess);
m_pPromptAccess = new QCheckBox(tr("Prompt user whether to allow an exemption from the blockade"));
m_pPromptAccess->setChecked(theConf->GetBool("BoxDefaults/PromptAccess", false));
layout->addWidget(m_pPromptAccess, row++, 1, 1, 3);
registerField("promptAccess", m_pPromptAccess);
QLabel* pAdminLabel = new QLabel(tr("Admin Options"), this); QLabel* pAdminLabel = new QLabel(tr("Admin Options"), this);
pAdminLabel->setFont(fnt); pAdminLabel->setFont(fnt);
@ -798,7 +809,14 @@ void CIsolationPage::initializePage()
m_pDropAdmin->setChecked(bDropAdmin || bHardened); m_pDropAdmin->setChecked(bDropAdmin || bHardened);
bool bAppBox = (BoxType == CSandBoxPlus::eAppBoxPlus || BoxType == CSandBoxPlus::eAppBox); bool bAppBox = (BoxType == CSandBoxPlus::eAppBoxPlus || BoxType == CSandBoxPlus::eAppBox);
bool bBoxToken = field("boxToken").toBool();
m_pBoxToken->setEnabled(!bAppBox); m_pBoxToken->setEnabled(!bAppBox);
m_pBoxToken->setChecked(!bAppBox && bBoxToken);
bool bAllowNetwork = field("blockNetwork").toInt() == 0;
bool bPromptAccess = field("promptAccess").toBool();
m_pPromptAccess->setEnabled(!bAllowNetwork);
m_pPromptAccess->setChecked(!bAllowNetwork && bPromptAccess);
} }
bool CIsolationPage::validatePage() bool CIsolationPage::validatePage()
@ -815,6 +833,20 @@ void CIsolationPage::OnDropAdminChanged(int state) {
else { else {
// If m_pDropAdmin is unchecked, enable m_pMSIServer // If m_pDropAdmin is unchecked, enable m_pMSIServer
m_pMSIServer->setEnabled(true); m_pMSIServer->setEnabled(true);
m_pMSIServer->setChecked(theConf->GetBool("BoxDefaults/MsiExemptions", false));
}
}
void CIsolationPage::OnBlockNetworkChanged(int index) {
if (index == 0) {
// If network access is allowed, disable m_pPromptAccess
m_pPromptAccess->setEnabled(false);
m_pPromptAccess->setChecked(false);
}
else {
// If network access is blocked, enable m_pPromptAccess
m_pPromptAccess->setEnabled(true);
m_pPromptAccess->setChecked(theConf->GetBool("BoxDefaults/PromptAccess", false));
} }
} }
@ -993,6 +1025,7 @@ bool CSummaryPage::validatePage()
theConf->SetValue("BoxDefaults/BlockNetwork", field("blockNetwork").toInt()); theConf->SetValue("BoxDefaults/BlockNetwork", field("blockNetwork").toInt());
theConf->SetValue("BoxDefaults/ShareAccess", field("shareAccess").toBool()); theConf->SetValue("BoxDefaults/ShareAccess", field("shareAccess").toBool());
theConf->SetValue("BoxDefaults/PromptAccess", field("promptAccess").toBool());
theConf->SetValue("BoxDefaults/DropAdmin", field("dropAdmin").toBool()); theConf->SetValue("BoxDefaults/DropAdmin", field("dropAdmin").toBool());
theConf->SetValue("BoxDefaults/FakeAdmin", field("fakeAdmin").toBool()); theConf->SetValue("BoxDefaults/FakeAdmin", field("fakeAdmin").toBool());

View File

@ -118,11 +118,15 @@ public:
bool validatePage() override; bool validatePage() override;
void OnDropAdminChanged(int state); void OnDropAdminChanged(int state);
private slots:
void OnBlockNetworkChanged(int index);
private: private:
QCheckBox* m_pShareAccess; QCheckBox* m_pShareAccess;
QCheckBox* m_pMSIServer; QCheckBox* m_pMSIServer;
QCheckBox* m_pDropAdmin; QCheckBox* m_pDropAdmin;
QCheckBox* m_pBoxToken; QCheckBox* m_pBoxToken;
QCheckBox* m_pPromptAccess;
}; };