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++ Data type problem

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

Joined: 27 Apr 2016
Posts: 1

PostPosted: Wed Apr 27, 2016 9:33 am    Post subject: C++ Data type problem Reply with quote

Hey,

I have a CE script I'd like to add to my C++ application, but I have encountered a small problem.

In the script I have this, which works perfectly.
Code:

alloc(val, 8)
registersymbol(val)
...
hook:
mov [val], eax
...


But in my C++ source I have tried doing this, which works with values under 4294967295, but overflows when above that.

Code:

unsigned __int64 val;

__asm
{
   mov dword ptr[val], eax
}


Removing/replacing "dword ptr" (which makes it 4 bytes, I know) throws me an "error C2443: operand size conflict", which I have tried digging around on google for.

Is there any way to read the "missing" 4 bytes? Some smart ror/rol thing that I don't know of?
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Wed Apr 27, 2016 10:15 am    Post subject: Reply with quote

What missing four bytes?

EAX can only store 4 bytes total, so your 8 bytes variable will always have 4 "empty" bytes (which are zero).

So either use "rax" here or an unsigned int32 (not int64).
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Apr 27, 2016 4:54 pm    Post subject: Reply with quote

Your variable should be
Code:
unsigned __int32 val;
Back to top
View user's profile Send private message
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