-
July 9th, 2009, 01:17 AM
#1
I've a question about SetWindowHookEx
hello
I've a question..
It may be involved in how callback function works
anyway what I wonder is.. why we should use dll when using SetWindowHookEx
I'm meaning global hooking.. when callback function(HOOKFUNC) is called in other process by OS
the address is function is matched into memory address of the process ?
if A process used SetWindowHookEx with paramater 7h
(suppose 7h is the address of HOOKFUNC), when HOOKFUNC is called in B process (maybe
there occured message from B process), Does the address of HOOKFUNC (7h) match to the memory address of B process ? if it's true I'm likely to know why HOOKFUNC should be dll..
but isn't it possible that OS calls HOOKFUNC which is defined in exefile of A process no matter
what process provided a message? I leaned each process can't access other's memory.. but
'cause it's OS that calls HOOKFUNC, I think it may be possible to access the address of HOOKFUNC in A process.. anyway the point is that why in gloabl hooking, HOOKFUNC should
be in dll..
thanks
P.S: 'cause english is not mother tongue, it's hard to explain my problem.. plz take time
to catch meaning..
-
July 9th, 2009, 01:32 AM
#2
Re: I've a question about SetWindowHookEx
No need that ur procedure in dll
it may contain in ur own process also
-
July 9th, 2009, 01:50 AM
#3
Re: I've a question about SetWindowHookEx
You need the function inside the DLL because in another process your local code can not be seen, it's the process address space issue. Operating system lets each process see the whole memory as a private view, no one can use another processes memory from it's own address space.
The hook DLL get loaded in other processes, thus becomes local there, and that's how it can trap the messages in that address space.
Regards,
Ramkrishna Pawar
-
July 9th, 2009, 03:43 AM
#4
-
July 9th, 2009, 03:58 AM
#5
Re: I've a question about SetWindowHookEx
The hook callback function is called inside the target process, yes offcource by the OS, but you need to understand that this "OS" is running inside the process too, and that OS component is GDI32.DLL, it has the mechanism to load the hook function DLL inside all required processes, and then make call to the hook callback function inside that process.
When you ask "process should know the address?" I would answer "Yes", because the GDI32 hook mechanism needs to know this, and it knows it as you mentioned that while setting the hook. But the other part of target process never knows and need not know what's going on.
Regards,
Ramkrishna Pawar
-
July 9th, 2009, 09:01 PM
#6
Re: I've a question about SetWindowHookEx
Originally Posted by Krishnaa
The hook callback function is called inside the target process, yes offcource by the OS, but you need to understand that this "OS" is running inside the process too, and that OS component is GDI32.DLL, it has the mechanism to load the hook function DLL inside all required processes, and then make call to the hook callback function inside that process.
When you ask "process should know the address?" I would answer "Yes", because the GDI32 hook mechanism needs to know this, and it knows it as you mentioned that while setting the hook. But the other part of target process never knows and need not know what's going on.
Very thanks!!
You seem to be a creator of the windows
thanks again and have a nice day
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|