Bugfix: Check return value of SHGetSpecialFolderPath in MyGetSpecialFolderPath

Upstream commit: 21ae37d (partial)
This commit is contained in:
Luke Dashjr
2012-03-03 13:44:42 -05:00
parent e9865a41d6
commit 4fc8c042a2

View File

@@ -643,13 +643,17 @@ string MyGetSpecialFolderPath(int nFolder, bool fCreate)
{
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
bool fSuccess = false;
if (pSHGetSpecialFolderPath)
fSuccess =
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
FreeModule(hShell32);
if (fSuccess)
return pszPath;
}
// Backup option
if (pszPath[0] == '\0')
pszPath[0] = '\0';
{
if (nFolder == CSIDL_STARTUP)
{