This commit is contained in:
DavidXanatos 2021-10-30 09:46:49 +02:00
parent 9fcfc4054e
commit a1e61fc0a5
14 changed files with 364 additions and 78 deletions

View File

@ -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 ## [0.9.8c / 5.53.2] - 2021-10-24
### Added ### 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 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 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 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 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 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) - fixed Waterfox phishing template (by Dyras) [#1309](https://github.com/sandboxie-plus/Sandboxie/pull/1309)

View File

@ -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 Filename: "{app}\KmdUtil.exe"; Parameters: "start SbieSvc"; StatusMsg: "KmdUtil start SbieSvc"; Check: not IsPortable
; Start the Sandman UI. ; 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: 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: runasoriginaluser nowait; Check: not IsPortable
[UninstallDelete] [UninstallDelete]

View File

@ -21,8 +21,8 @@
#ifndef _MY_VERSION_H #ifndef _MY_VERSION_H
#define _MY_VERSION_H #define _MY_VERSION_H
#define MY_VERSION_BINARY 5,53,2 #define MY_VERSION_BINARY 5,53,3
#define MY_VERSION_STRING "5.53.2" #define MY_VERSION_STRING "5.53.3"
#define MY_VERSION_COMPAT "5.53.0" // this refers to the driver ABI compatibility #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 // These #defines are used by either Resource Compiler, or by NSIC installer

View File

