- 分享
- 0
- 人气
- 0
- 主题
- 7
- 帖子
- 4707
- UID
- 82675
- 积分
- 5108
- 阅读权限
- 22
- 注册时间
- 2007-6-18
- 最后登录
- 2021-7-27
- 在线时间
- 5767 小时
|
原帖由 goodhermit95 于 2008-12-9 06:42 PM 发表
我推荐C++
- #include <windows.h>
- #include <tlhelp32.h>
- #include <conio.h>
- #include <stdlib.h>
- bool ChangeMemVal(const char * ProcessName, LPVOID MemAddress, int NewVal, int size);
- void main()
- {
- printf("=== Pinball Trainer Example. Made by <your name here> ===\n\n");
- if(ChangeMemVal("PINBALL.EXE", (void*) 0xA90C62, 100000000, 4))
- printf("The score has been edited successfully.\n");
- else
- printf("An error occured while attempting edit the score.\n");
- system("PAUSE");
- return 0;
- }
- bool ChangeMemVal(const char * ProcessName, LPVOID MemAddress, int NewVal, int size)
- {
- HANDLE hProcessSnap;
- HANDLE hProcess = NULL;
- PROCESSENTRY32 pe32;
- hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
- pe32.dwSize = sizeof( PROCESSENTRY32 );
- Process32First(hProcessSnap, &pe32);
- do
- {
- if(!strcmp(pe32.szExeFile, ProcessName))
- {
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
- break;
- }
- }
- while(Process32Next(hProcessSnap, &pe32));
- CloseHandle( hProcessSnap );
- if(hProcess != NULL)
- {
- WriteProcessMemory(hProcess, MemAddress, &NewVal, size, NULL);
- CloseHandle(hProcess);
- return true;
- }
- return false;
- }
复制代码
網上得來的吧 |
|