Windows has a limit of 32767 characters in the environment block. https://superuser.com/questions/1070272/why-does-windows-have-a-limit-on-en…
Wine doesn't attempt to respect that at all. Do some programs actually depend on this? Unfortunately yes.
With this patch, during initialization, if the block size would exceed (or be close to) the limit, the biggest environment variables will be excluded.
This is useful when a user has very long environment variables in their system for reasons unrelated to Wine.
Do note that there's still nothing done to make sure that the limit isn't exceeded after initialization.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56941
Signed-off-by: Martino Fontana <tinozzo123(a)gmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6140
We can't return the unicode string size, this returns sizes to small
for multi-byte characters.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54295
--
v7: kernel32: Rework ExpandEnvironmentStringsA to return ansi size and fix corner cases.
kernel32: Rework ExpandEnvironmentStringsW error handling.
ntdll: Rework RtlExpandEnvironmentStrings/_U to account for corner cases.
kernel32: Add ExpandEnvironmentStringsA tests for japanese.
kernel32: Add more tests for ExpandEnvironmentStringsA.
kernel32: Add tests for ExpandEnvironmentStringsW.
ntdll: Add more tests for RtlExpandEnvironmentStrings/_U.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4045
Fabian Maurer (@DarkShadow44) commented about dlls/win32u/sysparams.c:
> 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
> 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
>
> - if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) return 0;
> + if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) goto fail;
>
> if (!NtGdiGetTextExtentExW( hdc, abcdW, ARRAYSIZE(abcdW), 0, NULL, NULL, &sz, 0 ))
> - return 0;
> + goto fail;
>
> if (height) *height = sz.cy;
> return (sz.cx / 26 + 1) / 2;
> +fail:
> + if (height) *height = 1;
> + return 0;
Just curious, but why `1`?
Also, wouldn't it be easier to have `if (height) *height = 1;` at the beginning of the function? Then you could keep the rest the same. And maybe that function could zero the `metrics` as well? Not sure where it would be required, I find a setup without freetype strange to begin with.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5957#note_77190
clang will default to the host if no target is specified, which causes
compile test failures if arch-specific CFLAGS are used for a non-host
arch.
--
v4: configure: Test PE compilers after setting their target argument.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5586