kernel32 & winex11: WaitForMultipleObjectsEx should ignore NULL handles

Robert Shearman rob at
Fri Feb 29 10:58:16 CST 2008

Adam Strzelecki wrote:
> Hi,
> In MSI dialog.c: msi_dialog_check_messages function it often happens 
> that is sends:
> MsgWaitForMultipleObjects( 1, &handle, 0, INFINITE, QS_ALLINPUT );
> Where handle = NULL. I'm not sure if it is correct behavior. But 
> tracing it down I found out that kernel32 and winex11 sync functions 
> are not checking at all if the passes handles are not NULLs.
> So I'm not sure whether this patch is right or not, but I believe we 
> shouldn't bother wineserver with NULL handles!?
> Yet maybe I don't understand clearly the way interserver communication 
> works, and sending "WaitFor" with NULL handle makes sense. Does it?

No, but this is the wrong fix.

You're assuming that because MSI code does action A and that causes bad 
effect when it does action B that the correct action is to fix B so that 
it doesn't have a bad effect. However, the bug could also be that action 
A shouldn't be done.

In this case, MSI should not be calling MsgWaitForMultipleObjects with 
an invalid handle and in fact that barring memory corruption, this can't 
>     while (1)
>     {
>         msi_process_pending_messages( NULL );
>         if( !handle )
>             break;
>         /*
>          * block here until somebody creates a new dialog or
>          * the handle we're waiting on becomes ready
>          */
>         r = MsgWaitForMultipleObjects( 1, &handle, 0, INFINITE, 
>         if( r == WAIT_OBJECT_0 )
>             break;
>     }

Rob Shearman

More information about the wine-devel mailing list