Commit 443c2a47 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Pass SYNCHRONIZE flag in NtOpenFile and NtCreateFile calls.

This is needed by Office 2013, which hooks those functions and expects flag to be set. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b548f8c4
...@@ -2449,7 +2449,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name ) ...@@ -2449,7 +2449,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name )
attr.ObjectName = name; attr.ObjectName = name;
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
return NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT ); return NtOpenFile( handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
} }
static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, unsigned int extra_len ) static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, unsigned int extra_len )
...@@ -2790,7 +2790,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit ...@@ -2790,7 +2790,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
if (!NtOpenFile( &handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, if (!NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT )) FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ))
{ {
sxs_ai = *ai; sxs_ai = *ai;
......
...@@ -3345,7 +3345,7 @@ NTSTATUS DIR_get_unix_cwd( char **cwd ) ...@@ -3345,7 +3345,7 @@ NTSTATUS DIR_get_unix_cwd( char **cwd )
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &handle, 0, &attr, &io, 0, status = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io, 0,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
RtlFreeUnicodeString( &dirW ); RtlFreeUnicodeString( &dirW );
if (status != STATUS_SUCCESS) goto done; if (status != STATUS_SUCCESS) goto done;
......
...@@ -2149,7 +2149,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, ...@@ -2149,7 +2149,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|FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE )) *handle = 0; if (NtOpenFile( handle, GENERIC_READ|SYNCHRONIZE, &attr, &io, FILE_SHARE_READ|FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE )) *handle = 0;
goto found; goto found;
} }
...@@ -2184,7 +2184,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, ...@@ -2184,7 +2184,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|FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE )) *handle = 0; if (NtOpenFile( handle, GENERIC_READ|SYNCHRONIZE, &attr, &io, FILE_SHARE_READ|FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE )) *handle = 0;
} }
found: found:
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
......
...@@ -984,7 +984,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) ...@@ -984,7 +984,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
nts = NtOpenFile( &handle, 0, &attr, &io, 0, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); nts = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io, 0, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (nts != STATUS_SUCCESS) goto out; if (nts != STATUS_SUCCESS) goto out;
/* don't keep the directory handle open on removable media */ /* don't keep the directory handle open on removable media */
......
...@@ -659,7 +659,7 @@ NTSTATUS WINAPI NtLoadKey( const OBJECT_ATTRIBUTES *attr, OBJECT_ATTRIBUTES *fil ...@@ -659,7 +659,7 @@ NTSTATUS WINAPI NtLoadKey( const OBJECT_ATTRIBUTES *attr, OBJECT_ATTRIBUTES *fil
TRACE("(%p,%p)\n", attr, file); TRACE("(%p,%p)\n", attr, file);
ret = NtCreateFile(&hive, GENERIC_READ, file, &io, NULL, FILE_ATTRIBUTE_NORMAL, 0, ret = NtCreateFile(&hive, GENERIC_READ | SYNCHRONIZE, file, &io, NULL, FILE_ATTRIBUTE_NORMAL, 0,
FILE_OPEN, 0, NULL, 0); FILE_OPEN, 0, NULL, 0);
if (ret) return ret; if (ret) 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