mirror of
https://github.com/reactos/reactos.git
synced 2025-06-07 10:20:26 +00:00
[SHELL32] In _SHGetUserShellFolderPath(), check the return value of _SHExpandEnvironmentStrings()
and bail out if it failed. That way we won't use and cache in the registry an invalid-expanded string. CORE-14981
This commit is contained in:
parent
41a5b11fcd
commit
e29609147b
1 changed files with 6 additions and 1 deletions
|
@ -1480,7 +1480,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, HANDLE hToken, LPCWSTR us
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
_SHExpandEnvironmentStrings(path, szTemp);
|
_SHExpandEnvironmentStrings(path, szTemp);
|
||||||
#else
|
#else
|
||||||
_SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
|
hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
|
||||||
|
if (FAILED(hr))
|
||||||
|
goto end;
|
||||||
#endif
|
#endif
|
||||||
lstrcpynW(path, szTemp, MAX_PATH);
|
lstrcpynW(path, szTemp, MAX_PATH);
|
||||||
}
|
}
|
||||||
|
@ -1493,6 +1495,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, HANDLE hToken, LPCWSTR us
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
end:
|
||||||
|
#endif
|
||||||
RegCloseKey(shellFolderKey);
|
RegCloseKey(shellFolderKey);
|
||||||
RegCloseKey(userShellFolderKey);
|
RegCloseKey(userShellFolderKey);
|
||||||
TRACE("returning 0x%08x\n", hr);
|
TRACE("returning 0x%08x\n", hr);
|
||||||
|
|
Loading…
Reference in a new issue