diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ec4e87..6f9a70c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/). +## [1.6.0a / 5.61.0] - 2022-??-?? + +#fixed +- fixed issue with support setting drop down menu multiplying [2502#](https://github.com/sandboxie-plus/Sandboxie/pull/2502) (okrc) +- Add translations folder to deprecated [#2500](https://github.com/sandboxie-plus/Sandboxie/pull/2500) (lufog) +- fixed issue with boolean settings which can also be set per process [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495) + + ## [1.6.0 / 5.61.0] - 2022-11-26 ### Added diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.cpp index 447eb104..fa7d85a6 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.cpp @@ -59,6 +59,17 @@ SB_STATUS CSbieIni::SetBool(const QString& Setting, bool Value) return SetText(Setting, Value ? "y" : "n"); } +SB_STATUS CSbieIni::SetBoolSafe(const QString& Setting, bool Value) +{ + QStringList Values = GetTextList(Setting, false); + foreach(const QString & StrValue, Values) { + if (StrValue.contains(",")) + continue; + DelValue(Setting, StrValue); + } + return InsertText(Setting, Value ? "y" : "n"); +} + QString CSbieIni::GetText(const QString& Setting, const QString& Default, bool bWithGlobal, bool bNoExpand, bool withTemplates) const { int flags = (bWithGlobal ? 0 : CONF_GET_NO_GLOBAL); @@ -92,11 +103,15 @@ __int64 CSbieIni::GetNum64(const QString& Setting, __int64 Default, bool bWithGl bool CSbieIni::GetBool(const QString& Setting, bool Default, bool bWithGlobal, bool withTemplates) const { - QString StrValue = GetText(Setting, QString(), bWithGlobal, true, withTemplates); - if (StrValue.compare("y", Qt::CaseInsensitive) == 0) - return true; - if (StrValue.compare("n", Qt::CaseInsensitive) == 0) - return false; + QStringList Values = GetTextList(Setting, withTemplates, false, bWithGlobal); + foreach(const QString &StrValue, Values) { + if (StrValue.contains(",")) + continue; + if (StrValue.compare("y", Qt::CaseInsensitive) == 0) + return true; + if (StrValue.compare("n", Qt::CaseInsensitive) == 0) + return false; + } return Default; } diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.h b/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.h index 7c22e97b..3fe3a534 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.h +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SbieIni.h @@ -19,6 +19,7 @@ public: virtual SB_STATUS SetNum(const QString& Setting, int Value); virtual SB_STATUS SetNum64(const QString& Setting, __int64 Value); virtual SB_STATUS SetBool(const QString& Setting, bool Value); + virtual SB_STATUS SetBoolSafe(const QString& Setting, bool Value); virtual QString GetText(const QString& Setting, const QString& Default = QString(), bool bWithGlobal = false, bool bNoExpand = true, bool withTemplates = false) const; virtual int GetNum(const QString& Setting, int Default = 0, bool bWithGlobal = false, bool withTemplates = false) const; diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 4625ab4d..74f5d1b7 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -684,12 +684,12 @@ void CSandBoxPlus::SetINetBlock(bool bEnable) void CSandBoxPlus::SetAllowShares(bool bEnable) { - SetBool("BlockNetworkFiles", !bEnable); + SetBoolSafe("BlockNetworkFiles", !bEnable); } void CSandBoxPlus::SetDropRights(bool bEnable) { - SetBool("DropAdminRights", bEnable); + SetBoolSafe("DropAdminRights", bEnable); } QStringList::iterator FindInStrList(QStringList& list, const QString& str) diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 3580fd65..6637d483 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -1078,25 +1078,25 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList& SandB Results.append(SandBoxes.first()->RunStart("C:\\WINDOWS\\SysWOW64\\cmd.exe")); else if (Action == m_pMenuPresetsShowUAC) { - SandBoxes.first()->SetBool("DropAdminRights", false); - SandBoxes.first()->SetBool("FakeAdminRights", false); + SandBoxes.first()->SetBoolSafe("DropAdminRights", false); + SandBoxes.first()->SetBoolSafe("FakeAdminRights", false); } else if (Action == m_pMenuPresetsNoAdmin) { - SandBoxes.first()->SetBool("DropAdminRights", true); - SandBoxes.first()->SetBool("FakeAdminRights", false); + SandBoxes.first()->SetBoolSafe("DropAdminRights", true); + SandBoxes.first()->SetBoolSafe("FakeAdminRights", false); } else if (Action == m_pMenuPresetsFakeAdmin) { - SandBoxes.first()->SetBool("DropAdminRights", true); - SandBoxes.first()->SetBool("FakeAdminRights", true); + SandBoxes.first()->SetBoolSafe("DropAdminRights", true); + SandBoxes.first()->SetBoolSafe("FakeAdminRights", true); } else if (Action == m_pMenuPresetsINet) SandBoxes.first().objectCast()->SetINetBlock(m_pMenuPresetsINet->isChecked()); else if (Action == m_pMenuPresetsShares) SandBoxes.first().objectCast()->SetAllowShares(m_pMenuPresetsShares->isChecked()); else if (Action == m_pMenuPresetsRecovery) - m_pMenuPresetsRecovery->setChecked(SandBoxes.first()->SetBool("AutoRecover", m_pMenuPresetsRecovery->isChecked())); + m_pMenuPresetsRecovery->setChecked(SandBoxes.first()->SetBoolSafe("AutoRecover", m_pMenuPresetsRecovery->isChecked())); else if (Action == m_pMenuOptions) ShowOptions(SandBoxes.first()); else if (Action == m_pMenuBrowse) diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 947fe673..f39c6594 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -759,20 +759,23 @@ void COptionsWindow::WriteAdvancedCheck(QCheckBox* pCheck, const QString& Name, if (!pCheck->isEnabled()) return; + QStringList Values = m_pBox->GetTextList(Name, false); + foreach(const QString & StrValue, Values) { + if (StrValue.contains(",")) + continue; + m_pBox->DelValue(Name, StrValue); + } + SB_STATUS Status; if (pCheck->checkState() == Qt::Checked) { - if(!OnValue.isEmpty()) - Status = m_pBox->SetText(Name, OnValue); - else - Status = m_pBox->DelValue(Name); + if (!OnValue.isEmpty()) + Status = m_pBox->InsertText(Name, OnValue); } else if (pCheck->checkState() == Qt::Unchecked) { if (!OffValue.isEmpty()) - Status = m_pBox->SetText(Name, OffValue); - else - Status = m_pBox->DelValue(Name); + Status = m_pBox->InsertText(Name, OffValue); } if (!Status) diff --git a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp index a533cd6f..b34490b5 100644 --- a/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/RecoveryWindow.cpp @@ -590,7 +590,7 @@ void CRecoveryWindow::OnCloseUntil() void CRecoveryWindow::OnAutoDisable() { m_pBox.objectCast()->SetSuspendRecovery(); - m_pBox->SetBool("AutoRecover", false); + m_pBox->SetBoolSafe("AutoRecover", false); close(); } diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 0140cc2d..abf47796 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -3,7 +3,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 6 #define VERSION_REV 0 -#define VERSION_UPD 0 +#define VERSION_UPD 1 #ifndef STR #define STR2(X) #X