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 


C ++ change value address 64 bit games

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
KevinD
Cheater
Reputation: 0

Joined: 15 Apr 2020
Posts: 39

PostPosted: Sun Jun 14, 2020 4:08 pm    Post subject: C ++ change value address 64 bit games Reply with quote

Good evening, I would like to modify in c ++ the values of addresses of 64 bit games. The following code is 32-bit. What should I change ?

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#ifdef __MINGW32__
#include <windows.h>
#endif

using namespace std;
int main(){




DWORD Target = 0x22ACBA164D0;
SIZE_T bytes = 0;
BYTE exampleBytes[5] = { 0x8B,0xFF,0x55,0x8B,0xEC };

HWND hWnd;
while( !( hWnd = FindWindow( NULL, "Calculatrice" ) ) )
Sleep( 100 );

DWORD PID;
while( !( GetWindowThreadProcessId( hWnd, &PID ) ) )
Sleep( 100 );

// as learn_more said, you need process handle.
HANDLE hProcess;
while( !( hProcess = OpenProcess( PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, 0, PID ) ) )
Sleep( 100 );

WriteProcessMemory( hProcess, (PVOID)Target, exampleBytes, 5, &bytes );
system("pause");
return 0;
}
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3329

PostPosted: Mon Jun 15, 2020 8:48 am    Post subject: Reply with quote

I would try replacing DWORD with int where applicable.
A 64bit compiler will make them 64bit ints.
You might want to read up on the compiler's help and the docs of the API you are trying to use.
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: Mon Jun 15, 2020 7:19 pm    Post subject: Reply with quote

DWORD can be replaced with DWORD_PTR for 64bit compatibility. However, it is recommended to avoid Microsofts Windows-implemented typedefs like these and use the newer standard types.

https://en.cppreference.com/w/cpp/types
https://en.cppreference.com/w/cpp/types/integer

ie. in this case, you'd want to use intptr_t / uintptr_t.

_________________
- 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 Gamehacking 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