From: Maotong Zhang <zmtong1988@gmail.com> Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=56296 --- dlls/msi/dialog.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 21f6b159dfc..9f97231fb65 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -1510,7 +1510,8 @@ static UINT dialog_combobox_handler( msi_dialog *dialog, struct control *control static void dialog_combobox_update( msi_dialog *dialog, struct control *control ) { struct msi_combobox_info *info; - LPWSTR value, tmp; + LPWSTR value, tmp, text = NULL; + INT len; DWORD j; info = GetPropW( control->hwnd, L"MSIDATA" ); @@ -1524,21 +1525,31 @@ static void dialog_combobox_update( msi_dialog *dialog, struct control *control for (j = 0; j < info->num_items; j++) { - tmp = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, j, 0 ); - if (!wcscmp( value, tmp )) - break; - } + tmp = (LPWSTR)SendMessageW( control->hwnd, CB_GETITEMDATA, j, 0 ); + if (!tmp) + { + len = (INT)SendMessageW( control->hwnd, CB_GETLBTEXTLEN, j, 0 ); + if (len != CB_ERR && len >= 0) + { + text = (LPWSTR)malloc( (len + 1) * sizeof(WCHAR) ); + if (text) + SendMessageW( control->hwnd, CB_GETLBTEXT, j, (LPARAM)text ); + } + } - if (j < info->num_items) - { - SendMessageW( control->hwnd, CB_SETCURSEL, j, 0 ); - } - else - { - SendMessageW( control->hwnd, CB_SETCURSEL, -1, 0 ); - SetWindowTextW( control->hwnd, value ); + if ((tmp && !wcscmp( value, tmp )) || (text && !wcscmp( value, text ))) + { + SendMessageW( control->hwnd, CB_SETCURSEL, j, 0 ); + SetWindowTextW( control->hwnd, tmp ? tmp : text ); + free( value ); + if (text) free( text ); + return; + } + if (text) free( text ); } + SendMessageW( control->hwnd, CB_SETCURSEL, -1, 0 ); + SetWindowTextW( control->hwnd, value ); free( value ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10425