From a1e61fc0a500d9edb86228240b8d4e8e8cc63b05 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sat, 30 Oct 2021 09:46:49 +0200 Subject: [PATCH] updates --- CHANGELOG.md | 21 +- Installer/Sandboxie-Plus.iss | 4 +- Sandboxie/common/my_version.h | 4 +- Sandboxie/core/dll/com.c | 102 ++++---- Sandboxie/core/dll/rpcrt.c | 8 +- Sandboxie/core/drv/api_flags.h | 1 + Sandboxie/install/Templates.ini | 8 + SandboxiePlus/MiscHelpers/Common/CheckList.h | 226 ++++++++++++++++++ SandboxiePlus/MiscHelpers/Common/Finder.cpp | 2 +- SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj | 1 + .../MiscHelpers/MiscHelpers.vcxproj.filters | 3 + SandboxiePlus/SandMan/Views/TraceView.cpp | 56 +++-- SandboxiePlus/SandMan/Views/TraceView.h | 4 +- SandboxiePlus/version.h | 2 +- 14 files changed, 364 insertions(+), 78 deletions(-) create mode 100644 SandboxiePlus/MiscHelpers/Common/CheckList.h diff --git a/CHANGELOG.md b/CHANGELOG.md index db843bf2..e72a1bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,25 @@ This project adheres to [Semantic Versioning](http://semver.org/). + + +## [0.9.8d / 5.53.3] - 2021-10-?? + +### Added +- added checkbox if the user wants sandman to be started after instalation [#1318](https://github.com/sandboxie-plus/Sandboxie/issues/1318) +- added template for windows 10 virtual desktop manager [#1326](https://github.com/sandboxie-plus/Sandboxie/discussions/1326) + +### Changed +- "OpenClsid=..." is no longer restricted to CLSCTX_LOCAL_SERVER execution contexts only +-- this allows to run objects with the CLSCTX_INPROC_SERVER flag in the com helper service +- in teh trace view now multiple types can be sellected at once + +### Fixed +- fixed ini writing issue with sbiectrl and the new ini handling mechanism [#1331](https://github.com/sandboxie-plus/Sandboxie/issues/1331) +- fixed issue with trace log fitlering + + + ## [0.9.8c / 5.53.2] - 2021-10-24 ### Added @@ -16,7 +35,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed template sections not showing in editor [#1287](https://github.com/sandboxie-plus/Sandboxie/issues/1287) - fixed autodelete box content broken in the previous build [#1296](https://github.com/sandboxie-plus/Sandboxie/issues/1296) [#1324](https://github.com/sandboxie-plus/Sandboxie/issues/1324) - fixed crash in "Browse Content" window [#1313](https://github.com/sandboxie-plus/Sandboxie/issues/1313) -- fixed issue with icon resolution on Windows 7 [#1310](https://github.com/sandboxie-plus/Sandboxie/issues/1310) +- fixed issue with icon resolution [#1310](https://github.com/sandboxie-plus/Sandboxie/issues/1310) - fixed invalid "No Inet" status in the status column [#1312](https://github.com/sandboxie-plus/Sandboxie/issues/1312) - fixed Windows Explorer search box not working (by isaak654) [#1002](https://github.com/sandboxie-plus/Sandboxie/issues/1002) - fixed Waterfox phishing template (by Dyras) [#1309](https://github.com/sandboxie-plus/Sandboxie/pull/1309) diff --git a/Installer/Sandboxie-Plus.iss b/Installer/Sandboxie-Plus.iss index 1c1d4aee..bc6ec17b 100644 --- a/Installer/Sandboxie-Plus.iss +++ b/Installer/Sandboxie-Plus.iss @@ -107,8 +107,8 @@ Filename: "{app}\KmdUtil.exe"; Parameters: "install SbieSvc ""{app}\SbieSvc.exe" Filename: "{app}\KmdUtil.exe"; Parameters: "start SbieSvc"; StatusMsg: "KmdUtil start SbieSvc"; Check: not IsPortable ; Start the Sandman UI. -;Filename: "{app}\SandMan.exe"; Parameters: "-autorun"; StatusMsg: "Launch SandMan UI..."; Flags: postinstall nowait; Check: not IsPortable -Filename: "{app}\SandMan.exe"; Parameters: "-autorun"; StatusMsg: "Launch SandMan UI..."; Flags: runasoriginaluser nowait; Check: not IsPortable +Filename: "{app}\SandMan.exe"; Parameters: "-autorun"; StatusMsg: "Launch SandMan UI..."; Flags: postinstall nowait; Check: not IsPortable +;Filename: "{app}\SandMan.exe"; Parameters: "-autorun"; StatusMsg: "Launch SandMan UI..."; Flags: runasoriginaluser nowait; Check: not IsPortable [UninstallDelete] diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 0010964e..9230172d 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,53,2 -#define MY_VERSION_STRING "5.53.2" +#define MY_VERSION_BINARY 5,53,3 +#define MY_VERSION_STRING "5.53.3" #define MY_VERSION_COMPAT "5.53.0" // this refers to the driver ABI compatibility // These #defines are used by either Resource Compiler, or by NSIC installer diff --git a/Sandboxie/core/dll/com.c b/Sandboxie/core/dll/com.c index 55393f8b..d5cfc450 100644 --- a/Sandboxie/core/dll/com.c +++ b/Sandboxie/core/dll/com.c @@ -155,7 +155,7 @@ static void Com_Trace( ULONG ProcNum, HRESULT hr); static void Com_Trace2( - const WCHAR* TraceType, REFCLSID rclsid, REFIID riid, + const WCHAR* TraceType, const WCHAR* pszName, REFCLSID rclsid, REFIID riid, ULONG ProcNum, ULONG clsctx, HRESULT hr, ULONG monflag); static void Com_Monitor(REFCLSID rclsid, ULONG monflag); @@ -407,6 +407,9 @@ _FX void Com_LoadClsidList(const WCHAR* setting, GUID** pClsids, ULONG* pNumClsi _FX BOOLEAN SbieDll_IsOpenClsid( REFCLSID rclsid, ULONG clsctx, const WCHAR *BoxName) { + ULONG index; + GUID *guid; + static const GUID CLSID_WinMgmt = { 0x8BC3F05E, 0xD86B, 0x11D0, { 0xA0, 0x75, 0x00, 0xC0, 0x4F, 0xB6, 0x88, 0x20 } }; @@ -423,10 +426,15 @@ _FX BOOLEAN SbieDll_IsOpenClsid( 0x0358B920, 0x0AC7, 0x461F, { 0x98, 0xF4, 0x58, 0xE3, 0x2C, 0xD8, 0x91, 0x48 } }; - if (clsctx & CLSCTX_LOCAL_SERVER) { + // + // open the null clsid to open all + // - ULONG index; - GUID *guid; + //static const GUID CLSID_Null = { + // 0x00000000, 0x0000, 0x0000, + // { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; + + if (clsctx & CLSCTX_LOCAL_SERVER) { // // check against list of built-in CLSID exclusions @@ -440,25 +448,26 @@ _FX BOOLEAN SbieDll_IsOpenClsid( return TRUE; } - - // - // initialize list of user-configured CLSID exclusions - // - - static const WCHAR* setting = L"OpenClsid"; - Com_LoadClsidList(setting , &Com_OpenClsids, &Com_NumOpenClsids, BoxName); - - // - // check against list of user-configured CLSID exclusions - // - - for (index = 0; index < Com_NumOpenClsids; ++index) { - guid = &Com_OpenClsids[index]; - if (memcmp(guid, rclsid, sizeof(GUID)) == 0) - return TRUE; - } } + // + // initialize list of user-configured CLSID exclusions + // + + static const WCHAR* setting = L"OpenClsid"; + Com_LoadClsidList(setting , &Com_OpenClsids, &Com_NumOpenClsids, BoxName); + + // + // check against list of user-configured CLSID exclusions + // + + for (index = 0; index < Com_NumOpenClsids; ++index) { + guid = &Com_OpenClsids[index]; + if (memcmp(guid, rclsid, sizeof(GUID)) == 0 /*|| memcmp(guid, &CLSID_Null, sizeof(GUID)) == 0*/) + return TRUE; + } + + if (Com_IsFirewallClsid(rclsid, BoxName)) return TRUE; @@ -580,7 +589,8 @@ _FX HRESULT Com_CoGetClassObject( if (Com_IsClosedClsid(rclsid)) { *ppv = NULL; - Com_Monitor(rclsid, MONITOR_DENY); + Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, 0, MONITOR_DENY); + if (!Com_TraceFlag) Com_Monitor(rclsid, MONITOR_DENY); return E_ACCESSDENIED; } @@ -600,8 +610,8 @@ _FX HRESULT Com_CoGetClassObject( hr = __sys_CoGetClassObject(rclsid, clsctx, pServerInfo, riid, ppv); } - Com_Trace2(TraceType, rclsid, riid, 0, clsctx, hr, monflag); - if (clsctx & CLSCTX_LOCAL_SERVER) { + Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, hr, monflag); + if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) { if(!Com_TraceFlag) Com_Monitor(rclsid, monflag); } @@ -654,7 +664,7 @@ _FX HRESULT Com_CoGetObject( hr = __sys_CoGetObject(pszName, pBindOptions, riid, ppv); } - Com_Trace2(TraceType, &clsid, riid, 0, 0, hr, monflag); + Com_Trace2(TraceType, pszName, NULL, riid, 0, 0, hr, monflag); if (!Com_TraceFlag) Com_Monitor(&clsid, monflag); return hr; @@ -676,7 +686,8 @@ _FX HRESULT Com_CoCreateInstance( if (Com_IsClosedClsid(rclsid)) { *ppv = NULL; - Com_Monitor(rclsid, MONITOR_DENY); + Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, 0, MONITOR_DENY); + if (!Com_TraceFlag) Com_Monitor(rclsid, MONITOR_DENY); return E_ACCESSDENIED; } @@ -702,8 +713,8 @@ _FX HRESULT Com_CoCreateInstance( hr = __sys_CoCreateInstance(rclsid, pUnkOuter, clsctx, riid, ppv); } - Com_Trace2(TraceType, rclsid, riid, 0, clsctx, hr, monflag); - if (clsctx & CLSCTX_LOCAL_SERVER) { + Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, hr, monflag); + if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) { if (!Com_TraceFlag) Com_Monitor(rclsid, monflag); } @@ -749,7 +760,8 @@ _FX HRESULT Com_CoCreateInstanceEx( // if (Com_IsClosedClsid(rclsid)) { - Com_Monitor(rclsid, MONITOR_DENY); + Com_Trace2(TraceType, NULL, rclsid, NULL, 0, clsctx, 0, MONITOR_DENY); + if (!Com_TraceFlag) Com_Monitor(rclsid, MONITOR_DENY); return E_ACCESSDENIED; } @@ -814,8 +826,8 @@ _FX HRESULT Com_CoCreateInstanceEx( for (i = 0; i < cmq; ++i) { MULTI_QI *mqi = &pmqs[i]; - Com_Trace2(TraceType, rclsid, mqi->pIID, 0, clsctx, mqi->hr, monflag); - if (clsctx & CLSCTX_LOCAL_SERVER) { + Com_Trace2(TraceType, NULL, rclsid, mqi->pIID, 0, clsctx, mqi->hr, monflag); + if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) { if (!Com_TraceFlag) Com_Monitor(rclsid, monflag); } } @@ -1370,7 +1382,7 @@ _FX BOOLEAN Com_Init_ComBase(HMODULE module) } SBIEDLL_HOOK(Com_, CoMarshalInterface); - SbieDll_IsOpenClsid(&IID_IUnknown, CLSCTX_LOCAL_SERVER, NULL); + SbieDll_IsOpenClsid(&IID_IUnknown, CLSCTX_LOCAL_SERVER, NULL); // trigger list loading } if (Dll_OsBuild >= 8400) { // win8 and above @@ -3300,8 +3312,7 @@ _FX void Com_Trace_Guid( } if (rc != 0) { - ptr[0] = L'?'; - ptr[1] = L'\0'; + wcscpy(ptr, L"IUnknown"); } } @@ -3315,11 +3326,11 @@ _FX void Com_Trace( const WCHAR* TraceType, REFCLSID rclsid, REFIID riid, ULONG ProcNum, HRESULT hr) { - Com_Trace2(TraceType, rclsid, riid, ProcNum, 0, hr, MONITOR_TRACE); + Com_Trace2(TraceType, NULL, rclsid, riid, ProcNum, 0, hr, MONITOR_TRACE); } _FX void Com_Trace2( - const WCHAR* TraceType, REFCLSID rclsid, REFIID riid, + const WCHAR* TraceType, const WCHAR* pszName, REFCLSID rclsid, REFIID riid, ULONG ProcNum, ULONG clsctx, HRESULT hr, ULONG monflag) { WCHAR *text; @@ -3331,16 +3342,27 @@ _FX void Com_Trace2( text = Com_Alloc(1024 * sizeof(WCHAR)); ptr = text + Sbie_snwprintf(text, 1024, L"COM <%08X> %s <%08X> ", clsctx, TraceType, hr); + if (pszName) { + wcscpy(ptr, L"NAME: "); + ptr += 6; // wcslen(ptr); + wcscpy(ptr, pszName); + ptr += wcslen(ptr); + } + if (rclsid) { + wcscpy(ptr, L"CLSID: "); + ptr += 7; // wcslen(ptr); Com_Trace_Guid(ptr, rclsid, L"CLSID"); ptr += wcslen(ptr); } if (riid) { if (rclsid) { - *ptr = L' '; - ++ptr; + *ptr++ = L';'; + *ptr++ = L' '; } + wcscpy(ptr, L"Interface: "); + ptr += 11; // wcslen(ptr); Com_Trace_Guid(ptr, riid, L"Interface"); ptr += wcslen(ptr); @@ -3500,10 +3522,10 @@ _FX HRESULT Com_RoGetActivationFactory(HSTRING activatableClassId, REFIID iid, const wchar_t* strClassId = __sys_WindowsGetStringRawBuffer(activatableClassId, NULL); if (Com_IsClosedRT(strClassId)) { - SbieApi_MonitorPut(MONITOR_COMCLASS | MONITOR_DENY, strClassId); + SbieApi_MonitorPut(MONITOR_RTCLASS | MONITOR_DENY, strClassId); return E_ACCESSDENIED; } - SbieApi_MonitorPut(MONITOR_COMCLASS, strClassId); + SbieApi_MonitorPut(MONITOR_RTCLASS, strClassId); return __sys_RoGetActivationFactory(activatableClassId, iid, factory); } \ No newline at end of file diff --git a/Sandboxie/core/dll/rpcrt.c b/Sandboxie/core/dll/rpcrt.c index 3b7b15d6..ece03f7b 100644 --- a/Sandboxie/core/dll/rpcrt.c +++ b/Sandboxie/core/dll/rpcrt.c @@ -534,7 +534,7 @@ WCHAR* GetDynamicLpcPortName(const WCHAR* wszPortId) else Sbie_snwprintf(text, 130, L"Failed to resolve dynamic port: %s; status: %08X", req.wszPortId, rpl ? rpl->h.status : 0); - SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, text, FALSE); + SbieApi_MonitorPut2(MONITOR_RPC | MONITOR_TRACE, text, FALSE); } if (rpl && NT_SUCCESS(rpl->h.status)) @@ -763,7 +763,7 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW( CallingModule ? CallingModule : L"unknown"); //OutputDebugString(msg); - SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE); + SbieApi_MonitorPut2(MONITOR_RPC | MONITOR_TRACE, msg, FALSE); } if(use_RpcMgmtSetComTimeout) __sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT); @@ -878,7 +878,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW( CallingModule ? CallingModule : L"unknown"); //OutputDebugString(msg); - SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE); + SbieApi_MonitorPut2(MONITOR_RPC | MONITOR_TRACE, msg, FALSE); } __sys_RpcStringFreeW(&StringUuid); @@ -997,7 +997,7 @@ void RpcRt_NdrClientCallX(const WCHAR* Function, void* ReturnAddress, PMIDL_STUB Sbie_snwprintf(text, 512, L"Calling %s, caused log exception, caller = '%s'", Function, CallingModule); } - SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, text, FALSE); + SbieApi_MonitorPut2(MONITOR_RPC | MONITOR_TRACE, text, FALSE); } diff --git a/Sandboxie/core/drv/api_flags.h b/Sandboxie/core/drv/api_flags.h index 91bace42..e6f5d570 100644 --- a/Sandboxie/core/drv/api_flags.h +++ b/Sandboxie/core/drv/api_flags.h @@ -57,6 +57,7 @@ #define MONITOR_NETFW 0x0000000D #define MONITOR_SCM 0x0000000E // Service Control Manager #define MONITOR_APICALL 0x0000000F // needs the logapi.dll +#define MONITOR_RPC 0x00000010 #define MONITOR_TYPE_MASK 0x000000FF #define MONITOR_RESERVED 0x0000FF00 diff --git a/Sandboxie/install/Templates.ini b/Sandboxie/install/Templates.ini index e14dae58..b83ad454 100644 --- a/Sandboxie/install/Templates.ini +++ b/Sandboxie/install/Templates.ini @@ -2784,6 +2784,14 @@ OpenIpcPath=*\BaseNamedObjects*\Ai2_HOOKDATA_FILEMAP* OpenIpcPath=*\BaseNamedObjects*\ZoomTextRunning* OpenWinClass=ZT9MainWindow + +[Template_VirtualDesktopManager] +Tmpl.Title=Virtual Desktop Manager +Tmpl.Class=Desktop +Tmpl.Scan=s +Tmpl.ScanKey=\REGISTRY\MACHINE\SOFTWARE\Classes\CLSID\{AA509086-5CA9-4C25-8F95-589D3C07B48A} +OpenClsid={AA509086-5CA9-4C25-8F95-589D3C07B48A} + # # Media Players # diff --git a/SandboxiePlus/MiscHelpers/Common/CheckList.h b/SandboxiePlus/MiscHelpers/Common/CheckList.h new file mode 100644 index 00000000..be01f849 --- /dev/null +++ b/SandboxiePlus/MiscHelpers/Common/CheckList.h @@ -0,0 +1,226 @@ +#ifndef QCHECKLIST +#define QCHECKLIST + +#include +#include +#include +#include +#include +#include +#include + +/** + * @brief QComboBox with support of checkboxes + * http://stackoverflow.com/questions/8422760/combobox-of-checkboxes + */ + +#include "../mischelpers_global.h" + +class MISCHELPERS_EXPORT QCheckList : public QComboBox +{ + Q_OBJECT + +public: + /** + * @brief Additional value to Qt::CheckState when some checkboxes are Qt::PartiallyChecked + */ + static const int StateUnknown = 3; + +private: + QStandardItemModel* m_model; + /** + * @brief Text displayed when no item is checked + */ + QString m_noneCheckedText; + /** + * @brief Text displayed when all items are checked + */ + QString m_allCheckedText; + /** + * @brief Text displayed when some items are partially checked + */ + QString m_unknownlyCheckedText; + +signals: + void globalCheckStateChanged(int); + +public: + QCheckList(QWidget* _parent = 0) : QComboBox(_parent) + { + m_model = new QStandardItemModel(); + setModel(m_model); + + setEditable(true); + lineEdit()->setReadOnly(true); + lineEdit()->installEventFilter(this); + setItemDelegate(new QCheckListStyledItemDelegate(this)); + + connect(lineEdit(), &QLineEdit::selectionChanged, lineEdit(), &QLineEdit::deselect); + connect((QListView*) view(), SIGNAL(pressed(QModelIndex)), this, SLOT(on_itemPressed(QModelIndex))); + connect(m_model, SIGNAL(dataChanged(QModelIndex, QModelIndex, QVector)), this, SLOT(on_modelDataChanged())); + } + + ~QCheckList() + { + delete m_model; + } + + void setAllCheckedText(const QString &text) + { + m_allCheckedText = text; + updateText(); + } + + void setNoneCheckedText(const QString &text) + { + m_noneCheckedText = text; + updateText(); + } + + void setUnknownlyCheckedText(const QString &text) + { + m_unknownlyCheckedText = text; + updateText(); + } + + /** + * @brief Adds a item to the checklist (setChecklist must have been called) + * @return the new QStandardItem + */ + QStandardItem* addCheckItem(const QString &label, const QVariant &data, const Qt::CheckState checkState) + { + QStandardItem* item = new QStandardItem(label); + item->setCheckState(checkState); + item->setData(data); + item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); + + m_model->appendRow(item); + + updateText(); + + return item; + } + + /** + * @brief Computes the global state of the checklist : + * - if there is no item: StateUnknown + * - if there is at least one item partially checked: StateUnknown + * - if all items are checked: Qt::Checked + * - if no item is checked: Qt::Unchecked + * - else: Qt::PartiallyChecked + */ + int globalCheckState() + { + int nbRows = m_model->rowCount(), nbChecked = 0, nbUnchecked = 0; + + if (nbRows == 0) + { + return StateUnknown; + } + + for (int i = 0; i < nbRows; i++) + { + if (m_model->item(i)->checkState() == Qt::Checked) + { + nbChecked++; + } + else if (m_model->item(i)->checkState() == Qt::Unchecked) + { + nbUnchecked++; + } + else + { + return StateUnknown; + } + } + + return nbChecked == nbRows ? Qt::Checked : nbUnchecked == nbRows ? Qt::Unchecked : Qt::PartiallyChecked; + } + +protected: + /*bool eventFilter(QObject* _object, QEvent* _event) + { + if (_object == lineEdit() && _event->type() == QEvent::MouseButtonPress) + { + showPopup(); + return true; + } + + return false; + }*/ + +private: + void updateText() + { + QString text; + + switch (globalCheckState()) + { + case Qt::Checked: + text = m_allCheckedText; + break; + + case Qt::Unchecked: + text = m_noneCheckedText; + break; + + case Qt::PartiallyChecked: + for (int i = 0; i < m_model->rowCount(); i++) + { + if (m_model->item(i)->checkState() == Qt::Checked) + { + if (!text.isEmpty()) + { + text+= ", "; + } + + text+= m_model->item(i)->text(); + } + } + break; + + default: + text = m_unknownlyCheckedText; + } + + lineEdit()->setText(text); + } + +private slots: + void on_modelDataChanged() + { + updateText(); + emit globalCheckStateChanged(globalCheckState()); + } + + void on_itemPressed(const QModelIndex &index) + { + QStandardItem* item = m_model->itemFromIndex(index); + + if (item->checkState() == Qt::Checked) + { + item->setCheckState(Qt::Unchecked); + } + else + { + item->setCheckState(Qt::Checked); + } + } + +public: + class QCheckListStyledItemDelegate : public QStyledItemDelegate + { + public: + QCheckListStyledItemDelegate(QObject* parent = 0) : QStyledItemDelegate(parent) {} + + void paint(QPainter * painter_, const QStyleOptionViewItem & option_, const QModelIndex & index_) const + { + QStyleOptionViewItem & refToNonConstOption = const_cast(option_); + refToNonConstOption.showDecorationSelected = false; + QStyledItemDelegate::paint(painter_, refToNonConstOption, index_); + } + }; +}; + +#endif // QCHECKLIST + diff --git a/SandboxiePlus/MiscHelpers/Common/Finder.cpp b/SandboxiePlus/MiscHelpers/Common/Finder.cpp index 693f5b5e..aff203ed 100644 --- a/SandboxiePlus/MiscHelpers/Common/Finder.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Finder.cpp @@ -138,7 +138,7 @@ void CFinder::Open() QRegExp CFinder::GetRegExp() const { - if (!isVisible()) + if (!isVisible() || m_pSearch->text().isEmpty()) return QRegExp(); return QRegExp(m_pSearch->text(), m_pCaseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive, m_pRegExp->isChecked() ? QRegExp::RegExp : QRegExp::FixedString); } diff --git a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj index 29837d5c..a6bdba15 100644 --- a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj +++ b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj @@ -214,6 +214,7 @@ + diff --git a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters index 41d10b11..7960baf8 100644 --- a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters +++ b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters @@ -198,5 +198,8 @@ Common + + Common + \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Views/TraceView.cpp b/SandboxiePlus/SandMan/Views/TraceView.cpp index d457fb43..393cc675 100644 --- a/SandboxiePlus/SandMan/Views/TraceView.cpp +++ b/SandboxiePlus/SandMan/Views/TraceView.cpp @@ -4,6 +4,7 @@ #include "../QSbieAPI/SbieAPI.h" #include "..\Models\TraceModel.h" #include "..\..\MiscHelpers\Common\Common.h" +#include "..\..\MiscHelpers\Common\CheckList.h" #include "SbieView.h" //class CTraceFilterProxyModel : public CSortFilterProxyModel @@ -54,7 +55,6 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget(parent) //m_FilterCol = -1; m_FilterPid = 0; m_FilterTid = 0; - m_FilterType = 0; m_FilterStatus = 0; m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -81,15 +81,14 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget(parent) m_pTraceToolBar->addWidget(m_pTraceTid); m_pTraceToolBar->addWidget(new QLabel(tr("Type:"))); - m_pTraceType = new QComboBox(); - m_pTraceType->addItem(tr("[All]"), 0); - for (quint32 i = 0; i < 0xff; i++) { - QString TypeStr = CTraceEntry::GetTypeStr(i); - if(!TypeStr.isEmpty()) - m_pTraceType->addItem(TypeStr, i); - } - m_pTraceType->setMinimumWidth(75); - connect(m_pTraceType, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter())); + m_pTraceType = new QCheckList(); + //m_pTraceType->addItem(tr("[All]"), 0); + m_pTraceType->setAllCheckedText(tr("[All]")); + m_pTraceType->setNoneCheckedText(tr("[All]")); + foreach(quint32 type, CTraceEntry::AllTypes()) + m_pTraceType->addCheckItem(CTraceEntry::GetTypeStr(type), type, Qt::Unchecked); + m_pTraceType->setMinimumWidth(100); + connect(m_pTraceType, SIGNAL(globalCheckStateChanged(int)), this, SLOT(OnSetFilter())); m_pTraceToolBar->addWidget(m_pTraceType); m_pTraceToolBar->addWidget(new QLabel(tr("Status:"))); @@ -165,42 +164,43 @@ int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params) { CTraceView* This = (CTraceView*)params; - int True = This->m_bHighLight ? 2 : 1; - int False = This->m_bHighLight ? 1 : 0; + int Ret = 1; if (This->m_pCurrentBox != NULL && This->m_pCurrentBox != pEntry->GetBoxPtr()) - return False; + return 0; if (This->m_FilterExp.isValid()) { if (!pEntry->GetMessage().contains(This->m_FilterExp) //&& !pEntry->GetTypeStr().contains(This->m_FilterExp) //&& !pEntry->GetStautsStr().contains(This->m_FilterExp) && !pEntry->GetProcessName().contains(This->m_FilterExp)) - return False; + Ret = This->m_bHighLight ? 1 : 0; + else + Ret = This->m_bHighLight ? 2 : 1; } if (This->m_FilterPid != 0 && This->m_FilterPid != pEntry->GetProcessId()) - return False; + return 0; if (This->m_FilterTid != 0 && This->m_FilterTid != pEntry->GetThreadId()) - return False; + return 0; - if (This->m_FilterType != 0 && This->m_FilterType != pEntry->GetType()) - return False; + if (!This->m_FilterTypes.isEmpty() && !This->m_FilterTypes.contains(pEntry->GetType())) + return 0; if (This->m_FilterStatus != 0) { if (pEntry->IsOpen()) { - if(This->m_FilterStatus == 1) return True; + if(This->m_FilterStatus == 1) return Ret; } else if (pEntry->IsClosed()) { - if (This->m_FilterStatus == 2) return True; + if (This->m_FilterStatus == 2) return Ret; } else if (pEntry->IsTrace()) { - if(This->m_FilterStatus == 3) return True; + if(This->m_FilterStatus == 3) return Ret; } else - if(This->m_FilterStatus == 4) return True; - return False; + if(This->m_FilterStatus == 4) return Ret; + return 0; } - return True; + return Ret; } void CTraceView::Refresh() @@ -321,7 +321,13 @@ void CTraceView::OnSetTidFilter() void CTraceView::OnSetFilter() { - m_FilterType = m_pTraceType->currentData().toUInt(); + m_FilterTypes.clear(); + for (int i = 0; i < m_pTraceType->count(); i++) { + if (m_pTraceType->itemData(i, Qt::CheckStateRole).toInt() == Qt::Checked) { + m_FilterTypes.append(m_pTraceType->itemData(i, Qt::UserRole + 1).toUInt()); + } + } + m_FilterStatus = m_pTraceStatus->currentData().toUInt(); m_FullRefresh = true; diff --git a/SandboxiePlus/SandMan/Views/TraceView.h b/SandboxiePlus/SandMan/Views/TraceView.h index 6b8ddcf5..f65585d2 100644 --- a/SandboxiePlus/SandMan/Views/TraceView.h +++ b/SandboxiePlus/SandMan/Views/TraceView.h @@ -41,7 +41,7 @@ protected: //int m_FilterCol; quint32 m_FilterPid; quint32 m_FilterTid; - quint32 m_FilterType; + QList m_FilterTypes; quint32 m_FilterStatus; void* m_pCurrentBox; @@ -49,7 +49,7 @@ protected: QAction* m_pTraceTree; QComboBox* m_pTracePid; QComboBox* m_pTraceTid; - QComboBox* m_pTraceType; + class QCheckList* m_pTraceType; QComboBox* m_pTraceStatus; QAction* m_pAllBoxes; QAction* m_pSaveToFile; diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 9a9f1fed..5383f1e0 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -3,7 +3,7 @@ #define VERSION_MJR 0 #define VERSION_MIN 9 #define VERSION_REV 8 -#define VERSION_UPD 3 +#define VERSION_UPD 4 #ifndef STR #define STR2(X) #X