Alexandre Julliard : kernelbase: Verify that the file can be opened when looking for an executable.
Module: wine Branch: master Commit: b82842461215f25c6d0819104cd06ab5cc7bf28a URL: https://source.winehq.org/git/wine.git/?a=commit;h=b82842461215f25c6d0819104... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 4 10:07:03 2019 +0100 kernelbase: Verify that the file can be opened when looking for an executable. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48211 Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/process.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 51b75470c8..90ea299416 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; }
participants (1)
-
Alexandre Julliard