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 


Writing ASM to a program from another program (not a dll)

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

Joined: 08 Dec 2009
Posts: 119
Location: In a box

PostPosted: Fri Jul 11, 2014 9:51 pm    Post subject: Writing ASM to a program from another program (not a dll) Reply with quote

I want to write assembly code to a specific location in another program. In my assembly code, I use jmp (module+offset). The location of (module+offset) and the location of the assembly code I wrote changes every time too (I'm using VirtualAllocEx). How would I write jmp (module+offset) to the program? When I try WriteProcessMemory the bytes change because so do the locations of the addresses each time I allocate memory and/or restart the program. I looked at this thread but I don't think it would work because I am not doing this from a dll, and instead I am doing it from an executable. Any ideas?
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: Sat Jul 12, 2014 12:46 am    Post subject: Reply with quote

You need to calculate the jump based on the allocated cave and the original jump location.

YourAllocatedCave - OriginalLocation - 5 (for the jump instruction length)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
STN
I post too much
Reputation: 43

Joined: 09 Nov 2005
Posts: 2676

PostPosted: Sat Jul 12, 2014 8:34 am    Post subject: Reply with quote

That macro will work just fine because the formula for calculating jmps is the same whether you use it inside dll or from another process.

Use your allocated cave as the code cave address (instead of the function address that that thread uses) and your original code (module+offset) as the original code location. Instead of using hard-coded addresses, you use locations you calculate on the fly (variables).

You can also simply use
mov eax, your codecave/destination
jmp eax

or
push your codecave/destination
ret

Simply calculate the opcodes for them (on the fly) and WPM them like you do a JMP.

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
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