@ -155,7 +155,7 @@ static void Com_Trace(
ULONG ProcNum, HRESULT hr); ULONG ProcNum, HRESULT hr);
static void Com_Trace2( 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); ULONG ProcNum, ULONG clsctx, HRESULT hr, ULONG monflag);
static void Com_Monitor(REFCLSID rclsid, 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( _FX BOOLEAN SbieDll_IsOpenClsid(
REFCLSID rclsid, ULONG clsctx, const WCHAR *BoxName) REFCLSID rclsid, ULONG clsctx, const WCHAR *BoxName)
{ {
ULONG index;
GUID *guid;
static const GUID CLSID_WinMgmt = { static const GUID CLSID_WinMgmt = {
0x8BC3F05E, 0xD86B, 0x11D0, 0x8BC3F05E, 0xD86B, 0x11D0,
{ 0xA0, 0x75, 0x00, 0xC0, 0x4F, 0xB6, 0x88, 0x20 } }; { 0xA0, 0x75, 0x00, 0xC0, 0x4F, 0xB6, 0x88, 0x20 } };
@ -423,10 +426,15 @@ _FX BOOLEAN SbieDll_IsOpenClsid(
0x0358B920, 0x0AC7, 0x461F, 0x0358B920, 0x0AC7, 0x461F,
{ 0x98, 0xF4, 0x58, 0xE3, 0x2C, 0xD8, 0x91, 0x48 } }; { 0x98, 0xF4, 0x58, 0xE3, 0x2C, 0xD8, 0x91, 0x48 } };
if (clsctx & CLSCTX_LOCAL_SERVER) { //
// open the null clsid to open all
//
ULONG index; //static const GUID CLSID_Null = {
GUID *guid; // 0x00000000, 0x0000, 0x0000,
// { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
if (clsctx & CLSCTX_LOCAL_SERVER) {
// //
// check against list of built-in CLSID exclusions // check against list of built-in CLSID exclusions
@ -440,6 +448,7 @@ _FX BOOLEAN SbieDll_IsOpenClsid(
return TRUE; return TRUE;
} }
}
// //
// initialize list of user-configured CLSID exclusions // initialize list of user-configured CLSID exclusions
@ -454,10 +463,10 @@ _FX BOOLEAN SbieDll_IsOpenClsid(
for (index = 0; index < Com_NumOpenClsids; ++index) { for (index = 0; index < Com_NumOpenClsids; ++index) {
guid = &Com_OpenClsids[index]; guid = &Com_OpenClsids[index];
if (memcmp(guid, rclsid, sizeof(GUID)) == 0) if (memcmp(guid, rclsid, sizeof(GUID)) == 0 /*|| memcmp(guid, &CLSID_Null, sizeof(GUID)) == 0*/)
return TRUE; return TRUE;
} }
}
if (Com_IsFirewallClsid(rclsid, BoxName)) if (Com_IsFirewallClsid(rclsid, BoxName))
return TRUE; return TRUE;
@ -580,7 +589,8 @@ _FX HRESULT Com_CoGetClassObject(
if (Com_IsClosedClsid(rclsid)) { if (Com_IsClosedClsid(rclsid)) {
*ppv = NULL; *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; return E_ACCESSDENIED;
} }
@ -600,8 +610,8 @@ _FX HRESULT Com_CoGetClassObject(
hr = __sys_CoGetClassObject(rclsid, clsctx, pServerInfo, riid, ppv); hr = __sys_CoGetClassObject(rclsid, clsctx, pServerInfo, riid, ppv);
} }
Com_Trace2(TraceType, rclsid, riid, 0, clsctx, hr, monflag); Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, hr, monflag);
if (clsctx & CLSCTX_LOCAL_SERVER) { if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) {
if(!Com_TraceFlag) Com_Monitor(rclsid, monflag); if(!Com_TraceFlag) Com_Monitor(rclsid, monflag);
} }
@ -654,7 +664,7 @@ _FX HRESULT Com_CoGetObject(
hr = __sys_CoGetObject(pszName, pBindOptions, riid, ppv); 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); if (!Com_TraceFlag) Com_Monitor(&clsid, monflag);
return hr; return hr;
@ -676,7 +686,8 @@ _FX HRESULT Com_CoCreateInstance(
if (Com_IsClosedClsid(rclsid)) { if (Com_IsClosedClsid(rclsid)) {
*ppv = NULL; *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; return E_ACCESSDENIED;
} }
@ -702,8 +713,8 @@ _FX HRESULT Com_CoCreateInstance(
hr = __sys_CoCreateInstance(rclsid, pUnkOuter, clsctx, riid, ppv); hr = __sys_CoCreateInstance(rclsid, pUnkOuter, clsctx, riid, ppv);
} }
Com_Trace2(TraceType, rclsid, riid, 0, clsctx, hr, monflag); Com_Trace2(TraceType, NULL, rclsid, riid, 0, clsctx, hr, monflag);
if (clsctx & CLSCTX_LOCAL_SERVER) { if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) {
if (!Com_TraceFlag) Com_Monitor(rclsid, monflag); if (!Com_TraceFlag) Com_Monitor(rclsid, monflag);
} }
@ -749,7 +760,8 @@ _FX HRESULT Com_CoCreateInstanceEx(
// //
if (Com_IsClosedClsid(rclsid)) { 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; return E_ACCESSDENIED;
} }
@ -814,8 +826,8 @@ _FX HRESULT Com_CoCreateInstanceEx(
for (i = 0; i < cmq; ++i) { for (i = 0; i < cmq; ++i) {
MULTI_QI *mqi = &pmqs[i]; MULTI_QI *mqi = &pmqs[i];
Com_Trace2(TraceType, rclsid, mqi->pIID, 0, clsctx, mqi->hr, monflag); Com_Trace2(TraceType, NULL, rclsid, mqi->pIID, 0, clsctx, mqi->hr, monflag);
if (clsctx & CLSCTX_LOCAL_SERVER) { if ((clsctx & CLSCTX_LOCAL_SERVER) != 0 || monflag) {
if (!Com_TraceFlag) Com_Monitor(rclsid, monflag); if (!Com_TraceFlag) Com_Monitor(rclsid, monflag);
} }
} }
@ -1370,7 +1382,7 @@ _FX BOOLEAN Com_Init_ComBase(HMODULE module)
} }
SBIEDLL_HOOK(Com_, CoMarshalInterface); 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 if (Dll_OsBuild >= 8400) { // win8 and above
@ -3300,8 +3312,7 @@ _FX void Com_Trace_Guid(
} }
if (rc != 0) { if (rc != 0) {
ptr[0] = L'?'; wcscpy(ptr, L"IUnknown");
ptr[1] = L'\0';
} }
} }
@ -3315,11 +3326,11 @@ _FX void Com_Trace(
const WCHAR* TraceType, REFCLSID rclsid, REFIID riid, const WCHAR* TraceType, REFCLSID rclsid, REFIID riid,
ULONG ProcNum, HRESULT hr) 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( _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) ULONG ProcNum, ULONG clsctx, HRESULT hr, ULONG monflag)
{ {
WCHAR *text; WCHAR *text;
@ -3331,16 +3342,27 @@ _FX void Com_Trace2(
text = Com_Alloc(1024 * sizeof(WCHAR)); text = Com_Alloc(1024 * sizeof(WCHAR));
ptr = text + Sbie_snwprintf(text, 1024, L"COM <%08X> %s <%08X> ", clsctx, TraceType, hr); 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) { if (rclsid) {
wcscpy(ptr, L"CLSID: ");
ptr += 7; // wcslen(ptr);
Com_Trace_Guid(ptr, rclsid, L"CLSID"); Com_Trace_Guid(ptr, rclsid, L"CLSID");
ptr += wcslen(ptr); ptr += wcslen(ptr);
} }
if (riid) { if (riid) {
if (rclsid) { if (rclsid) {
*ptr = L' '; *ptr++ = L';';
++ptr; *ptr++ = L' ';
} }
wcscpy(ptr, L"Interface: ");
ptr += 11; // wcslen(ptr);
Com_Trace_Guid(ptr, riid, L"Interface"); Com_Trace_Guid(ptr, riid, L"Interface");
ptr += wcslen(ptr); ptr += wcslen(ptr);
@ -3500,10 +3522,10 @@ _FX HRESULT Com_RoGetActivationFactory(HSTRING activatableClassId, REFIID iid,
const wchar_t* strClassId = __sys_WindowsGetStringRawBuffer(activatableClassId, NULL); const wchar_t* strClassId = __sys_WindowsGetStringRawBuffer(activatableClassId, NULL);
if (Com_IsClosedRT(strClassId)) { if (Com_IsClosedRT(strClassId)) {
SbieApi_MonitorPut(MONITOR_COMCLASS | MONITOR_DENY, strClassId); SbieApi_MonitorPut(MONITOR_RTCLASS | MONITOR_DENY, strClassId);
return E_ACCESSDENIED; return E_ACCESSDENIED;
} }
SbieApi_MonitorPut(MONITOR_COMCLASS, strClassId); SbieApi_MonitorPut(MONITOR_RTCLASS, strClassId);
return __sys_RoGetActivationFactory(activatableClassId, iid, factory); return __sys_RoGetActivationFactory(activatableClassId, iid, factory);
} }

View File

@ -534,7 +534,7 @@ WCHAR* GetDynamicLpcPortName(const WCHAR* wszPortId)
else else
Sbie_snwprintf(text, 130, L"Failed to resolve dynamic port: %s; status: %08X", req.wszPortId, rpl ? rpl->h.status : 0); 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)) if (rpl && NT_SUCCESS(rpl->h.status))
@ -763,7 +763,7 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW(
CallingModule ? CallingModule : L"unknown"); CallingModule ? CallingModule : L"unknown");
//OutputDebugString(msg); //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); if(use_RpcMgmtSetComTimeout) __sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT);
@ -878,7 +878,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW(
CallingModule ? CallingModule : L"unknown"); CallingModule ? CallingModule : L"unknown");
//OutputDebugString(msg); //OutputDebugString(msg);
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE); SbieApi_MonitorPut2(MONITOR_RPC | MONITOR_TRACE, msg, FALSE);
} }
__sys_RpcStringFreeW(&StringUuid); __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); 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);
} }

