void CModifyGameDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
//CDialogEx::OnOK();
HWND hwnd = ::FindWindow(0, L"植物大战僵尸中文版");
if (!hwnd)
{
return;
}
DWORD pid = 0;
//通过窗口句柄获取pid
DWORD result = GetWindowThreadProcessId(hwnd, &pid);
if (!pid)
{
return;
}
//通过pid打开一个进程并获取进程句柄
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if (!handle)
{
return;
}
DWORD baseAdress = 0x006A9EC0;
DWORD newMoneyAdress = 0;
ReadProcessMemory(handle, (LPVOID)baseAdress, &newMoneyAdress, sizeof(newMoneyAdress), 0);
//读取不到说明你开了游戏,但是没有开始
if (baseAdress <= 0)
{
return;
}
if (newMoneyAdress == 0x027C9908)
{
int wjr = 0;
}
newMoneyAdress += 0x768;
ReadProcessMemory(handle, (LPVOID)newMoneyAdress, &newMoneyAdress, sizeof(newMoneyAdress), 0);
if (newMoneyAdress == 0x10317B50)
{
int wjr = 0;
}
newMoneyAdress += 0x5560;
DWORD Sun = 0;
ReadProcessMemory(handle, (LPVOID)newMoneyAdress, &Sun, sizeof(Sun), 0);
Sun = 9999;
WriteProcessMemory(handle, (LPVOID)newMoneyAdress, &Sun, sizeof(Sun), 0);
CloseHandle(handle);
}
修改植物大战僵尸阳关代码
最新推荐文章于 2023-01-02 15:59:18 发布