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
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).