P
Sent from my iPhone
On Aug 7, 2020, at 12:01 PM, Alexandre Julliard julliard@winehq.org wrote:
Gijs Vermeulen gijsvrm@gmail.com writes:
From: Vladimir Panteleev git@vladimir.panteleev.md
The previous implementation of GetEnvironmentVariableA incorrectly assumed that, after WideCharToMultiByte conversion, the resulting A string will have the same number of CHARs as the number of WCHARs in the W string. This assumption resulted in failures when querying environment variables with non-ASCII values in locales with multi-byte character pages.
Address this by always retrieving the Unicode value of the variable, then measuring its length after code page conversion, and only then deciding whether it fits into the user-supplied buffer.
The problem is that you are now retrieving it twice, and the value may have changed in the meantime.
-- Alexandre Julliard julliard@winehq.org