4 * Copyright (C) 2020 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __NTDLL_UNIXLIB_H
22 #define __NTDLL_UNIXLIB_H
24 #include "wine/server.h"
25 #include "wine/debug.h"
30 /* increment this when you change the function table */
31 #define NTDLL_UNIXLIB_VERSION 36
36 NTSTATUS (WINAPI
*NtAlertResumeThread
)( HANDLE handle
, ULONG
*count
);
37 NTSTATUS (WINAPI
*NtAlertThread
)( HANDLE handle
);
38 NTSTATUS (WINAPI
*NtAllocateVirtualMemory
)( HANDLE process
, PVOID
*ret
, ULONG_PTR zero_bits
,
39 SIZE_T
*size_ptr
, ULONG type
, ULONG protect
);
40 NTSTATUS (WINAPI
*NtAreMappedFilesTheSame
)(PVOID addr1
, PVOID addr2
);
41 NTSTATUS (WINAPI
*NtCancelTimer
)( HANDLE handle
, BOOLEAN
*state
);
42 NTSTATUS (WINAPI
*NtClearEvent
)( HANDLE handle
);
43 NTSTATUS (WINAPI
*NtClose
)( HANDLE handle
);
44 NTSTATUS (WINAPI
*NtContinue
)( CONTEXT
*context
, BOOLEAN alertable
);
45 NTSTATUS (WINAPI
*NtCreateEvent
)( HANDLE
*handle
, ACCESS_MASK access
,
46 const OBJECT_ATTRIBUTES
*attr
, EVENT_TYPE type
, BOOLEAN state
);
47 NTSTATUS (WINAPI
*NtCreateKeyedEvent
)( HANDLE
*handle
, ACCESS_MASK access
,
48 const OBJECT_ATTRIBUTES
*attr
, ULONG flags
);
49 NTSTATUS (WINAPI
*NtCreateMutant
)( HANDLE
*handle
, ACCESS_MASK access
,
50 const OBJECT_ATTRIBUTES
*attr
, BOOLEAN owned
);
51 NTSTATUS (WINAPI
*NtCreateSection
)( HANDLE
*handle
, ACCESS_MASK access
,
52 const OBJECT_ATTRIBUTES
*attr
, const LARGE_INTEGER
*size
,
53 ULONG protect
, ULONG sec_flags
, HANDLE file
);
54 NTSTATUS (WINAPI
*NtCreateSemaphore
)( HANDLE
*handle
, ACCESS_MASK access
,
55 const OBJECT_ATTRIBUTES
*attr
, LONG initial
, LONG max
);
56 NTSTATUS (WINAPI
*NtCreateThreadEx
)( HANDLE
*handle
, ACCESS_MASK access
, OBJECT_ATTRIBUTES
*attr
,
57 HANDLE process
, PRTL_THREAD_START_ROUTINE start
, void *param
,
58 ULONG flags
, SIZE_T zero_bits
, SIZE_T stack_commit
,
59 SIZE_T stack_reserve
, PS_ATTRIBUTE_LIST
*attr_list
);
60 NTSTATUS (WINAPI
*NtCreateTimer
)( HANDLE
*handle
, ACCESS_MASK access
,
61 const OBJECT_ATTRIBUTES
*attr
, TIMER_TYPE type
);
62 TEB
* (WINAPI
*NtCurrentTeb
)(void);
63 NTSTATUS (WINAPI
*NtDelayExecution
)( BOOLEAN alertable
, const LARGE_INTEGER
*timeout
);
64 NTSTATUS (WINAPI
*NtDuplicateObject
)( HANDLE source_process
, HANDLE source
,
65 HANDLE dest_process
, HANDLE
*dest
,
66 ACCESS_MASK access
, ULONG attributes
, ULONG options
);
67 NTSTATUS (WINAPI
*NtFlushVirtualMemory
)( HANDLE process
, LPCVOID
*addr_ptr
,
68 SIZE_T
*size_ptr
, ULONG unknown
);
69 NTSTATUS (WINAPI
*NtFreeVirtualMemory
)( HANDLE process
, PVOID
*addr_ptr
,
70 SIZE_T
*size_ptr
, ULONG type
);
71 NTSTATUS (WINAPI
*NtGetContextThread
)( HANDLE handle
, CONTEXT
*context
);
72 NTSTATUS (WINAPI
*NtGetWriteWatch
)( HANDLE process
, ULONG flags
, PVOID base
, SIZE_T size
,
73 PVOID
*addresses
, ULONG_PTR
*count
, ULONG
*granularity
);
74 NTSTATUS (WINAPI
*NtLockVirtualMemory
)( HANDLE process
, PVOID
*addr
, SIZE_T
*size
, ULONG unknown
);
75 NTSTATUS (WINAPI
*NtMapViewOfSection
)( HANDLE handle
, HANDLE process
, PVOID
*addr_ptr
,
76 ULONG_PTR zero_bits
, SIZE_T commit_size
,
77 const LARGE_INTEGER
*offset_ptr
, SIZE_T
*size_ptr
,
78 SECTION_INHERIT inherit
, ULONG alloc_type
, ULONG protect
);
79 NTSTATUS (WINAPI
*NtOpenEvent
)( HANDLE
*handle
, ACCESS_MASK access
,
80 const OBJECT_ATTRIBUTES
*attr
);
81 NTSTATUS (WINAPI
*NtOpenKeyedEvent
)( HANDLE
*handle
, ACCESS_MASK access
,
82 const OBJECT_ATTRIBUTES
*attr
);
83 NTSTATUS (WINAPI
*NtOpenMutant
)( HANDLE
*handle
, ACCESS_MASK access
,
84 const OBJECT_ATTRIBUTES
*attr
);
85 NTSTATUS (WINAPI
*NtOpenSection
)( HANDLE
*handle
, ACCESS_MASK access
,
86 const OBJECT_ATTRIBUTES
*attr
);
87 NTSTATUS (WINAPI
*NtOpenSemaphore
)( HANDLE
*handle
, ACCESS_MASK access
,
88 const OBJECT_ATTRIBUTES
*attr
);
89 NTSTATUS (WINAPI
*NtOpenThread
)( HANDLE
*handle
, ACCESS_MASK access
, const OBJECT_ATTRIBUTES
*attr
, const CLIENT_ID
*id
);
90 NTSTATUS (WINAPI
*NtOpenTimer
)( HANDLE
*handle
, ACCESS_MASK access
,
91 const OBJECT_ATTRIBUTES
*attr
);
92 NTSTATUS (WINAPI
*NtProtectVirtualMemory
)( HANDLE process
, PVOID
*addr_ptr
, SIZE_T
*size_ptr
,
93 ULONG new_prot
, ULONG
*old_prot
);
94 NTSTATUS (WINAPI
*NtPulseEvent
)( HANDLE handle
, LONG
*prev_state
);
95 NTSTATUS (WINAPI
*NtQueryEvent
)( HANDLE handle
, EVENT_INFORMATION_CLASS
class,
96 void *info
, ULONG len
, ULONG
*ret_len
);
97 NTSTATUS (WINAPI
*NtQueryMutant
)( HANDLE handle
, MUTANT_INFORMATION_CLASS
class,
98 void *info
, ULONG len
, ULONG
*ret_len
);
99 NTSTATUS (WINAPI
*NtQuerySection
)( HANDLE handle
, SECTION_INFORMATION_CLASS
class,
100 void *ptr
, SIZE_T size
, SIZE_T
*ret_size
);
101 NTSTATUS (WINAPI
*NtQuerySemaphore
)( HANDLE handle
, SEMAPHORE_INFORMATION_CLASS
class,
102 void *info
, ULONG len
, ULONG
*ret_len
);
103 NTSTATUS (WINAPI
*NtQueryTimer
)( HANDLE handle
, TIMER_INFORMATION_CLASS
class,
104 void *info
, ULONG len
, ULONG
*ret_len
);
105 NTSTATUS (WINAPI
*NtQueryVirtualMemory
)( HANDLE process
, LPCVOID addr
,
106 MEMORY_INFORMATION_CLASS info_class
,
107 PVOID buffer
, SIZE_T len
, SIZE_T
*res_len
);
108 NTSTATUS (WINAPI
*NtQueueApcThread
)( HANDLE handle
, PNTAPCFUNC func
, ULONG_PTR arg1
,
109 ULONG_PTR arg2
, ULONG_PTR arg3
);
110 NTSTATUS (WINAPI
*NtRaiseException
)( EXCEPTION_RECORD
*rec
, CONTEXT
*context
, BOOL first_chance
);
111 NTSTATUS (WINAPI
*NtReadVirtualMemory
)( HANDLE process
, const void *addr
, void *buffer
,
112 SIZE_T size
, SIZE_T
*bytes_read
);
113 NTSTATUS (WINAPI
*NtReleaseKeyedEvent
)( HANDLE handle
, const void *key
,
114 BOOLEAN alertable
, const LARGE_INTEGER
*timeout
);
115 NTSTATUS (WINAPI
*NtReleaseMutant
)( HANDLE handle
, LONG
*prev_count
);
116 NTSTATUS (WINAPI
*NtReleaseSemaphore
)( HANDLE handle
, ULONG count
, ULONG
*previous
);
117 NTSTATUS (WINAPI
*NtResetEvent
)( HANDLE handle
, LONG
*prev_state
);
118 NTSTATUS (WINAPI
*NtResetWriteWatch
)( HANDLE process
, PVOID base
, SIZE_T size
);
119 NTSTATUS (WINAPI
*NtResumeThread
)( HANDLE handle
, ULONG
*count
);
120 NTSTATUS (WINAPI
*NtSetContextThread
)( HANDLE handle
, const CONTEXT
*context
);
121 NTSTATUS (WINAPI
*NtSetEvent
)( HANDLE handle
, LONG
*prev_state
);
122 NTSTATUS (WINAPI
*NtSetLdtEntries
)( ULONG sel1
, LDT_ENTRY entry1
, ULONG sel2
, LDT_ENTRY entry2
);
123 NTSTATUS (WINAPI
*NtSetTimer
)( HANDLE handle
, const LARGE_INTEGER
*when
,
124 PTIMER_APC_ROUTINE callback
, void *arg
,
125 BOOLEAN resume
, ULONG period
, BOOLEAN
*state
);
126 NTSTATUS (WINAPI
*NtSignalAndWaitForSingleObject
)( HANDLE signal
, HANDLE wait
,
127 BOOLEAN alertable
, const LARGE_INTEGER
*timeout
);
128 NTSTATUS (WINAPI
*NtSuspendThread
)( HANDLE handle
, ULONG
*count
);
129 NTSTATUS (WINAPI
*NtTerminateThread
)( HANDLE handle
, LONG exit_code
);
130 NTSTATUS (WINAPI
*NtUnlockVirtualMemory
)( HANDLE process
, PVOID
*addr
,
131 SIZE_T
*size
, ULONG unknown
);
132 NTSTATUS (WINAPI
*NtUnmapViewOfSection
)( HANDLE process
, PVOID addr
);
133 NTSTATUS (WINAPI
*NtWaitForKeyedEvent
)( HANDLE handle
, const void *key
, BOOLEAN alertable
,
134 const LARGE_INTEGER
*timeout
);
135 NTSTATUS (WINAPI
*NtWaitForMultipleObjects
)( DWORD count
, const HANDLE
*handles
,
136 BOOLEAN wait_any
, BOOLEAN alertable
,
137 const LARGE_INTEGER
*timeout
);
138 NTSTATUS (WINAPI
*NtWaitForSingleObject
)( HANDLE handle
, BOOLEAN alertable
,
139 const LARGE_INTEGER
*timeout
);
140 NTSTATUS (WINAPI
*NtWriteVirtualMemory
)( HANDLE process
, void *addr
, const void *buffer
,
141 SIZE_T size
, SIZE_T
*bytes_written
);
142 NTSTATUS (WINAPI
*NtYieldExecution
)(void);
144 /* other Win32 API functions */
145 NTSTATUS (WINAPI
*DbgUiIssueRemoteBreakin
)( HANDLE process
);
148 NTSTATUS (CDECL
*fast_RtlTryAcquireSRWLockExclusive
)( RTL_SRWLOCK
*lock
);
149 NTSTATUS (CDECL
*fast_RtlAcquireSRWLockExclusive
)( RTL_SRWLOCK
*lock
);
150 NTSTATUS (CDECL
*fast_RtlTryAcquireSRWLockShared
)( RTL_SRWLOCK
*lock
);
151 NTSTATUS (CDECL
*fast_RtlAcquireSRWLockShared
)( RTL_SRWLOCK
*lock
);
152 NTSTATUS (CDECL
*fast_RtlReleaseSRWLockExclusive
)( RTL_SRWLOCK
*lock
);
153 NTSTATUS (CDECL
*fast_RtlReleaseSRWLockShared
)( RTL_SRWLOCK
*lock
);
154 NTSTATUS (CDECL
*fast_RtlSleepConditionVariableSRW
)( RTL_CONDITION_VARIABLE
*variable
,
156 const LARGE_INTEGER
*timeout
, ULONG flags
);
157 NTSTATUS (CDECL
*fast_RtlSleepConditionVariableCS
)( RTL_CONDITION_VARIABLE
*variable
,
158 RTL_CRITICAL_SECTION
*cs
,
159 const LARGE_INTEGER
*timeout
);
160 NTSTATUS (CDECL
*fast_RtlWakeConditionVariable
)( RTL_CONDITION_VARIABLE
*variable
, int count
);
162 /* environment functions */
163 void (CDECL
*get_main_args
)( int *argc
, char **argv
[], char **envp
[] );
164 void (CDECL
*get_paths
)( const char **builddir
, const char **datadir
, const char **configdir
);
165 void (CDECL
*get_dll_path
)( const char ***paths
, SIZE_T
*maxlen
);
166 void (CDECL
*get_unix_codepage
)( CPTABLEINFO
*table
);
167 const char * (CDECL
*get_version
)(void);
168 const char * (CDECL
*get_build_id
)(void);
169 void (CDECL
*get_host_version
)( const char **sysname
, const char **release
);
171 /* loader functions */
172 NTSTATUS (CDECL
*exec_wineloader
)( char **argv
, int socketfd
, int is_child_64bit
,
173 ULONGLONG res_start
, ULONGLONG res_end
);
175 /* virtual memory functions */
176 NTSTATUS (CDECL
*map_so_dll
)( const IMAGE_NT_HEADERS
*nt_descr
, HMODULE module
);
177 NTSTATUS (CDECL
*virtual_map_section
)( HANDLE handle
, PVOID
*addr_ptr
, unsigned short zero_bits_64
, SIZE_T commit_size
,
178 const LARGE_INTEGER
*offset_ptr
, SIZE_T
*size_ptr
, ULONG alloc_type
,
179 ULONG protect
, pe_image_info_t
*image_info
);
180 void (CDECL
*virtual_get_system_info
)( SYSTEM_BASIC_INFORMATION
*info
);
181 NTSTATUS (CDECL
*virtual_create_builtin_view
)( void *module
);
182 NTSTATUS (CDECL
*virtual_alloc_thread_stack
)( INITIAL_TEB
*stack
, SIZE_T reserve_size
, SIZE_T commit_size
, SIZE_T
*pthread_size
);
183 unsigned int (CDECL
*virtual_locked_server_call
)( void *req_ptr
);
184 ssize_t (CDECL
*virtual_locked_read
)( int fd
, void *addr
, size_t size
);
185 ssize_t (CDECL
*virtual_locked_pread
)( int fd
, void *addr
, size_t size
, off_t offset
);
186 ssize_t (CDECL
*virtual_locked_recvmsg
)( int fd
, struct msghdr
*hdr
, int flags
);
187 BOOL (CDECL
*virtual_check_buffer_for_read
)( const void *ptr
, SIZE_T size
);
188 BOOL (CDECL
*virtual_check_buffer_for_write
)( void *ptr
, SIZE_T size
);
189 void (CDECL
*virtual_set_force_exec
)( BOOL enable
);
190 void (CDECL
*virtual_release_address_space
)(void);
191 void (CDECL
*virtual_set_large_address_space
)(void);
193 /* thread/process functions */
194 TEB
* (CDECL
*init_threading
)( int *nb_threads_ptr
, struct ldt_copy
**ldt_copy
, SIZE_T
*size
,
195 BOOL
*suspend
, unsigned int *cpus
, BOOL
*wow64
, timeout_t
*start_time
);
196 void (CDECL
*exit_thread
)( int status
);
197 void (CDECL
*exit_process
)( int status
);
198 NTSTATUS (CDECL
*get_thread_ldt_entry
)( HANDLE handle
, void *data
, ULONG len
, ULONG
*ret_len
);
200 /* server functions */
201 unsigned int (CDECL
*server_call
)( void *req_ptr
);
202 unsigned int (CDECL
*server_select
)( const select_op_t
*select_op
, data_size_t size
, UINT flags
,
203 timeout_t abs_timeout
, CONTEXT
*context
, RTL_CRITICAL_SECTION
*cs
,
204 user_apc_t
*user_apc
);
205 unsigned int (CDECL
*server_wait
)( const select_op_t
*select_op
, data_size_t size
, UINT flags
,
206 const LARGE_INTEGER
*timeout
);
207 void (CDECL
*server_send_fd
)( int fd
);
208 int (CDECL
*server_get_unix_fd
)( HANDLE handle
, unsigned int wanted_access
, int *unix_fd
,
209 int *needs_close
, enum server_fd_type
*type
, unsigned int *options
);
210 NTSTATUS (CDECL
*server_fd_to_handle
)( int fd
, unsigned int access
, unsigned int attributes
,
212 NTSTATUS (CDECL
*server_handle_to_fd
)( HANDLE handle
, unsigned int access
, int *unix_fd
,
213 unsigned int *options
);
214 void (CDECL
*server_release_fd
)( HANDLE handle
, int unix_fd
);
215 void (CDECL
*server_init_process_done
)( void *relay
);
217 /* debugging functions */
218 unsigned char (CDECL
*dbg_get_channel_flags
)( struct __wine_debug_channel
*channel
);
219 const char * (CDECL
*dbg_strdup
)( const char *str
);
220 int (CDECL
*dbg_output
)( const char *str
);
221 int (CDECL
*dbg_header
)( enum __wine_debug_class cls
, struct __wine_debug_channel
*channel
,
222 const char *function
);
225 #endif /* __NTDLL_UNIXLIB_H */