Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=57113
-- v6: comdlg32: Display filter specs in itemdlg File Type combo box
From: Maotong Zhang zmtong1988@gmail.com
Verified on Windows 10: the string (*.txt) is required to find the combo box --- dlls/comdlg32/tests/itemdlg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index 7ab8fa8f148..f1d0a62525e 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -1165,15 +1165,11 @@ static void filedialog_change_filetype(IFileDialog *pfd, HWND dlg_hwnd) const WCHAR filetype1_broken[] = {'f','n','a','m','e','1',' ', '(','*','.','t','x','t',')',0};
cb_filetype = find_window(dlg_hwnd, NULL, filetype1); - ok(cb_filetype != NULL || broken(cb_filetype == NULL), "Could not find combobox on first attempt\n"); - if(!cb_filetype) { - /* Not sure when this happens. Some specific version? - * Seen on 32-bit English Vista */ - trace("Didn't find combobox on first attempt, trying broken string..\n"); + /* Verified on Windows 10: the string "(*.txt)" is required to find the combobox. */ cb_filetype = find_window(dlg_hwnd, NULL, filetype1_broken); - ok(broken(cb_filetype != NULL), "Failed to find combobox on second attempt\n"); + ok(cb_filetype != NULL, "Failed to find combobox.\n"); if(!cb_filetype) return; }
From: Maotong Zhang zmtong1988@gmail.com
Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=57113 --- dlls/comdlg32/itemdlg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 99af524a06f..d974131924a 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -2549,6 +2549,26 @@ static HRESULT WINAPI IFileDialog2_fnSetFileTypes(IFileDialog2 *iface, UINT cFil { This->filterspecs[i].pszName = StrDupW(rgFilterSpec[i].pszName); This->filterspecs[i].pszSpec = StrDupW(rgFilterSpec[i].pszSpec); + + if (This->filterspecs[i].pszName != NULL && This->filterspecs[i].pszSpec != NULL) + { + DWORD name_len = lstrlenW(This->filterspecs[i].pszName); + + if (name_len == 0 || This->filterspecs[i].pszName[name_len - 1] != L')') + { + DWORD spec_len = lstrlenW(This->filterspecs[i].pszSpec); + + DWORD total_len = name_len + spec_len + 4; + + WCHAR* pszName = LocalAlloc(LMEM_FIXED, total_len * sizeof(WCHAR)); + if (pszName != NULL) + { + swprintf(pszName, total_len, L"%s (%s)", This->filterspecs[i].pszName, This->filterspecs[i].pszSpec); + LocalFree((void *)This->filterspecs[i].pszName); + This->filterspecs[i].pszName = pszName; + } + } + } } This->filterspec_count = cFileTypes;