Author: hbelusca
Date: Fri Jul 19 15:05:28 2013
New Revision: 59514
URL:
http://svn.reactos.org/svn/reactos?rev=59514&view=rev
Log:
Add the SYNCHRONIZE flag to the DesiredAccess parameter when using the flags
FILE_SYNCHRONOUS_IO_(NON)ALERT in NtCreateFile or NtOpenFile, even if one uses
DesiredAccess == GENERIC_xxx (which should map to some FILE_GENERIC_xxx already containing
the SYNCHRONIZE flag).
Indeed, it appears after extended testing that, when calling from user-mode, Windows
checks the real presence of the SYNCHRONIZE flag when using FILE_SYNCHRONOUS_IO_(NON)ALERT
even if we pass any of the GENERIC_xxx access flags...
Otherwise, when using FILE_GENERIC_(READ/WRITE) flags directly, there is no need to add
the SYNCHRONIZE flag since it is already incorporated in it.
See CORE-7361 for more details.
Modified:
trunk/reactos/dll/win32/kernel32/client/file/create.c
trunk/reactos/dll/win32/kernel32/client/file/npipe.c
trunk/reactos/dll/win32/kernel32/client/file/volume.c
trunk/reactos/dll/win32/ntmarta/ntmarta.c
trunk/reactos/lib/rtl/actctx.c
trunk/reactos/ntoskrnl/io/iomgr/bootlog.c
trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
Modified: trunk/reactos/dll/win32/kernel32/client/file/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/create.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/create.c [iso-8859-1] Fri Jul 19 15:05:28
2013
@@ -535,11 +535,11 @@
ObjectAttributes.SecurityQualityOfService = NULL;
errCode = NtOpenFile (&FileHandle,
- GENERIC_READ|SYNCHRONIZE,
+ GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ,
- FILE_NON_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT);
+ FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameString.Buffer);
Modified: trunk/reactos/dll/win32/kernel32/client/file/npipe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/npipe.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/npipe.c [iso-8859-1] Fri Jul 19 15:05:28
2013
@@ -105,7 +105,7 @@
/* Now try opening it for write access */
Status = NtOpenFile(&WritePipeHandle,
- FILE_GENERIC_WRITE | SYNCHRONIZE,
+ FILE_GENERIC_WRITE,
&ObjectAttributes,
&StatusBlock,
FILE_SHARE_READ,
Modified: trunk/reactos/dll/win32/kernel32/client/file/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/volume.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/volume.c [iso-8859-1] Fri Jul 19 15:05:28
2013
@@ -967,7 +967,7 @@
RtlInitUnicodeString(&NtFileName, L"\\??\\MountPointManager");
InitializeObjectAttributes(&ObjectAttributes, &NtFileName, 0, NULL, NULL);
- Status = NtOpenFile(&FileHandle, FILE_GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,
+ Status = NtOpenFile(&FileHandle, FILE_GENERIC_READ, &ObjectAttributes,
&Iosb, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/dll/win32/ntmarta/ntmarta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ntmarta/ntmarta.…
==============================================================================
--- trunk/reactos/dll/win32/ntmarta/ntmarta.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ntmarta/ntmarta.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -887,7 +887,7 @@
NULL);
Status = NtOpenFile(Handle,
- DesiredAccess,
+ DesiredAccess /* | SYNCHRONIZE */,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
Modified: trunk/reactos/lib/rtl/actctx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=59514…
==============================================================================
--- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -1618,7 +1618,11 @@
attr.ObjectName = name;
attr.SecurityDescriptor = 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, USHORT
extra_len )
@@ -1952,8 +1956,11 @@
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- if (!NtOpenFile( &handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ |
FILE_SHARE_WRITE,
- FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ))
+ if (!NtOpenFile(&handle,
+ GENERIC_READ | SYNCHRONIZE,
+ &attr, &io,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT))
{
sxs_ai = *ai;
file = lookup_manifest_file( handle, &sxs_ai );
Modified: trunk/reactos/ntoskrnl/io/iomgr/bootlog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/bootlog.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/bootlog.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/bootlog.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -168,7 +168,7 @@
NULL);
Status = ZwCreateFile(&FileHandle,
- FILE_APPEND_DATA,
+ FILE_APPEND_DATA | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
NULL,
Modified: trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/ramdisk.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -161,7 +161,7 @@
// Open a handle to the driver
//
Status = ZwOpenFile(&DriverHandle,
- GENERIC_ALL,
+ GENERIC_ALL | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ | FILE_SHARE_WRITE,
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -3578,7 +3578,8 @@
InitializeObjectAttributes(&ObjectAttributes, &FileName, 0, NULL, NULL);
/* Open the file */
- Status = ZwOpenFile(&hFile, FILE_READ_DATA, &ObjectAttributes, &Iosb, 0,
+ Status = ZwOpenFile(&hFile, FILE_READ_DATA | SYNCHRONIZE,
+ &ObjectAttributes, &Iosb, 0,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT |
FILE_NO_INTERMEDIATE_BUFFERING);
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_symbols.…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1] Fri Jul 19 15:05:28 2013
@@ -391,10 +391,10 @@
DPRINT("Attempting to open image: %wZ\n", FileName);
Status = ZwOpenFile(&FileHandle,
- FILE_READ_ACCESS,
+ FILE_READ_ACCESS | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status))
{