[SHELL32] In _SHGetUserShellFolderPath(), check the return value of _SHExpandEnvironm...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 22 Sep 2018 21:37:43 +0000 (23:37 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 22 Sep 2018 22:16:06 +0000 (00:16 +0200)
and bail out if it failed. That way we won't use and cache in the registry an invalid-expanded string.

CORE-14981

dll/win32/shell32/wine/shellpath.c

index 6396641..96e47b2 100644 (file)
@@ -1480,7 +1480,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, HANDLE hToken, LPCWSTR us
 #ifndef __REACTOS__
             _SHExpandEnvironmentStrings(path, szTemp);
 #else
-            _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
+            hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
+            if (FAILED(hr))
+                goto end;
 #endif
             lstrcpynW(path, szTemp, MAX_PATH);
         }
@@ -1493,6 +1495,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, HANDLE hToken, LPCWSTR us
     }
     else
         hr = E_FAIL;
+#ifdef __REACTOS__
+end:
+#endif
     RegCloseKey(shellFolderKey);
     RegCloseKey(userShellFolderKey);
     TRACE("returning 0x%08x\n", hr);