你好,我有这个代码:
#include <iostream>
#include <windows.h>
int main() {
DWORD processId = 8716;
float newSpeed = 2.0; /* New speed value, e.g., 2.0 for double speed */
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
if (hProcess == NULL) {
std::cerr << "Failed to open the target process." << std::endl;
return 1;
}
// Address of the speed variable in the target process
uintptr_t speedAddress = /* Address of the speed variable in target process */;
// Write the new speed value to the target process
WriteProcessMemory(hProcess, (LPVOID)speedAddress, &newSpeed, sizeof(newSpeed), NULL);
std::cout << "Speed modified successfully!" << std::endl;
CloseHandle(hProcess);
return 0;
}
它应该使用 pid 号将目标进程加速 2 倍,但我需要“speedAddress”
如何找到“speedAddress”?我只是想让记事本速度加快 2 倍。
您不能对局部变量执行此操作。您可以使用共享内存。