[PATCH] add: SetEnvironmentStringsW

Chip Davis cdavis at codeweavers.com
Fri Jan 17 16:43:48 CST 2020

January 16, 2020 1:52 PM, "Frank Uhlig" <uhlig.frank at gmail.com> wrote:

> diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
> index a14bed04be..8f48a5fdb1 100644
> --- a/dlls/kernel32/kernel32.spec
> +++ b/dlls/kernel32/kernel32.spec
> @@ -1387,7 +1387,7 @@
>  # @ stub SetDynamicTimeZoneInformation
>  @ stdcall -import SetEndOfFile(long)
>  # @ stub SetEnvironmentStringsA
> -# @ stub SetEnvironmentStringsW
> +@ stdcall -import SetEnvironmentStringsW (long ptr wstr)

This is wrong. It's supposed to be:

@ stdcall -import SetEnvironmentStringsW(ptr)

because the function prototype is:

BOOL WINAPI SetEnvironmentStringsW(LPWCH);

Similarly for the other spec files.

Since it's a double-null-terminated string, I don't think this should use 'wstr' here.

I suspect you were unable to reproduce the build failures because you don't have a MinGW build environment installed. If you tried running with relay tracing enabled, you'd see two extra bits of garbage anytime SetEnvironmentStringsW() were called. And on 64-bit, it would likely crash due to the relay tracing mechanism clipping the upper half of a 64-bit pointer.

>  @ stdcall -import SetEnvironmentVariableA(str str)
>  @ stdcall -import SetEnvironmentVariableW(wstr wstr)
>  @ stdcall -import SetErrorMode(long)


More information about the wine-devel mailing list