News:

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

subclass procedure

Started by alpha, December 24, 2004, 01:46:02 PM

Previous topic - Next topic

alpha

i know that this is not very important but i am just curious if it can be done

LRESULT APIENTRY newproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){
     return CallWindowProc(oldproc, hwnd, msg, wp, lp);
}


this works in asm

oldproc dd 0

newproc:
push [esp+16]
push [esp+16]
push [esp+16]
push [esp+16]
push oldproc
call _imp__CallWindowProcA@20
ret 16


trying to reuse the params instead of pushing them again..where is wrong?

nproc:
mov eax,oldproc
mov ecx,[esp]
mov oldproc,ecx
mov [esp],eax
call _imp__CallWindowProcA@20
sub esp,4
mov eax,oproc
mov [esp],eax
ret

hutch--

I have seen it done by jumping to the API procedure name but its dangerous code. With the jump, you do not alter the stack parameters where if you use CALL you change the stack pointer (ESP).
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php