mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:42:57 +00:00
[SHELL32] In _SHExpandEnvironmentStrings(), fall back to SHExpandEnvironmentStringsForUserW() if the simplified code paths failed.
This allows the code to give a last chance for expanding the string.
And if it still fails, we bail out as expected and the caller will
take appropriate actions.
As a by-product, this commit (together with the previous one e2960914
)
fixes the regression CORE-14981 (Quick-Launch bar couldn't be opened
in LiveCD).
This commit is contained in:
parent
e29609147b
commit
7ee298bbfc
1 changed files with 7 additions and 4 deletions
|
@ -1986,7 +1986,7 @@ static HRESULT _SHExpandEnvironmentStrings(HANDLE hToken, LPCWSTR szSrc, LPWSTR
|
||||||
#else
|
#else
|
||||||
DWORD cchSize = cchDest;
|
DWORD cchSize = cchDest;
|
||||||
if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
|
if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
goto fallback_expand;
|
||||||
#endif
|
#endif
|
||||||
PathAppendW(szDest, szTemp + strlenW(AllUsersProfileW));
|
PathAppendW(szDest, szTemp + strlenW(AllUsersProfileW));
|
||||||
}
|
}
|
||||||
|
@ -2015,7 +2015,7 @@ static HRESULT _SHExpandEnvironmentStrings(HANDLE hToken, LPCWSTR szSrc, LPWSTR
|
||||||
#else
|
#else
|
||||||
DWORD cchSize = cchDest;
|
DWORD cchSize = cchDest;
|
||||||
if (!_SHGetUserProfileDirectoryW(hToken, szDest, &cchSize))
|
if (!_SHGetUserProfileDirectoryW(hToken, szDest, &cchSize))
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
goto fallback_expand;
|
||||||
#endif
|
#endif
|
||||||
PathAppendW(szDest, szTemp + strlenW(UserProfileW));
|
PathAppendW(szDest, szTemp + strlenW(UserProfileW));
|
||||||
}
|
}
|
||||||
|
@ -2025,16 +2025,19 @@ static HRESULT _SHExpandEnvironmentStrings(HANDLE hToken, LPCWSTR szSrc, LPWSTR
|
||||||
GetSystemDirectoryW(szDest, MAX_PATH);
|
GetSystemDirectoryW(szDest, MAX_PATH);
|
||||||
#else
|
#else
|
||||||
if (!GetSystemDirectoryW(szDest, cchDest))
|
if (!GetSystemDirectoryW(szDest, cchDest))
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
goto fallback_expand;
|
||||||
#endif
|
#endif
|
||||||
strcpyW(szDest + 3, szTemp + strlenW(SystemDriveW) + 1);
|
strcpyW(szDest + 3, szTemp + strlenW(SystemDriveW) + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
fallback_expand:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
|
DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
|
||||||
#else
|
#else
|
||||||
DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szSrc, szDest, cchDest);
|
DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szTemp, szDest, cchDest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue