This commit is contained in:
DavidXanatos 2023-07-06 21:12:22 +02:00
parent b4bcfaf262
commit ffb75551eb
6 changed files with 115 additions and 63 deletions

View File

@ -25,6 +25,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added `What's new in Sandboxie-Plus` dialog in SbieCtrl.exe to praise the new features of the Plus UI
- Note: this is shown after the installation of Sandboxie Classic
- added "fixdacls" command to KmdUtil.exe, it repairs broken DACL entries on the Sandboxie folder to fix issues where SbieDll.dll fails to load
- added option to hide sandboxies's own processes [#3054](https://github.com/sandboxie-plus/Sandboxie/issues/3054)
- added Cache Sandboxie messages within the Plus UI [#2920](https://github.com/sandboxie-plus/Sandboxie/issues/2920)
### Changed
- setup wizard has now a dedicated update configuration page

View File

@ -812,16 +812,6 @@
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_15">
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkBackground">
<property name="text">
<string>Show &quot;Pizza&quot; Background in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="chkOptTree">
<property name="text">
@ -842,7 +832,6 @@
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
@ -852,6 +841,20 @@
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="chkColorIcons">
<property name="text">
<string>Make Box Icons match the Border Color</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3">
<widget class="QCheckBox" name="chkOverlayIcons">
<property name="text">
<string>Show overlay icons for boxes and processes</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="chkFusionTheme">
<property name="text">
@ -862,6 +865,16 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkLargeIcons">
<property name="text">
<string>Use large icons in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="chkNoIcons">
<property name="text">
@ -872,20 +885,20 @@
</property>
</widget>
</item>
<item row="9" column="1" colspan="3">
<widget class="QCheckBox" name="chkOverlayIcons">
<item row="12" column="0" colspan="4">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Show overlay icons for boxes and processes</string>
<string>* a partially checked checkbox will leave the behavior to be determined by the view mode.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkLargeIcons">
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkAltRows">
<property name="text">
<string>Use large icons in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
<string>Alternate row background in lists</string>
</property>
</widget>
</item>
@ -909,21 +922,17 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkAltRows">
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkBackground">
<property name="text">
<string>Alternate row background in lists</string>
<string>Show &quot;Pizza&quot; Background in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="chkColorIcons">
<property name="text">
<string>Make Box Icons match the Border Color</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="11" column="1">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -936,13 +945,10 @@
</property>
</spacer>
</item>
<item row="11" column="0" colspan="4">
<widget class="QLabel" name="label_11">
<item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="chkHideCore">
<property name="text">
<string>* a partially checked checkbox will leave the behavior to be determined by the view mode.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Hide sandboxie's own processes from the task list</string>
</property>
</widget>
</item>

View File

@ -126,6 +126,7 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
bool bVintage = theConf->GetInt("Options/ViewMode", 1) == 2;
if (bVintage)
bPlus = false;
bool bHideCore = theConf->GetBool("Options/HideSbieProcesses", false);
foreach(const QString& Group, Groups.keys())
{
@ -219,6 +220,15 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
QMap<quint32, CBoxedProcessPtr> ProcessList = pBox->GetProcessList();
if (bHideCore) {
for (auto I = ProcessList.begin(); I != ProcessList.end();) {
if (I.value()->GetFileName().indexOf(theAPI->GetSbiePath() + "\\Sandboxie", Qt::CaseInsensitive) == 0)
I = ProcessList.erase(I);
else
++I;
}
}
bool inUse = Sync(pBox, pNode->Path, ProcessList, New, Old, Added);
bool Busy = pBoxEx->IsBoxBusy();
int boxType = pBoxEx->GetType();

View File

@ -2371,6 +2371,11 @@ void CSandMan::AddLogMessage(const QString& Message)
if (!m_pMessageLog)
return;
AddLogMessage(QDateTime::currentDateTime(), Message);
}
void CSandMan::AddLogMessage(const QDateTime& TimeStamp, const QString& Message)
{
int last = m_pMessageLog->GetTree()->topLevelItemCount();
if (last > 0) {
QTreeWidgetItem* pItem = m_pMessageLog->GetTree()->topLevelItem(last-1);
@ -2390,7 +2395,7 @@ void CSandMan::AddLogMessage(const QString& Message)
}
QTreeWidgetItem* pItem = new QTreeWidgetItem(); // Time|Message
pItem->setText(0, QDateTime::currentDateTime().toString("hh:mm:ss.zzz"));
pItem->setText(0, TimeStamp.toString("hh:mm:ss.zzz"));
pItem->setData(1, Qt::UserRole, Message);
m_pMessageLog->GetTree()->addTopLevelItem(pItem);
if (Message.contains("</a>")) {
@ -2412,6 +2417,34 @@ void CSandMan::AddLogMessage(const QString& Message)
m_pMessageLog->GetView()->verticalScrollBar()->setValue(m_pMessageLog->GetView()->verticalScrollBar()->maximum());
}
QString CSandMan::FormatSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId, bool bNoLink)
{
QString Message;
if (MsgCode != 0) {
Message = theAPI->GetSbieMsgStr(MsgCode, m_LanguageId);
if (!bNoLink) {
Message.insert(8, "</a>");
Message.prepend("<a href=\"https://sandboxie-plus.com/go.php?to=sbie-sbie" + QString::number(MsgCode & 0xFFFF) + "\">");
}
}
else if(MsgData.size() > 0)
Message = MsgData[0];
for (int i = 1; i < MsgData.size(); i++)
Message = Message.arg(MsgData[i]);
if (ProcessId != 4) // if it's not from the driver, add the pid
{
CBoxedProcessPtr pProcess = theAPI->GetProcessById(ProcessId);
if(pProcess.isNull())
Message.prepend(tr("PID %1: ").arg(ProcessId));
else
Message.prepend(tr("%1 (%2): ").arg(pProcess->GetProcessName()).arg(ProcessId));
}
return Message;
}
void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId)
{
if ((MsgCode & 0xFFFF) == 2198 ) // file migration progress
@ -2457,27 +2490,9 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui
// return;
}
QString Message;
if (MsgCode != 0) {
Message = theAPI->GetSbieMsgStr(MsgCode, m_LanguageId);
Message.insert(8, "</a>");
Message.prepend("<a href=\"https://sandboxie-plus.com/go.php?to=sbie-sbie" + QString::number(MsgCode & 0xFFFF) + "\">");
}
else if(MsgData.size() > 0)
Message = MsgData[0];
for (int i = 1; i < MsgData.size(); i++)
Message = Message.arg(MsgData[i]);
if (ProcessId != 4) // if it's not from the driver, add the pid
{
CBoxedProcessPtr pProcess = theAPI->GetProcessById(ProcessId);
if(pProcess.isNull())
Message.prepend(tr("PID %1: ").arg(ProcessId));
else
Message.prepend(tr("%1 (%2): ").arg(pProcess->GetProcessName()).arg(ProcessId));
}
m_MessageLog.append(SSbieMsg{ QDateTime::currentDateTime(), MsgCode, MsgData, ProcessId });
QString Message = FormatSbieMessage(MsgCode, MsgData, ProcessId);
OnLogMessage(Message);
if ((MsgCode & 0xFFFF) == 6004) // certificate error
@ -2492,9 +2507,8 @@ void CSandMan::OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, qui
void CSandMan::SaveMessageLog(QIODevice* pFile)
{
QList<QStringList> Rows = m_pMessageLog->DumpPanel();
foreach(const QStringList& Row, Rows)
pFile->write(Row.join("\t").toLatin1() + "\n");
foreach(const SSbieMsg& Msg, m_MessageLog)
pFile->write((Msg.TimeStamp.toString("hh:mm:ss.zzz") + "\t" + FormatSbieMessage(Msg.MsgCode, Msg.MsgData, Msg.ProcessId)).toLatin1() + "\n");
}
bool CSandMan::CheckCertificate(QWidget* pWidget)
@ -2950,8 +2964,10 @@ void CSandMan::OnRefresh()
void CSandMan::OnCleanUp()
{
if (sender() == m_pCleanUpMsgLog || sender() == m_pCleanUpButton)
if(m_pMessageLog) m_pMessageLog->GetTree()->clear();
if (sender() == m_pCleanUpMsgLog || sender() == m_pCleanUpButton) {
m_MessageLog.clear();
if (m_pMessageLog) m_pMessageLog->GetTree()->clear();
}
if (sender() == m_pCleanUpTrace || sender() == m_pCleanUpButton)
if (m_pTraceView) {

View File

@ -117,6 +117,9 @@ protected:
static void RecoverFilesAsync(QPair<const CSbieProgressPtr&,QWidget*> pParam, const QString& BoxName, const QList<QPair<QString, QString>>& FileList, const QStringList& Checkers, int Action = 0);
static void CheckFilesAsync(const CSbieProgressPtr& pProgress, const QString& BoxName, const QStringList &Files, const QStringList& Checkers);
QString FormatSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId, bool bNoLink = false);
void AddLogMessage(const QDateTime& TimeStamp, const QString& Message);
QIcon GetTrayIcon(bool isConnected = true, bool bSun = false);
QString GetTrayText(bool isConnected = true);
@ -163,6 +166,16 @@ protected:
class UGlobalHotkeys* m_pHotkeyManager;
bool m_ImDiskReady;
struct SSbieMsg {
QDateTime TimeStamp;
quint32 MsgCode;
QStringList MsgData;
quint32 ProcessId;
};
QVector<SSbieMsg> m_MessageLog;
public slots:
void OnBoxSelected();

View File

@ -350,6 +350,8 @@ CSettingsWindow::CSettingsWindow(QWidget* parent)
connect(ui.chkNewLayout, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
connect(ui.chkColorIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.chkOverlayIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.chkHideCore, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
connect(ui.cmbFontScale, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.cmbFontScale, SIGNAL(currentTextChanged(const QString&)), this, SLOT(OnChangeGUI()));
@ -865,6 +867,8 @@ void CSettingsWindow::LoadSettings()
ui.chkNewLayout->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/NewConfigLayout", 2)));
ui.chkColorIcons->setChecked(theConf->GetBool("Options/ColorBoxIcons", false));
ui.chkOverlayIcons->setChecked(theConf->GetBool("Options/UseOverlayIcons", true));
ui.chkHideCore->setChecked(theConf->GetBool("Options/HideSbieProcesses", false));
//ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
ui.cmbFontScale->setCurrentText(QString::number(theConf->GetInt("Options/FontScaling", 100)));
@ -1170,6 +1174,7 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/NewConfigLayout", CSettingsWindow__Chk2Int(ui.chkNewLayout->checkState()));
theConf->SetValue("Options/ColorBoxIcons", ui.chkColorIcons->isChecked());
theConf->SetValue("Options/UseOverlayIcons", ui.chkOverlayIcons->isChecked());
theConf->SetValue("Options/HideSbieProcesses", ui.chkHideCore->isChecked());
int Scaling = ui.cmbFontScale->currentText().toInt();
if (Scaling < 75)