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@winehq.org>
This commit is contained in:
parent
7b1b0ce506
commit
b828424612
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue