From: Alexandre Julliard julliard@winehq.org
Either because they would confuse Windows apps, or make the Windows environment grow too large. --- dlls/ntdll/unix/env.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 3862836404b..0f9b1874e59 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -326,7 +326,7 @@ static void init_unix_codepage(void) * is_special_env_var * * Check if an environment variable needs to be handled specially when - * passed through the Unix environment (i.e. prefixed with "WINE"). + * imported from the Unix environment (i.e. prefixed with "WINE_HOST_"). */ static BOOL is_special_env_var( const char *var ) { @@ -335,13 +335,25 @@ static BOOL is_special_env_var( const char *var ) STARTS_WITH( var, "HOME=" ) || STARTS_WITH( var, "TEMP=" ) || STARTS_WITH( var, "TMP=" ) || + STARTS_WITH( var, "XDG_" )); +} + + +/*********************************************************************** + * is_ignored_env_var + * + * Check if an environment variable needs to be skipped when + * importing from the Unix environment. + */ +static BOOL is_ignored_env_var( const char *var ) +{ + return (STARTS_WITH( var, "NIXPKGS_" ) || STARTS_WITH( var, "QT_" ) || STARTS_WITH( var, "SDL_AUDIODRIVER=" ) || STARTS_WITH( var, "SDL_AUDIO_DRIVER=" ) || STARTS_WITH( var, "SDL_VIDEODRIVER=" ) || STARTS_WITH( var, "SDL_VIDEO_DRIVER=" ) || - STARTS_WITH( var, "VK_" ) || - STARTS_WITH( var, "XDG_" )); + STARTS_WITH( var, "VK_" )); }
@@ -861,13 +873,6 @@ static WCHAR *get_initial_environment( SIZE_T *pos, SIZE_T *size ) *size = 1; for (e = environ; *e; e++) *size += strlen(*e) + 6;
- if (*size > 30000) /* Windows is limited to 32767, and we need some space for the Wine variables */ - { - ERR( "Unix environment too large, not importing it.\n"); - *size = *pos = 0; - return NULL; - } - env = malloc( *size * sizeof(WCHAR) ); ptr = env; end = env + *size - 1; @@ -878,13 +883,14 @@ static WCHAR *get_initial_environment( SIZE_T *pos, SIZE_T *size ) /* skip Unix special variables and use the Wine variants instead */ if (STARTS_WITH( str, "WINE" )) { - if (is_special_env_var( str + 4 )) str += 4; + if (is_special_env_var( str + 4 ) || is_ignored_env_var( str + 4 )) str += 4; else if (!strcmp( str, "WINEDLLOVERRIDES=help" )) { MESSAGE( overrides_help_message ); exit(0); } } + else if (is_ignored_env_var( str )) continue; else if (host_var_exists( str )) continue; else if (is_special_env_var( str )) /* prefix it with WINE_HOST_ */ {
I know this is unrelated to the issues in !9423 (it's not long), but perhaps we should also consider `TMPDIR`? I've recently seen Unity games attempting to use that, which must be some cross-platform code since that variable is not usually set on Windows. That's lead to issues in some games, since e.g. `/var/tmp` will get converted into `c:\var\tmp`, which will surely not exist in the prefix. For example, the Steam game "Content Warning" (yes, that's its name) ends up showing an error quite often because of this.
Good point, I can add that.