Set short path names for 'temp' and 'tmp' environment variables.

svn path=/trunk/; revision=9926
This commit is contained in:
Eric Kohl 2004-06-29 12:06:01 +00:00
parent 2a6745d9d4
commit b031cfa717

View file

@ -1,4 +1,4 @@
/* $Id: environment.c,v 1.4 2004/06/25 11:42:00 ekohl Exp $ /* $Id: environment.c,v 1.5 2004/06/29 12:06:01 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -21,6 +21,7 @@ SetUserEnvironmentVariable (LPVOID *Environment,
LPWSTR lpValue, LPWSTR lpValue,
BOOL bExpand) BOOL bExpand)
{ {
WCHAR ShortName[MAX_PATH];
UNICODE_STRING Name; UNICODE_STRING Name;
UNICODE_STRING SrcValue; UNICODE_STRING SrcValue;
UNICODE_STRING DstValue; UNICODE_STRING DstValue;
@ -61,6 +62,19 @@ SetUserEnvironmentVariable (LPVOID *Environment,
lpValue); lpValue);
} }
if (!_wcsicmp (lpName, L"temp") || !_wcsicmp (lpName, L"tmp"))
{
if (!GetShortPathNameW(DstValue.Buffer, ShortName, MAX_PATH))
{
DPRINT1("GetShortPathNameW() failed (Error %lu)\n", GetLastError());
return FALSE;
}
DPRINT("Buffer: %S\n", ShortName);
RtlInitUnicodeString(&DstValue,
ShortName);
}
RtlInitUnicodeString(&Name, RtlInitUnicodeString(&Name,
lpName); lpName);