植物大战僵尸(阳光)
#include <iostream> #include <windows.h> using namespace std; int main() { int value=0; int pid=0; cout<<"输入修改进程ID"; cin>>pid; HANDLE hProcess=NULL; DWORD address1=0x006A9EC0; DWORD address2; //1.拿到句柄 注入进程 hProcess=OpenProcess(PROCESS_ALL_ACCESS,false,pid); if(hProcess==NULL){ cout<<"无法注入进程"<<endl; return false; } cout<<"注入进程成功"<<endl; bool Result= ReadProcessMemory( hProcess,(LPVOID)address1,&address2,4,NULL ); if(!Result){ cout<<"无法打开"<<endl; return false; } DWORD YangGuang1=address2+0x768; DWORD YG1=0; Result=ReadProcessMemory( hProcess, (LPVOID)YangGuang1, &YG1, 4, NULL ); if(!Result){ cout<<"无法打开"<<endl; return false; } DWORD yangguangAddress=YG1+0x5560; int zzyGa=0; while(1){ Result=ReadProcessMemory( hProcess, (LPVOID)yangguangAddress, &zzyGa, 4, NULL ); if(!Result){ cout<<"获取失败"<<endl; return 0; } cout<<"阳光数据"<<zzyGa<<endl; cout<<"输入修改的值"; cin>>value; WriteProcessMemory(hProcess,(LPVOID)yangguangAddress,&value,4,NULL); } return 0; }