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++ Memory changing problems

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

Joined: 12 Sep 2010
Posts: 2

PostPosted: Sun Sep 12, 2010 12:14 pm    Post subject: C++ Memory changing problems Reply with quote

I am trying to edit specific addresses on a target program by injecting a dll in to the code so that from there i can just use pointers.

The problem is that when i write to the address it will crash. Reading seems to work fine and gives no problems. Now the strange thing is that when i edit the same address with a memory editing program it works perfectly fine
Code:

unsigned char *Addy1 = (unsigned char *)dllbase + OFFSET + 0;
unsigned char *Addy2 = (unsigned char *)dllbase + OFFSET + 1;
unsigned char *Addy3 = (unsigned char *)dllbase + OFFSET + 2;

*Addy1 = 144;
*Addy2 = 144;
*Addy3 = 144;
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 891

PostPosted: Sun Sep 12, 2010 12:17 pm    Post subject: Reply with quote

It might not have read/write permissions. You may need to change the permissions before writing. See VirtualProtect. Unless you tell us what "crash" means, it's hart to say.

Cheers,
adude
Back to top
View user's profile Send private message
ColdFusion_
How do I cheat?
Reputation: 0

Joined: 12 Sep 2010
Posts: 2

PostPosted: Sun Sep 12, 2010 12:53 pm    Post subject: Reply with quote

Thank you

With crash i mean just "X stopped responding"

I am gona give VirtualProtect a try and see if it helps.

EDIT: Yea that fixed the thing. Thanks for your help a mod can close this now
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Sep 12, 2010 3:10 pm    Post subject: Reply with quote

you can debug injected dll's as well which makes tracking down problems a lot easier.

in visual studio you can just set your breakpoints, inject the dll, then attach the debugger and it will break like usual.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon Sep 13, 2010 1:37 am    Post subject: Reply with quote

slovach wrote:
in visual studio you can just set your breakpoints, inject the dll, then attach the debugger and it will break like usual.
Debugger detected running on your system. Please unload it from memory and try again :p
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Mon Sep 13, 2010 2:11 am    Post subject: Reply with quote

Maybe some game you are trying to debug, unpack it, and it works.
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Sep 13, 2010 3:39 am    Post subject: Reply with quote

slovach wrote:
you can debug injected dll's as well which makes tracking down problems a lot easier.

in visual studio you can just set your breakpoints, inject the dll, then attach the debugger and it will break like usual.

Wow, thanks. I was always using Olly for that.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Sep 13, 2010 5:56 am    Post subject: Reply with quote

Jani wrote:
slovach wrote:
in visual studio you can just set your breakpoints, inject the dll, then attach the debugger and it will break like usual.
Debugger detected running on your system. Please unload it from memory and try again :p

Don't inject into a probably themida protected binary. In the properties of your project, set the command to be executed to be loaddll.exe from ollydbg and the argument to be the full path to your debug dll. Then pressing f5 will start debugging. Alternatively you can make your own executable which simply loadlibrary's your dll.

You generally are debugging to find problems with your code itself rather than to find problems in the way it interacts with the game.
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