diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 51b75470c8f..90ea2994163 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -57,6 +57,13 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, DWORD buflen ) ret = (SearchPathW( load_path, name, L".exe", buflen, buffer, NULL ) || /* not found, try without extension in case it is a Unix app */ SearchPathW( load_path, name, NULL, buflen, buffer, NULL )); + + if (ret) /* make sure it can be opened, SearchPathW also returns directories */ + { + HANDLE handle = CreateFileW( buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, 0, 0 ); + if ((ret = (handle != INVALID_HANDLE_VALUE))) CloseHandle( handle ); + } RtlReleasePath( load_path ); return ret; }