我正在尝试写入内存中的某个地址(我从作弊引擎获得的基址,因此它不会改变),问题是我无法弄清楚我需要如何使用所有偏移量进行写入。 / p>
以下是我拥有的以下地址和偏移量:
DWORD Pointer = 0x001E8AA0;
DWORD offset1 = 0x3F0;
DWORD offset2 = 0x62C;
DWORD offset3 = 0x4;
DWORD offset4 = 0x104;
DWORD offset5 = 0x68;
char moduleName[] = "Insaniquarium.exe";
作弊引擎中指针的图片:
我尝试了很多事情,但都失败了,我知道这是因为在游戏中,值不变,在作弊引擎中,值的指针也不变。 这是我最终尝试的:
WriteProcessMemory(handle, (LPVOID)(moduleName + Pointer + offset1 + offset2 + offset3 + offset4 + offset5), &val, sizeof(val), nullptr);
我之前所述的广告,该值没有更改。
如果您认为您需要更多信息,请告诉我,谢谢。
答案 0 :(得分:0)
您的偏移量添加顺序错误。您需要从屏幕快照的底部到顶部进行操作。
您需要取消引用链中的每个指针,而不是这样做。
以下是正确执行操作的方法:
DWORD GetProcId(const wchar_t* procName)
{
DWORD procId = 0;
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 procEntry;
procEntry.dwSize = sizeof(procEntry);
if (Process32First(hSnap, &procEntry))
{
do
{
if (!_wcsicmp(procEntry.szExeFile, procName))
{
procId = procEntry.th32ProcessID;
break;
}
} while (Process32Next(hSnap, &procEntry));
}
}
CloseHandle(hSnap);
return procId;
}
uintptr_t GetModuleBaseAddress(DWORD procId, const wchar_t* modName)
{
uintptr_t modBaseAddr = 0;
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procId);
if (hSnap != INVALID_HANDLE_VALUE)
{
MODULEENTRY32 modEntry;
modEntry.dwSize = sizeof(modEntry);
if (Module32First(hSnap, &modEntry))
{
do
{
if (!_wcsicmp(modEntry.szModule, modName))
{
modBaseAddr = (uintptr_t)modEntry.modBaseAddr;
break;
}
} while (Module32Next(hSnap, &modEntry));
}
}
CloseHandle(hSnap);
return modBaseAddr;
}
uintptr_t FindDMAAddy(HANDLE hProc, uintptr_t ptr, std::vector<unsigned int> offsets)
{
uintptr_t addr = ptr;
for (unsigned int i = 0; i < offsets.size(); ++i)
{
ReadProcessMemory(hProc, (BYTE*)addr, &addr, sizeof(addr), 0);
addr += offsets[i];
}
return addr;
}
int main()
{
//Get ProcId of the target process
DWORD procId = GetProcId(L"Insaniquarium.exe");
//Getmodulebaseaddress
uintptr_t moduleBase = GetModuleBaseAddress(procId, L"Insaniquarium.exe");
//Get Handle to Process
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, procId);
//Resolve base address of the pointer chain
uintptr_t dynamicPtrBaseAddr = moduleBase + 0x001E8AA0;
//Resolve the pointer chain
std::vector<unsigned int> offsets = {0x68, 0x104, 0x4, 0x62C, 0x3F0};
uintptr_t addr = FindDMAAddy(hProcess, dynamicPtrBaseAddr, offsets);
return 0;
}