CBT HOOK not called sometimes
-
Hi, I have a hook dll to implement a CBT global hook which help us identify some specific type of windows creation. Lets assume the dll is called "a.dll" and that it is is installed by process "a.exe" using SetWindowsHookEx. Due to performance considerations, the hook should only be installed on processes with name "b.exe". In the DllMain of "a.dll", when dwReason == DLL_PROCESS_ATTACH I check for the hosting process name and ensure it is either "a.exe" or "b.exe", otherwise I return 0, which ensures the dll is not loaded to that process. This works great 99% of the time, but seldom we see glitches, where the cbt hook is not being called, and we miss the creation of some of the windows. Are you familiar with this issue? Can you think of something we are doing wrong? Do you have a better/fully consistent solution for identifying windows creation? 10x Dani
-
Hi, I have a hook dll to implement a CBT global hook which help us identify some specific type of windows creation. Lets assume the dll is called "a.dll" and that it is is installed by process "a.exe" using SetWindowsHookEx. Due to performance considerations, the hook should only be installed on processes with name "b.exe". In the DllMain of "a.dll", when dwReason == DLL_PROCESS_ATTACH I check for the hosting process name and ensure it is either "a.exe" or "b.exe", otherwise I return 0, which ensures the dll is not loaded to that process. This works great 99% of the time, but seldom we see glitches, where the cbt hook is not being called, and we miss the creation of some of the windows. Are you familiar with this issue? Can you think of something we are doing wrong? Do you have a better/fully consistent solution for identifying windows creation? 10x Dani
dani kenan wrote:
Are you familiar with this issue?
No
dani kenan wrote:
Can you think of something we are doing wrong?
Yes. maybe your comparison code isn't correct. Are you using a case-sensitive string compare? suggestion: log every DLL_PROCESS_ATTACH with its relevant data to a text file and inspect that. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.