Sandboxie/SandboxiePlus/SandMan/SbiePlusAPI.h

122 lines
4.4 KiB
C
Raw Normal View History

2020-06-18 16:44:29 +01:00
#pragma once
#include "../QSbieAPI/SbieAPI.h"
class CSbiePlusAPI : public CSbieAPI
{
Q_OBJECT
public:
CSbiePlusAPI(QObject* parent);
virtual ~CSbiePlusAPI();
2021-01-26 20:58:43 +00:00
virtual void UpdateWindowMap();
virtual QString GetProcessTitle(quint32 pid) { return m_WindowMap.value(pid); }
2020-06-18 16:44:29 +01:00
protected:
virtual CSandBox* NewSandBox(const QString& BoxName, class CSbieAPI* pAPI);
2020-11-28 16:20:56 +00:00
virtual CBoxedProcess* NewBoxedProcess(quint32 ProcessId, class CSandBox* pBox);
2020-06-18 16:44:29 +01:00
2020-12-22 14:50:58 +00:00
virtual CBoxedProcessPtr OnProcessBoxed(quint32 ProcessId, const QString& Path, const QString& Box, quint32 ParentId);
2021-01-26 20:58:43 +00:00
QMultiMap<quint32, QString> m_WindowMap;
2020-06-18 16:44:29 +01:00
};
///////////////////////////////////////////////////////////////////////////////
2020-11-16 16:15:03 +00:00
// CSandBoxPlus
2020-06-18 16:44:29 +01:00
//
class CSandBoxPlus : public CSandBox
{
Q_OBJECT
public:
CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI);
virtual ~CSandBoxPlus();
virtual void UpdateDetails();
2020-11-28 16:20:56 +00:00
virtual void CloseBox();
2020-07-04 11:07:36 +01:00
virtual QString GetStatusStr() const;
virtual void SetLogApi(bool bEnable);
2020-11-16 16:15:03 +00:00
virtual bool HasLogApi() const { return m_bLogApiFound; }
2020-07-04 11:07:36 +01:00
virtual void SetINetBlock(bool bEnable);
2020-11-16 16:15:03 +00:00
virtual bool IsINetBlocked() const { return m_bINetBlocked; }
2020-07-04 11:07:36 +01:00
virtual void SetAllowShares(bool bEnable);
2020-11-16 16:15:03 +00:00
virtual bool HasSharesAccess() const { return m_bSharesAllowed; }
2020-07-04 11:07:36 +01:00
virtual void SetDropRights(bool bEnable);
2020-11-16 16:15:03 +00:00
virtual bool IsDropRights() const { return m_bDropRights; }
2020-07-04 11:07:36 +01:00
2020-11-16 16:15:03 +00:00
virtual bool IsSecurityRestricted() const { return m_bSecurityRestricted; }
virtual bool IsUnsecureDebugging() const { return m_iUnsecureDebugging != 0; }
virtual void BlockProgram(const QString& ProgName);
2020-12-29 08:54:59 +00:00
virtual void SetInternetAccess(const QString& ProgName, bool bSet);
virtual bool HasInternetAccess(const QString& ProgName);
virtual void SetForcedProgram(const QString& ProgName, bool bSet);
virtual bool IsForcedProgram(const QString& ProgName);
2020-11-16 16:15:03 +00:00
virtual void SetLingeringProgram(const QString& ProgName, bool bSet);
virtual int IsLingeringProgram(const QString& ProgName);
virtual void SetLeaderProgram(const QString& ProgName, bool bSet);
virtual int IsLeaderProgram(const QString& ProgName);
2020-06-18 16:44:29 +01:00
2020-12-22 14:50:58 +00:00
virtual bool IsRecoverySuspended() const { return m_SuspendRecovery; }
2020-11-28 16:20:56 +00:00
virtual void SetSuspendRecovery(bool bSet = true) { m_SuspendRecovery = bSet; }
2020-12-22 14:50:58 +00:00
const QSet<QString>& GetRecentPrograms() { return m_RecentPrograms; }
2020-06-18 16:44:29 +01:00
protected:
2020-12-22 14:50:58 +00:00
friend class CSbiePlusAPI;
2020-07-04 11:07:36 +01:00
virtual bool CheckOpenToken() const;
2020-12-29 08:54:59 +00:00
virtual bool TestProgramGroup(const QString& Group, const QString& ProgName);
virtual void EditProgramGroup(const QString& Group, const QString& ProgName, bool bSet);
2020-06-18 16:44:29 +01:00
bool m_bLogApiFound;
2020-07-04 11:07:36 +01:00
bool m_bINetBlocked;
bool m_bSharesAllowed;
bool m_bDropRights;
2020-06-18 16:44:29 +01:00
2020-07-04 11:07:36 +01:00
bool m_bSecurityRestricted;
int m_iUnsecureDebugging;
2020-11-28 16:20:56 +00:00
bool m_SuspendRecovery;
2020-12-22 14:50:58 +00:00
QSet<QString> m_RecentPrograms;
2020-11-16 16:15:03 +00:00
};
///////////////////////////////////////////////////////////////////////////////
// CSbieProcess
//
class CSbieProcess : public CBoxedProcess
{
Q_OBJECT
public:
2020-11-28 16:20:56 +00:00
CSbieProcess(quint32 ProcessId, class CSandBox* pBox) : CBoxedProcess(ProcessId, pBox) {}
2020-11-16 16:15:03 +00:00
2020-12-23 18:17:24 +00:00
virtual QString GetStatusStr() const;
2020-11-16 16:15:03 +00:00
virtual void BlockProgram() { GetBox()->BlockProgram(m_ImageName); }
2020-12-29 08:54:59 +00:00
virtual void SetInternetAccess(bool bSet) { GetBox()->SetInternetAccess(m_ImageName, bSet); }
virtual bool HasInternetAccess() { return GetBox()->HasInternetAccess(m_ImageName); }
virtual void SetForcedProgram(bool bSet) { GetBox()->SetForcedProgram(m_ImageName, bSet); }
virtual bool IsForcedProgram() { return GetBox()->IsForcedProgram(m_ImageName); }
2020-11-16 16:15:03 +00:00
virtual void SetLingeringProgram(bool bSet) { GetBox()->SetLingeringProgram(m_ImageName, bSet); }
virtual int IsLingeringProgram() { return GetBox()->IsLingeringProgram(m_ImageName); }
virtual void SetLeaderProgram(bool bSet) { GetBox()->SetLeaderProgram(m_ImageName, bSet); }
virtual int IsLeaderProgram() { return GetBox()->IsLeaderProgram(m_ImageName); }
virtual CSandBoxPlus* GetBox() { return qobject_cast<CSandBoxPlus*>(m_pBox); }
2020-11-28 16:20:56 +00:00
virtual int GetRememberedAction(int Action) { return m_RememberedActions.value(Action, -1); }
virtual void SetRememberedAction(int Action, int retval) { m_RememberedActions.insert(Action, retval); }
protected:
QMap<int, int> m_RememberedActions;
2020-06-18 16:44:29 +01:00
};