[PATCH 0/1] MR8608: comdlg32:IFileDialog2_fnSetFileTypes pszName revise
The name not display the filtered file types Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=57113 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608
From: Maotong Zhang <zmtong1988(a)gmail.com> The name not display the filtered file types 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..01596ae3870 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 = HeapAlloc(GetProcessHeap(), 0, total_len * sizeof(WCHAR)); + if (pszName != NULL) + { + swprintf(pszName, total_len, L"%s (%s)", This->filterspecs[i].pszName, This->filterspecs[i].pszSpec); + HeapFree(GetProcessHeap(), 0, (void*)This->filterspecs[i].pszName); + This->filterspecs[i].pszName = pszName; + } + } + } } This->filterspec_count = cFileTypes; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8608
This appears to break the comdlg32:itemdlg tests. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110874
Yes, it destroyed the class name. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110879
On Fri Jul 25 03:20:21 2025 +0000, Esme Povirk wrote:
This appears to break the comdlg32:itemdlg tests. Test code: executes filedialog_change_filetype() to first detect "fname1", and then detects "fname1 (*. txt)". If "fname1 (*. txt) " exists, it will also fail.
Modify code :add "(*. txt)" to pszName that does not have "(*. txt)". Only "fname1 (*. txt)" exists, without "fname1", resulting in test failure. Can the test code program be modify directly determine "fname1 (*. txt)" ? If the pszName is not modify in IFileDialog2_fnSetFileTypes. Can be used: on_wm_initdialog() --> SendMessageW(CB_ADDSTRING), add "(*. txt)" before sending, do not modify the original data of pszName. How can I do it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110980
On Fri Jul 25 03:20:21 2025 +0000, Maotong Zhang wrote:
Test code: executes filedialog_change_filetype() to first detect "fname1", and then detects "fname1 (*. txt)". If "fname1 (*. txt) " exists, it will also fail. Modify code :add "(*. txt)" to pszName that does not have "(*. txt)". Only "fname1 (*. txt)" exists, without "fname1", resulting in test failure. Can the test code program be modify directly determine "fname1 (*. txt)" ? If the pszName is not modify in IFileDialog2_fnSetFileTypes. Can be used: on_wm_initdialog() --> SendMessageW(CB_ADDSTRING), add "(*. txt)" before sending, do not modify the original data of pszName. How can I do it. I am suspicious of the test. Which string succeeds in finding the combo box on current Windows? I think it might be the one marked as "broken".
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110983
On Fri Jul 25 04:53:54 2025 +0000, Esme Povirk wrote:
I am suspicious of the test. Which string succeeds in finding the combo box on current Windows? I think it might be the one marked as "broken". Test run comdlg32_test.exe:
Wine: Test passed. Windows 10: Failed. Modify comdlg32_test to only perform the "fname1 (*.txt)" check: Windows 10: Test passed. Wine: Failed. wine code add "(*. txt)" to pszName, Wine test passed . -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110985
On Fri Jul 25 07:07:40 2025 +0000, Maotong Zhang wrote:
Test run comdlg32_test.exe: Wine: Test passed. Windows 10: Failed. Modify comdlg32_test to only perform the "fname1 (*.txt)" check: Windows 10: Test passed. Wine: Failed. wine code add "(*. txt)" to pszName, Wine test passed . Presumably some Windows version at some point needed "fname1". I think we should modify the test to accept both names, as I see no reason to say "fname1 (*.txt)" is "broken".
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8608#note_110992
participants (3)
-
Esme Povirk (@madewokherd) -
Maotong Zhang -
Maotong Zhang (@xiaotong)