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 


Modifying read-only values in ASM?

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

Joined: 24 Feb 2011
Posts: 7

PostPosted: Fri Mar 04, 2011 2:45 am    Post subject: Modifying read-only values in ASM? Reply with quote

Hello

I have been doing some code injection using codecaves, but not using auto assembler neither CT, because I plan to do a standalone program to patch the exe. I have done several codecaves for modifying the code/values and they work fine, but recently I have found some values (2) that give me problems.

First, in order to find a valid pointer for these two addresses, I used pointer scan but it returned an empty window, so I unchecked "Don't include pointers with read-only nodes", and then I found the pointers, (both are 1 level/1-offset pointers) so I guess the values are read-only.

The surprising part is that I can change these values manually in CE (no need to freeze them, as they are not re-written automatically), but when I try to write to them with mov [....],nnnnnnnn, the program hangs and crash as soon as I execute that instruction.

I can show here the exact values, etc if needed. But please, could you tell me how I can change these values without using CT (I want to be able to do that in ASM in order to modify the exe permanently by adding my own code, as explained)?

Thanks a lot!

PS: the addresses store float values and the game is Silent Hunter III
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Fri Mar 04, 2011 5:14 am    Post subject: Reply with quote

Call VirtualProtectEx to make the memory writable
Or adjust the pe header and change the region to writable

_________________
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
Darkbluesky
How do I cheat?
Reputation: 0

Joined: 24 Feb 2011
Posts: 7

PostPosted: Fri Mar 04, 2011 6:11 am    Post subject: Reply with quote

Thanks for the answer (and sorry for posting in the wrong forum).

I was wondering if I could write to these address by programming in ASM in the codecave, I mean without calling VirtualProtectEX in the ttrainer/patcher or needing a previously modified PE header file. I don't know if I explain myself, I am looking for something that in the same injected code, allowed me to write there.

If it is not possible, or too hard for me, then I guess I can modify the ASM code to use some static addressess filled by me...


PS: BTW, I am having a hard time, trying to make CE to keep the addresses referred to a base address of a module. I mean I write something like mov ebx,["CameraBehavior.act"+00009414], but then it converts it to the value, and when I save the codecave and reload it after a game restart, it does not keep the relative path, thus it is wrong. It is surprising because in other parts of the code it works, but not for me...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Fri Mar 04, 2011 1:07 pm    Post subject: Reply with quote

No, codecaves are really difficult to use and give more trouble than what they're worth (only thing they are good for is not having to run a trainer and being stuck with cheats on all the time)


about : mov ebx,["CameraBehavior.act"+00009414]
try changing it to lea,["CameraBehavior.act"+00009414] so you get the address instead of the value

_________________
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
Darkbluesky
How do I cheat?
Reputation: 0

Joined: 24 Feb 2011
Posts: 7

PostPosted: Fri Mar 04, 2011 2:23 pm    Post subject: Reply with quote

Tx! Well, I'll use new static addresses to put the new values I want and use them.

But still I need to use (read) the other values for reference, and I can't keep the module reference refreshed when game is restarted, I mean the lea instruction, when saved and loaded with codecave after a game restart now keeps the last value (address), just as with mov, only that instead of showing it as the hex value of the address it shows as a module+offset, only that the module and offset are the corresponding to the last address and it should be viceversa (the address should change to fit to the module+offset I wrote, which should be always the same...) Sad
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