dlls/user/hook.c HOOK_CallHooks() help

Phil Lodwick Phil.Lodwick at EFI.COM
Wed Nov 8 16:09:24 CST 2006


Alexandre,

> The idea is that active_hooks is a shortcut to avoid calling the
> server if we know that a hook is not set. If we don't have a valid
> active_hooks then we need to call the server, which will then tell us
> whether or not we really have a hook to call.

I don't know if this matters, but when I add more debug (+hook,+msg) I don't
see the problem.  Could be a coincidence.  Anyway, I have added some debug
information and my theory that thread_info->active_hooks being 0 is true.
With your explanation of the code I think I have a pretty good understanding
of what is supposed to happen -- but something is strange.  It appears that
even after a trip to the server thread_info->active_hooks is 0.  I have
stared at code but I don't see how this can be the case.

HOOK_CallHooks() we have code that looks like:

// Understanding Alexandre's explanation, it is very valid to skip past
// this call if we still need to get active_hooks from the server.
if (!HOOK_IsHooked( id ))
    return;

tid = 0;
MyDebugOriginalActiveHooks = thread_info->active_hooks;

SERVER_START_REQ( start_hook_chain )
{
  if (!wine_server_call( req ))
  {
     tid = reply->tid;
     thread_info->active_hooks = reply->active_hooks;
  }
}

if (tid)
{
   switch(id)
   {
     default:
        ERR("Unknown hook id %d\n", id);
        FIXME("Original Hooks = %x; CurrentHooks = %x", 
              MyDebugOriginalActiveHooks,
              thread_info->active_hooks); 
        assert(0);
   }
}

We hit the assert and the active_hooks are 0 before and after the call to the
server.  Since tid is non-zero it means we hit the server successfully.  I
must be missing something really basic.

Phil



More information about the wine-devel mailing list