forked from game1024/OpenSpeedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessmonitor.h
More file actions
111 lines (85 loc) · 2.82 KB
/
Copy pathprocessmonitor.h
File metadata and controls
111 lines (85 loc) · 2.82 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* OpenSpeedy - Open Source Game Speed Controller
* Copyright (C) 2025 Game1024
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 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 <https://www.gnu.org/licenses/>.
*/
#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