[PATCH 1/3] msi: Set dialog as parent in subsequent dialog

Nikolay Sivov nsivov at codeweavers.com
Fri Sep 3 14:03:10 CDT 2021



On 9/3/21 9:33 PM, Fabian Maurer wrote:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51576
> Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
> ---
>  dlls/msi/dialog.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
> index 703f9d43957..e6048ee6a22 100644
> --- a/dlls/msi/dialog.c
> +++ b/dlls/msi/dialog.c
> @@ -140,6 +140,9 @@ typedef struct
>  static DWORD uiThreadId;
>  static HWND hMsiHiddenWindow;
>
> +static HWND handle_parent_dialog[10] = { NULL };
> +static UINT parent_level = 0;
> +
I'm curious, how does this work wrt threading? Why 10? This looks more
like a workaround to me.
>  static LPWSTR msi_get_window_text( HWND hwnd )
>  {
>      UINT sz, r;
> @@ -3881,6 +3884,11 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
>          return SendMessageW( (HWND) lParam, WM_CTLCOLORSTATIC, wParam, lParam );
>
>      case WM_DESTROY:
> +        if (parent_level > 0)
> +        {
> +            handle_parent_dialog[parent_level - 1] = NULL;
> +            parent_level--;
> +        }
>          dialog->hwnd = NULL;
>          return 0;
>      case WM_NOTIFY:
> @@ -3904,7 +3912,7 @@ static void process_pending_messages( HWND hdlg )
>  static UINT dialog_run_message_loop( msi_dialog *dialog )
>  {
>      DWORD style;
> -    HWND hwnd;
> +    HWND hwnd, parent;
>
>      if( uiThreadId != GetCurrentThreadId() )
>          return SendMessageW( hMsiHiddenWindow, WM_MSI_DIALOG_CREATE, 0, (LPARAM) dialog );
> @@ -3917,15 +3925,23 @@ static UINT dialog_run_message_loop( msi_dialog *dialog )
>      if (dialog->parent == NULL && (dialog->attributes & msidbDialogAttributesMinimize))
>          style |= WS_MINIMIZEBOX;
>
> +    parent = parent_level > 0 ? handle_parent_dialog[parent_level - 1] : 0;
> +
>      hwnd = CreateWindowW( L"MsiDialogCloseClass", dialog->name, style,
>                       CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
> -                     NULL, NULL, NULL, dialog );
> +                     parent, NULL, NULL, dialog );
>      if( !hwnd )
>      {
>          ERR("Failed to create dialog %s\n", debugstr_w( dialog->name ));
>          return ERROR_FUNCTION_FAILED;
>      }
>
> +    if (parent_level < ARRAY_SIZE(handle_parent_dialog))
> +    {
> +        handle_parent_dialog[parent_level] = hwnd;
> +        parent_level++;
> +    }
> +
>      ShowWindow( hwnd, SW_SHOW );
>      /* UpdateWindow( hwnd ); - and causes the transparent static controls not to paint */
>
> --
> 2.33.0
>
>




More information about the wine-devel mailing list