Commit b8284246 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Verify that the file can be opened when looking for an executable.

parent 7b1b0ce5
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment