Skip to content

Commit

Permalink
1.12.8
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Jan 29, 2024
1 parent bf43dd0 commit 7997025
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Sandboxie/core/drv/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static NTSTATUS Conf_Merge_Global(

static NTSTATUS Conf_Merge_Template(
CONF_DATA *data, ULONG session_id,
const WCHAR *tmpl_name, CONF_SECTION *section);
const WCHAR *tmpl_name, CONF_SECTION *section, const WCHAR* name);

static const WCHAR *Conf_Get_Helper(
const WCHAR *section_name, const WCHAR *setting_name,
Expand Down Expand Up @@ -866,7 +866,7 @@ _FX NTSTATUS Conf_Merge_Templates(CONF_DATA *data, ULONG session_id)
//

status = Conf_Merge_Template(
data, session_id, setting->value, sandbox);
data, session_id, setting->value, sandbox, NULL);

if (! NT_SUCCESS(status))
return status;
Expand Down Expand Up @@ -955,7 +955,7 @@ _FX NTSTATUS Conf_Merge_Global(
//

status = Conf_Merge_Template(
data, session_id, setting->value, sandbox);
data, session_id, setting->value, sandbox, L"GlobalSettings");

if (! NT_SUCCESS(status))
return status;
Expand Down Expand Up @@ -985,7 +985,7 @@ _FX NTSTATUS Conf_Merge_Global(

_FX NTSTATUS Conf_Merge_Template(
CONF_DATA *data, ULONG session_id,
const WCHAR *tmpl_name, CONF_SECTION *section)
const WCHAR *tmpl_name, CONF_SECTION *section, const WCHAR* name)
{
CONF_SECTION *tmpl = NULL;

Expand Down Expand Up @@ -1036,7 +1036,7 @@ _FX NTSTATUS Conf_Merge_Template(
} else {

Log_Msg_Session(MSG_CONF_MISSING_TMPL,
section->name, tmpl_name, session_id);
name ? name : section->name, tmpl_name, session_id);
}

return STATUS_SUCCESS;
Expand Down
39 changes: 25 additions & 14 deletions SandboxiePlus/SandMan/SandMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,17 +1827,20 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)

if (!m_MissingTemplates.isEmpty())
{
if (m_MissingTemplates[0] == "") {
m_MissingTemplates.clear();
return;
}

int CleanupTemplates = theConf->GetInt("Options/AutoCleanupTemplates", -1);
if (CleanupTemplates == -1)
{
QStringList AllTemplates;
foreach(const QSet<QString>& Templates, m_MissingTemplates) {
foreach(const QString & Template, Templates) {
if (!AllTemplates.contains(Template))
AllTemplates.append(Template);
}
}

bool State = false;
CleanupTemplates = CCheckableMessageBox::question(this, "Sandboxie-Plus", tr("Some compatibility templates (%1) are missing, probably deleted, do you want to remove them from all boxes?")
.arg(m_MissingTemplates.join(", "))
.arg(AllTemplates.join(", "))
, tr("Don't show this message again."), &State, QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::Yes, QMessageBox::Information) == QDialogButtonBox::Yes ? 1 : 0;

if (State)
Expand All @@ -1846,18 +1849,26 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)

if (CleanupTemplates)
{
foreach(const QString& Template, m_MissingTemplates)
for(auto I = m_MissingTemplates.begin(); I != m_MissingTemplates.end(); ++I)
{
theAPI->GetGlobalSettings()->DelValue("Template", Template);
foreach(const CSandBoxPtr& pBox, theAPI->GetAllBoxes())
pBox->DelValue("Template", Template);
QSharedPointer<CSbieIni> Section;
if (I.key() == "GlobalSettings")
Section = theAPI->GetGlobalSettings();
else
Section = theAPI->GetBoxByName(I.key());
if (!Section) continue;

Section->SetRefreshOnChange(false);
foreach(const QString & Template, I.value())
Section->DelValue("Template", Template);
Section->SetRefreshOnChange(true);
}

theAPI->CommitIniChanges();

OnLogMessage(tr("Cleaned up removed templates..."));
}
m_MissingTemplates.clear();

m_MissingTemplates.append("");
}
}

Expand Down Expand Up @@ -2738,8 +2749,8 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui

if ((MsgCode & 0xFFFF) == 1411) // removed/missing template
{
if(MsgData.size() >= 3 && !m_MissingTemplates.contains(MsgData[2]))
m_MissingTemplates.append(MsgData[2]);
if (MsgData.size() >= 3)
m_MissingTemplates[MsgData[1]].insert(MsgData[2]);
}

if ((MsgCode & 0xFFFF) == 6004 || (MsgCode & 0xFFFF) == 6008 || (MsgCode & 0xFFFF) == 6009) // certificate error
Expand Down
2 changes: 1 addition & 1 deletion SandboxiePlus/SandMan/SandMan.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class CSandMan : public QMainWindow

QMap<CSbieProgress*, QPair<CSbieProgressPtr, QPointer<QWidget>>> m_pAsyncProgress;

QStringList m_MissingTemplates;
QMap<QString, QSet<QString>> m_MissingTemplates;

enum EBoxColors
{
Expand Down

0 comments on commit 7997025

Please sign in to comment.