到目前为止,这是我的代码:
#include "iostream"
#include "Windows.h"
#include "stdio.h"
using namespace std;
int main() {
HWND hWnd = FindWindow(NULL,TEXT("Vovoid VSXu Artiste 0.4.0 [Windows 64-bit]"));
if (hWnd == 0) {
cerr << "Cannot find window "<< endl;
}
else {
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
cout << "Found Window at "<<pId << endl;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
HMODULE hModule = GetModuleHandle(TEXT("sound.rtaudio.dll"));
if (hProc == 0) {
cerr << "Cannot open process." << endl;
}else if(hModule==0){
DWORD error = GetLastError();
cerr << "could not find Module -> error: " <<error<< endl;
}
else {
float val = 0;
int addr = 0x04D40000 + 0x19098;//should be sound.rtaudio.dll+ 0x19098
while(TRUE){
int suc = ReadProcessMemory(hProc, (LPVOID)addr, &val, (DWORD)sizeof(val), NULL);
if (suc > 0) {
cout << "Success reading " << val << " of " << hex << addr << endl;
system("cls");
}
else {
DWORD error = GetLastError();
cerr << "fail " << error << endl;
}
}
}
CloseHandle(hProc);
}
cin.get();
return 0;
}
我想用 C++ 和 Cheat Engine 读取 VSXu Artiste 声音可视化程序的 VU(声卡音量)值。ReadProcessMemory(hProc, (LPVOID)addr, &val, (DWORD)sizeof(val), NULL);
在您重新打开 VSXu 之前,它可以正常工作。这很明显,因为我在作弊引擎中的值的地址是“sound.rtaudio.dll+19098”,并且 DLL 加载到“随机”地址。在 Cheat Engine 中,您只需在内存查看器中按 Ctrl+G 并键入 DLL 的名称即可找到其基地址。我已经在 C++ 中尝试了 GetModuleHandle 方法,但没有成功:
HMODULE hModule = GetModuleHandle(TEXT("sound.rtaudio.dll"));
有谁知道如何使用 C++ 获取 dll 的基地址?
作弊引擎截图: http: //oi57.tinypic.com/331k7sw.jpg
亲切的问候,
罗伯特