View File

@ -57,6 +57,7 @@
#define MONITOR_NETFW 0x0000000D #define MONITOR_NETFW 0x0000000D
#define MONITOR_SCM 0x0000000E // Service Control Manager #define MONITOR_SCM 0x0000000E // Service Control Manager
#define MONITOR_APICALL 0x0000000F // needs the logapi.dll #define MONITOR_APICALL 0x0000000F // needs the logapi.dll
#define MONITOR_RPC 0x00000010
#define MONITOR_TYPE_MASK 0x000000FF #define MONITOR_TYPE_MASK 0x000000FF
#define MONITOR_RESERVED 0x0000FF00 #define MONITOR_RESERVED 0x0000FF00

View File

@ -2784,6 +2784,14 @@ OpenIpcPath=*\BaseNamedObjects*\Ai2_HOOKDATA_FILEMAP*
OpenIpcPath=*\BaseNamedObjects*\ZoomTextRunning* OpenIpcPath=*\BaseNamedObjects*\ZoomTextRunning*
OpenWinClass=ZT9MainWindow 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 # Media Players
# #

View File

@ -0,0 +1,226 @@
#ifndef QCHECKLIST
#define QCHECKLIST
#include <QWidget>
#include <QComboBox>
#include <QStandardItemModel>
#include <QLineEdit>
#include <QEvent>
#include <QStyledItemDelegate>
#include <QListView>
/**
* @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<int>)), 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<QStyleOptionViewItem &>(option_);
refToNonConstOption.showDecorationSelected = false;
QStyledItemDelegate::paint(painter_, refToNonConstOption, index_);
}
};
};
#endif // QCHECKLIST

View File

@ -138,7 +138,7 @@ void CFinder::Open()
QRegExp CFinder::GetRegExp() const QRegExp CFinder::GetRegExp() const
{ {
if (!isVisible()) if (!isVisible() || m_pSearch->text().isEmpty())
return QRegExp(); return QRegExp();
return QRegExp(m_pSearch->text(), m_pCaseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive, m_pRegExp->isChecked() ? QRegExp::RegExp : QRegExp::FixedString); return QRegExp(m_pSearch->text(), m_pCaseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive, m_pRegExp->isChecked() ? QRegExp::RegExp : QRegExp::FixedString);
} }

View File

@ -214,6 +214,7 @@
<ItemGroup> <ItemGroup>
<QtMoc Include="Common\CheckableMessageBox.h" /> <QtMoc Include="Common\CheckableMessageBox.h" />
<QtMoc Include="Common\ComboInputDialog.h" /> <QtMoc Include="Common\ComboInputDialog.h" />
<QtMoc Include="Common\CheckList.h" />
<ClInclude Include="Common\Common.h" /> <ClInclude Include="Common\Common.h" />
<ClInclude Include="Common\DebugHelpers.h" /> <ClInclude Include="Common\DebugHelpers.h" />
<ClInclude Include="Common\ExitDialog.h" /> <ClInclude Include="Common\ExitDialog.h" />

View File

@ -198,5 +198,8 @@
<QtMoc Include="Common\NetworkAccessManager.h"> <QtMoc Include="Common\NetworkAccessManager.h">
<Filter>Common</Filter> <Filter>Common</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="Common\CheckList.h">
<Filter>Common</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -4,6 +4,7 @@
#include "../QSbieAPI/SbieAPI.h" #include "../QSbieAPI/SbieAPI.h"
#include "..\Models\TraceModel.h" #include "..\Models\TraceModel.h"
#include "..\..\MiscHelpers\Common\Common.h" #include "..\..\MiscHelpers\Common\Common.h"
#include "..\..\MiscHelpers\Common\CheckList.h"
#include "SbieView.h" #include "SbieView.h"
//class CTraceFilterProxyModel : public CSortFilterProxyModel //class CTraceFilterProxyModel : public CSortFilterProxyModel
@ -54,7 +55,6 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
//m_FilterCol = -1; //m_FilterCol = -1;
m_FilterPid = 0; m_FilterPid = 0;
m_FilterTid = 0; m_FilterTid = 0;
m_FilterType = 0;
m_FilterStatus = 0; m_FilterStatus = 0;
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection); m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
@ -81,15 +81,14 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
m_pTraceToolBar->addWidget(m_pTraceTid); m_pTraceToolBar->addWidget(m_pTraceTid);
m_pTraceToolBar->addWidget(new QLabel(tr("Type:"))); m_pTraceToolBar->addWidget(new QLabel(tr("Type:")));
m_pTraceType = new QComboBox(); m_pTraceType = new QCheckList();
m_pTraceType->addItem(tr("[All]"), 0); //m_pTraceType->addItem(tr("[All]"), 0);
for (quint32 i = 0; i < 0xff; i++) { m_pTraceType->setAllCheckedText(tr("[All]"));
QString TypeStr = CTraceEntry::GetTypeStr(i); m_pTraceType->setNoneCheckedText(tr("[All]"));
if(!TypeStr.isEmpty()) foreach(quint32 type, CTraceEntry::AllTypes())
m_pTraceType->addItem(TypeStr, i); m_pTraceType->addCheckItem(CTraceEntry::GetTypeStr(type), type, Qt::Unchecked);
} m_pTraceType->setMinimumWidth(100);
m_pTraceType->setMinimumWidth(75); connect(m_pTraceType, SIGNAL(globalCheckStateChanged(int)), this, SLOT(OnSetFilter()));
connect(m_pTraceType, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter()));
m_pTraceToolBar->addWidget(m_pTraceType); m_pTraceToolBar->addWidget(m_pTraceType);
m_pTraceToolBar->addWidget(new QLabel(tr("Status:"))); m_pTraceToolBar->addWidget(new QLabel(tr("Status:")));
@ -165,42 +164,43 @@ int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params)
{ {
CTraceView* This = (CTraceView*)params; CTraceView* This = (CTraceView*)params;
int True = This->m_bHighLight ? 2 : 1; int Ret = 1;
int False = This->m_bHighLight ? 1 : 0;
if (This->m_pCurrentBox != NULL && This->m_pCurrentBox != pEntry->GetBoxPtr()) if (This->m_pCurrentBox != NULL && This->m_pCurrentBox != pEntry->GetBoxPtr())
return False; return 0;
if (This->m_FilterExp.isValid()) { if (This->m_FilterExp.isValid()) {
if (!pEntry->GetMessage().contains(This->m_FilterExp) if (!pEntry->GetMessage().contains(This->m_FilterExp)
//&& !pEntry->GetTypeStr().contains(This->m_FilterExp) //&& !pEntry->GetTypeStr().contains(This->m_FilterExp)
//&& !pEntry->GetStautsStr().contains(This->m_FilterExp) //&& !pEntry->GetStautsStr().contains(This->m_FilterExp)
&& !pEntry->GetProcessName().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()) if (This->m_FilterPid != 0 && This->m_FilterPid != pEntry->GetProcessId())
return False; return 0;
if (This->m_FilterTid != 0 && This->m_FilterTid != pEntry->GetThreadId()) if (This->m_FilterTid != 0 && This->m_FilterTid != pEntry->GetThreadId())
return False; return 0;
if (This->m_FilterType != 0 && This->m_FilterType != pEntry->GetType()) if (!This->m_FilterTypes.isEmpty() && !This->m_FilterTypes.contains(pEntry->GetType()))
return False; return 0;
if (This->m_FilterStatus != 0) { if (This->m_FilterStatus != 0) {
if (pEntry->IsOpen()) { if (pEntry->IsOpen()) {
if(This->m_FilterStatus == 1) return True; if(This->m_FilterStatus == 1) return Ret;
} else if (pEntry->IsClosed()) { } else if (pEntry->IsClosed()) {
if (This->m_FilterStatus == 2) return True; if (This->m_FilterStatus == 2) return Ret;
} else if (pEntry->IsTrace()) { } else if (pEntry->IsTrace()) {
if(This->m_FilterStatus == 3) return True; if(This->m_FilterStatus == 3) return Ret;
} else } else
if(This->m_FilterStatus == 4) return True; if(This->m_FilterStatus == 4) return Ret;
return False; return 0;
} }
return True; return Ret;
} }
void CTraceView::Refresh() void CTraceView::Refresh()
@ -321,7 +321,13 @@ void CTraceView::OnSetTidFilter()
void CTraceView::OnSetFilter() 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_FilterStatus = m_pTraceStatus->currentData().toUInt();
m_FullRefresh = true; m_FullRefresh = true;

View File

@ -41,7 +41,7 @@ protected:
//int m_FilterCol; //int m_FilterCol;
quint32 m_FilterPid; quint32 m_FilterPid;
quint32 m_FilterTid; quint32 m_FilterTid;
quint32 m_FilterType; QList<quint32> m_FilterTypes;
quint32 m_FilterStatus; quint32 m_FilterStatus;
void* m_pCurrentBox; void* m_pCurrentBox;
@ -49,7 +49,7 @@ protected:
QAction* m_pTraceTree; QAction* m_pTraceTree;
QComboBox* m_pTracePid; QComboBox* m_pTracePid;
QComboBox* m_pTraceTid; QComboBox* m_pTraceTid;
QComboBox* m_pTraceType; class QCheckList* m_pTraceType;
QComboBox* m_pTraceStatus; QComboBox* m_pTraceStatus;
QAction* m_pAllBoxes; QAction* m_pAllBoxes;
QAction* m_pSaveToFile; QAction* m_pSaveToFile;

View File

@ -3,7 +3,7 @@
#define VERSION_MJR 0 #define VERSION_MJR 0
#define VERSION_MIN 9 #define VERSION_MIN 9
#define VERSION_REV 8 #define VERSION_REV 8
#define VERSION_UPD 3 #define VERSION_UPD 4
#ifndef STR #ifndef STR
#define STR2(X) #X #define STR2(X) #X