Sandboxie/SandboxiePlus/QSbieAPI/SbieTrace.h

87 lines
2.3 KiB
C
Raw Normal View History

2021-02-14 19:18:29 +00:00
/*
*
* Copyright (c) 2020, David Xanatos
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QThread>
#include "qsbieapi_global.h"
#include "SbieStatus.h"
2021-02-21 14:32:20 +00:00
2021-02-14 19:18:29 +00:00
class QSBIEAPI_EXPORT CTraceEntry : public QSharedData
{
public:
CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, const QString& Message);
virtual QString GetMessage() const { return m_Message; }
virtual quint32 GetProcessId() const { return m_ProcessId; }
virtual quint32 GetThreadId() const { return m_ThreadId; }
virtual QDateTime GetTimeStamp() const { return m_TimeStamp; }
virtual quint16 GetType() const { return m_Type.Flags; }
virtual QString GetTypeStr() const;
virtual QString GetStautsStr() const;
virtual int GetCount() const { return m_Counter; }
virtual bool Equals(const QSharedDataPointer<CTraceEntry>& pOther) const {
return pOther->m_ProcessId == this->m_ProcessId && pOther->m_ThreadId == this->m_ThreadId
&& pOther->m_Message == this->m_Message;
}
virtual void Merge(const QSharedDataPointer<CTraceEntry>& pOther) {
m_Counter++; this->m_Type.Flags |= pOther->m_Type.Flags;
}
quint64 GetUID() const { return m_uid; }
protected:
QString m_Message;
quint32 m_ProcessId;
quint32 m_ThreadId;
QDateTime m_TimeStamp;
union
{
2021-03-04 20:13:45 +00:00
quint32 Flags;
2021-02-14 19:18:29 +00:00
struct
{
2021-03-04 20:13:45 +00:00
quint32
Type : 8,
SubType : 8,
Disposition : 4,
Allowed : 1,
Denided : 1,
Success : 1,
Failed : 1,
Reserved : 6,
Trace : 1,
User : 1;
2021-02-14 19:18:29 +00:00
};
} m_Type;
quint64 m_uid;
int m_Counter;
};
typedef QSharedDataPointer<CTraceEntry> CTraceEntryPtr;