Determing which thread a hook is comming from..
Posted: Thu Sep 02, 2004 10:23 pm
Hello Madshi and all,
"madCodeHook" rocks! It's very stable and makes process or system wide hooks easy to do.
I have this application I'm hooking some API calls from.
I'm doing this do make an add-on tool to the program.
The source application opens up four seperate windows in shared thread(s).
I'm trying to figure out from inside the hook which one of the four windows the hook belongs too (using documented or not API calls).
I thought I would do this simply by thread ID (using "GetCurrentThreadId()") or handle. But since they are all shared, they all come up as the same ID or handle.
I CAN do a GetActiveWindow() and get the threads(window) unique HWND, but only when it's in focus.
Is there some undocumented windows API call to get the REAL thread ID or handle, and or address, etc., that I can use to associate the window?
I'm not adverse to reading the selector or descritor tables, mapping the virtual to physical memeory, or making a WDM for it if I have too..
Thanks,
"SirMabus"
"madCodeHook" rocks! It's very stable and makes process or system wide hooks easy to do.
I have this application I'm hooking some API calls from.
I'm doing this do make an add-on tool to the program.
The source application opens up four seperate windows in shared thread(s).
I'm trying to figure out from inside the hook which one of the four windows the hook belongs too (using documented or not API calls).
I thought I would do this simply by thread ID (using "GetCurrentThreadId()") or handle. But since they are all shared, they all come up as the same ID or handle.
I CAN do a GetActiveWindow() and get the threads(window) unique HWND, but only when it's in focus.
Is there some undocumented windows API call to get the REAL thread ID or handle, and or address, etc., that I can use to associate the window?
I'm not adverse to reading the selector or descritor tables, mapping the virtual to physical memeory, or making a WDM for it if I have too..
Thanks,
"SirMabus"