diff --git a/reactos/dll/win32/shell32/shellpath.c b/reactos/dll/win32/shell32/shellpath.c index dd2d66850f5..31a465068b2 100644 --- a/reactos/dll/win32/shell32/shellpath.c +++ b/reactos/dll/win32/shell32/shellpath.c @@ -1548,12 +1548,12 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) hr = HRESULT_FROM_WIN32(GetLastError()); else hr = S_OK; - if (SUCCEEDED(hr) && szDest[0] == '%') - strcpyW(szTemp, szDest); - else + /* By default, terminate loop */ + szTemp[0] = '\0'; + if (SUCCEEDED(hr) && strcmpW(szSrc, szDest) != 0) { - /* terminate loop */ - szTemp[0] = '\0'; + /* Continue the loop */ + strcpyW(szTemp, szDest); } } end: