[PATCH 0/3] MR10425: msi:Add ComboBox items, using value if text does not exist.
From: Maotong Zhang <zmtong1988@gmail.com> Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=56296 --- dlls/msi/dialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index a228f138966..21f6b159dfc 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -1397,7 +1397,7 @@ static UINT combobox_add_item( MSIRECORD *rec, void *param ) info->items[info->addpos_items] = wcsdup( value ); - pos = SendMessageW( info->hwnd, CB_ADDSTRING, 0, (LPARAM)text ); + pos = SendMessageW( info->hwnd, CB_ADDSTRING, 0, (LPARAM)(text ? text : value) ); SendMessageW( info->hwnd, CB_SETITEMDATA, pos, (LPARAM)info->items[info->addpos_items] ); info->addpos_items++; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10425
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
From: Maotong Zhang <zmtong1988@gmail.com> Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=56296 --- dlls/msi/dialog.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 9f97231fb65..a19a30619d1 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -1363,6 +1363,8 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP struct msi_combobox_info *info; LRESULT r; DWORD j; + LPWSTR value, text = NULL; + INT index, len; TRACE( "%p %04x %#Ix %#Ix\n", hWnd, msg, wParam, lParam ); @@ -1374,6 +1376,31 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP switch (msg) { + case WM_COMMAND: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + index = SendMessageW( hWnd, CB_GETCURSEL, 0, 0 ); + if (index != CB_ERR) + { + value = (LPWSTR)SendMessageW( hWnd, CB_GETITEMDATA, index, 0 ); + if (value) SetWindowTextW( hWnd, value ); + else + { + len = (INT)SendMessageW( hWnd, CB_GETLBTEXTLEN, index, 0 ); + if (len != CB_ERR && len >= 0) + { + text = (LPWSTR)malloc( (len + 1) * sizeof(WCHAR) ); + if (text) + { + SendMessageW( hWnd, CB_GETLBTEXT, index, (LPARAM)text ); + SetWindowTextW( hWnd, text ); + free( text ); + } + } + } + } + } + break; case WM_NCDESTROY: for (j = 0; j < info->num_items; j++) free( info->items[j] ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10425
The first patch fixes the referenced bug. Can you explain why the other 2 patches are needed? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133354
On Mon Mar 23 13:25:24 2026 +0000, Hans Leidekker wrote:
The first patch fixes the referenced bug. Can you explain why the other 2 patches are needed? 1.On initialization, the ComboBox prioritizes the value, then the text.
2.After a user selection, the ComboBox prioritizes the value, then the text. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133368
On Mon Mar 23 13:25:24 2026 +0000, Maotong Zhang wrote:
1.On initialization, the ComboBox prioritizes the value, then the text. 2.After a user selection, the ComboBox prioritizes the value, then the text. These patches add a SetWindowTextW() call which changes the windows title but the combobox window doesn't have a visible title bar, at least not in this installer.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133373
On Mon Mar 23 13:50:17 2026 +0000, Hans Leidekker wrote:
These patches add a SetWindowTextW() call which changes the windows title but the combobox window doesn't have a visible title bar, at least not in this installer. {width=900 height=320} The window has a visible title bar, so SetWindowTextW() works. The ComboBox items have value = English(UK) and text = add-text. Selecting add-text displays the corresponding value (English(UK)).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133384
On Mon Mar 23 14:40:05 2026 +0000, Maotong Zhang wrote:
{width=900 height=320} The window has a visible title bar, so SetWindowTextW() works. The ComboBox items have value = English(UK) and text = add-text. Selecting add-text displays the corresponding value (English(UK)). Where does 'add-text' come from? Please describe the steps to reproduce.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133511
On Tue Mar 24 09:17:06 2026 +0000, Hans Leidekker wrote:
Where does 'add-text' come from? Please describe the steps to reproduce. {width=861 height=523} Using the Orca.exe tool of Windows, open the msi file and you can modify the content of the msi file. Add 'add-text' to the corresponding text of English (UK).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133529
On Tue Mar 24 11:54:42 2026 +0000, Maotong Zhang wrote:
{width=861 height=523} Using the Orca.exe tool of Windows, open the msi file and you can modify the content of the msi file. Add 'add-text' to the corresponding text of English (UK). That makes it clear, thanks.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425#note_133740
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10425
participants (3)
-
Hans Leidekker (@hans) -
Maotong Zhang -
Maotong Zhang (@xiaotong)