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++]Write OpCode in Memory / Problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Blackvz
Newbie cheater
Reputation: 0

Joined: 08 Jul 2012
Posts: 19

PostPosted: Fri Jun 28, 2013 9:08 am    Post subject: [C++]Write OpCode in Memory / Problem Reply with quote

Hey guys , I have a Problem again.
I think a Screenshot is better than writing.

//Look in the attachments

So the Problem is , if I write my Bytes to Memory, it will change more than just that Memory (0x5244F7).

So even (0x5244F9....etc) will get modified.But why ? Where's the Problem :O

Embarassed

Thanks in advance



problem.jpg
 Description:
C++ Memory Opcode
 Filesize:  421.51 KB
 Viewed:  7750 Time(s)

problem.jpg


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: Fri Jun 28, 2013 12:53 pm    Post subject: Reply with quote

The size of your array is 3, but you are only using 2 bytes. Change it to 2.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Blackvz
Newbie cheater
Reputation: 0

Joined: 08 Jul 2012
Posts: 19

PostPosted: Fri Jun 28, 2013 4:12 pm    Post subject: Reply with quote

I get an error then :

const char[3] cant get intialisied with Byte[2]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Fri Jun 28, 2013 4:30 pm    Post subject: Reply with quote

I was already expecting that reply...

In C strings always get appended a 0 terminator. So when you do "BLA" you actually do BLA\0

There are 2 easy solutions:
1: instead of sizeof(JmpHook) just enter the value 2

2:
instead of BYTE JmpHook[3]="\xEB\x1F" do
Code:

BYTE JmpHook[2];
JmpHook[0]=0xEB;
JmpHook[1]=0x1F;

_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jun 28, 2013 6:15 pm    Post subject: Reply with quote

You can use casting to avoid byte by byte as well.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Blackvz
Newbie cheater
Reputation: 0

Joined: 08 Jul 2012
Posts: 19

PostPosted: Sat Jun 29, 2013 3:23 am    Post subject: Reply with quote

I will keep that in mind ! Thanks for your help again Embarassed
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