user32: Use top level window as dialog parent for modal dialogs.

Jacek Caban jacek at
Tue Apr 5 07:18:34 CDT 2016

On 04/05/16 13:59, Dmitry Timoshkov wrote:
> Hi Jacek,
> Jacek Caban <jacek at> wrote:
>> This is part of the fix for bug 40282.
> Could you please add actual tests that show the handling of disabled
> window state? Neither current tests nor the new ones actually check
> that at all, having such tests would prevent new regressions in this
> area. Feel free to use my tests from the staging repository as a base
> if desired, or write your own ones that use the same approach.

This patch is not directly related to enabled/disabled state of
parent/owner. I plan to send such tests together with the other part of
the fix. For the reference, I attached a patch that (on top on this one)
passes all your tests.

-------------- next part --------------
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 2bacf4d..64b1368 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -771,7 +771,7 @@ HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst, LPCDLGTEMPLATEW dlgTemp
 INT DIALOG_DoDialogBox( HWND hwnd )
-    HWND owner = GetWindow( hwnd, GW_OWNER );
+    HWND owner = GetParent( hwnd );
     DIALOGINFO * dlgInfo;
     MSG msg;
     INT retval;
@@ -822,7 +822,7 @@ INT DIALOG_DoDialogBox( HWND hwnd )
-    if (dlgInfo->flags & DF_OWNERENABLED) EnableWindow( owner, TRUE );
+    EnableWindow( owner, TRUE );
     retval = dlgInfo->idResult;
     DestroyWindow( hwnd );
     return retval;

More information about the wine-devel mailing list