Hi, I'm injecting a DLL into a process, and I'd like to be able to receive it's messages so I read them as you would in your own program. If I'm too confusing I'll try to clear it up;):
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.ELSEIF uMsg==WM_CHAR
push wParam
pop char
xor eax,eax
ret
WndProc endp
That would be in your normal program.. how you read messages, stored in "uMsg". I'm wondering how I can do this in my DLL. I don't know if this is possible.. but it seems all things are possible in assembly! ;)
Thanks,
Titan
I'm not sure I understand the question... why would DLL injection bother you when processing window (or thread) messages? :eek
No, I need to process the messeges IN my DLL itself! I don't have access to the main program. Is there a way to get hook the uMsg of a window? Or emulate the WndProc in my DLL so I can get the uMsg?:)
titan,
Quote
I don't have access to the main program.
This sounds suspiciously like a forum rule violation. We have no way of determining if you have the legal right to modify the functionality of the main program so unles you can explain to us what you are doing and why, we will have to close this thread.
One day I was playing around with depencies, to see what DLLs some programs used, and I noticed that the Google Toolbar is a DLL injected into Internet Explorer which peeked my curiousity. I don't plan on modifying any program, I simply want to play around to see if I can "add on" using some of the messages you get in uMsg(like hotkeying and painting). I'm sorry if this is against the rules. If not, can you help out?
Thanks,
Titan
It sounds OK so we can leave the topic here at the moment. It looks like you are trying to find the interface to add a DLL to the Internet Explorer program which is not a problem at all. I don't directly know how it is done but it sounds like a hook procedure rather than the code injection technique that tends to be used for "other" purposes.
i attempted this a while back so i could make a plugin for MSN Messenger.the way i did it was to inject my dll. which i see you have done.
then Create a Thread pointing to your function which will have the subclassing code in it. this will be executed on DLL_PROCESS_ATTACH.
then use the SetWindowLong api call with the first argument of the handle of the process you want to hook. like the main window or a text box. then the second arg as the constant GWL_WNDPROC. (which is the procedure called when events happen for that window.) then the 3rd (from memory :wink ) i think you use "addr yourprocname" have all the calls you want to intercept and stuff. make sure to store the old wndproc somewhere which is stored in eax when you make the SetWindowLong api call. and youll have to call "CallWindowProc" with the value from SetWindowLong. otherwise the messages the original window procedure parses wont get parsed.
umm also check out Icztutes Tutorial 20 it shows an example on subclassing.
hope this helps.