This fixes a bug in EastMoney, which calls SetFileTypes() with a COMDLG_FILTERSPEC structure in which pszSpec = L"" followed by SetFileName(L"*.fml"). In windows, this matches all *.fml files. In wine, this matched no files. Before this patch, wine did not use filters from the file name field (marked as a FIXME) and a file type entry with an empty spec would match no files (as opposed to leaving the current filter unmodified).
The exact rules worked out by testing in a Windows 10 VM seem to be:
Current filter is initially empty and can be set by typing a filter
into the file name field (or SetFileName) or selecting an entry from the file type menu (or SetFileTypeIndex).
Selecting a file type entry with an empty spec leaves the current filter unchanged.
Selecting a file type entry with a non-empty spec clears the file name field if it currently contains a filter.
This was tested using https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7… (MIT Licensed). There is a c_rgSaveTypes variable at the top which can be modified to various configurations (especially ones that include a COMDLG_FILTERSPEC with an empty pszSpec)
--
v3: comdlg32: add tests for itemdlg file name field filters
comdlg32: allow entering a filter in the itemdlg file name field
https://gitlab.winehq.org/wine/wine/-/merge_requests/6443