我已經大概知道編程 , 但是卻無法修改遊戲中的數值 , 請高手指正我哪邊錯誤了 ? 謝謝 !
程式可以運行 , 我在輸入 address 有加上16進位的 0x , value 這是修改直接要得值 ?
開啟時會叫出client.exe , client.exe會顯示 0x440004= 7474
代碼是外國高手幫忙的 , 我不知到哪邊錯誤 , 請版上高手幫幫忙 謝謝 ~
====================================
首先 run MemoryEdit.exe
佢會 CreateProcess and run Client.exe
Client.exe 會 不斷 咁 print 會 int 既 address and value
之後 MemoryEdit.exe 會要你 input 個 address 你要 edit 既
個 address 可以 抄返 Client.exe Show 出 o黎 既
e.g. 010E9008 就 input 0x010E9008 <= 0x 開頭 hex
之後 要你 input 個 value e.g. input 8888
之後 等 5 秒
check 返 Client.exe
佢個 value 會 唔同左
=====================================
Client.exe
複製程式
#include <windows.h>
#include <iostream>
int addr = 7474;
int main()
{
int i=0;
while(++i < 1000)
{
std::cout << &addr << " = " << addr << std::endl;
Sleep(1000);
}
return 0;
}
MemoryEdit.exe
複製程式
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
HANDLE g_hProcess;
DWORD g_arList;
int iVal;
BOOL WriteMemory(DWORD dwAddr, DWORD dwValue)
{
return ::WriteProcessMemory(g_hProcess, (LPVOID)dwAddr, &dwValue, sizeof(DWORD), NULL);
}
int main()
{
char szFileName[] = "Client.exe";
STARTUPINFO si = {sizeof(si)};
PROCESS_INFORMATION pi;
::CreateProcess(NULL, szFileName, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
cout << "Please enter the addr [0x1234567...]: ";
cin >> hex >> g_arList;
cout << "Please enter the value: ";
cin.clear();
cin >> dec >> iVal;
Sleep(5000);
CloseHandle(pi.hThread);
g_hProcess = pi.hProcess;
if(WriteMemory(g_arList, iVal))
cout << "Memory: " << g_arList << " [Written]\n";
CloseHandle(g_hProcess);
return 0;
}
::CreateProcess(NULL, szFileName, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si,
&pi);
程式碼尾
π 這邊是 & pi