dlls/user/hook.c HOOK_CallHooks() help

Phil Lodwick Phil.Lodwick at EFI.COM
Wed Nov 8 10:34:53 CST 2006


Unfortunately this problem I am seeing is very hard to reproduce.  I have
added some more debug in case it happens again.  However, looking at code,
the HOOK_IsHooked function seems strange:

BOOL HOOK_IsHooked( INT id )
{
    struct user_thread_info *thread_info = get_user_thread_info();

    if (!thread_info->active_hooks) return TRUE;
    return (thread_info->active_hooks & (1 << (id - WH_MINHOOK))) != 0;
}

Active_hooks is pretty much set by the server.  Bit 0x80000000 is set to
indicate that the bitmask is valid.  One of my suspicions that I hope to
confirm with debug is that in my case of failure active_hooks is 0.

Would it not make more sense to return FALSE from this routine in that case?
That is to say, if the bitmask is NOT valid, miss processing the hook instead
of erroneously trying to process a hook that is not set.

Even if that is the case, I will have to figure out the real problem of why
active_hooks is 0.

Thanks,
Phil

-----Original Message-----
From: wine-devel-bounces at winehq.org [mailto:wine-devel-bounces at winehq.org] On
Behalf Of Phil Lodwick
Sent: Friday, November 03, 2006 4:25 PM
To: wine-devel at winehq.org
Subject: dlls/user/hook.c HOOK_CallHooks() help

Hi,

I have an application that is hitting the assert in HOOK_CallHooks.

------
trace:hook:HOOK_CallHooks calling hook in thread 0113 WH_CALLWNDPROC code 0
wp 0 lp 7fbef984
err:hook:HOOK_CallHooks Unknown hook id 4
wine-pthread: hook.c:381: HOOK_CallHooks: Assertion `0' failed.
------

Basically I have a call stack that looks like this:

4 0x7f886b31 HOOK_CallHooks+0x251(id=0x4, code=0x0, wparam=0x0,
lparam=0x7fbef984, unicode=0x0) [dlls/user/hook.c:381] in user32 (0x7fbef944)
  
5 0x7f8a4e8c call_window_proc+0x9c(hwnd=0x0, msg=0x0, wparam=0x0, lparam=0x0,
unicode=0x0, same_thread=0x0) [dlls/user/message.c:1512] in user32
(0x7fbef9a0)

6 0x7f8a5dca peek_message(msg=0x7fbefcd0, hwnd=0x0, first=0x0,
last=0xffffffff, flags=0x1) [dlls/user/message.c:2053] in user32 (0x7fbefca8)

7 0x7f8a7a16 PeekMessageW(msg_out=0x7fbefe10, hwnd=0x0, first=0x0, last=0x0,
flags=0x1) [dlls/user/message.c:2694] in user32 (0x7fbefcfc)
 
8 0x7f8a7cc9 GetMessageW+0x109(msg=0x7fbefe10, hwnd=0x0, first=0x0, last=0x0)
[dlls/user/message.c:2764] in user32 (0x7fbefdb0)

9 0x7f8a7e67 GetMessageA+0x37(msg=0x7fbefe10, hwnd=0x0, first=0x0, last=0x0)
[dlls/user/message.c:2804] in user32 (0x7fbefdd0)

-------------------

The WH_CALLWNDPROC is usually filtered out by the HOOK_IsHooked() call, but
not in this case.  I don't have source code available for the application.  I
was hoping somebody might have a good suggestion for the next step in
debugging this problem.  Right now I am going to start looking at GetMessageA
and follow that code down to call_window_proc and see if I see something
obvious.

Thanks,
Phil





More information about the wine-devel mailing list