Commit 82947221 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32: Pass SYNCHRONIZE flag to NtOpenFile.

parent b4eab714
...@@ -2038,7 +2038,7 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level, ...@@ -2038,7 +2038,7 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &info->handle, GENERIC_READ, &attr, &io, status = NtOpenFile( &info->handle, GENERIC_READ | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
...@@ -2440,7 +2440,7 @@ BOOL WINAPI SetFileAttributesW( LPCWSTR name, DWORD attributes ) ...@@ -2440,7 +2440,7 @@ BOOL WINAPI SetFileAttributesW( LPCWSTR name, DWORD attributes )
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &handle, 0, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT ); status = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT );
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
...@@ -2572,7 +2572,7 @@ DWORD WINAPI GetCompressedFileSizeW( ...@@ -2572,7 +2572,7 @@ DWORD WINAPI GetCompressedFileSizeW(
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &handle, 0, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT ); status = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT );
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
......
...@@ -1280,7 +1280,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest, ...@@ -1280,7 +1280,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &source_handle, 0, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT ); status = NtOpenFile( &source_handle, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
status = wine_nt_to_unix_file_name( &nt_name, &source_unix, FILE_OPEN, FALSE ); status = wine_nt_to_unix_file_name( &nt_name, &source_unix, FILE_OPEN, FALSE );
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
...@@ -1304,7 +1304,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest, ...@@ -1304,7 +1304,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
SetLastError( ERROR_PATH_NOT_FOUND ); SetLastError( ERROR_PATH_NOT_FOUND );
goto error; goto error;
} }
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE, &attr, &io, 0, status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS) /* destination exists */ if (status == STATUS_SUCCESS) /* destination exists */
{ {
...@@ -1643,7 +1643,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) ...@@ -1643,7 +1643,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtOpenFile( &handle, DELETE, &attr, &io, status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
......
...@@ -1547,7 +1547,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut) ...@@ -1547,7 +1547,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
pipe_dev_name.Length = sizeof(leadin); pipe_dev_name.Length = sizeof(leadin);
pipe_dev_name.MaximumLength = sizeof(leadin); pipe_dev_name.MaximumLength = sizeof(leadin);
InitializeObjectAttributes(&attr,&pipe_dev_name, OBJ_CASE_INSENSITIVE, NULL, NULL); InitializeObjectAttributes(&attr,&pipe_dev_name, OBJ_CASE_INSENSITIVE, NULL, NULL);
status = NtOpenFile( &pipe_dev, FILE_READ_ATTRIBUTES, &attr, status = NtOpenFile( &pipe_dev, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr,
&iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SYNCHRONOUS_IO_NONALERT); FILE_SYNCHRONOUS_IO_NONALERT);
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS)
......
...@@ -171,7 +171,7 @@ static BOOL open_device_root( LPCWSTR root, HANDLE *handle ) ...@@ -171,7 +171,7 @@ static BOOL open_device_root( LPCWSTR root, HANDLE *handle )
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( &nt_name ); RtlFreeUnicodeString( &nt_name );
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
...@@ -235,7 +235,7 @@ static void get_filesystem_label( const UNICODE_STRING *device, WCHAR *label, DW ...@@ -235,7 +235,7 @@ static void get_filesystem_label( const UNICODE_STRING *device, WCHAR *label, DW
memcpy( name.Buffer, device->Buffer, device->Length ); memcpy( name.Buffer, device->Buffer, device->Length );
memcpy( name.Buffer + device->Length / sizeof(WCHAR), labelW, sizeof(labelW) ); memcpy( name.Buffer + device->Length / sizeof(WCHAR), labelW, sizeof(labelW) );
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_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT )) FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ))
{ {
char buffer[256], *p; char buffer[256], *p;
...@@ -275,7 +275,7 @@ static DWORD get_filesystem_serial( const UNICODE_STRING *device ) ...@@ -275,7 +275,7 @@ static DWORD get_filesystem_serial( const UNICODE_STRING *device )
memcpy( name.Buffer, device->Buffer, device->Length ); memcpy( name.Buffer, device->Buffer, device->Length );
memcpy( name.Buffer + device->Length / sizeof(WCHAR), serialW, sizeof(serialW) ); memcpy( name.Buffer + device->Length / sizeof(WCHAR), serialW, sizeof(serialW) );
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_SYNCHRONOUS_IO_NONALERT )) FILE_SYNCHRONOUS_IO_NONALERT ))
{ {
char buffer[32]; char buffer[32];
...@@ -765,7 +765,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len, ...@@ -765,7 +765,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
nt_name.Length -= sizeof(WCHAR); /* without trailing slash */ nt_name.Length -= sizeof(WCHAR); /* without trailing slash */
status = NtOpenFile( &handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, status = NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
nt_name.Length += sizeof(WCHAR); nt_name.Length += sizeof(WCHAR);
...@@ -811,7 +811,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len, ...@@ -811,7 +811,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
/* we couldn't open the device, fallback to default strategy */ /* we couldn't open the device, fallback to default strategy */
status = NtOpenFile( &handle, 0, &attr, &io, 0, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); status = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io, 0, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
{ {
SetLastError( RtlNtStatusToDosError(status) ); SetLastError( RtlNtStatusToDosError(status) );
......
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