This commit is contained in:
DavidXanatos 2023-05-21 14:48:58 +02:00
parent cdd952433d
commit 51bf9bdea5
9 changed files with 52 additions and 21 deletions

View File

@ -20,7 +20,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- improved compatibility template for Privacy Enhanced box types (thanks offhub) [#2899](https://github.com/sandboxie-plus/Sandboxie/pull/2899)
- improved support page in settings and reminder [#2896](https://github.com/sandboxie-plus/Sandboxie/issues/2896)
- improved signature error message [#2931](https://github.com/sandboxie-plus/Sandboxie/issues/2931)
- changed Don't show "No Inet" when exceptions exist [#2919](https://github.com/sandboxie-plus/Sandboxie/issues/2919)
### Fixed
- fixed Qt6 issues in ARM64 build
@ -35,7 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed System tray icon hourglass overlay gets stuck when operation is stopped [#2869](https://github.com/sandboxie-plus/Sandboxie/issues/2869)
- fixed File Panel doesn't allow to adjust columns size in a permanent way [#2930](https://github.com/sandboxie-plus/Sandboxie/issues/2930)
- fixed Renaming a box with sandboxed run entries can break those entries. [#2921](https://github.com/sandboxie-plus/Sandboxie/issues/2921)
- fixed WFP not enabled after Setup Wizard [#2915](https://github.com/sandboxie-plus/Sandboxie/issues/2915)

View File

@ -1263,7 +1263,7 @@ QString CSandMan::GetBoxDescription(int boxType)
}
if(boxType == CSandBoxPlus::eHardenedPlus || boxType == CSandBoxPlus::eDefaultPlus || boxType == CSandBoxPlus::eAppBoxPlus)
Info.append(tr("\n\nThis box <a href=\"sbie://docs/privacy-mode\">prevents access to all user data</a> locations, except explicitly granted in the Resource Access options."));
Info.append(tr("<br /><br />This box <a href=\"sbie://docs/privacy-mode\">prevents access to all user data</a> locations, except explicitly granted in the Resource Access options."));
return Info;
}
@ -2913,6 +2913,8 @@ void CSandMan::OnIniReloaded()
m_pBoxView->ReloadUserConfig();
m_pPopUpWindow->ReloadHiddenMessages();
g_FeatureFlags = theAPI->GetFeatureFlags();
}
void CSandMan::OnMonitoring()

View File

@ -35,6 +35,8 @@ public:
static QString GetVersion();
bool IsWFPEnabled() const { return (g_FeatureFlags & CSbieAPI::eSbieFeatureWFP) != 0; }
SB_PROGRESS RecoverFiles(const QString& BoxName, const QList<QPair<QString, QString>>& FileList, QWidget* pParent, int Action = 0);
SB_PROGRESS CheckFiles(const QString& BoxName, const QStringList& Files);

View File

@ -123,6 +123,7 @@ CSandBoxPlus::CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI) : CSand
{
m_bLogApiFound = false;
m_bINetBlocked = false;
m_bINetExceptions = false;
m_bSharesAllowed = false;
m_bDropRights = false;
@ -337,13 +338,23 @@ void CSandBoxPlus::UpdateDetails()
break;
}
}
foreach(const QString& Entry, GetTextList("AllowNetworkAccess", false)) {
if (Entry == "!<InternetAccess>,n") {
m_bINetBlocked = true;
break;
if (theGUI->IsWFPEnabled()) {
foreach(const QString & Entry, GetTextList("AllowNetworkAccess", false)) {
if (Entry == "!<InternetAccess>,n") {
m_bINetBlocked = true;
break;
}
}
}
if (m_bINetBlocked) {
foreach(const QString& Entry, GetTextList("ProcessGroup", true)) {
StrPair NameList = Split2(Entry, ",");
if (NameList.first == "<InternetAccess>" && !NameList.second.isEmpty()) {
m_bINetExceptions = true;
break;
}
}
}
m_bSharesAllowed = GetBool("BlockNetworkFiles", true) == false;
@ -661,8 +672,12 @@ QString CSandBoxPlus::GetStatusStr() const
if (m_bLogApiFound)
Status.append(tr("API Log"));
if (m_bINetBlocked)
Status.append(tr("No INet"));
if (m_bINetBlocked) {
if(m_bINetExceptions)
Status.append(tr("No INet (with Exceptions)"));
else
Status.append(tr("No INet"));
}
if (m_bSharesAllowed)
Status.append(tr("Net Share"));
if (m_bDropRights && !m_bSecurityEnhanced)
@ -724,8 +739,12 @@ void CSandBoxPlus::SetLogApi(bool bEnable)
void CSandBoxPlus::SetINetBlock(bool bEnable)
{
if (bEnable)
InsertText("ClosedFilePath", "!<InternetAccess>,InternetAccessDevices");
if (bEnable) {
if(theGUI->IsWFPEnabled())
InsertText("AllowNetworkAccess", "!<InternetAccess>,n");
else
InsertText("ClosedFilePath", "!<InternetAccess>,InternetAccessDevices");
}
else
{
foreach(const QString& Entry, GetTextList("ClosedFilePath", false))
@ -733,6 +752,11 @@ void CSandBoxPlus::SetINetBlock(bool bEnable)
if (Entry.contains("InternetAccessDevices"))
DelValue("ClosedFilePath", Entry);
}
foreach(const QString& Entry, GetTextList("AllowNetworkAccess", false))
{
if (Entry.contains("!<InternetAccess>,n"))
DelValue("AllowNetworkAccess", Entry);
}
}
}

View File

@ -209,6 +209,7 @@ protected:
bool m_bLogApiFound;
bool m_bINetBlocked;
bool m_bINetExceptions;
bool m_bSharesAllowed;
bool m_bDropRights;

View File

@ -43,15 +43,14 @@ void COptionsWindow::CreateNetwork()
void COptionsWindow::LoadINetAccess()
{
m_IsEnabledWFP = m_pBox->GetAPI()->GetGlobalSettings()->GetBool("NetworkEnableWFP", false);
// check if we are blocking globally and if so adapt the behaviour accordingly
m_WFPisBlocking = !m_pBox->GetAPI()->GetGlobalSettings()->GetBool("AllowNetworkAccess", true);
ui.lblNoWfp->setVisible(!m_IsEnabledWFP); // warn user that this is only user mode
ui.lblNoWfp->setVisible(!theGUI->IsWFPEnabled()); // warn user that this is only user mode
ui.cmbBlockINet->clear();
ui.cmbBlockINet->addItem(tr("Allow access"), 0);
if (m_IsEnabledWFP) ui.cmbBlockINet->addItem(tr("Block using Windows Filtering Platform"), 1);
if (theGUI->IsWFPEnabled()) ui.cmbBlockINet->addItem(tr("Block using Windows Filtering Platform"), 1);
ui.cmbBlockINet->addItem(tr("Block by denying access to Network devices"), 2);
m_INetBlockChanged = false;
@ -76,7 +75,7 @@ void COptionsWindow::SaveINetAccess()
QTreeWidgetItem* pBlockedNet = FindGroupByName("<BlockNetAccess>");
if (pBlockedNet && pBlockedNet->childCount() > 0) {
if (m_IsEnabledWFP && !FindEntryInSettingList("AllowNetworkAccess", "<BlockNetAccess>,n"))
if (theGUI->IsWFPEnabled() && !FindEntryInSettingList("AllowNetworkAccess", "<BlockNetAccess>,n"))
m_pBox->InsertText("AllowNetworkAccess", "<BlockNetAccess>,n");
}
else
@ -123,7 +122,7 @@ void COptionsWindow::LoadBlockINet()
{
if (IsAccessEntrySet(eFile, "!<InternetAccess>", eClosed, "InternetAccessDevices"))
ui.cmbBlockINet->setCurrentIndex(ui.cmbBlockINet->findData(2));
else if (m_IsEnabledWFP && (FindEntryInSettingList("AllowNetworkAccess", "!<InternetAccess>,n")
else if (theGUI->IsWFPEnabled() && (FindEntryInSettingList("AllowNetworkAccess", "!<InternetAccess>,n")
|| (m_WFPisBlocking && !FindEntryInSettingList("AllowNetworkAccess", "y"))))
ui.cmbBlockINet->setCurrentIndex(ui.cmbBlockINet->findData(1));
else
@ -156,7 +155,7 @@ void COptionsWindow::LoadBlockINet()
SetProgramItem(Value, pItem, 0);
pItem->setData(1, Qt::UserRole, Mode);
if (!m_IsEnabledWFP && Mode == 1) Mode = -1; // this mode is not available
if (!theGUI->IsWFPEnabled() && Mode == 1) Mode = -1; // this mode is not available
pItem->setText(1, GetINetModeStr(Mode));
ui.treeINet->addTopLevelItem(pItem);
@ -208,7 +207,7 @@ void COptionsWindow::OnINetItemDoubleClicked(QTreeWidgetItem* pItem, int Column)
QComboBox* pMode = new QComboBox();
for (int i = 0; i < 3; i++) {
if (!m_IsEnabledWFP && i == 1) continue; // this mode is not available
if (!theGUI->IsWFPEnabled() && i == 1) continue; // this mode is not available
pMode->addItem(GetINetModeStr(i), i);
}
pMode->setCurrentIndex(pMode->findData(pItem->data(1, Qt::UserRole)));

View File

@ -506,7 +506,6 @@ protected:
bool m_RecoveryChanged;
bool m_AdvancedChanged;
bool m_IsEnabledWFP;
bool m_WFPisBlocking;
bool m_Template;

View File

@ -439,7 +439,7 @@ CAdvancedPage::CAdvancedPage(QWidget *parent)
QComboBox* pNetAccess = new QComboBox();
pNetAccess->addItem(tr("Allow network/internet access"));
pNetAccess->addItem(tr("Block network/internet by denying access to Network devices"));
if (theAPI->GetGlobalSettings()->GetBool("NetworkEnableWFP", false))
if (theGUI->IsWFPEnabled())
pNetAccess->addItem(tr("Block network/internet using Windows Filtering Platform"));
pNetAccess->setCurrentIndex(theConf->GetInt("BoxDefaults/BlockNetwork", 0));
layout->addWidget(pNetAccess, row++, 1, 1, 3);

View File

@ -81,8 +81,10 @@ bool CSetupWizard::ShowWizard()
if (wizard.field("useBrowserIcon").toBool())
CSettingsWindow__AddBrowserIcon();
if (wizard.field("useWFP").toBool())
if (wizard.field("useWFP").toBool()) {
theAPI->GetGlobalSettings()->SetBool("NetworkEnableWFP", true);
theAPI->ReloadConfig(true);
}
if (wizard.field("isUpdate").toBool()) {
theConf->SetValue("Options/CheckForUpdates", 1);