2020-05-14 15:17:06 +02:00
|
|
|
/*
|
|
|
|
* Ntdll Unix interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NTDLL_UNIXLIB_H
|
|
|
|
#define __NTDLL_UNIXLIB_H
|
|
|
|
|
2020-05-29 14:17:55 +02:00
|
|
|
#include "wine/server.h"
|
2020-05-17 11:07:02 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2020-06-01 12:52:05 +02:00
|
|
|
struct ldt_copy;
|
2020-06-02 17:08:59 +02:00
|
|
|
struct msghdr;
|
2020-06-01 12:52:05 +02:00
|
|
|
|
2020-05-14 15:17:06 +02:00
|
|
|
/* increment this when you change the function table */
|
2020-06-06 15:16:38 +02:00
|
|
|
#define NTDLL_UNIXLIB_VERSION 32
|
2020-05-14 15:17:06 +02:00
|
|
|
|
|
|
|
struct unix_funcs
|
|
|
|
{
|
2020-05-30 14:21:09 +02:00
|
|
|
/* Nt* functions */
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtAllocateVirtualMemory)( HANDLE process, PVOID *ret, ULONG_PTR zero_bits,
|
|
|
|
SIZE_T *size_ptr, ULONG type, ULONG protect );
|
|
|
|
NTSTATUS (WINAPI *NtAreMappedFilesTheSame)(PVOID addr1, PVOID addr2);
|
2020-06-04 21:21:33 +02:00
|
|
|
NTSTATUS (WINAPI *NtCancelTimer)( HANDLE handle, BOOLEAN *state );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtClearEvent)( HANDLE handle );
|
2020-05-30 14:21:09 +02:00
|
|
|
NTSTATUS (WINAPI *NtClose)( HANDLE handle );
|
2020-06-06 15:16:38 +02:00
|
|
|
NTSTATUS (WINAPI *NtContinue)( CONTEXT *context, BOOLEAN alertable );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateEvent)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN state );
|
2020-06-04 21:27:22 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateKeyedEvent)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, ULONG flags );
|
2020-06-04 21:10:17 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateMutant)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, BOOLEAN owned );
|
2020-06-04 21:34:28 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateSection)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, const LARGE_INTEGER *size,
|
|
|
|
ULONG protect, ULONG sec_flags, HANDLE file );
|
2020-06-04 20:19:37 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateSemaphore)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max );
|
2020-06-05 16:37:49 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateThreadEx)( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr,
|
|
|
|
HANDLE process, PRTL_THREAD_START_ROUTINE start, void *param,
|
|
|
|
ULONG flags, SIZE_T zero_bits, SIZE_T stack_commit,
|
|
|
|
SIZE_T stack_reserve, PS_ATTRIBUTE_LIST *attr_list );
|
2020-06-04 21:21:33 +02:00
|
|
|
NTSTATUS (WINAPI *NtCreateTimer)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr, TIMER_TYPE type );
|
2020-06-01 12:52:05 +02:00
|
|
|
TEB * (WINAPI *NtCurrentTeb)(void);
|
2020-06-04 20:06:53 +02:00
|
|
|
NTSTATUS (WINAPI *NtDelayExecution)( BOOLEAN alertable, const LARGE_INTEGER *timeout );
|
2020-05-30 14:21:09 +02:00
|
|
|
NTSTATUS (WINAPI *NtDuplicateObject)( HANDLE source_process, HANDLE source,
|
|
|
|
HANDLE dest_process, HANDLE *dest,
|
|
|
|
ACCESS_MASK access, ULONG attributes, ULONG options );
|
2020-06-02 17:08:59 +02:00
|
|
|
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 );
|
2020-06-02 14:05:42 +02:00
|
|
|
NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtGetWriteWatch)( HANDLE process, ULONG flags, PVOID base, SIZE_T size,
|
|
|
|
PVOID *addresses, ULONG_PTR *count, ULONG *granularity );
|
|
|
|
NTSTATUS (WINAPI *NtLockVirtualMemory)( HANDLE process, PVOID *addr, SIZE_T *size, ULONG unknown );
|
|
|
|
NTSTATUS (WINAPI *NtMapViewOfSection)( HANDLE handle, HANDLE process, PVOID *addr_ptr,
|
|
|
|
ULONG_PTR zero_bits, SIZE_T commit_size,
|
|
|
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr,
|
|
|
|
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenEvent)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-04 21:27:22 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenKeyedEvent)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-04 21:10:17 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenMutant)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-04 21:34:28 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenSection)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-04 20:19:37 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenSemaphore)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-04 21:21:33 +02:00
|
|
|
NTSTATUS (WINAPI *NtOpenTimer)( HANDLE *handle, ACCESS_MASK access,
|
|
|
|
const OBJECT_ATTRIBUTES *attr );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtProtectVirtualMemory)( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr,
|
|
|
|
ULONG new_prot, ULONG *old_prot );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtPulseEvent)( HANDLE handle, LONG *prev_state );
|
|
|
|
NTSTATUS (WINAPI *NtQueryEvent)( HANDLE handle, EVENT_INFORMATION_CLASS class,
|
|
|
|
void *info, ULONG len, ULONG *ret_len );
|
2020-06-04 21:10:17 +02:00
|
|
|
NTSTATUS (WINAPI *NtQueryMutant)( HANDLE handle, MUTANT_INFORMATION_CLASS class,
|
|
|
|
void *info, ULONG len, ULONG *ret_len );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtQuerySection)( HANDLE handle, SECTION_INFORMATION_CLASS class,
|
|
|
|
void *ptr, SIZE_T size, SIZE_T *ret_size );
|
2020-06-04 20:19:37 +02:00
|
|
|
NTSTATUS (WINAPI *NtQuerySemaphore)( HANDLE handle, SEMAPHORE_INFORMATION_CLASS class,
|
|
|
|
void *info, ULONG len, ULONG *ret_len );
|
2020-06-04 21:21:33 +02:00
|
|
|
NTSTATUS (WINAPI *NtQueryTimer)( HANDLE handle, TIMER_INFORMATION_CLASS class,
|
|
|
|
void *info, ULONG len, ULONG *ret_len );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtQueryVirtualMemory)( HANDLE process, LPCVOID addr,
|
|
|
|
MEMORY_INFORMATION_CLASS info_class,
|
|
|
|
PVOID buffer, SIZE_T len, SIZE_T *res_len );
|
2020-06-06 13:56:19 +02:00
|
|
|
NTSTATUS (WINAPI *NtRaiseException)( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtReadVirtualMemory)( HANDLE process, const void *addr, void *buffer,
|
|
|
|
SIZE_T size, SIZE_T *bytes_read );
|
2020-06-04 21:27:22 +02:00
|
|
|
NTSTATUS (WINAPI *NtReleaseKeyedEvent)( HANDLE handle, const void *key,
|
|
|
|
BOOLEAN alertable, const LARGE_INTEGER *timeout );
|
2020-06-04 21:10:17 +02:00
|
|
|
NTSTATUS (WINAPI *NtReleaseMutant)( HANDLE handle, LONG *prev_count );
|
2020-06-04 20:19:37 +02:00
|
|
|
NTSTATUS (WINAPI *NtReleaseSemaphore)( HANDLE handle, ULONG count, ULONG *previous );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtResetEvent)( HANDLE handle, LONG *prev_state );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size );
|
2020-06-02 13:11:54 +02:00
|
|
|
NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context );
|
2020-06-04 20:34:58 +02:00
|
|
|
NTSTATUS (WINAPI *NtSetEvent)( HANDLE handle, LONG *prev_state );
|
2020-06-01 12:52:05 +02:00
|
|
|
NTSTATUS (WINAPI *NtSetLdtEntries)( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 );
|
2020-06-04 21:21:33 +02:00
|
|
|
NTSTATUS (WINAPI *NtSetTimer)( HANDLE handle, const LARGE_INTEGER *when,
|
|
|
|
PTIMER_APC_ROUTINE callback, void *arg,
|
|
|
|
BOOLEAN resume, ULONG period, BOOLEAN *state );
|
2020-06-04 20:06:53 +02:00
|
|
|
NTSTATUS (WINAPI *NtSignalAndWaitForSingleObject)( HANDLE signal, HANDLE wait,
|
|
|
|
BOOLEAN alertable, const LARGE_INTEGER *timeout );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtUnlockVirtualMemory)( HANDLE process, PVOID *addr,
|
|
|
|
SIZE_T *size, ULONG unknown );
|
|
|
|
NTSTATUS (WINAPI *NtUnmapViewOfSection)( HANDLE process, PVOID addr );
|
2020-06-04 21:27:22 +02:00
|
|
|
NTSTATUS (WINAPI *NtWaitForKeyedEvent)( HANDLE handle, const void *key, BOOLEAN alertable,
|
|
|
|
const LARGE_INTEGER *timeout );
|
2020-06-04 20:06:53 +02:00
|
|
|
NTSTATUS (WINAPI *NtWaitForMultipleObjects)( DWORD count, const HANDLE *handles,
|
|
|
|
BOOLEAN wait_any, BOOLEAN alertable,
|
|
|
|
const LARGE_INTEGER *timeout );
|
|
|
|
NTSTATUS (WINAPI *NtWaitForSingleObject)( HANDLE handle, BOOLEAN alertable,
|
|
|
|
const LARGE_INTEGER *timeout );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (WINAPI *NtWriteVirtualMemory)( HANDLE process, void *addr, const void *buffer,
|
|
|
|
SIZE_T size, SIZE_T *bytes_written );
|
2020-06-04 20:06:53 +02:00
|
|
|
NTSTATUS (WINAPI *NtYieldExecution)(void);
|
2020-05-30 14:21:09 +02:00
|
|
|
|
2020-06-05 16:54:17 +02:00
|
|
|
/* other Win32 API functions */
|
|
|
|
NTSTATUS (WINAPI *DbgUiIssueRemoteBreakin)( HANDLE process );
|
|
|
|
|
2020-05-17 11:09:30 +02:00
|
|
|
/* environment functions */
|
2020-05-17 11:44:16 +02:00
|
|
|
void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] );
|
2020-05-19 12:35:54 +02:00
|
|
|
void (CDECL *get_paths)( const char **builddir, const char **datadir, const char **configdir );
|
|
|
|
void (CDECL *get_dll_path)( const char ***paths, SIZE_T *maxlen );
|
2020-05-20 14:04:32 +02:00
|
|
|
void (CDECL *get_unix_codepage)( CPTABLEINFO *table );
|
2020-05-17 11:09:30 +02:00
|
|
|
const char * (CDECL *get_version)(void);
|
|
|
|
const char * (CDECL *get_build_id)(void);
|
|
|
|
void (CDECL *get_host_version)( const char **sysname, const char **release );
|
|
|
|
|
2020-05-19 14:08:16 +02:00
|
|
|
/* loader functions */
|
|
|
|
NTSTATUS (CDECL *exec_wineloader)( char **argv, int socketfd, int is_child_64bit,
|
|
|
|
ULONGLONG res_start, ULONGLONG res_end );
|
|
|
|
|
2020-05-17 11:04:47 +02:00
|
|
|
/* virtual memory functions */
|
|
|
|
NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module );
|
2020-06-02 17:08:59 +02:00
|
|
|
NTSTATUS (CDECL *virtual_map_section)( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
|
|
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
|
|
|
|
ULONG protect, pe_image_info_t *image_info );
|
|
|
|
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 );
|
|
|
|
NTSTATUS (CDECL *virtual_handle_fault)( LPCVOID addr, DWORD err, BOOL on_signal_stack );
|
|
|
|
unsigned int (CDECL *virtual_locked_server_call)( void *req_ptr );
|
|
|
|
ssize_t (CDECL *virtual_locked_read)( int fd, void *addr, size_t size );
|
|
|
|
ssize_t (CDECL *virtual_locked_pread)( int fd, void *addr, size_t size, off_t offset );
|
|
|
|
ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags );
|
|
|
|
BOOL (CDECL *virtual_is_valid_code_address)( const void *addr, SIZE_T size );
|
|
|
|
int (CDECL *virtual_handle_stack_fault)( void *addr );
|
|
|
|
BOOL (CDECL *virtual_check_buffer_for_read)( const void *ptr, SIZE_T size );
|
|
|
|
BOOL (CDECL *virtual_check_buffer_for_write)( void *ptr, SIZE_T size );
|
|
|
|
SIZE_T (CDECL *virtual_uninterrupted_read_memory)( const void *addr, void *buffer, SIZE_T size );
|
|
|
|
NTSTATUS (CDECL *virtual_uninterrupted_write_memory)( void *addr, const void *buffer, SIZE_T size );
|
|
|
|
void (CDECL *virtual_set_force_exec)( BOOL enable );
|
|
|
|
void (CDECL *virtual_release_address_space)(void);
|
|
|
|
void (CDECL *virtual_set_large_address_space)(void);
|
2020-05-17 11:07:02 +02:00
|
|
|
|
2020-06-01 12:52:05 +02:00
|
|
|
/* thread/process functions */
|
2020-06-04 19:37:35 +02:00
|
|
|
TEB * (CDECL *init_threading)( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size,
|
|
|
|
BOOL *suspend, unsigned int *cpus, BOOL *wow64, timeout_t *start_time );
|
2020-06-03 16:32:02 +02:00
|
|
|
void (CDECL *start_process)( PRTL_THREAD_START_ROUTINE entry, BOOL suspend, void *relay );
|
2020-06-01 12:52:05 +02:00
|
|
|
void (CDECL *abort_thread)( int status );
|
|
|
|
void (CDECL *exit_thread)( int status );
|
|
|
|
void (CDECL *exit_process)( int status );
|
|
|
|
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
|
|
|
|
|
2020-05-29 14:17:55 +02:00
|
|
|
/* server functions */
|
2020-05-29 15:53:42 +02:00
|
|
|
unsigned int (CDECL *server_call)( void *req_ptr );
|
2020-06-01 13:40:25 +02:00
|
|
|
unsigned int (CDECL *server_select)( const select_op_t *select_op, data_size_t size, UINT flags,
|
|
|
|
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
|
|
|
user_apc_t *user_apc );
|
|
|
|
unsigned int (CDECL *server_wait)( const select_op_t *select_op, data_size_t size, UINT flags,
|
|
|
|
const LARGE_INTEGER *timeout );
|
2020-05-29 14:17:55 +02:00
|
|
|
void (CDECL *server_send_fd)( int fd );
|
2020-05-29 15:35:16 +02:00
|
|
|
int (CDECL *server_get_unix_fd)( HANDLE handle, unsigned int wanted_access, int *unix_fd,
|
|
|
|
int *needs_close, enum server_fd_type *type, unsigned int *options );
|
|
|
|
NTSTATUS (CDECL *server_fd_to_handle)( int fd, unsigned int access, unsigned int attributes,
|
|
|
|
HANDLE *handle );
|
|
|
|
NTSTATUS (CDECL *server_handle_to_fd)( HANDLE handle, unsigned int access, int *unix_fd,
|
|
|
|
unsigned int *options );
|
|
|
|
void (CDECL *server_release_fd)( HANDLE handle, int unix_fd );
|
2020-05-29 14:17:55 +02:00
|
|
|
void (CDECL *server_init_process_done)(void);
|
|
|
|
|
2020-05-17 11:07:02 +02:00
|
|
|
/* debugging functions */
|
|
|
|
unsigned char (CDECL *dbg_get_channel_flags)( struct __wine_debug_channel *channel );
|
|
|
|
const char * (CDECL *dbg_strdup)( const char *str );
|
|
|
|
int (CDECL *dbg_output)( const char *str );
|
|
|
|
int (CDECL *dbg_header)( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
|
|
|
|
const char *function );
|
2020-05-14 15:17:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __NTDLL_UNIXLIB_H */
|