1.12.8
This commit is contained in:
parent
bf43dd0d43
commit
7997025f4e
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
@ -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("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -159,7 +159,7 @@ protected:
|
|||
|
||||
QMap<CSbieProgress*, QPair<CSbieProgressPtr, QPointer<QWidget>>> m_pAsyncProgress;
|
||||
|
||||
QStringList m_MissingTemplates;
|
||||
QMap<QString, QSet<QString>> m_MissingTemplates;
|
||||
|
||||
enum EBoxColors
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue