News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

API Hooking

Started by InfamousBytes, July 28, 2008, 11:36:40 PM

Previous topic - Next topic

InfamousBytes

Well, trying to hook MessageBoxA more for the hell of it than anything else, and I have narrowed down the problem to my generic hook function. The problem is that instead of writing the address ot my own proc after writing the jmp, it writes the totally wrong address. Here's my code:

HookFxn proc AddrFxn:DWORD, AddrNewFxn:DWORD, AddrStoreVar:DWORD

mov ebx, AddrFxn
mov AddrStoreVar, ebx
invoke WriteMem, AddrFxn, addr JmpByte, 1
mov ebx, AddrFxn
inc ebx
invoke WriteMem, ebx, AddrFxn, 4
ret

HookFxn endp


Thanks for any suggestions.

PBrennick

InfamousBytes,

For hooking a Message Box, use the MessageProc API with the MSGF_DIALOGBOX for the hook code. This hook code is used when the input event occurred in a message box or dialog box.

Hope this helps,
-- Paul
The GeneSys Project is available from:
The Repository or My crappy website

Vortex

Hi InfamousBytes,

Here, you can find how to hook a message box :

http://www.masm32.com/board/index.php?topic=7375.0