Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get VU of VSXu artiste with C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Trirop
How do I cheat?
Reputation: 0

Joined: 16 May 2015
Posts: 1
Location: Germany

PostPosted: Sat May 16, 2015 6:01 pm    Post subject: Get VU of VSXu artiste with C++ Reply with quote

Hello everybody!

this is my code so far:
Code:
#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;
}


I want to read the VU (sound card volume) value of the VSXu Artiste sound visualisation programm with C++ and with the help of Cheat Engine. It works perfectly fine with
Code:
ReadProcessMemory(hProc, (LPVOID)addr, &val, (DWORD)sizeof(val), NULL);
until you re-open VSXu. This is pretty obvious, because the address of my value in Cheat Engine is "sound.rtaudio.dll+19098" and the DLL loads to a "random" address.
In Cheat Engine you can simply press Ctrl+G in the memory viewer and type the name of the DLL to find its base address. I have already tried the GetModuleHandle method in C++ without success:
Code:
HMODULE hModule = GetModuleHandle(TEXT("sound.rtaudio.dll"));

Has anyone an idea how to get the base address of the dll with C++?

Kind regards,

Robert
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun May 17, 2015 1:32 am    Post subject: Reply with quote

You can use the CreateToolhelp32Snapshot and Module32First / Module32Next API to obtain the DLL information of a remote process.

GetModuleHandle only works within the same process, so in your case it will never work.

See the following for more info and examples:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682489(v=vs.85).aspx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites