diff --git a/dll/win32/kernel32/client/path.c b/dll/win32/kernel32/client/path.c index 1fa09d530c8..ea014bb512d 100644 --- a/dll/win32/kernel32/client/path.c +++ b/dll/win32/kernel32/client/path.c @@ -2321,7 +2321,7 @@ GetSystemDirectoryW(OUT LPWSTR lpBuffer, RtlCopyMemory(lpBuffer, BaseWindowsSystemDirectory.Buffer, BaseWindowsSystemDirectory.Length); - lpBuffer[BaseWindowsSystemDirectory.Length / sizeof(WCHAR)] = ANSI_NULL; + lpBuffer[BaseWindowsSystemDirectory.Length / sizeof(WCHAR)] = UNICODE_NULL; ReturnLength = BaseWindowsSystemDirectory.Length; } @@ -2405,7 +2405,7 @@ GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, RtlCopyMemory(lpBuffer, BaseWindowsDirectory.Buffer, BaseWindowsDirectory.Length); - lpBuffer[BaseWindowsDirectory.Length / sizeof(WCHAR)] = ANSI_NULL; + lpBuffer[BaseWindowsDirectory.Length / sizeof(WCHAR)] = UNICODE_NULL; ReturnLength = BaseWindowsDirectory.Length; } diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp index 746c92076bb..292c8db8292 100644 --- a/dll/win32/shell32/shlexec.cpp +++ b/dll/win32/shell32/shlexec.cpp @@ -2531,6 +2531,8 @@ HRESULT WINAPI ShellExecCmdLine( } else { + PCWSTR apPathList[2]; + pchParams = SplitParams(lpCommand, szFile, _countof(szFile)); if (szFile[0] != UNICODE_NULL && szFile[1] == L':' && szFile[2] == UNICODE_NULL) @@ -2551,30 +2553,10 @@ HRESULT WINAPI ShellExecCmdLine( { StringCchCopyW(szFile, _countof(szFile), szFile2); } - else if (SearchPathW(NULL, szFile, NULL, _countof(szFile2), szFile2, NULL) || - SearchPathW(NULL, szFile, L".exe", _countof(szFile2), szFile2, NULL) || - SearchPathW(NULL, szFile, L".com", _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, szFile, NULL, _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, szFile, L".exe", _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, szFile, L".com", _countof(szFile2), szFile2, NULL)) - { - StringCchCopyW(szFile, _countof(szFile), szFile2); - } - else if (SearchPathW(NULL, lpCommand, NULL, _countof(szFile2), szFile2, NULL) || - SearchPathW(NULL, lpCommand, L".exe", _countof(szFile2), szFile2, NULL) || - SearchPathW(NULL, lpCommand, L".com", _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, lpCommand, NULL, _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, lpCommand, L".exe", _countof(szFile2), szFile2, NULL) || - SearchPathW(pwszStartDir, lpCommand, L".com", _countof(szFile2), szFile2, NULL)) - { - StringCchCopyW(szFile, _countof(szFile), szFile2); - pchParams = NULL; - } - if (pwszStartDir) - { - SetCurrentDirectoryW(szCurDir); - } + apPathList[0] = pwszStartDir; + apPathList[1] = NULL; + PathFindOnPathExW(szFile, apPathList, WHICH_DEFAULT); if (!(dwSeclFlags & SECL_ALLOW_NONEXE)) { diff --git a/dll/win32/shlwapi/path.c b/dll/win32/shlwapi/path.c index fc698251cf2..2966a8bf93b 100644 --- a/dll/win32/shlwapi/path.c +++ b/dll/win32/shlwapi/path.c @@ -1151,6 +1151,7 @@ BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath,DWORD dwWhich) #ifdef __REACTOS__ if (dwWhich & 0x1) { + if (GetFileAttributes(lpszPath) != FILE_ATTRIBUTE_DIRECTORY) #endif lstrcpyW(lpszPath + iLen, pszExts[iChoose]); if (PathFileExistsW(lpszPath))