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
enum
Type {
Sunlight, Money, TreeHeight, Chocolate, TreeFood, FlowerFood, Insecticide
};
unsigned
int
offsetTable[10] = { 0x5578,0x50,0x11c,0x250,0x258,0x220,0x224 };
unsigned
int
getSomething(
HANDLE
handle,
DWORD
BaseAddr,unsigned
int
type) {
unsigned
int
num = 0;
DWORD
addr = BaseAddr + 0x00355E0C;
ReadProcessMemory(handle, addr, &addr,
sizeof
(
DWORD
), NULL);
if
(type == Sunlight)
addr += 0x868;
else
addr += 0x950;
ReadProcessMemory(handle, (
LPVOID
)addr, &addr,
sizeof
(
DWORD
), NULL);
addr += offsetTable[type];
ReadProcessMemory(handle, (
LPVOID
)addr, &num,
sizeof
(
DWORD
), 0);
return
num;
}
void
setSomething(
HANDLE
handle,
DWORD
BaseAddr,unsigned
int
type, unsigned
int
num) {
DWORD
addr = BaseAddr + 0x00355E0C;
ReadProcessMemory(handle, addr, &addr,
sizeof
(
DWORD
), NULL);
if
(type == Sunlight)
addr += 0x868;
else
addr += 0x950;
ReadProcessMemory(handle, (
LPVOID
)addr, &addr,
sizeof
(
DWORD
), NULL);
addr += offsetTable[type];
WriteProcessMemory(handle, (
LPVOID
)addr, &num,
sizeof
(
DWORD
), 0);
}
1
2
3
4
5
6
7
8
9
10
11
BOOL
SetPlantCard(
HANDLE
hProcess,
DWORD
BaseAddr,
DWORD
nCard,
DWORD
plantType) {
DWORD
cardAddr = BaseAddr + 0x355E0C;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x868;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x15C;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x5C+nCard*0x50;
return
WriteProcessMemory(hProcess, cardAddr, &plantType,
sizeof
(
DWORD
), NULL);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
BOOL
WriteProcessCodeMemory(
HANDLE
hProcess,
LPVOID
lpStartAddress,
LPCVOID
lpBuffer,
SIZE_T
nSize) {
DWORD
dwOldProtect;
if
(!VirtualProtectEx(hProcess, lpStartAddress, nSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
return
FALSE;
}
BOOL
bResult = WriteProcessMemory(hProcess, lpStartAddress, lpBuffer, nSize, NULL);
VirtualProtectEx(hProcess, lpStartAddress, nSize, dwOldProtect, &dwOldProtect);
return
bResult;
}
BOOL
Uncooled(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
code[2] = { 0xeb,0x00 };
return
WriteProcessCodeMemory(hProcess, BaseAddr + 0x9ce02, code, 2);
}
BOOL
RecoveryCooling(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
OriginalCode[2] = { 0x7E ,0x16 };
return
WriteProcessCodeMemory(hProcess, BaseAddr + 0x9ce02, OriginalCode, 2);
}
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
BOOL
WriteProcessCodeMemory(
HANDLE
hProcess,
LPVOID
lpStartAddress,
LPCVOID
lpBuffer,
SIZE_T
nSize) {
DWORD
dwOldProtect;
if
(!VirtualProtectEx(hProcess, lpStartAddress, nSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
return
FALSE;
}
BOOL
bResult = WriteProcessMemory(hProcess, lpStartAddress, lpBuffer, nSize, NULL);
VirtualProtectEx(hProcess, lpStartAddress, nSize, dwOldProtect, &dwOldProtect);
return
bResult;
}
BOOL
UnlimitedSun(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
Code[3] = { 0x29,0xdb,0 };
BOOL
flag;
flag = setSomething(hProcess, BaseAddr, Sunlight, 9999);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x27690, Code, 2);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x3C0AB, &Code[2], 1);
return
flag;
}
BOOL
RecoverySunConsume(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
OriginalCode[3] = { 0x3B,0xD8,0x32 };
BOOL
flag = WriteProcessCodeMemory(hProcess, BaseAddr + 0x27690, OriginalCode, 2);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x3C0AB, &OriginalCode[2], 1);
return
flag;
}
具体方法: 在生存模式浓雾进行,初值未知,通过在雾区种植和铲除路灯花引起的变化来判断,最终可以发现是4字节数据,数值代表雾的浓度,255代表浓雾,0代表没雾,再查找修改雾值的代码
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
BOOL
WriteProcessCodeMemory(
HANDLE
hProcess,
LPVOID
lpStartAddress,
LPCVOID
lpBuffer,
SIZE_T
nSize) {
DWORD
dwOldProtect;
if
(!VirtualProtectEx(hProcess, lpStartAddress, nSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
return
FALSE;
}
BOOL
bResult = WriteProcessMemory(hProcess, lpStartAddress, lpBuffer, nSize, NULL);
VirtualProtectEx(hProcess, lpStartAddress, nSize, dwOldProtect, &dwOldProtect);
return
bResult;
}
LPVOID
SetHook(
HANDLE
hProcess,
LPVOID
desAddr,
LPCVOID
hookCode,
SIZE_T
hookCodeSize,
SIZE_T
origCodeSize) {
BYTE
origCode[10] = { 0 }, jmpCode[5] = { 0xE9,0,0,0,0 };
if
(!ReadProcessMemory(hProcess, desAddr, origCode, origCodeSize, NULL))
return
NULL;
LPVOID
allocAddr = VirtualAllocEx(hProcess, NULL, hookCodeSize + origCodeSize + 5, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if
(!allocAddr)
return
NULL;
*(
DWORD
*)(jmpCode + 1) = (
DWORD
)desAddr + 5 - ((
DWORD
)allocAddr + hookCodeSize + origCodeSize + 5);
if
(!WriteProcessCodeMemory(hProcess, allocAddr, origCode, origCodeSize)
|| !WriteProcessCodeMemory(hProcess, (
DWORD
)allocAddr + origCodeSize, hookCode, hookCodeSize)
|| !WriteProcessCodeMemory(hProcess, (
DWORD
)allocAddr + origCodeSize + hookCodeSize, jmpCode, 5))
{
VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE);
return
NULL;
}
*(
DWORD
*)(jmpCode + 1) = ((
DWORD
)allocAddr + origCodeSize) - ((
DWORD
)desAddr + 5);
WriteProcessCodeMemory(hProcess, desAddr, jmpCode, 5);
if
(origCodeSize > 5)
{
BYTE
nopCode[5] = { 0x90,0x90,0x90,0x90,0x90 };
if
(!WriteProcessCodeMemory(hProcess, (
DWORD
)desAddr + 5, nopCode, origCodeSize - 5))
{
VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE);
return
NULL;
}
}
return
allocAddr;
}
BOOL
UnHook(
HANDLE
hProcess,
LPVOID
desAddr,
SIZE_T
origCodeSize,
LPVOID
allocAddr) {
BYTE
origCode[10] = { 0 };
if
(!ReadProcessMemory(hProcess, allocAddr, origCode, origCodeSize, NULL))
return
FALSE;
if
(!WriteProcessCodeMemory(hProcess, desAddr, origCode, origCodeSize))
return
FALSE;
if
(!VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE))
return
FALSE;
return
TRUE;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
LPVOID
DeFogByHook(
HANDLE
hProcess,
LPVOID
BaseAddr) {
unsigned
char
hookCode[9] = {
0xc7,0x01,0x00,0x00,0x00,0x00,
0x83,0xc1,0x04
};
return
SetHook(hProcess, (
DWORD
)BaseAddr + 0x26173, hookCode,
sizeof
(hookCode), 5);
}
BOOL
RecoveryFogByUnHook(
HANDLE
hProcess,
LPVOID
BaseAddr,
LPVOID
allocAddr) {
return
UnHook(hProcess, (
DWORD
)BaseAddr + 0x26173, 5, allocAddr);
}
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
BOOL
InjectDllByRemoteThread(
DWORD
desProcId,
WCHAR
* dllPath) {
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, desProcId);
if
(!hProcess)
return
FALSE;
DWORD
pathSize = (wcslen(dllPath) + 1) * 2;
LPVOID
newMemAddr = VirtualAllocEx(hProcess, 0, pathSize, MEM_COMMIT, PAGE_READWRITE);
if
(!newMemAddr)
return
FALSE;
if
(!WriteProcessMemory(hProcess, newMemAddr, dllPath, pathSize, NULL))
{
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
return
FALSE;
}
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)LoadLibraryW, newMemAddr, 0, NULL);
if
(!hThread)
{
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
return
FALSE;
}
WaitForSingleObject(hThread, INFINITE);
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
CloseHandle(hThread);
CloseHandle(hProcess);
return
TRUE;
}
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
BOOL
UnLoadDllByRemoteThread(
DWORD
dwProcessId,
LPCWSTR
lpDllName)
{
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess == NULL)
return
FALSE;
LPVOID
lpRemoteDllName = VirtualAllocEx(hProcess, NULL, (wcslen(lpDllName) + 1) *
sizeof
(
WCHAR
), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if
(lpRemoteDllName == NULL)
{
CloseHandle(hProcess);
return
FALSE;
}
if
(!WriteProcessMemory(hProcess, lpRemoteDllName, lpDllName, (wcslen(lpDllName) + 1) *
sizeof
(
WCHAR
), NULL))
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
HMODULE
hModules[1024],DesModule=NULL;
DWORD
dwSize = 0;
if
(!EnumProcessModules(hProcess, hModules,
sizeof
(hModules), &dwSize))
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
for
(
DWORD
i = 0; i < (dwSize /
sizeof
(
HMODULE
)); i++)
{
WCHAR
szModuleName[MAX_PATH] = { 0 };
if
(GetModuleFileNameExW(hProcess, hModules[i], szModuleName, MAX_PATH) > 0)
{
if
(wcsicmp(szModuleName, lpDllName) == 0)
{
DesModule = hModules[i];
}
}
}
if
(!DesModule) {
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)FreeLibrary, DesModule, 0, NULL);
if
(hThread == NULL)
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
TRUE;
}
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
#include<windows.h>
#include<stdio.h>
BOOL
GrowPlant(
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
TypePlant) {
LPVOID
PlantFunc = BaseAddr + 0x18D70;
__asm {
pushad
push -1
push TypePlant
mov eax, y
push x
mov ecx, BaseAddr
mov ecx, [ecx+0x355E0C]
mov ecx, [ecx + 0x868]
push ecx
call PlantFunc
popad
}
return
TRUE;
}
BOOL
WINAPI DllMain(
HMODULE
hInstance,
DWORD
fdwReason,
LPVOID
lpReserved) {
DWORD
BaseAddr = GetModuleHandle(NULL);
DWORD
pid = GetCurrentProcessId();
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
LPVOID
PlantFunc = BaseAddr + 0x18D70;
DWORD
ebpAddr = BaseAddr+0x355E0C,num=0;
ReadProcessMemory(hProcess, ebpAddr, &ebpAddr,
sizeof
(
DWORD
), NULL);
ebpAddr += 0x868;
ReadProcessMemory(hProcess, ebpAddr, &ebpAddr,
sizeof
(
DWORD
), NULL);
DWORD
x = 1, y = 1, TypePlant = 16;
switch
(fdwReason)
{
case
DLL_PROCESS_ATTACH:
__asm {
pushad
push - 1
push TypePlant
mov eax, y
push x
push ebpAddr
call PlantFunc
popad
}
x = 3, y = 2, TypePlant = 18;
__asm {
pushad
push - 1
push TypePlant
mov eax, y
push x
mov ecx, BaseAddr
mov ecx, [ecx+0x355E0C]
mov ecx, [ecx + 0x868]
push ecx
call PlantFunc
popad
}
GrowPlant(BaseAddr,7,3,23);
break
;
break
;
case
DLL_PROCESS_DETACH:
MessageBoxW(0, L
"ProcessDeTachDll!"
, L
"window2"
, 0);
break
;
}
return
TRUE;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
__asm {
pushad
push - 1
push TypePlant
mov eax, y
push x
mov ecx,[BaseAddr+ 0x355E0C]
mov ecx,[ecx+0x868]
mov num, ecx
push ecx
call PlantFunc
popad
}
1
2
3
DWORD
WINAPI ThreadProc(
_In_
LPVOID
lpParameter
);
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
BOOL
GrowPlantByInjectCode(
DWORD
dwProcessId,
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
PlantType)
{
BOOL
bSuccess = FALSE;
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess != NULL)
{
BYTE
InjectCode[50] = {
0x55,
0x89, 0xE5,
0x60,
0x68, 0xFF, 0xFF, 0xFF, 0xFF,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB8, 0x00, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB9, 0x00, 0x00, 0x00, 0x00,
0x8B, 0x89, 0x0C, 0x5E, 0x35, 0x00,
0x8B, 0x89, 0x68, 0x08, 0x00, 0x00,
0x51,
0xE8, 0x00, 0x00, 0x00, 0x00,
0x61,
0xC9,
0xC3
};
DWORD
dwCodeSize = 50, desFunc = BaseAddr + 0x18D70;
LPVOID
lpRemoteCodeMem = VirtualAllocEx(hProcess, NULL, dwCodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
*(
DWORD
*)&InjectCode[10] = PlantType;
*(
DWORD
*)&InjectCode[15] = y;
*(
DWORD
*)&InjectCode[20] = x;
*(
DWORD
*)&InjectCode[25] = BaseAddr;
*(
DWORD
*)&InjectCode[43] = desFunc-((
DWORD
)lpRemoteCodeMem+42+5) ;
if
(lpRemoteCodeMem != NULL)
{
SIZE_T
dwBytesWritten = 0;
if
(WriteProcessMemory(hProcess, lpRemoteCodeMem, InjectCode, dwCodeSize, &dwBytesWritten) &&
dwBytesWritten == dwCodeSize)
{
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lpRemoteCodeMem,NULL, 0, NULL);
if
(hThread != NULL)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
bSuccess = TRUE;
}
}
VirtualFreeEx(hProcess, lpRemoteCodeMem, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
}
return
bSuccess;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
BOOL
GrowZombie(
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
ZombieType) {
LPVOID
PlantZombieFunc = BaseAddr + 0x35390;
__asm {
pushad
push x
push ZombieType
mov eax,y
mov ecx,BaseAddr
mov ecx,[ecx+0x355E0C]
mov ecx,[ecx+0x868]
mov ecx,[ecx+0x178]
call PlantZombieFunc
popad
}
return
TRUE;
}
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
BOOL
GrowZombieByRemoteThread(
DWORD
dwProcessId,
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
ZombieType) {
BOOL
bSuccess = FALSE;
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess != NULL)
{
BYTE
InjectCode[50] = {
0x55,
0x89, 0xE5,
0x60,
0x68, 0x00, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB8, 0x00, 0x00, 0x00, 0x00,
0xB9, 0x00, 0x00, 0x00, 0x00,
0x8B, 0x89, 0x0C, 0x5E, 0x35, 0x00,
0x8B, 0x89, 0x68, 0x08, 0x00, 0x00,
0x8B, 0x89, 0x78, 0x01, 0x00, 0x00,
0xE8, 0x00, 0x00, 0x00, 0x00,
0x61,
0xC9,
0xC3
};
DWORD
dwCodeSize = 50, desFunc = BaseAddr + 0x35390;
LPVOID
lpRemoteCodeMem = VirtualAllocEx(hProcess, NULL, dwCodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
*(
DWORD
*)&InjectCode[5] = x;
*(
DWORD
*)&InjectCode[10] = ZombieType;
*(
DWORD
*)&InjectCode[15] = y;
*(
DWORD
*)&InjectCode[20] = BaseAddr;
*(
DWORD
*)&InjectCode[43] = desFunc - ((
DWORD
)lpRemoteCodeMem + 42 + 5);
if
(lpRemoteCodeMem != NULL)
{
SIZE_T
dwBytesWritten = 0;
if
(WriteProcessMemory(hProcess, lpRemoteCodeMem, InjectCode, dwCodeSize, &dwBytesWritten) &&
dwBytesWritten == dwCodeSize)
{
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lpRemoteCodeMem, NULL, 0, NULL);
if
(hThread != NULL)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
bSuccess = TRUE;
}
}
VirtualFreeEx(hProcess, lpRemoteCodeMem, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
}
return
bSuccess;
}
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
#include<stdio.h>
#include<windows.h>
#include <tlhelp32.h>
#include <string.h>
#include <shlwapi.h>
#include <psapi.h>
enum
Type {
Sunlight, Money, TreeHeight, Chocolate, TreeFood, FlowerFood, Insecticide
};
unsigned
int
offsetTable[10] = { 0x5578,0x50,0x11c,0x250,0x258,0x220,0x224 };
DWORD
GetProcessIdByName(
const
wchar_t
* processName) {
HANDLE
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if
(snapshot == INVALID_HANDLE_VALUE) {
return
0;
}
PROCESSENTRY32 processEntry = { 0 };
processEntry.dwSize =
sizeof
(PROCESSENTRY32);
if
(!Process32First(snapshot, &processEntry)) {
CloseHandle(snapshot);
return
0;
}
do
{
wchar_t
currentProcessName[MAX_PATH];
wcscpy_s(currentProcessName, MAX_PATH, processEntry.szExeFile);
if
(wcscmp(currentProcessName, processName) == 0) {
CloseHandle(snapshot);
return
processEntry.th32ProcessID;
}
}
while
(Process32Next(snapshot, &processEntry));
CloseHandle(snapshot);
return
0;
}
LPVOID
GetModuleBaseAddress(
DWORD
processId,
LPCWSTR
moduleName) {
LPVOID
lpBaseAddress = NULL;
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
if
(hProcess != NULL) {
HMODULE
hMods[1024];
DWORD
cbNeeded;
if
(EnumProcessModules(hProcess, hMods,
sizeof
(hMods), &cbNeeded)) {
DWORD
dwModuleCount = cbNeeded /
sizeof
(
HMODULE
);
for
(
DWORD
i = 0; i < dwModuleCount; i++) {
TCHAR
szModName[MAX_PATH];
if
(GetModuleFileNameEx(hProcess, hMods[i], szModName, MAX_PATH)) {
if
(wcsstr(szModName, moduleName)) {
MODULEINFO modInfo = { 0 };
if
(GetModuleInformation(hProcess, hMods[i], &modInfo,
sizeof
(MODULEINFO))) {
lpBaseAddress = modInfo.lpBaseOfDll;
break
;
}
}
}
}
}
CloseHandle(hProcess);
}
return
lpBaseAddress;
}
BOOL
WriteProcessCodeMemory(
HANDLE
hProcess,
LPVOID
lpStartAddress,
LPCVOID
lpBuffer,
SIZE_T
nSize) {
DWORD
dwOldProtect;
if
(!VirtualProtectEx(hProcess, lpStartAddress, nSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
return
FALSE;
}
BOOL
bResult = WriteProcessMemory(hProcess, lpStartAddress, lpBuffer, nSize, NULL);
VirtualProtectEx(hProcess, lpStartAddress, nSize, dwOldProtect, &dwOldProtect);
return
bResult;
}
LPVOID
SetHook(
HANDLE
hProcess,
LPVOID
desAddr,
LPCVOID
hookCode,
SIZE_T
hookCodeSize,
SIZE_T
origCodeSize) {
BYTE
origCode[10] = { 0 }, jmpCode[5] = { 0xE9,0,0,0,0 };
if
(!ReadProcessMemory(hProcess, desAddr, origCode, origCodeSize, NULL))
return
NULL;
LPVOID
allocAddr = VirtualAllocEx(hProcess, NULL, hookCodeSize + origCodeSize + 5, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if
(!allocAddr)
return
NULL;
*(
DWORD
*)(jmpCode + 1) = (
DWORD
)desAddr + 5 - ((
DWORD
)allocAddr + hookCodeSize + origCodeSize + 5);
if
(!WriteProcessCodeMemory(hProcess, allocAddr, origCode, origCodeSize)
|| !WriteProcessCodeMemory(hProcess, (
DWORD
)allocAddr + origCodeSize, hookCode, hookCodeSize)
|| !WriteProcessCodeMemory(hProcess, (
DWORD
)allocAddr + origCodeSize + hookCodeSize, jmpCode, 5))
{
VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE);
return
NULL;
}
*(
DWORD
*)(jmpCode + 1) = ((
DWORD
)allocAddr + origCodeSize) - ((
DWORD
)desAddr + 5);
WriteProcessCodeMemory(hProcess, desAddr, jmpCode, 5);
if
(origCodeSize > 5)
{
BYTE
nopCode[5] = { 0x90,0x90,0x90,0x90,0x90 };
if
(!WriteProcessCodeMemory(hProcess, (
DWORD
)desAddr + 5, nopCode, origCodeSize - 5))
{
VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE);
return
NULL;
}
}
return
allocAddr;
}
BOOL
UnHook(
HANDLE
hProcess,
LPVOID
desAddr,
SIZE_T
origCodeSize,
LPVOID
allocAddr) {
BYTE
origCode[10] = { 0 };
if
(!ReadProcessMemory(hProcess, allocAddr, origCode, origCodeSize, NULL))
return
FALSE;
if
(!WriteProcessCodeMemory(hProcess, desAddr, origCode, origCodeSize))
return
FALSE;
if
(!VirtualFreeEx(hProcess, allocAddr, 0, MEM_RELEASE))
return
FALSE;
return
TRUE;
}
unsigned
int
getSomething(
HANDLE
handle,
DWORD
BaseAddr, unsigned
int
type) {
unsigned
int
num = 0;
DWORD
addr = BaseAddr + 0x00355E0C;
ReadProcessMemory(handle, (
LPVOID
)addr, &addr,
sizeof
(
DWORD
), NULL);
if
(type == Sunlight)
addr += 0x868;
else
addr += 0x950;
ReadProcessMemory(handle, (
LPVOID
)addr, &addr,
sizeof
(
DWORD
), NULL);
addr += offsetTable[type];
ReadProcessMemory(handle, (
LPVOID
)addr, &num,
sizeof
(
DWORD
), 0);
return
num;
}
BOOL
setSomething(
HANDLE
handle,
DWORD
BaseAddr, unsigned
int
type, unsigned
int
num) {
DWORD
addr = BaseAddr + 0x00355E0C;
ReadProcessMemory(handle, addr, &addr,
sizeof
(
DWORD
), NULL);
if
(type == Sunlight)
addr += 0x868;
else
addr += 0x950;
ReadProcessMemory(handle, (
LPVOID
)addr, &addr,
sizeof
(
DWORD
), NULL);
addr += offsetTable[type];
return
WriteProcessMemory(handle, (
LPVOID
)addr, &num,
sizeof
(
DWORD
), 0);
}
BOOL
Uncooled(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
code[2] = { 0xeb,0x00 };
return
WriteProcessCodeMemory(hProcess, BaseAddr + 0x9ce02, code, 2);
}
BOOL
RecoveryCooling(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
OriginalCode[2] = { 0x7E ,0x16 };
return
WriteProcessCodeMemory(hProcess, BaseAddr + 0x9ce02, OriginalCode, 2);
}
BOOL
UnlimitedSun(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
Code[3] = { 0x29,0xdb,0 };
BOOL
flag;
flag = setSomething(hProcess, BaseAddr, Sunlight, 9999);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x27690, Code, 2);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x3C0AB, &Code[2], 1);
return
flag;
}
BOOL
RecoverySunConsume(
HANDLE
hProcess,
DWORD
BaseAddr) {
unsigned
char
OriginalCode[3] = { 0x3B,0xD8,0x32 };
BOOL
flag = WriteProcessCodeMemory(hProcess, BaseAddr + 0x27690, OriginalCode, 2);
flag &= WriteProcessCodeMemory(hProcess, BaseAddr + 0x3C0AB, &OriginalCode[2], 1);
return
flag;
}
LPVOID
DeFogByHook(
HANDLE
hProcess,
LPVOID
BaseAddr) {
unsigned
char
hookCode[9] = {
0xc7,0x01,0x00,0x00,0x00,0x00,
0x83,0xc1,0x04
};
return
SetHook(hProcess, (
DWORD
)BaseAddr + 0x26173, hookCode,
sizeof
(hookCode), 5);
}
BOOL
RecoveryFogByUnHook(
HANDLE
hProcess,
LPVOID
BaseAddr,
LPVOID
allocAddr) {
return
UnHook(hProcess, (
DWORD
)BaseAddr + 0x26173, 5, allocAddr);
}
BOOL
InjectDllByRemoteThread(
DWORD
desProcId,
WCHAR
* dllPath) {
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, desProcId);
if
(!hProcess)
return
FALSE;
DWORD
pathSize = (wcslen(dllPath) + 1) * 2;
LPVOID
newMemAddr = VirtualAllocEx(hProcess, 0, pathSize, MEM_COMMIT, PAGE_READWRITE);
if
(!newMemAddr)
return
FALSE;
if
(!WriteProcessMemory(hProcess, newMemAddr, dllPath, pathSize, NULL))
{
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
return
FALSE;
}
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)LoadLibraryW, newMemAddr, 0, NULL);
if
(!hThread)
{
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
return
FALSE;
}
WaitForSingleObject(hThread, INFINITE);
VirtualFreeEx(hProcess, newMemAddr, 0, MEM_RELEASE);
CloseHandle(hThread);
CloseHandle(hProcess);
return
TRUE;
}
BOOL
UnLoadDllByRemoteThread(
DWORD
dwProcessId,
LPCWSTR
lpDllName)
{
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess == NULL)
return
FALSE;
LPVOID
lpRemoteDllName = VirtualAllocEx(hProcess, NULL, (wcslen(lpDllName) + 1) *
sizeof
(
WCHAR
), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if
(lpRemoteDllName == NULL)
{
CloseHandle(hProcess);
return
FALSE;
}
if
(!WriteProcessMemory(hProcess, lpRemoteDllName, lpDllName, (wcslen(lpDllName) + 1) *
sizeof
(
WCHAR
), NULL))
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
HMODULE
hModules[1024],DesModule=NULL;
DWORD
dwSize = 0;
if
(!EnumProcessModules(hProcess, hModules,
sizeof
(hModules), &dwSize))
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
for
(
DWORD
i = 0; i < (dwSize /
sizeof
(
HMODULE
)); i++)
{
WCHAR
szModuleName[MAX_PATH] = { 0 };
if
(GetModuleFileNameExW(hProcess, hModules[i], szModuleName, MAX_PATH) > 0)
{
if
(wcsicmp(szModuleName, lpDllName) == 0)
{
DesModule = hModules[i];
}
}
}
if
(!DesModule) {
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)FreeLibrary, DesModule, 0, NULL);
if
(hThread == NULL)
{
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
FALSE;
}
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
VirtualFreeEx(hProcess, lpRemoteDllName, 0, MEM_RELEASE);
CloseHandle(hProcess);
return
TRUE;
}
BOOL
GrowPlantByInjectCode(
DWORD
dwProcessId,
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
PlantType)
{
BOOL
bSuccess = FALSE;
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess != NULL)
{
BYTE
InjectCode[50] = {
0x55,
0x89, 0xE5,
0x60,
0x68, 0xFF, 0xFF, 0xFF, 0xFF,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB8, 0x00, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB9, 0x00, 0x00, 0x00, 0x00,
0x8B, 0x89, 0x0C, 0x5E, 0x35, 0x00,
0x8B, 0x89, 0x68, 0x08, 0x00, 0x00,
0x51,
0xE8, 0x00, 0x00, 0x00, 0x00,
0x61,
0xC9,
0xC3
};
DWORD
dwCodeSize = 50, desFunc = BaseAddr + 0x18D70;
LPVOID
lpRemoteCodeMem = VirtualAllocEx(hProcess, NULL, dwCodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
*(
DWORD
*)&InjectCode[10] = PlantType;
*(
DWORD
*)&InjectCode[15] = y;
*(
DWORD
*)&InjectCode[20] = x;
*(
DWORD
*)&InjectCode[25] = BaseAddr;
*(
DWORD
*)&InjectCode[43] = desFunc-((
DWORD
)lpRemoteCodeMem+42+5) ;
if
(lpRemoteCodeMem != NULL)
{
SIZE_T
dwBytesWritten = 0;
if
(WriteProcessMemory(hProcess, lpRemoteCodeMem, InjectCode, dwCodeSize, &dwBytesWritten) &&
dwBytesWritten == dwCodeSize)
{
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lpRemoteCodeMem,NULL, 0, NULL);
if
(hThread != NULL)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
bSuccess = TRUE;
}
}
VirtualFreeEx(hProcess, lpRemoteCodeMem, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
}
return
bSuccess;
}
BOOL
GrowZombieByInjectCode(
DWORD
dwProcessId,
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
ZombieType) {
BOOL
bSuccess = FALSE;
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if
(hProcess != NULL)
{
BYTE
InjectCode[50] = {
0x55,
0x89, 0xE5,
0x60,
0x68, 0x00, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x00, 0x00,
0xB8, 0x00, 0x00, 0x00, 0x00,
0xB9, 0x00, 0x00, 0x00, 0x00,
0x8B, 0x89, 0x0C, 0x5E, 0x35, 0x00,
0x8B, 0x89, 0x68, 0x08, 0x00, 0x00,
0x8B, 0x89, 0x78, 0x01, 0x00, 0x00,
0xE8, 0x00, 0x00, 0x00, 0x00,
0x61,
0xC9,
0xC3
};
DWORD
dwCodeSize = 50, desFunc = BaseAddr + 0x35390;
LPVOID
lpRemoteCodeMem = VirtualAllocEx(hProcess, NULL, dwCodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
*(
DWORD
*)&InjectCode[5] = x;
*(
DWORD
*)&InjectCode[10] = ZombieType;
*(
DWORD
*)&InjectCode[15] = y;
*(
DWORD
*)&InjectCode[20] = BaseAddr;
*(
DWORD
*)&InjectCode[43] = desFunc - ((
DWORD
)lpRemoteCodeMem + 42 + 5);
if
(lpRemoteCodeMem != NULL)
{
SIZE_T
dwBytesWritten = 0;
if
(WriteProcessMemory(hProcess, lpRemoteCodeMem, InjectCode, dwCodeSize, &dwBytesWritten) &&
dwBytesWritten == dwCodeSize)
{
HANDLE
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lpRemoteCodeMem, NULL, 0, NULL);
if
(hThread != NULL)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
bSuccess = TRUE;
}
}
VirtualFreeEx(hProcess, lpRemoteCodeMem, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
}
return
bSuccess;
}
BOOL
SetPlantCard(
HANDLE
hProcess,
DWORD
BaseAddr,
DWORD
nCard,
DWORD
plantType) {
DWORD
cardAddr = BaseAddr + 0x355E0C;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x868;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x15C;
ReadProcessMemory(hProcess, cardAddr, &cardAddr,
sizeof
(
DWORD
), NULL);
cardAddr += 0x5C+nCard*0x50;
return
WriteProcessMemory(hProcess, cardAddr, &plantType,
sizeof
(
DWORD
), NULL);
}
void
choiceMenu(
HANDLE
hProcess,
DWORD
Pid,
LPVOID
BaseAddr) {
DWORD
choice = 0;
unsigned
int
num = 0;
DWORD
fogAddr = 0;
unsigned
int
x, y, Type;
while
(1) {
system
(
"cls"
);
printf
(
"\t\t\t\tWelcome to PVZ Modifier!\n"
);
printf
(
"\t\t\t\t\t0.退出\n"
);
printf
(
"\t\t\t\t\t1.修改阳光数\n"
);
printf
(
"\t\t\t\t\t2.修改金钱数\n"
);
printf
(
"\t\t\t\t\t3.修改智慧树高\n"
);
printf
(
"\t\t\t\t\t4.修改巧克力数\n"
);
printf
(
"\t\t\t\t\t5.修改树肥\n"
);
printf
(
"\t\t\t\t\t6.修改花肥\n"
);
printf
(
"\t\t\t\t\t7.修改杀虫剂\n"
);
printf
(
"\t\t\t\t\t8.无限冷却\n"
);
printf
(
"\t\t\t\t\t9.恢复冷却\n"
);
printf
(
"\t\t\t\t\t10.无限阳光\n"
);
printf
(
"\t\t\t\t\t11.恢复阳光消耗\n"
);
printf
(
"\t\t\t\t\t12.除雾\n"
);
printf
(
"\t\t\t\t\t13.恢复雾\n"
);
printf
(
"\t\t\t\t\t14.种植植物\n"
);
printf
(
"\t\t\t\t\t15.生成僵尸\n"
);
printf
(
"\t\t\t\tPlease choose your option:[ ]\b\b"
);
scanf
(
"%d"
, &choice);
switch
(choice){
case
0:
return
;
case
1:
case
2:
case
3:
case
4:
case
5:
case
6:
case
7:
printf
(
"\t\t\t\tPlease input Num:"
);
scanf
(
"%d"
, &num);
setSomething(hProcess, BaseAddr, choice - 1, num);
break
;
case
8:
Uncooled(hProcess, BaseAddr);
break
;
case
9:
RecoveryCooling(hProcess, BaseAddr);
break
;
case
10:
UnlimitedSun(hProcess,BaseAddr);
break
;
case
11:
RecoverySunConsume(hProcess, BaseAddr);
break
;
case
12:
fogAddr=(
DWORD
)DeFogByHook(hProcess, BaseAddr);
break
;
case
13:
RecoveryFogByUnHook(hProcess, BaseAddr,fogAddr );
break
;
case
14:
printf
(
"请输入X Y PlantType: "
);
scanf
(
"%d%d%d"
, &x, &y, &Type);
GrowPlantByInjectCode(Pid, BaseAddr,x,y,Type );
break
;
case
15:
printf
(
"请输入X Y ZombieType: "
);
scanf
(
"%d%d%d"
, &x, &y, &Type);
GrowZombieByInjectCode(Pid, BaseAddr, x, y, Type);
break
;
}
}
}
int
main() {
DWORD
Pid = GetProcessIdByName(L
"PlantsVsZombies.exe"
);
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE,Pid);
DWORD
BaseAddr=GetModuleBaseAddress(Pid, L
"PlantsVsZombies.exe"
);
choiceMenu(hProcess, Pid, BaseAddr);
CloseHandle(hProcess);
return
0;
}
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
#include<windows.h>
#include<stdio.h>
BOOL
GrowPlant(
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
TypePlant) {
LPVOID
PlantFunc = BaseAddr + 0x18D70;
__asm {
pushad
push -1
push TypePlant
mov eax, y
push x
mov ecx, BaseAddr
mov ecx, [ecx+0x355E0C]
mov ecx, [ecx + 0x868]
push ecx
call PlantFunc
popad
}
return
TRUE;
}
BOOL
GrowZombie(
DWORD
BaseAddr,
DWORD
x,
DWORD
y,
DWORD
ZombieType) {
LPVOID
PlantZombieFunc = BaseAddr + 0x35390;
__asm {
pushad
push x
push ZombieType
mov eax,y
mov ecx,BaseAddr
mov ecx,[ecx+0x355E0C]
mov ecx,[ecx+0x868]
mov ecx,[ecx+0x178]
call PlantZombieFunc
popad
}
return
TRUE;
}
BOOL
WINAPI DllMain(
HMODULE
hInstance,
DWORD
fdwReason,
LPVOID
lpReserved) {
DWORD
BaseAddr = GetModuleHandle(NULL);
DWORD
pid = GetCurrentProcessId();
HANDLE
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
switch
(fdwReason)
{
case
DLL_PROCESS_ATTACH:
MessageBoxW(0, L
"ProcessAttachDll!"
, L
"window2"
, 0);
GrowPlant(BaseAddr,5,3,23);
GrowZombie(BaseAddr, 6, 2, 23);
break
;
case
DLL_PROCESS_DETACH:
MessageBoxW(0, L
"ProcessDeTachDll!"
, L
"window2"
, 0);
break
;
}
return
TRUE;
}