Please consider this patch obsolete, I sent in a test for the underlying issue - see https://source.winehq.org/patches/data/161743
Regards, Fabian Maurer
For a test program see the bug report. A test is hard to include since environment variables won't update without a reboot.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46901 Signed-off-by: Fabian Maurer dark.shadow4@web.de
dlls/ntdll/env.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 367d083211..e186e3b917 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -164,11 +164,16 @@ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR env, var = ENV_FindVariable(var, name->Buffer, namelen); if (var != NULL) {
value->Length = strlenW(var) * sizeof(WCHAR);
WCHAR buffer[UNICODE_STRING_MAX_CHARS];
SIZE_T len;
RtlExpandEnvironmentStrings(env, (WCHAR *)var, strlenW(var),
buffer, ARRAY_SIZE(buffer), &len); +
value->Length = (len - 1) * sizeof(WCHAR); /* Length without '\0'
terminator */
if (value->Length <= value->MaximumLength) {
memmove(value->Buffer, var, min(value->Length + sizeof(WCHAR),
value->MaximumLength)); + memmove(value->Buffer, buffer, min(value->Length + sizeof(WCHAR), value->MaximumLength)); + nts = STATUS_SUCCESS; } else nts = STATUS_BUFFER_TOO_SMALL; -- 2.21.0