好友
阅读权限10
听众
最后登录1970-1-1
|
楼主|
jzwyq
发表于 2025-4-17 09:24
本帖最后由 jzwyq 于 2025-4-17 09:32 编辑
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, targetProcessId);
if (hProcess == NULL) {
cout << "Failed to open process. Error: " << GetLastError() << endl;
system("pause");
return 1;
}
// 自定义函数,用于获取所有符合条件的目标地址
std::vector<DWORD> GetTargetAddresses(HANDLE hProcess) {
// 地址范围
DWORD startAddress = 0x82650004; // 起始地址
DWORD endAddress = 0x827fffff; // 结束地址
char mem[sizeof(int) * 16 * 6] = { 0 }; // 存储读取值
std::vector<DWORD> targetAddresses; // 用于存储所有符合条件的地址
// 遍历地址范围
for (DWORD currentAddress = startAddress; currentAddress <= endAddress; currentAddress += 0x10) {
// 读取指定内存
if (ReadProcessMemory(hProcess, (LPCVOID)currentAddress, &mem, sizeof(mem), NULL)) {
if (*(int*)(&mem[8]) == 0x01 &&
*(int*)(&mem[16]) == 0x0 &&
*(int*)(&mem[24]) == 0x0193 &&
*(long long*)(&mem[48]) == 0x0 &&
*(int*)(&mem[72]) == 0x01 &&
*(int*)(&mem[80]) == 0x0) {
targetAddresses.push_back(currentAddress);
}
}
else {
cout << "Failed to read memory! Error:" << GetLastError() << endl;
}
}
// 修改起始地址为另一个偏移
startAddress = 0x8265000c;
for (DWORD currentAddress = startAddress; currentAddress <= endAddress; currentAddress += 0x10) {
if (ReadProcessMemory(hProcess, (LPCVOID)currentAddress, &mem, sizeof(mem), NULL)) {
if (*(int*)(&mem[8]) == 0x01 &&
*(int*)(&mem[16]) == 0x0 &&
*(int*)(&mem[24]) == 0x0193 &&
*(long long*)(&mem[48]) == 0x0 &&
*(int*)(&mem[72]) == 0x01 &&
*(int*)(&mem[80]) == 0x0) {
targetAddresses.push_back(currentAddress);
}
}
else {
cout << "Failed to read memory! Error:" << GetLastError() << endl;
}
}
return targetAddresses;}这是我的代码,遇到这种问题一般要怎么排查的 如果是对方有保护的话还有办法吗 |
|