植物大战僵尸修改阳光值(附源码)

本文涉及到寻找植物大战僵尸游戏的阳光基址,可以参考以下链接:

https://www.cnblogs.com/iBinary/p/9513105.html

 

本文只涉及到跨进程读写的基本操作,其他功能请自行修改实现。

#include "pch.h"
#include <stdio.h>
#include <windows.h>

DWORD WriteGameProcessMemory(DWORD dwbase, void* Gmwritebuff,int n) {

  HWND h = FindWindow(0,"植物大战僵尸中文版");
  DWORD pid = 0;
  GetWindowThreadProcessId(h,&pid);
  HANDLE hp = OpenProcess(PROCESS_ALL_ACCESS,false,pid);
  DWORD sun00 = 0;
  SIZE_T forrealwrite = 0;
  WriteProcessMemory(hp,(char*)dwbase, Gmwritebuff,n,&forrealwrite);
  return sun00;
}
DWORD R4(DWORD dwBase) {
  HWND h = FindWindow(0, "植物大战僵尸中文版");
  DWORD pid = 0;
  GetWindowThreadProcessId(h,&pid);
  HANDLE hp = OpenProcess(PROCESS_ALL_ACCESS,false,pid);
  DWORD sun00 = 0;
  ReadProcessMemory(hp, (LPCVOID)dwBase, &sun00, 4, 0);
  return sun00;

}
int main() {
  int sunshine = R4(R4(R4(R4(R4(0x6a9ec0) + 0x768) + 0x144) + 0x2c) + 0x5560);
  printf("当前阳光值 = %d\n", sunshine);
  unsigned int GmProcessadress = R4(R4(R4(R4(0x6a9ec0) + 0x768) + 0x144) + 0x2c) + 0x5560;
  int w = 0;
  printf("请输入要修改的阳光值:");
  scanf_s("%d", &w);
  WriteGameProcessMemory(GmProcessadress, &w, 4);
  system("pause");
}

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注