[1/2] ntdll/file: Make NtCreateFile and NtOpenFile thin wrappers over internal function (try2)
Nikolay Sivov
bunglehead at gmail.com
Fri Jun 5 05:05:57 CDT 2009
Calling NtCreateFile in response of NtOpenFile cause problems sometimes as
described here http://bugs.winehq.org/show_bug.cgi?id=11030#c9
Changelog:
- try2: remove Nt for internal function
- Make NtCreateFile and NtOpenFile thin wrappers over internal function
>From 1e9a0f95ba932ffbae3ff0da2a151c80e81718b3 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 5 Jun 2009 13:56:54 +0400
Subject: Make NtCreateFile and NtOpenFile thin wrappers over internal function
---
dlls/ntdll/file.c | 116 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 66 insertions(+), 50 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index ecba665..2a8f5fd 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -90,60 +90,17 @@ mode_t FILE_umask = 0;
#define SECSPERDAY 86400
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
-/**************************************************************************
- * NtOpenFile [NTDLL.@]
- * ZwOpenFile [NTDLL.@]
- *
- * Open a file.
- *
- * PARAMS
- * handle [O] Variable that receives the file handle on return
- * access [I] Access desired by the caller to the file
- * attr [I] Structure describing the file to be opened
- * io [O] Receives details about the result of the operation
- * sharing [I] Type of shared access the caller requires
- * options [I] Options for the file open
- *
- * RETURNS
- * Success: 0. FileHandle and IoStatusBlock are updated.
- * Failure: An NTSTATUS error code describing the error.
- */
-NTSTATUS WINAPI NtOpenFile( PHANDLE handle, ACCESS_MASK access,
- POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK io,
- ULONG sharing, ULONG options )
-{
- return NtCreateFile( handle, access, attr, io, NULL, 0,
- sharing, FILE_OPEN, options, NULL, 0 );
-}
/**************************************************************************
- * NtCreateFile [NTDLL.@]
- * ZwCreateFile [NTDLL.@]
- *
- * Either create a new file or directory, or open an existing file, device,
- * directory or volume.
- *
- * PARAMS
- * handle [O] Points to a variable which receives the file handle on return
- * access [I] Desired access to the file
- * attr [I] Structure describing the file
- * io [O] Receives information about the operation on return
- * alloc_size [I] Initial size of the file in bytes
- * attributes [I] Attributes to create the file with
- * sharing [I] Type of shared access the caller would like to the file
- * disposition [I] Specifies what to do, depending on whether the file already exists
- * options [I] Options for creating a new file
- * ea_buffer [I] Pointer to an extended attributes buffer
- * ea_length [I] Length of ea_buffer
+ * FILE_CreateFile (internal)
+ * Open a file.
*
- * RETURNS
- * Success: 0. handle and io are updated.
- * Failure: An NTSTATUS error code describing the error.
+ * Parameter set fully identical with NtCreateFile
*/
-NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIBUTES attr,
- PIO_STATUS_BLOCK io, PLARGE_INTEGER alloc_size,
- ULONG attributes, ULONG sharing, ULONG disposition,
- ULONG options, PVOID ea_buffer, ULONG ea_length )
+static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIBUTES attr,
+ PIO_STATUS_BLOCK io, PLARGE_INTEGER alloc_size,
+ ULONG attributes, ULONG sharing, ULONG disposition,
+ ULONG options, PVOID ea_buffer, ULONG ea_length )
{
ANSI_STRING unix_name;
int created = FALSE;
@@ -248,6 +205,65 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
return io->u.Status;
}
+/**************************************************************************
+ * NtOpenFile [NTDLL.@]
+ * ZwOpenFile [NTDLL.@]
+ *
+ * Open a file.
+ *
+ * PARAMS
+ * handle [O] Variable that receives the file handle on return
+ * access [I] Access desired by the caller to the file
+ * attr [I] Structure describing the file to be opened
+ * io [O] Receives details about the result of the operation
+ * sharing [I] Type of shared access the caller requires
+ * options [I] Options for the file open
+ *
+ * RETURNS
+ * Success: 0. FileHandle and IoStatusBlock are updated.
+ * Failure: An NTSTATUS error code describing the error.
+ */
+NTSTATUS WINAPI NtOpenFile( PHANDLE handle, ACCESS_MASK access,
+ POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK io,
+ ULONG sharing, ULONG options )
+{
+ return FILE_CreateFile( handle, access, attr, io, NULL, 0,
+ sharing, FILE_OPEN, options, NULL, 0 );
+}
+
+/**************************************************************************
+ * NtCreateFile [NTDLL.@]
+ * ZwCreateFile [NTDLL.@]
+ *
+ * Either create a new file or directory, or open an existing file, device,
+ * directory or volume.
+ *
+ * PARAMS
+ * handle [O] Points to a variable which receives the file handle on return
+ * access [I] Desired access to the file
+ * attr [I] Structure describing the file
+ * io [O] Receives information about the operation on return
+ * alloc_size [I] Initial size of the file in bytes
+ * attributes [I] Attributes to create the file with
+ * sharing [I] Type of shared access the caller would like to the file
+ * disposition [I] Specifies what to do, depending on whether the file already exists
+ * options [I] Options for creating a new file
+ * ea_buffer [I] Pointer to an extended attributes buffer
+ * ea_length [I] Length of ea_buffer
+ *
+ * RETURNS
+ * Success: 0. handle and io are updated.
+ * Failure: An NTSTATUS error code describing the error.
+ */
+NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIBUTES attr,
+ PIO_STATUS_BLOCK io, PLARGE_INTEGER alloc_size,
+ ULONG attributes, ULONG sharing, ULONG disposition,
+ ULONG options, PVOID ea_buffer, ULONG ea_length )
+{
+ return FILE_CreateFile( handle, access, attr, io, alloc_size, attributes,
+ sharing, disposition, options, ea_buffer, ea_length );
+}
+
/***********************************************************************
* Asynchronous file I/O *
*/
--
1.5.6.5
More information about the wine-patches
mailing list