Commit 28bf959c authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move the remaining file functions to the Unix library.

parent 7053b7c6
......@@ -16,7 +16,6 @@ C_SRCS = \
env.c \
error.c \
exception.c \
file.c \
handletable.c \
heap.c \
large_int.c \
......
/*
* Copyright 1999, 2000 Juergen Schmied
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "wine/debug.h"
#include "wine/server.h"
#include "ntdll_misc.h"
#include "winternl.h"
#include "winioctl.h"
#include "ddk/ntddk.h"
#include "ddk/ntddser.h"
#define WINE_MOUNTMGR_EXTENSIONS
#include "ddk/mountmgr.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
/******************************************************************
* NtQueryEaFile (NTDLL.@)
*
* Read extended attributes from NTFS files.
*
* PARAMS
* hFile [I] File handle, must be opened with FILE_READ_EA access
* iosb [O] Receives information about the operation on return
* buffer [O] Output buffer
* length [I] Length of output buffer
* single_entry [I] Only read and return one entry
* ea_list [I] Optional list with names of EAs to return
* ea_list_len [I] Length of ea_list in bytes
* ea_index [I] Optional pointer to 1-based index of attribute to return
* restart [I] restart EA scan
*
* RETURNS
* Success: 0. Attributes read into buffer
* Failure: An NTSTATUS error code describing the error.
*/
NTSTATUS WINAPI NtQueryEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer, ULONG length,
BOOLEAN single_entry, PVOID ea_list, ULONG ea_list_len,
PULONG ea_index, BOOLEAN restart )
{
FIXME("(%p,%p,%p,%d,%d,%p,%d,%p,%d) stub\n",
hFile, iosb, buffer, length, single_entry, ea_list,
ea_list_len, ea_index, restart);
return STATUS_ACCESS_DENIED;
}
/******************************************************************
* NtSetEaFile (NTDLL.@)
*
* Update extended attributes for NTFS files.
*
* PARAMS
* hFile [I] File handle, must be opened with FILE_READ_EA access
* iosb [O] Receives information about the operation on return
* buffer [I] Buffer with EA information
* length [I] Length of buffer
*
* RETURNS
* Success: 0. Attributes are updated
* Failure: An NTSTATUS error code describing the error.
*/
NTSTATUS WINAPI NtSetEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer, ULONG length )
{
FIXME("(%p,%p,%p,%d) stub\n", hFile, iosb, buffer, length);
return STATUS_ACCESS_DENIED;
}
/******************************************************************
* NtLockFile (NTDLL.@)
*
*
*/
NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event,
PIO_APC_ROUTINE apc, void* apc_user,
PIO_STATUS_BLOCK io_status, PLARGE_INTEGER offset,
PLARGE_INTEGER count, ULONG* key, BOOLEAN dont_wait,
BOOLEAN exclusive )
{
NTSTATUS ret;
HANDLE handle;
BOOLEAN async;
static BOOLEAN warn = TRUE;
if (apc || io_status || key)
{
FIXME("Unimplemented yet parameter\n");
return STATUS_NOT_IMPLEMENTED;
}
if (apc_user && warn)
{
FIXME("I/O completion on lock not implemented yet\n");
warn = FALSE;
}
for (;;)
{
SERVER_START_REQ( lock_file )
{
req->handle = wine_server_obj_handle( hFile );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
req->shared = !exclusive;
req->wait = !dont_wait;
ret = wine_server_call( req );
handle = wine_server_ptr_handle( reply->handle );
async = reply->overlapped;
}
SERVER_END_REQ;
if (ret != STATUS_PENDING)
{
if (!ret && lock_granted_event) NtSetEvent(lock_granted_event, NULL);
return ret;
}
if (async)
{
FIXME( "Async I/O lock wait not implemented, might deadlock\n" );
if (handle) NtClose( handle );
return STATUS_PENDING;
}
if (handle)
{
NtWaitForSingleObject( handle, FALSE, NULL );
NtClose( handle );
}
else
{
LARGE_INTEGER time;
/* Unix lock conflict, sleep a bit and retry */
time.QuadPart = 100 * (ULONGLONG)10000;
time.QuadPart = -time.QuadPart;
NtDelayExecution( FALSE, &time );
}
}
}
/******************************************************************
* NtUnlockFile (NTDLL.@)
*
*
*/
NTSTATUS WINAPI NtUnlockFile( HANDLE hFile, PIO_STATUS_BLOCK io_status,
PLARGE_INTEGER offset, PLARGE_INTEGER count,
PULONG key )
{
NTSTATUS status;
TRACE( "%p %x%08x %x%08x\n",
hFile, offset->u.HighPart, offset->u.LowPart, count->u.HighPart, count->u.LowPart );
if (io_status || key)
{
FIXME("Unimplemented yet parameter\n");
return STATUS_NOT_IMPLEMENTED;
}
SERVER_START_REQ( unlock_file )
{
req->handle = wine_server_obj_handle( hFile );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
status = wine_server_call( req );
}
SERVER_END_REQ;
return status;
}
/******************************************************************
* NtCancelIoFileEx (NTDLL.@)
*
*
*/
NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATUS_BLOCK io_status )
{
TRACE("%p %p %p\n", hFile, iosb, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( hFile );
req->iosb = wine_server_client_ptr( iosb );
req->only_thread = FALSE;
io_status->u.Status = wine_server_call( req );
}
SERVER_END_REQ;
return io_status->u.Status;
}
/******************************************************************
* NtCancelIoFile (NTDLL.@)
*
*
*/
NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
{
TRACE("%p %p\n", hFile, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( hFile );
req->iosb = 0;
req->only_thread = TRUE;
io_status->u.Status = wine_server_call( req );
}
SERVER_END_REQ;
return io_status->u.Status;
}
......@@ -145,8 +145,8 @@
@ stdcall -syscall NtAssignProcessToJobObject(long long)
@ stub NtCallbackReturn
# @ stub NtCancelDeviceWakeupRequest
@ stdcall NtCancelIoFile(long ptr)
@ stdcall NtCancelIoFileEx(long ptr ptr)
@ stdcall -syscall NtCancelIoFile(long ptr)
@ stdcall -syscall NtCancelIoFileEx(long ptr ptr)
@ stdcall -syscall NtCancelTimer(long ptr)
@ stdcall -syscall NtClearEvent(long)
@ stdcall NtClearPowerRequest(long long)
......@@ -237,7 +237,7 @@
@ stdcall NtLoadDriver(ptr)
@ stdcall -syscall NtLoadKey2(ptr ptr long)
@ stdcall -syscall NtLoadKey(ptr ptr)
@ stdcall NtLockFile(long long ptr ptr ptr ptr ptr ptr long long)
@ stdcall -syscall NtLockFile(long long ptr ptr ptr ptr ptr ptr long long)
# @ stub NtLockProductActivationKeys
# @ stub NtLockRegistryKey
@ stdcall -syscall NtLockVirtualMemory(long ptr ptr long)
......@@ -288,7 +288,7 @@
@ stdcall NtQueryDefaultUILanguage(ptr)
@ stdcall -syscall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)
@ stdcall NtQueryDirectoryObject(long ptr long long long ptr ptr)
@ stdcall NtQueryEaFile(long ptr ptr long long ptr long ptr long)
@ stdcall -syscall NtQueryEaFile(long ptr ptr long long ptr long ptr long)
@ stdcall -syscall NtQueryEvent(long long ptr long ptr)
@ stdcall -syscall NtQueryFullAttributesFile(ptr ptr)
@ stdcall NtQueryInformationAtom(long long ptr long ptr)
......@@ -366,7 +366,7 @@
@ stub NtSetDefaultHardErrorPort
@ stdcall NtSetDefaultLocale(long long)
@ stdcall NtSetDefaultUILanguage(long)
@ stdcall NtSetEaFile(long ptr ptr long)
@ stdcall -syscall NtSetEaFile(long ptr ptr long)
@ stdcall -syscall NtSetEvent(long ptr)
# @ stub NtSetEventBoostPriority
@ stub NtSetHighEventPair
......@@ -416,7 +416,7 @@
@ stdcall NtUnloadDriver(ptr)
@ stdcall -syscall NtUnloadKey(ptr)
@ stub NtUnloadKeyEx
@ stdcall NtUnlockFile(long ptr ptr ptr ptr)
@ stdcall -syscall NtUnlockFile(long ptr ptr ptr ptr)
@ stdcall -syscall NtUnlockVirtualMemory(long ptr ptr long)
@ stdcall -syscall NtUnmapViewOfSection(long ptr)
@ stub NtVdmControl
......@@ -1134,8 +1134,8 @@
@ stdcall -private -syscall ZwAssignProcessToJobObject(long long) NtAssignProcessToJobObject
@ stub ZwCallbackReturn
# @ stub ZwCancelDeviceWakeupRequest
@ stdcall -private ZwCancelIoFile(long ptr) NtCancelIoFile
@ stdcall -private ZwCancelIoFileEx(long ptr ptr) NtCancelIoFileEx
@ stdcall -private -syscall ZwCancelIoFile(long ptr) NtCancelIoFile
@ stdcall -private -syscall ZwCancelIoFileEx(long ptr ptr) NtCancelIoFileEx
@ stdcall -private -syscall ZwCancelTimer(long ptr) NtCancelTimer
@ stdcall -private -syscall ZwClearEvent(long) NtClearEvent
@ stdcall -private ZwClearPowerRequest(long long) NtClearPowerRequest
......@@ -1224,7 +1224,7 @@
@ stdcall -private ZwLoadDriver(ptr) NtLoadDriver
@ stdcall -private -syscall ZwLoadKey2(ptr ptr long) NtLoadKey2
@ stdcall -private -syscall ZwLoadKey(ptr ptr) NtLoadKey
@ stdcall -private ZwLockFile(long long ptr ptr ptr ptr ptr ptr long long) NtLockFile
@ stdcall -private -syscall ZwLockFile(long long ptr ptr ptr ptr ptr ptr long long) NtLockFile
# @ stub ZwLockProductActivationKeys
# @ stub ZwLockRegistryKey
@ stdcall -private -syscall ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
......@@ -1275,7 +1275,7 @@
@ stdcall -private ZwQueryDefaultUILanguage(ptr) NtQueryDefaultUILanguage
@ stdcall -private -syscall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) NtQueryDirectoryFile
@ stdcall -private ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
@ stdcall -private ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile
@ stdcall -private -syscall ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile
@ stdcall -private -syscall ZwQueryEvent(long long ptr long ptr) NtQueryEvent
@ stdcall -private -syscall ZwQueryFullAttributesFile(ptr ptr) NtQueryFullAttributesFile
@ stdcall -private ZwQueryInformationAtom(long long ptr long ptr) NtQueryInformationAtom
......@@ -1353,7 +1353,7 @@
@ stub ZwSetDefaultHardErrorPort
@ stdcall -private ZwSetDefaultLocale(long long) NtSetDefaultLocale
@ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage
@ stdcall -private ZwSetEaFile(long ptr ptr long) NtSetEaFile
@ stdcall -private -syscall ZwSetEaFile(long ptr ptr long) NtSetEaFile
@ stdcall -private -syscall ZwSetEvent(long ptr) NtSetEvent
# @ stub ZwSetEventBoostPriority
@ stub ZwSetHighEventPair
......@@ -1403,7 +1403,7 @@
@ stdcall -private ZwUnloadDriver(ptr) NtUnloadDriver
@ stdcall -private -syscall ZwUnloadKey(ptr) NtUnloadKey
@ stub ZwUnloadKeyEx
@ stdcall -private ZwUnlockFile(long ptr ptr ptr ptr) NtUnlockFile
@ stdcall -private -syscall ZwUnlockFile(long ptr ptr ptr ptr) NtUnlockFile
@ stdcall -private -syscall ZwUnlockVirtualMemory(long ptr ptr long) NtUnlockVirtualMemory
@ stdcall -private -syscall ZwUnmapViewOfSection(long ptr) NtUnmapViewOfSection
@ stub ZwVdmControl
......
......@@ -5747,6 +5747,130 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
}
/**************************************************************************
* NtCancelIoFile (NTDLL.@)
*/
NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status )
{
TRACE( "%p %p\n", handle, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( handle );
req->only_thread = TRUE;
io_status->u.Status = wine_server_call( req );
}
SERVER_END_REQ;
return io_status->u.Status;
}
/**************************************************************************
* NtCancelIoFileEx (NTDLL.@)
*/
NTSTATUS WINAPI NtCancelIoFileEx( HANDLE handle, IO_STATUS_BLOCK *io, IO_STATUS_BLOCK *io_status )
{
TRACE( "%p %p %p\n", handle, io, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( handle );
req->iosb = wine_server_client_ptr( io );
io_status->u.Status = wine_server_call( req );
}
SERVER_END_REQ;
return io_status->u.Status;
}
/******************************************************************
* NtLockFile (NTDLL.@)
*/
NTSTATUS WINAPI NtLockFile( HANDLE file, HANDLE event, PIO_APC_ROUTINE apc, void* apc_user,
IO_STATUS_BLOCK *io_status, LARGE_INTEGER *offset,
LARGE_INTEGER *count, ULONG *key, BOOLEAN dont_wait, BOOLEAN exclusive )
{
static int warn;
NTSTATUS ret;
HANDLE handle;
BOOLEAN async;
if (apc || io_status || key)
{
FIXME("Unimplemented yet parameter\n");
return STATUS_NOT_IMPLEMENTED;
}
if (apc_user && !warn++) FIXME("I/O completion on lock not implemented yet\n");
for (;;)
{
SERVER_START_REQ( lock_file )
{
req->handle = wine_server_obj_handle( file );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
req->shared = !exclusive;
req->wait = !dont_wait;
ret = wine_server_call( req );
handle = wine_server_ptr_handle( reply->handle );
async = reply->overlapped;
}
SERVER_END_REQ;
if (ret != STATUS_PENDING)
{
if (!ret && event) NtSetEvent( event, NULL );
return ret;
}
if (async)
{
FIXME( "Async I/O lock wait not implemented, might deadlock\n" );
if (handle) NtClose( handle );
return STATUS_PENDING;
}
if (handle)
{
NtWaitForSingleObject( handle, FALSE, NULL );
NtClose( handle );
}
else /* Unix lock conflict, sleep a bit and retry */
{
LARGE_INTEGER time;
time.QuadPart = -100 * (ULONGLONG)10000;
NtDelayExecution( FALSE, &time );
}
}
}
/******************************************************************
* NtUnlockFile (NTDLL.@)
*/
NTSTATUS WINAPI NtUnlockFile( HANDLE handle, IO_STATUS_BLOCK *io_status, LARGE_INTEGER *offset,
LARGE_INTEGER *count, ULONG *key )
{
NTSTATUS status;
TRACE( "%p %x%08x %x%08x\n",
handle, offset->u.HighPart, offset->u.LowPart, count->u.HighPart, count->u.LowPart );
if (io_status || key)
{
FIXME("Unimplemented yet parameter\n");
return STATUS_NOT_IMPLEMENTED;
}
SERVER_START_REQ( unlock_file )
{
req->handle = wine_server_obj_handle( handle );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
status = wine_server_call( req );
}
SERVER_END_REQ;
return status;
}
static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
{
struct async_fileio_read_changes *fileio = user;
......@@ -6309,8 +6433,31 @@ NTSTATUS WINAPI NtSetVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
}
/******************************************************************
* NtQueryEaFile (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryEaFile( HANDLE handle, IO_STATUS_BLOCK *io, void *buffer, ULONG length,
BOOLEAN single_entry, void *list, ULONG list_len,
ULONG *index, BOOLEAN restart )
{
FIXME( "(%p,%p,%p,%d,%d,%p,%d,%p,%d) stub\n",
handle, io, buffer, length, single_entry, list, list_len, index, restart );
return STATUS_ACCESS_DENIED;
}
/******************************************************************
* NtSetEaFile (NTDLL.@)
*/
NTSTATUS WINAPI NtSetEaFile( HANDLE handle, IO_STATUS_BLOCK *io, void *buffer, ULONG length )
{
FIXME( "(%p,%p,%p,%d) stub\n", handle, io, buffer, length );
return STATUS_ACCESS_DENIED;
}
/**************************************************************************
* NtQueryObject
* NtQueryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_class,
void *ptr, ULONG len, ULONG *used_len )
......@@ -6481,7 +6628,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
/**************************************************************************
* NtSetInformationObject
* NtSetInformationObject (NTDLL.@)
*/
NTSTATUS WINAPI NtSetInformationObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_class,
void *ptr, ULONG len )
......
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