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 


Code Injection MessageBox Hook

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

Joined: 09 Feb 2014
Posts: 18

PostPosted: Thu Feb 18, 2016 7:02 am    Post subject: Code Injection MessageBox Hook Reply with quote

Alright Hi,

I need a snippet for MessageBox() Hook using Code injection Pls. Can someone be of help, i'd appreciate it .
Back to top
View user's profile Send private message Yahoo Messenger
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4691

PostPosted: Thu Feb 18, 2016 11:58 am    Post subject: Reply with quote

  1. Find that function's location in memory (ultimap might be useful)
  2. Make a jmp to your code near the beginning of that function
  3. Write your code with either a "ret" instruction at the end or a jmp back to the code if you still want the function to run

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mgostIH
Expert Cheater
Reputation: 3

Joined: 01 Jan 2016
Posts: 159

PostPosted: Thu Feb 18, 2016 12:50 pm    Post subject: Reply with quote

ParkourPenguin wrote:
  1. Find that function's location in memory (ultimap might be useful)
  2. Make a jmp to your code near the beginning of that function
  3. Write your code with either a "ret" instruction at the end or a jmp back to the code if you still want the function to run


Ultimap for a MessageBox hook is not needed and a lot of people can't use it, so it's not a tip for everyone.

If the MessageBox function is a game related one, then you can find it easily using OllyDBG or even Cheat Engine "Find referenced strings" function (yes, it has one aswell) and searching for the text used by the messagebox.

If it's the windows default one, you can find it on cheat engine easily, just go to the memory viewer code section , Right Click->Goto Address and write:
Code:
user32.MessageBoxA


There you have the address. For the hook, Windows default messagebox uses 4 parameters, so a "ret 10" is needed at the end of your hook, if you don't clean up the stack already in your code (which you shouldn't actually).


Simple Code Snippet for Windows MessageBoxA hook:
Code:
alloc(newmem,2048)


newmem: //this is allocated memory, you have read,write,execute access
mov eax,0  //Hook code
ret 10
MessageBoxA:
jmp newmem


_________________
Do you need to ask me something? Feel free to join my discord server at: https://discord.gg/At4VZXA or ask me something in my YouTube channel: https://www.youtube.com/c/mgostIH
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