Find that function's location in memory (ultimap might be useful)
Make a jmp to your code near the beginning of that function
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
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