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.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6443
Alfred Agrell (@Alcaro) commented about dlls/kernel32/process.c:
> +
> + return FALSE;
> +}
> +
> +/***********************************************************************
> + * GetFirmwareEnvironmentVariableExA (KERNEL32.@)
> + */
> +DWORD WINAPI GetFirmwareEnvironmentVariableExA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size, PDWORD attributes)
> +{
> + int nsize;
> + GUID vendor = {0};
> + LPWSTR wname;
> + UNICODE_STRING uname;
> + DWORD ret_size = size;
> +
> + if (!__wine_string_to_guid(guid, &vendor))
Probably better to convert this string to utf16, then call the W function. That'd not only remove that GUID conversion function (I'd rather not review that amount of math - I think even GCC will complain that, unclear precedence warnings on | and +), but also make future maintenance easier.
Yes, it'll copy and convert around things a little more. Who cares, this isn't performance sensitive.
If you want to remove the allocations, you can put one in NtCurrentTeb()->StaticUnicodeBuffer, A/W conversions is exactly what it's for. (Though there's only one, so you'll need pointer math or allocations for the other one.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6423#note_81250