[C++] 纯文本查看 复制代码 #include <iostream>
#include<vector>
#include<Windows.h>
#include"Proc.h"
int main()
{
DWORD procid = GetProdid(L"ac_client.exe");//封装的函数获取进程
uintptr_t modulebase = GetModuleBaseAddress(procid,L"ac_client.exe");//封装的函数获取模块
HANDLE process = 0;
process = OpenProcess(PROCESS_ALL_ACCESS, NULL, procid);//打开进程
uintptr_t dynamicptrBaseaddr = modulebase + 0x17E560;//本地exe地址
std::cout << "dynamicptrBaseaddr = " << "0x" << std::hex << dynamicptrBaseaddr << std::endl;//获取地址
std::vector<unsigned int>ammooffsets = { 0x364,0x14,0x0 };////本地的偏移
uintptr_t ammoaddr = FindDMAAddy(process, dynamicptrBaseaddr, ammooffsets);//获取地址
std::cout << "ammoaddr = " << "0x" << std::hex << ammoaddr << std::endl;//十进制输出
int ammValue = 0;
ReadProcessMemory(process, (BYTE*)ammoaddr, &ammValue, sizeof(ammValue), nullptr);//读取出子弹数量
std::cout << "zidan = " << std::dec << ammValue << std::endl;//输出子弹
int newValue = 9999;//给他一个新的值
WriteProcessMemory(process, (BYTE*)ammoaddr, &newValue, sizeof(newValue), nullptr);//写入内存
ReadProcessMemory(process, (BYTE*)ammoaddr, &ammValue, sizeof(ammValue), nullptr);//读取他刚刚写入的新值
std::cout << "xin zidan = " << std::dec << ammValue << std::endl;//然后输出一下
getchar();//
return 0;
}
我相信遍历 进程 模块 没人不会
|