This commit is contained in:
DavidXanatos 2022-11-29 16:49:16 +01:00
parent 9272a077cd
commit 7f77d5eed6
8 changed files with 50 additions and 23 deletions

View File

@ -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

View File

@ -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);
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;
}

View File

@ -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;

View File

@ -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)

View File

@ -1078,25 +1078,25 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& 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<CSandBoxPlus>()->SetINetBlock(m_pMenuPresetsINet->isChecked());
else if (Action == m_pMenuPresetsShares)
SandBoxes.first().objectCast<CSandBoxPlus>()->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)

View File

@ -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);
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)

View File

@ -590,7 +590,7 @@ void CRecoveryWindow::OnCloseUntil()
void CRecoveryWindow::OnAutoDisable()
{
m_pBox.objectCast<CSandBoxPlus>()->SetSuspendRecovery();
m_pBox->SetBool("AutoRecover", false);
m_pBox->SetBoolSafe("AutoRecover", false);
close();
}

View File

@ -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