hi coders...
im new to teh asm world.
im trying to subclassing Notepad, im using hooks.
this is my callback function.



CBTCallBackProc proc Code:DWORD, wParam:DWORD, lParam:DWORD
.IF Code == HCBT_CREATEWND
GetClassName, wParam, ADDR Buffer, 256
invoke lstrcmpi, ADDR NotePadClass, ADDR Buffer
.IF eax == 0
invoke SetWindowLong, wParam, GWL_WNDPROC, ADDR NotePadProc
mov NotePadWndProc, eax
.ENDIF
.ENDIF
invoke CallNextHookEx, CBTHookHandle, Code, wParam, lParam
ret
CBTCallBackProc endp

NotePadProc proc Handle:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
invoke CallWindowProc, NotePadWndProc, Handle, uMsg, wParam, lParam
ret
NotePadProc endp


for one instance it works good, but when i open two instances of notepad is the problem, and notepad crashes :(
how can i handle two or more instances of notepad?
is there any examples, hints, ideas, that would help me with this huge problem.
thanks in advance
regards,
maCo
Posted on 2003-02-20 12:17:05 by maCo
Might be posting nonsense but if it crashes at second Hook I guess the Notepad crashing is the first instance and not the second. In case I'm right, could be because the NotepadProc executed by the first instance changes when you hook the second Notepad Instance.


NotePadProc proc Handle:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
invoke CallWindowProc, NotePadWndProc, Handle, uMsg, wParam, lParam
ret
NotePadProc endp


NotePadWndProc Changes between first and second "hooking". First instance is told in NotePadProc to execute "pre-hook" WndProc of second instance.

Quite a newbie in Win32asm so better the idea from an expert.


Ka.
Posted on 2003-02-20 17:11:08 by KaSt
hello KaSt.
so I must have some kind of a list or array, right ?
could anyone help me with that please
thank you :)
Posted on 2003-02-21 12:13:31 by maCo