到目前为止,这是我的代码:
#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;
}
我想在 Cheat Engine 的帮助下使用 C++ 读取 VSXu Artiste 声音可视化程序的 VU(声卡音量)值。它与 ReadProcessMemory(hProc, (LPVOID)addr, &val, (DWORD)sizeof(val), NULL);
完美配合,直到您重新打开 VSXu。这很明显,因为我的值在 Cheat Engine 中的地址是“sound.rtaudio.dll+19098”并且 DLL 加载到一个“随机”地址。在 Cheat Engine 中,您只需在内存查看器中按 Ctrl+G 并键入 DLL 的名称即可找到其基地址。我已经在 C++ 中尝试过 GetModuleHandle 方法但没有成功:
HMODULE hModule = GetModuleHandle(TEXT("sound.rtaudio.dll"));
有谁知道如何使用 C++ 获取 dll 的基址?
Cheat Engine 截图:http://oi57.tinypic.com/331k7sw.jpg
亲切的问候,
罗伯特
我是一名优秀的程序员,十分优秀!