DWORD SuspendThread(
HANDLE hThread // handle to the thread
); 挂起进程
hThread 可以从LPPROCESS_INFORMATION 结构获得。
最后,可以利用下面的函数读写进程:
BOOL WriteProcessMemory(
HANDLE hProcess, // 需要修改的进程的句柄
LPVOID lpBaseAddress, // 开始写入的地址
LPVOID lpBuffer, // 指向被写入的数据
DWORD nSize, // 写入字节数目
LPDWORD lpNumberOfBytesWritten // 返回写入的数据长度
);
这是一个典型的信息自我返回(self-explanatory)。hProcess可以从LPPROCESS_INFORMATION结构获取。
从进程读取数据:
BOOL ReadProcessMemory(
HANDLE hProcess, // handle of the process whose memory is read
LPCVOID lpBaseAddress, // address to start reading
LPVOID lpBuffer, // address of buffer to place read data
DWORD nSize, // number of bytes to read
LPDWORD lpNumberOfBytesRead // address of number of bytes read
);
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
FileName db "C:\somedir\crackme.exe",0
notloaded db "It did not work :-(",0
Letsgo db "The process is started",13,10,
"Let's change smthg and run it now :-)",0
NewText db "Dettens Caption",0