-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrc.cpp
More file actions
50 lines (41 loc) · 1.04 KB
/
src.cpp
File metadata and controls
50 lines (41 loc) · 1.04 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
#include <windows.h>
#include <stdio.h>
int main(int argc,char *argv[])
{
//ĐéÄâľŘÖˇ
DWORD dwVAddress = 0x010525AF;
BYTE bCode = 0;
DWORD dwReadNum = 0;
if (2 != argc)
{
printf("Please input two argument \r\n");
return -1;
}
STARTUPINFO si = { 0 };
si.cb = sizeof(STARTUPINFO);
si.wShowWindow = SW_SHOW;
si.dwFlags = STARTF_USESHOWWINDOW;
PROCESS_INFORMATION pi = { 0 };
BOOL bRet = CreateProcess(argv[1], NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi);
if (bRet = FALSE)
{
printf("Create Process Error ! \r\n");
return -1;
}
ReadProcessMemory(pi.hProcess, (LPVOID)dwVAddress, (LPVOID)&bCode, sizeof(BYTE), &dwReadNum);
if (bCode != '\x75')
{
printf("%02x \r\n", bCode);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return -1;
}
bCode = '\x74';
WriteProcessMemory(pi.hProcess, (LPVOID)dwVAddress, (LPVOID)&bCode, sizeof(BYTE), &dwReadNum);
ResumeThread(pi.hThread);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
printf("Write JZ is successfully ! \r\n");
system("pause");
return 0;
}