Use FILE_SHARE_DELETE when loading modules, as running an exe that's

going to be deleted should work.
This commit is contained in:
Mike McCormack 2004-09-15 18:02:49 +00:00 committed by Alexandre Julliard
parent 8087fca344
commit d80eb97b29
2 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ static HANDLE open_exe_file( const WCHAR *name )
TRACE("looking for %s\n", debugstr_w(name) );
if ((handle = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ,
if ((handle = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
{
/* file doesn't exist, check for builtin */
@ -260,7 +260,7 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE
if (SearchPathW( NULL, name, NULL, buflen, buffer, NULL ))
{
TRACE( "Trying native/Unix binary %s\n", debugstr_w(buffer) );
if ((*handle = CreateFileW( buffer, GENERIC_READ, FILE_SHARE_READ,
if ((*handle = CreateFileW( buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, 0 )) != INVALID_HANDLE_VALUE)
return TRUE;
}
@ -276,7 +276,7 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE
{
case LOADORDER_DLL:
TRACE( "Trying native exe %s\n", debugstr_w(buffer) );
if ((*handle = CreateFileW( buffer, GENERIC_READ, FILE_SHARE_READ,
if ((*handle = CreateFileW( buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, 0 )) != INVALID_HANDLE_VALUE)
return TRUE;
if (GetLastError() != ERROR_FILE_NOT_FOUND) return TRUE;

View File

@ -1398,7 +1398,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
attr.ObjectName = &nt_name;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
if (NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ, 0 )) *handle = 0;
if (NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ|FILE_SHARE_DELETE, 0 )) *handle = 0;
RtlFreeUnicodeString( &nt_name );
return STATUS_SUCCESS;
}
@ -1445,7 +1445,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
attr.ObjectName = &nt_name;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
if (NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ, 0 )) *handle = 0;
if (NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ|FILE_SHARE_DELETE, 0 )) *handle = 0;
}
RtlFreeUnicodeString( &nt_name );
return STATUS_SUCCESS;