-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathprocessmonitor.h
More file actions
95 lines (68 loc) · 2.1 KB
/
Copy pathprocessmonitor.h
File metadata and controls
95 lines (68 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef PROCESSMONITOR_H
#define PROCESSMONITOR_H
#include <windows.h>
#include "winutils.h"
#include <QLabel>
#include <QMap>
#include <QObject>
#include <QProcess>
#include <QSettings>
#include <QThread>
#include <QTimer>
#include <QTreeWidget>
#include <tlhelp32.h>
#define CONFIG_TARGETNAMES_KEY "ProcessMonitor/TargetNames"
class ProcessMonitor : public QObject
{
Q_OBJECT
public:
explicit ProcessMonitor(QSettings *settings,
QTreeWidget *treeWidget,
QLabel *treeStatusLabel,
QLabel *injector32StatusLabel,
QLabel *injector64StatusLabel,
QObject *parent = nullptr);
~ProcessMonitor();
// 设置刷新间隔(毫秒)
void setInterval(int msec);
// 设置过滤
void setFilter(QString processName);
void changeSpeed(double factor);
public slots:
// 定时刷新槽函数
void refresh();
void start();
private slots:
void onItemChanged(QTreeWidgetItem *item, int column);
private:
QTreeWidget *m_treeWidget;
QLabel *m_treeStatusLabel;
QLabel *m_injector32StatusLabel;
QLabel *m_injector64StatusLabel;
QString m_filter;
QTimer *m_timer = nullptr;
QString m_dllPath;
QProcess *m_bridge32;
QProcess *m_bridge64;
QSettings *m_settings;
// 图标缓存
QHash<QString, QIcon> m_iconCache;
// 存储进程ID到TreeWidgetItem的映射
QMap<DWORD, QTreeWidgetItem *> m_processItems;
// 存储需要加速的进程
QSet<QString> m_targetNames;
void init();
void dump();
void update(const QList<ProcessInfo> &processList);
void injectDll(DWORD processId, bool is64Bit);
void unhookDll(DWORD processId, bool is64Bit);
void startBridge32();
void startBridge64();
void healthcheckBridge();
void terminalBridge();
// 获取进程图标
static QIcon getProcessIcon(QString processPath);
static QIcon getDefaultIcon(const QString &processName);
QIcon getProcessIconCached(DWORD proccessId);
};
#endif // PROCESSMONITOR_H