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 


pls help....

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kot1990
Expert Cheater
Reputation: 1

Joined: 06 Sep 2009
Posts: 131
Location: Greece

PostPosted: Sat Mar 06, 2010 5:30 pm    Post subject: pls help.... Reply with quote

I hate those type conversions in C, they are driving me crazy!! I am trying to write byte-byte all bytes to a DWORD.

Code:

*(BYTE*)(&playerId) = someByte;
*(BYTE*)(&playerId+1) = someByte2; //&playerId+1 gives +4bytes address and not the next byte

,, I also tried
Code:

*(BYTE*)((&playerId)+1) = someByte2; //but that also failed as hell


Finally I did this,, but that's odd, I don't want a new value for this:
Code:

BYTE* ptr = (BYTE*)&playerId;
*(ptr+1) = someByte2


EDIT: sorry for the thread,, I found it xD

Code:
*((BYTE*)(&playerId)+1) = someByte2;
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sat Mar 06, 2010 7:52 pm    Post subject: Reply with quote

Idiot.

Code:

*(BYTE*) (&Address) = SomeByte


You dont need the '&' operator.

Code:

*(BYTE*) Address = SomeByte
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25848
Location: The netherlands

PostPosted: Sat Mar 06, 2010 8:16 pm    Post subject: Reply with quote

Don't call people idiot without knowing the full situation

I am assuming that playerId isn't an address specifier, so just a variable(multibyte variable)

then the method the original poster gave is a proper solution: First get the address of playerId, then increase that result as if it's a pointer to a byte, and then dereference that pointer.

by just adding +1 to the pointer specifier it'd be treated as a int pointer which is why it went +4 instead

also for the original poster, you could also just assign an byte array to the start of the playerId address and then read it out as byte[0], byte[1], etc...
And then still, why do you need it as seperate bytes?
WriteProcessMemory ? Just give it the address of playerid and size 4.
CopyMemory? Just give it the address of playerid and size 4
etc...

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Mar 06, 2010 8:21 pm    Post subject: Reply with quote

iPromise wrote:
Idiot.

Code:

*(BYTE*) (&Address) = SomeByte


You dont need the '&' operator.

Code:

*(BYTE*) Address = SomeByte


A bit ironic calling him an idiot while you are even more of an idiot? *hint*your memory engine*hint*
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