Commit f6bfb4ce authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move the device I/O control functions to the Unix library.

parent 888d66a2
......@@ -9,7 +9,6 @@ EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
C_SRCS = \
actctx.c \
atom.c \
cdrom.c \
critsection.c \
crypt.c \
debugbuffer.c \
......@@ -37,7 +36,6 @@ C_SRCS = \
rtlbitmap.c \
rtlstr.c \
sec.c \
serial.c \
server.c \
signal_arm.c \
signal_arm64.c \
......@@ -46,15 +44,16 @@ C_SRCS = \
signal_x86_64.c \
string.c \
sync.c \
tape.c \
thread.c \
threadpool.c \
time.c \
unix/cdrom.c \
unix/debug.c \
unix/env.c \
unix/file.c \
unix/loader.c \
unix/process.c \
unix/serial.c \
unix/server.c \
unix/signal_arm.c \
unix/signal_arm64.c \
......@@ -62,6 +61,7 @@ C_SRCS = \
unix/signal_powerpc.c \
unix/signal_x86_64.c \
unix/sync.c \
unix/tape.c \
unix/thread.c \
unix/virtual.c \
version.c \
......
......@@ -114,30 +114,6 @@ extern const WCHAR syswow64_dir[] DECLSPEC_HIDDEN;
extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
/* Device IO */
extern NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
PVOID UserApcContext,
PIO_STATUS_BLOCK piosb,
ULONG IoControlCode,
LPVOID lpInBuffer, DWORD nInBufferSize,
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
extern NTSTATUS COMM_DeviceIoControl(HANDLE hDevice,
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
PVOID UserApcContext,
PIO_STATUS_BLOCK piosb,
ULONG IoControlCode,
LPVOID lpInBuffer, DWORD nInBufferSize,
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
extern NTSTATUS TAPE_DeviceIoControl(HANDLE hDevice,
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
PVOID UserApcContext,
PIO_STATUS_BLOCK piosb,
ULONG IoControlCode,
LPVOID lpInBuffer, DWORD nInBufferSize,
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
extern NTSTATUS COMM_FlushBuffersFile( int fd ) DECLSPEC_HIDDEN;
/* file I/O */
extern NTSTATUS FILE_GetNtStatus(void) DECLSPEC_HIDDEN;
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
......
......@@ -331,7 +331,7 @@ static inline BOOL has_wildcard( const UNICODE_STRING *mask )
return FALSE;
}
static NTSTATUS errno_to_status( int err )
NTSTATUS errno_to_status( int err )
{
TRACE( "errno = %d\n", err );
switch (err)
......@@ -3336,7 +3336,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
*
* Unmount the specified device.
*/
NTSTATUS CDECL unmount_device( HANDLE handle )
static NTSTATUS unmount_device( HANDLE handle )
{
NTSTATUS status;
int unix_fd, needs_close;
......@@ -4579,6 +4579,51 @@ static NTSTATUS server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE
return status;
}
/* do an ioctl call through the server */
static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
PIO_APC_ROUTINE apc, PVOID apc_context,
IO_STATUS_BLOCK *io, ULONG code,
const void *in_buffer, ULONG in_size,
PVOID out_buffer, ULONG out_size )
{
struct async_irp *async;
NTSTATUS status;
HANDLE wait_handle;
ULONG options;
if (!(async = (struct async_irp *)alloc_fileio( sizeof(*async), irp_completion, handle )))
return STATUS_NO_MEMORY;
async->buffer = out_buffer;
async->size = out_size;
SERVER_START_REQ( ioctl )
{
req->code = code;
req->async = server_async( handle, &async->io, event, apc, apc_context, io );
wine_server_add_data( req, in_buffer, in_size );
if ((code & 3) != METHOD_BUFFERED) wine_server_add_data( req, out_buffer, out_size );
wine_server_set_reply( req, out_buffer, out_size );
status = virtual_locked_server_call( req );
wait_handle = wine_server_ptr_handle( reply->wait );
options = reply->options;
if (wait_handle && status != STATUS_PENDING)
{
io->u.Status = status;
io->Information = wine_server_reply_size( reply );
}
}
SERVER_END_REQ;
if (status == STATUS_NOT_SUPPORTED)
FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
return status;
}
struct io_timeouts
{
......@@ -5353,3 +5398,201 @@ NTSTATUS WINAPI NtWriteFileGather( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
if (send_completion) add_completion( file, cvalue, status, total, FALSE );
return status;
}
/******************************************************************************
* NtDeviceIoControlFile (NTDLL.@)
*/
NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_context,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer, ULONG in_size,
void *out_buffer, ULONG out_size )
{
ULONG device = (code >> 16);
NTSTATUS status = STATUS_NOT_SUPPORTED;
TRACE( "(%p,%p,%p,%p,%p,0x%08x,%p,0x%08x,%p,0x%08x)\n",
handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size );
switch (device)
{
case FILE_DEVICE_DISK:
case FILE_DEVICE_CD_ROM:
case FILE_DEVICE_DVD:
case FILE_DEVICE_CONTROLLER:
case FILE_DEVICE_MASS_STORAGE:
status = cdrom_DeviceIoControl( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
break;
case FILE_DEVICE_SERIAL_PORT:
status = serial_DeviceIoControl( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
break;
case FILE_DEVICE_TAPE:
status = tape_DeviceIoControl( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
break;
}
if (status == STATUS_NOT_SUPPORTED || status == STATUS_BAD_DEVICE_TYPE)
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
if (status != STATUS_PENDING) io->u.Status = status;
return status;
}
/* Tell Valgrind to ignore any holes in structs we will be passing to the
* server */
static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, ULONG in_size )
{
#ifdef VALGRIND_MAKE_MEM_DEFINED
# define IGNORE_STRUCT_HOLE(buf, size, t, f1, f2) \
do { \
if (FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1) < FIELD_OFFSET(t, f2)) \
if ((size) >= FIELD_OFFSET(t, f2)) \
VALGRIND_MAKE_MEM_DEFINED( \
(const char *)(buf) + FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1), \
FIELD_OFFSET(t, f2) - FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1)); \
} while (0)
switch (code)
{
case FSCTL_PIPE_WAIT:
IGNORE_STRUCT_HOLE(in_buffer, in_size, FILE_PIPE_WAIT_FOR_BUFFER, TimeoutSpecified, Name);
break;
}
#endif
}
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_context,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer, ULONG in_size,
void *out_buffer, ULONG out_size )
{
NTSTATUS status;
TRACE( "(%p,%p,%p,%p,%p,0x%08x,%p,0x%08x,%p,0x%08x)\n",
handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size );
if (!io) return STATUS_INVALID_PARAMETER;
ignore_server_ioctl_struct_holes( code, in_buffer, in_size );
switch (code)
{
case FSCTL_DISMOUNT_VOLUME:
status = server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
if (!status) status = unmount_device( handle );
return status;
case FSCTL_PIPE_IMPERSONATE:
FIXME("FSCTL_PIPE_IMPERSONATE: impersonating self\n");
status = RtlImpersonateSelf( SecurityImpersonation );
break;
case FSCTL_IS_VOLUME_MOUNTED:
case FSCTL_LOCK_VOLUME:
case FSCTL_UNLOCK_VOLUME:
FIXME("stub! return success - Unsupported fsctl %x (device=%x access=%x func=%x method=%x)\n",
code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
status = STATUS_SUCCESS;
break;
case FSCTL_GET_RETRIEVAL_POINTERS:
{
RETRIEVAL_POINTERS_BUFFER *buffer = (RETRIEVAL_POINTERS_BUFFER *)out_buffer;
FIXME("stub: FSCTL_GET_RETRIEVAL_POINTERS\n");
if (out_size >= sizeof(RETRIEVAL_POINTERS_BUFFER))
{
buffer->ExtentCount = 1;
buffer->StartingVcn.QuadPart = 1;
buffer->Extents[0].NextVcn.QuadPart = 0;
buffer->Extents[0].Lcn.QuadPart = 0;
io->Information = sizeof(RETRIEVAL_POINTERS_BUFFER);
status = STATUS_SUCCESS;
}
else
{
io->Information = 0;
status = STATUS_BUFFER_TOO_SMALL;
}
break;
}
case FSCTL_SET_SPARSE:
TRACE("FSCTL_SET_SPARSE: Ignoring request\n");
io->Information = 0;
status = STATUS_SUCCESS;
break;
default:
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
}
if (status != STATUS_PENDING) io->u.Status = status;
return status;
}
/******************************************************************************
* NtFlushBuffersFile (NTDLL.@)
*/
NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
{
NTSTATUS ret;
HANDLE wait_handle;
enum server_fd_type type;
int fd, needs_close;
if (!io || !virtual_check_buffer_for_write( io, sizeof(*io) )) return STATUS_ACCESS_VIOLATION;
ret = server_get_unix_fd( handle, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL );
if (ret == STATUS_ACCESS_DENIED)
ret = server_get_unix_fd( handle, FILE_APPEND_DATA, &fd, &needs_close, &type, NULL );
if (!ret && (type == FD_TYPE_FILE || type == FD_TYPE_DIR))
{
if (fsync(fd)) ret = errno_to_status( errno );
io->u.Status = ret;
io->Information = 0;
}
else if (!ret && type == FD_TYPE_SERIAL)
{
ret = serial_FlushBuffersFile( fd );
}
else if (ret != STATUS_ACCESS_DENIED)
{
struct async_irp *async;
if (!(async = (struct async_irp *)alloc_fileio( sizeof(*async), irp_completion, handle )))
return STATUS_NO_MEMORY;
async->buffer = NULL;
async->size = 0;
SERVER_START_REQ( flush )
{
req->async = server_async( handle, &async->io, NULL, NULL, NULL, io );
ret = wine_server_call( req );
wait_handle = wine_server_ptr_handle( reply->event );
if (wait_handle && ret != STATUS_PENDING)
{
io->u.Status = ret;
io->Information = 0;
}
}
SERVER_END_REQ;
if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle) ret = wait_async( wait_handle, FALSE, io );
}
if (needs_close) close( fd );
return ret;
}
......@@ -841,9 +841,12 @@ static struct unix_funcs unix_funcs =
NtCurrentTeb,
NtDelayExecution,
NtDeleteFile,
NtDeviceIoControlFile,
NtDuplicateObject,
NtFlushBuffersFile,
NtFlushVirtualMemory,
NtFreeVirtualMemory,
NtFsControlFile,
NtGetContextThread,
NtGetWriteWatch,
NtIsProcessInJob,
......@@ -942,9 +945,7 @@ static struct unix_funcs unix_funcs =
virtual_get_system_info,
virtual_create_builtin_view,
virtual_alloc_thread_stack,
virtual_locked_server_call,
virtual_locked_recvmsg,
virtual_check_buffer_for_write,
virtual_release_address_space,
virtual_set_large_address_space,
init_threading,
......@@ -960,7 +961,6 @@ static struct unix_funcs unix_funcs =
server_release_fd,
server_init_process_done,
nt_to_unix_file_name,
unmount_device,
set_show_dot_files,
__wine_dbg_get_channel_flags,
__wine_dbg_strdup,
......
......@@ -18,11 +18,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
......@@ -42,7 +47,6 @@
#ifndef MT_ST_BLKSIZE_MASK
#define MT_ST_BLKSIZE_MASK 0xffffff
#endif
/* Darwin 7.9.0 has MTSETBSIZ instead of MTSETBLK */
#if !defined(MTSETBLK) && defined(MTSETBSIZ)
#define MTSETBLK MTSETBSIZ
......@@ -55,8 +59,8 @@
#include "winternl.h"
#include "winioctl.h"
#include "ddk/ntddtape.h"
#include "ntdll_misc.h"
#include "wine/server.h"
#include "unix_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(tape);
......@@ -91,7 +95,7 @@ static const char *io2str( DWORD io )
static inline NTSTATUS TAPE_GetStatus( int error )
{
if (!error) return STATUS_SUCCESS;
return FILE_GetNtStatus();
return errno_to_status( errno );
}
#endif
......@@ -376,7 +380,7 @@ static NTSTATUS TAPE_SetDriveParams( int fd, const TAPE_SET_DRIVE_PARAMETERS *da
return STATUS_NOT_SUPPORTED;
#endif
}
/******************************************************************
* TAPE_SetMediaParams
*/
......@@ -386,7 +390,7 @@ static NTSTATUS TAPE_SetMediaParams( int fd, const TAPE_SET_MEDIA_PARAMETERS *da
struct mtop cmd;
TRACE( "fd: %d blocksize: 0x%08x\n", fd, data->BlockSize );
cmd.mt_op = MTSETBLK;
cmd.mt_count = data->BlockSize;
......@@ -396,7 +400,7 @@ static NTSTATUS TAPE_SetMediaParams( int fd, const TAPE_SET_MEDIA_PARAMETERS *da
return STATUS_NOT_SUPPORTED;
#endif
}
/******************************************************************
* TAPE_SetPosition
*/
......@@ -511,29 +515,24 @@ static NTSTATUS TAPE_WriteMarks( int fd, const TAPE_WRITE_MARKS *data )
}
/******************************************************************
* TAPE_DeviceIoControl
*
* SEE ALSO
* NtDeviceIoControl.
* tape_DeviceIoControl
*/
NTSTATUS TAPE_DeviceIoControl( HANDLE device, HANDLE event,
PIO_APC_ROUTINE apc, PVOID apc_user, PIO_STATUS_BLOCK io_status,
ULONG io_control, LPVOID in_buffer, DWORD in_size,
LPVOID out_buffer, DWORD out_size )
NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, ULONG code,
void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size )
{
DWORD sz = 0;
NTSTATUS status = STATUS_INVALID_PARAMETER;
int fd, needs_close;
TRACE( "%p %s %p %d %p %d %p\n", device, io2str(io_control),
in_buffer, in_size, out_buffer, out_size, io_status );
TRACE( "%p %s %p %d %p %d %p\n", device, io2str(code),
in_buffer, in_size, out_buffer, out_size, io );
io_status->Information = 0;
io->Information = 0;
if ((status = unix_funcs->server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL )))
goto error;
if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL ))) goto error;
switch (io_control)
switch (code)
{
case IOCTL_TAPE_CREATE_PARTITION:
status = TAPE_CreatePartition( fd, in_buffer );
......@@ -552,7 +551,7 @@ NTSTATUS TAPE_DeviceIoControl( HANDLE device, HANDLE event,
out_buffer );
break;
case IOCTL_TAPE_GET_STATUS:
status = FILE_GetNtStatus();
status = errno_to_status( errno );
break;
case IOCTL_TAPE_PREPARE:
status = TAPE_Prepare( fd, in_buffer );
......@@ -575,16 +574,15 @@ NTSTATUS TAPE_DeviceIoControl( HANDLE device, HANDLE event,
break;
default:
FIXME( "Unsupported IOCTL %x (type=%x access=%x func=%x meth=%x)\n",
io_control, io_control >> 16, (io_control >> 14) & 3,
(io_control >> 2) & 0xfff, io_control & 3 );
code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3 );
break;
}
if (needs_close) close( fd );
error:
io_status->u.Status = status;
io_status->Information = sz;
io->u.Status = status;
io->Information = sz;
if (event) NtSetEvent( event, NULL );
return status;
}
......@@ -90,9 +90,7 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig
extern void CDECL virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL virtual_create_builtin_view( void *module ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN;
extern unsigned int CDECL virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN;
extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN;
extern BOOL CDECL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
......@@ -116,7 +114,6 @@ extern NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_imag
extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
UINT disposition, BOOLEAN check_case ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
extern void CDECL set_show_dot_files( BOOL enable ) DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
......@@ -173,11 +170,13 @@ extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN;
extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN;
extern void virtual_map_user_shared_data(void) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN;
extern unsigned int virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN;
extern ssize_t virtual_locked_read( int fd, void *addr, size_t size ) DECLSPEC_HIDDEN;
extern ssize_t virtual_locked_pread( int fd, void *addr, size_t size, off_t offset ) DECLSPEC_HIDDEN;
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
extern int virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
extern void virtual_set_force_exec( BOOL enable ) DECLSPEC_HIDDEN;
......@@ -193,6 +192,18 @@ extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE ent
BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN;
extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
extern NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
extern NTSTATUS serial_FlushBuffersFile( int fd ) DECLSPEC_HIDDEN;
extern NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
extern NTSTATUS errno_to_status( int err ) DECLSPEC_HIDDEN;
extern void init_files(void) DECLSPEC_HIDDEN;
extern void dbg_init(void) DECLSPEC_HIDDEN;
......
......@@ -2840,7 +2840,7 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
/***********************************************************************
* virtual_locked_server_call
*/
unsigned int CDECL virtual_locked_server_call( void *req_ptr )
unsigned int virtual_locked_server_call( void *req_ptr )
{
struct __server_request_info * const req = req_ptr;
sigset_t sigset;
......@@ -3040,7 +3040,7 @@ BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size )
*
* Check if a memory buffer can be written to, triggering page faults if needed for write watches.
*/
BOOL CDECL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
{
if (!size) return TRUE;
if (!ptr) return FALSE;
......
......@@ -28,7 +28,7 @@ struct ldt_copy;
struct msghdr;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 49
#define NTDLL_UNIXLIB_VERSION 50
struct unix_funcs
{
......@@ -86,13 +86,22 @@ struct unix_funcs
TEB * (WINAPI *NtCurrentTeb)(void);
NTSTATUS (WINAPI *NtDelayExecution)( BOOLEAN alertable, const LARGE_INTEGER *timeout );
NTSTATUS (WINAPI *NtDeleteFile)( OBJECT_ATTRIBUTES *attr );
NTSTATUS (WINAPI *NtDeviceIoControlFile)( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc,
void *apc_context, IO_STATUS_BLOCK *io, ULONG code,
void *in_buffer, ULONG in_size,
void *out_buffer, ULONG out_size );
NTSTATUS (WINAPI *NtDuplicateObject)( HANDLE source_process, HANDLE source,
HANDLE dest_process, HANDLE *dest,
ACCESS_MASK access, ULONG attributes, ULONG options );
NTSTATUS (WINAPI *NtFlushBuffersFile)( HANDLE handle, IO_STATUS_BLOCK *io );
NTSTATUS (WINAPI *NtFlushVirtualMemory)( HANDLE process, LPCVOID *addr_ptr,
SIZE_T *size_ptr, ULONG unknown );
NTSTATUS (WINAPI *NtFreeVirtualMemory)( HANDLE process, PVOID *addr_ptr,
SIZE_T *size_ptr, ULONG type );
NTSTATUS (WINAPI *NtFsControlFile)( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc,
void *apc_context, IO_STATUS_BLOCK *io, ULONG code,
void *in_buffer, ULONG in_size,
void *out_buffer, ULONG out_size );
NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context );
NTSTATUS (WINAPI *NtGetWriteWatch)( HANDLE process, ULONG flags, PVOID base, SIZE_T size,
PVOID *addresses, ULONG_PTR *count, ULONG *granularity );
......@@ -266,9 +275,7 @@ struct unix_funcs
void (CDECL *virtual_get_system_info)( SYSTEM_BASIC_INFORMATION *info );
NTSTATUS (CDECL *virtual_create_builtin_view)( void *module );
NTSTATUS (CDECL *virtual_alloc_thread_stack)( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size );
unsigned int (CDECL *virtual_locked_server_call)( void *req_ptr );
ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags );
BOOL (CDECL *virtual_check_buffer_for_write)( void *ptr, SIZE_T size );
void (CDECL *virtual_release_address_space)(void);
void (CDECL *virtual_set_large_address_space)(void);
......@@ -295,7 +302,6 @@ struct unix_funcs
/* file functions */
NTSTATUS (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
UINT disposition, BOOLEAN check_case );
NTSTATUS (CDECL *unmount_device)( HANDLE handle );
void (CDECL *set_show_dot_files)( BOOL enable );
/* debugging functions */
......
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