msvcrt: Do not put cmd.exe special environment variables into the environ.

All the special environment variables from the command shell which
track directory use are stripped out from the C runtime
environ/wenviron.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45320
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jason Edmeades 2018-09-25 08:39:59 +01:00 committed by Alexandre Julliard
parent 58148a31fc
commit 0dcfc97fcb
1 changed files with 8 additions and 4 deletions

View File

@ -73,7 +73,8 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk)
for (ptr = environ_strings; *ptr; ptr += strlen(ptr) + 1)
{
count++;
/* Don't count environment variables starting with '=' which are command shell specific */
if (*ptr != '=') count++;
len += strlen(ptr) + 1;
}
if (blk)
@ -88,7 +89,8 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk)
memcpy(&blk[count],environ_strings,len);
for (ptr = (char*) &blk[count]; *ptr; ptr += strlen(ptr) + 1)
{
blk[i++] = ptr;
/* Skip special environment strings set by the command shell */
if (*ptr != '=') blk[i++] = ptr;
}
}
blk[i] = NULL;
@ -105,7 +107,8 @@ MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk)
for (wptr = wenviron_strings; *wptr; wptr += strlenW(wptr) + 1)
{
count++;
/* Don't count environment variables starting with '=' which are command shell specific */
if (*wptr != '=') count++;
len += strlenW(wptr) + 1;
}
if (wblk)
@ -119,7 +122,8 @@ MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk)
memcpy(&wblk[count],wenviron_strings,len * sizeof(MSVCRT_wchar_t));
for (wptr = (MSVCRT_wchar_t*)&wblk[count]; *wptr; wptr += strlenW(wptr) + 1)
{
wblk[i++] = wptr;
/* Skip special environment strings set by the command shell */
if (*wptr != '=') wblk[i++] = wptr;
}
}
wblk[i] = NULL;