mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:12:57 +00:00
Sync GetTempPathW with current Wine. This should help with some
installers the depend on the USERPROFILE variable being present. Does not fix the Word 2003 viewer install but changes the behavior slightly and is more correct. svn path=/trunk/; revision=33650
This commit is contained in:
parent
09a85aaedd
commit
5c30086951
1 changed files with 16 additions and 13 deletions
|
@ -166,15 +166,18 @@ GetTempPathW (
|
||||||
LPWSTR path
|
LPWSTR path
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
static const WCHAR tmp[] = { 'T', 'M', 'P', 0 };
|
||||||
|
static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 };
|
||||||
|
static const WCHAR userprofile[] = { 'U','S','E','R','P','R','O','F','I','L','E',0 };
|
||||||
WCHAR tmp_path[MAX_PATH];
|
WCHAR tmp_path[MAX_PATH];
|
||||||
WCHAR tmp_full_path[MAX_PATH];
|
|
||||||
UINT ret;
|
UINT ret;
|
||||||
|
|
||||||
TRACE("GetTempPathW(%lu,%p)\n", count, path);
|
TRACE("%u,%p\n", count, path);
|
||||||
|
|
||||||
if (!(ret = GetEnvironmentVariableW( L"TMP", tmp_path, MAX_PATH )))
|
if (!(ret = GetEnvironmentVariableW( tmp, tmp_path, MAX_PATH )) &&
|
||||||
if (!(ret = GetEnvironmentVariableW( L"TEMP", tmp_path, MAX_PATH )))
|
!(ret = GetEnvironmentVariableW( temp, tmp_path, MAX_PATH )) &&
|
||||||
if (!(ret = GetCurrentDirectoryW( MAX_PATH, tmp_path )))
|
!(ret = GetEnvironmentVariableW( userprofile, tmp_path, MAX_PATH )) &&
|
||||||
|
!(ret = GetWindowsDirectoryW( tmp_path, MAX_PATH )))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (ret > MAX_PATH)
|
if (ret > MAX_PATH)
|
||||||
|
@ -183,7 +186,7 @@ GetTempPathW (
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = GetFullPathNameW(tmp_path, MAX_PATH, tmp_full_path, NULL);
|
ret = GetFullPathNameW(tmp_path, MAX_PATH, tmp_path, NULL);
|
||||||
if (!ret) return 0;
|
if (!ret) return 0;
|
||||||
|
|
||||||
if (ret > MAX_PATH - 2)
|
if (ret > MAX_PATH - 2)
|
||||||
|
@ -192,17 +195,17 @@ GetTempPathW (
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_full_path[ret-1] != '\\')
|
if (tmp_path[ret-1] != '\\')
|
||||||
{
|
{
|
||||||
tmp_full_path[ret++] = '\\';
|
tmp_path[ret++] = '\\';
|
||||||
tmp_full_path[ret] = '\0';
|
tmp_path[ret] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
ret++; /* add space for terminating 0 */
|
ret++; /* add space for terminating 0 */
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
lstrcpynW(path, tmp_full_path, count);
|
lstrcpynW(path, tmp_path, count);
|
||||||
if (count >= ret)
|
if (count >= ret)
|
||||||
ret--; /* return length without 0 */
|
ret--; /* return length without 0 */
|
||||||
else if (count < 4)
|
else if (count < 4)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue