Module: wine Branch: master Commit: 1880a786d131126220f9784d033eb57a268ebf7e URL: http://source.winehq.org/git/wine.git/?a=commit;h=1880a786d131126220f9784d03...
Author: Nikolay Sivov bunglehead@gmail.com Date: Fri Jun 5 13:56:54 2009 +0400
ntdll: Make NtCreateFile and NtOpenFile thin wrappers over an 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 * */