Use FILE_SHARE_DELETE when loading modules, as running an exe that's
going to be deleted should work.
This commit is contained in:
parent
8087fca344
commit
d80eb97b29
@ -195,7 +195,7 @@ static HANDLE open_exe_file( const WCHAR *name )
|
|||||||
|
|
||||||
TRACE("looking for %s\n", debugstr_w(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)
|
NULL, OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
/* file doesn't exist, check for builtin */
|
/* 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 ))
|
if (SearchPathW( NULL, name, NULL, buflen, buffer, NULL ))
|
||||||
{
|
{
|
||||||
TRACE( "Trying native/Unix binary %s\n", debugstr_w(buffer) );
|
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)
|
NULL, OPEN_EXISTING, 0, 0 )) != INVALID_HANDLE_VALUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE
|
|||||||
{
|
{
|
||||||
case LOADORDER_DLL:
|
case LOADORDER_DLL:
|
||||||
TRACE( "Trying native exe %s\n", debugstr_w(buffer) );
|
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)
|
NULL, OPEN_EXISTING, 0, 0 )) != INVALID_HANDLE_VALUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (GetLastError() != ERROR_FILE_NOT_FOUND) return TRUE;
|
if (GetLastError() != ERROR_FILE_NOT_FOUND) return TRUE;
|
||||||
|
@ -1398,7 +1398,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
|||||||
attr.ObjectName = &nt_name;
|
attr.ObjectName = &nt_name;
|
||||||
attr.SecurityDescriptor = NULL;
|
attr.SecurityDescriptor = NULL;
|
||||||
attr.SecurityQualityOfService = 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 );
|
RtlFreeUnicodeString( &nt_name );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1445,7 +1445,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
|||||||
attr.ObjectName = &nt_name;
|
attr.ObjectName = &nt_name;
|
||||||
attr.SecurityDescriptor = NULL;
|
attr.SecurityDescriptor = NULL;
|
||||||
attr.SecurityQualityOfService = 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 );
|
RtlFreeUnicodeString( &nt_name );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user