gpt4 book ai didi

c++ - 用C++获取VSXu艺人的VU

转载 作者:太空宇宙 更新时间:2023-11-04 13:34:12 24 4
gpt4 key购买 nike

到目前为止,这是我的代码:

#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

亲切的问候,

罗伯特

最佳答案

我想问题是因为您在自己的进程中调用 GetModuleHandle。您可以尝试的解决方案是使用:

GetModuleInformation , 它将返回 MODULEINFO 中的基地址:

lpBaseOfDll

The load address of the module.

要获取进程和模块句柄,您可以使用此处的示例代码:Enumerating All Modules For a Process

关于c++ - 用C++获取VSXu艺人的VU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30281170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com