wine  6.0.1
About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs.
  Fossies Dox: wine-6.0.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

unix_private.h
Go to the documentation of this file.
1 /*
2  * Ntdll Unix private interface
3  *
4  * Copyright (C) 2020 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef __NTDLL_UNIX_PRIVATE_H
22 #define __NTDLL_UNIX_PRIVATE_H
23 
24 #include <pthread.h>
25 #include <signal.h>
26 #include "unixlib.h"
27 #include "wine/list.h"
28 
29 #ifdef __i386__
30 static const enum cpu_type client_cpu = CPU_x86;
31 #elif defined(__x86_64__)
32 static const enum cpu_type client_cpu = CPU_x86_64;
33 #elif defined(__arm__)
34 static const enum cpu_type client_cpu = CPU_ARM;
35 #elif defined(__aarch64__)
36 static const enum cpu_type client_cpu = CPU_ARM64;
37 #endif
38 
39 struct debug_info
40 {
41  unsigned int str_pos; /* current position in strings buffer */
42  unsigned int out_pos; /* current position in output buffer */
43  char strings[1024]; /* buffer for temporary strings */
44  char output[1024]; /* current output line */
45 };
46 
47 /* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
49 {
50  void *cpu_data[16]; /* reserved for CPU-specific data */
51  struct debug_info *debug_info; /* info for debugstr functions */
52  void *start_stack; /* stack for thread startup */
53  int request_fd; /* fd for sending server requests */
54  int reply_fd; /* fd for receiving server replies */
55  int wait_fd[2]; /* fd for sleeping server requests */
56  pthread_t pthread_id; /* pthread thread id */
57  struct list entry; /* entry in TEB list */
58  PRTL_THREAD_START_ROUTINE start; /* thread entry point */
59  void *param; /* thread entry point parameter */
60 };
61 
62 C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );
63 
64 static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
65 {
66  return (struct ntdll_thread_data *)&NtCurrentTeb()->GdiTebBatch;
67 }
68 
69 static const SIZE_T page_size = 0x1000;
70 static const SIZE_T signal_stack_mask = 0xffff;
71 #ifdef _WIN64
72 static const SIZE_T teb_size = 0x2000;
73 static const SIZE_T teb_offset = 0;
74 static const SIZE_T signal_stack_size = 0x10000 - 0x2000;
75 #else
76 static const SIZE_T teb_size = 0x3000; /* TEB64 + TEB */
77 static const SIZE_T teb_offset = 0x2000;
78 static const SIZE_T signal_stack_size = 0x10000 - 0x3000;
79 #endif
80 
81 /* callbacks to PE ntdll from the Unix side */
99 extern NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value,
100  const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
101 
103 extern NTSTATUS CDECL get_startup_info( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size ) DECLSPEC_HIDDEN;
108 extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
110 
111 extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
112  CONTEXT *context ) DECLSPEC_HIDDEN;
113 
115 
116 extern const char *home_dir DECLSPEC_HIDDEN;
117 extern const char *data_dir DECLSPEC_HIDDEN;
118 extern const char *build_dir DECLSPEC_HIDDEN;
119 extern const char *config_dir DECLSPEC_HIDDEN;
120 extern const char *user_name DECLSPEC_HIDDEN;
121 extern const char **dll_paths DECLSPEC_HIDDEN;
125 extern int main_argc DECLSPEC_HIDDEN;
126 extern char **main_argv DECLSPEC_HIDDEN;
127 extern char **main_envp DECLSPEC_HIDDEN;
129 extern unsigned int server_cpus DECLSPEC_HIDDEN;
134 extern sigset_t server_block_set DECLSPEC_HIDDEN;
136 #ifdef __i386__
137 extern struct ldt_copy __wine_ldt_copy DECLSPEC_HIDDEN;
138 #endif
139 
140 extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HIDDEN;
141 extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
142 extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
143 extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
144 extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
145 extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
147 
148 extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
149 extern void server_enter_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
150 extern void server_leave_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
151 extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
152  timeout_t abs_timeout, CONTEXT *context, pthread_mutex_t *mutex,
153  user_apc_t *user_apc ) DECLSPEC_HIDDEN;
154 extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags,
155  const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
156 extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call,
157  apc_result_t *result ) DECLSPEC_HIDDEN;
158 extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
159  int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
160 extern void server_init_process(void) DECLSPEC_HIDDEN;
161 extern void server_init_process_done(void) DECLSPEC_HIDDEN;
162 extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
163 extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
164 
165 extern NTSTATUS context_to_server( context_t *to, const CONTEXT *from ) DECLSPEC_HIDDEN;
166 extern NTSTATUS context_from_server( CONTEXT *to, const context_t *from ) DECLSPEC_HIDDEN;
170 extern void wait_suspend( CONTEXT *context ) DECLSPEC_HIDDEN;
171 extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ) DECLSPEC_HIDDEN;
172 extern NTSTATUS set_thread_context( HANDLE handle, const context_t *context, BOOL *self ) DECLSPEC_HIDDEN;
173 extern NTSTATUS get_thread_context( HANDLE handle, context_t *context, unsigned int flags, BOOL *self ) DECLSPEC_HIDDEN;
175  data_size_t *ret_len ) DECLSPEC_HIDDEN;
176 
177 extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ) DECLSPEC_HIDDEN;
178 extern void *anon_mmap_alloc( size_t size, int prot ) DECLSPEC_HIDDEN;
179 extern void virtual_init(void) DECLSPEC_HIDDEN;
184 extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN;
185 extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN;
187 extern NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size,
188  SIZE_T *pthread_size ) DECLSPEC_HIDDEN;
190 extern NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) DECLSPEC_HIDDEN;
191 extern unsigned int virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN;
192 extern ssize_t virtual_locked_read( int fd, void *addr, size_t size ) DECLSPEC_HIDDEN;
193 extern ssize_t virtual_locked_pread( int fd, void *addr, size_t size, off_t offset ) DECLSPEC_HIDDEN;
194 extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
195 extern void *virtual_setup_exception( void *stack_ptr, size_t size, EXCEPTION_RECORD *rec ) DECLSPEC_HIDDEN;
198 extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
202 extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
204 
206 extern BOOL get_thread_times( int unix_pid, int unix_tid, LARGE_INTEGER *kernel_time,
207  LARGE_INTEGER *user_time ) DECLSPEC_HIDDEN;
214  BOOL suspend, void *thunk, TEB *teb ) DECLSPEC_HIDDEN;
218 extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) DECLSPEC_HIDDEN;
219 
221  IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
222  ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
224  IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
225  ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
228  IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
229  ULONG in_size, void *out_buffer, ULONG out_size ) DECLSPEC_HIDDEN;
230 
232 extern NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **name_ret, UINT disposition ) DECLSPEC_HIDDEN;
233 extern NTSTATUS unix_to_nt_file_name( const char *name, WCHAR **nt ) DECLSPEC_HIDDEN;
234 extern NTSTATUS open_unix_file( HANDLE *handle, const char *unix_name, ACCESS_MASK access,
235  OBJECT_ATTRIBUTES *attr, ULONG attributes, ULONG sharing, ULONG disposition,
236  ULONG options, void *ea_buffer, ULONG ea_length ) DECLSPEC_HIDDEN;
237 extern void init_files(void) DECLSPEC_HIDDEN;
238 extern void init_cpu_info(void) DECLSPEC_HIDDEN;
239 
240 extern void dbg_init(void) DECLSPEC_HIDDEN;
241 
243  ULONG_PTR arg1, ULONG_PTR arg2,
245  void (WINAPI *dispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) ) DECLSPEC_HIDDEN;
247  NTSTATUS (WINAPI *dispatcher)(EXCEPTION_RECORD*,CONTEXT*) ) DECLSPEC_HIDDEN;
249 
251 extern void set_syscall_frame(void *frame) DECLSPEC_HIDDEN;
252 
253 #define TICKSPERSEC 10000000
254 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)86400)
255 
257 {
258  if (sizeof(time_t) == sizeof(int)) /* time_t may be signed */
260  else
262 }
263 
264 static inline const char *debugstr_us( const UNICODE_STRING *us )
265 {
266  if (!us) return "<null>";
267  return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
268 }
269 
270 /* convert from straight ASCII to Unicode without depending on the current codepage */
271 static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
272 {
273  while (len--) *dst++ = (unsigned char)*src++;
274 }
275 
277 {
278  IMAGE_DOS_HEADER *module = (IMAGE_DOS_HEADER *)NtCurrentTeb()->Peb->ImageBaseAddress;
279  return (IMAGE_NT_HEADERS *)((char *)module + module->e_lfanew);
280 }
281 
282 static inline void *get_signal_stack(void)
283 {
284  return (char *)NtCurrentTeb() + teb_size - teb_offset;
285 }
286 
287 static inline void mutex_lock( pthread_mutex_t *mutex )
288 {
289  if (!process_exiting) pthread_mutex_lock( mutex );
290 }
291 
292 static inline void mutex_unlock( pthread_mutex_t *mutex )
293 {
294  if (!process_exiting) pthread_mutex_unlock( mutex );
295 }
296 
297 #ifndef _WIN64
298 static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
299 #endif
300 
301 struct xcontext
302 {
303  CONTEXT c;
306 };
307 
308 #if defined(__i386__) || defined(__x86_64__)
309 static inline XSTATE *xstate_from_context( const CONTEXT *context )
310 {
311  CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1);
312 
313  if ((context->ContextFlags & CONTEXT_XSTATE) != CONTEXT_XSTATE)
314  return NULL;
315 
316  return (XSTATE *)((char *)(context + 1) + xctx->XState.Offset);
317 }
318 
319 static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
320 {
321  CONTEXT_EX *xctx;
322 
323  xctx = (CONTEXT_EX *)(context + 1);
324  xctx->Legacy.Length = sizeof(CONTEXT);
325  xctx->Legacy.Offset = -(LONG)sizeof(CONTEXT);
326 
327  xctx->XState.Length = sizeof(XSTATE);
328  xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx;
329 
330  xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
331  xctx->All.Offset = -(LONG)sizeof(CONTEXT);
332  context->ContextFlags |= 0x40;
333 }
334 
335 static inline void xstate_to_server( context_t *to, const XSTATE *xs )
336 {
337  if (!xs)
338  return;
339 
341  if (xs->Mask & 4)
342  memcpy(&to->ymm.ymm_high_regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext));
343  else
344  memset(&to->ymm.ymm_high_regs.ymm_high, 0, sizeof(xs->YmmContext));
345 }
346 
347 static inline void xstate_from_server_( XSTATE *xs, const context_t *from, BOOL compaction_enabled)
348 {
349  if (!xs)
350  return;
351 
352  xs->Mask = 0;
353  xs->CompactionMask = compaction_enabled ? 0x8000000000000004 : 0;
354 
355  if (from->flags & SERVER_CTX_YMM_REGISTERS)
356  {
357  unsigned long *src = (unsigned long *)&from->ymm.ymm_high_regs.ymm_high;
358  unsigned int i;
359 
360  for (i = 0; i < sizeof(xs->YmmContext) / sizeof(unsigned long); ++i)
361  if (src[i])
362  {
363  memcpy( &xs->YmmContext, &from->ymm.ymm_high_regs.ymm_high, sizeof(xs->YmmContext) );
364  xs->Mask = 4;
365  break;
366  }
367  }
368 }
369 #define xstate_from_server( xs, from ) xstate_from_server_( xs, from, user_shared_data->XState.CompactionEnabled )
370 
371 #else
372 static inline XSTATE *xstate_from_context( const CONTEXT *context )
373 {
374  return NULL;
375 }
376 static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
377 {
378 }
379 #endif
380 
381 static inline size_t ntdll_wcslen( const WCHAR *str )
382 {
383  const WCHAR *s = str;
384  while (*s) s++;
385  return s - str;
386 }
387 
388 static inline WCHAR *ntdll_wcscpy( WCHAR *dst, const WCHAR *src )
389 {
390  WCHAR *p = dst;
391  while ((*p++ = *src++));
392  return dst;
393 }
394 
395 static inline WCHAR *ntdll_wcscat( WCHAR *dst, const WCHAR *src )
396 {
397  ntdll_wcscpy( dst + ntdll_wcslen(dst), src );
398  return dst;
399 }
400 
401 static inline int ntdll_wcscmp( const WCHAR *str1, const WCHAR *str2 )
402 {
403  while (*str1 && (*str1 == *str2)) { str1++; str2++; }
404  return *str1 - *str2;
405 }
406 
407 static inline int ntdll_wcsncmp( const WCHAR *str1, const WCHAR *str2, int n )
408 {
409  if (n <= 0) return 0;
410  while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
411  return *str1 - *str2;
412 }
413 
414 static inline WCHAR *ntdll_wcschr( const WCHAR *str, WCHAR ch )
415 {
416  do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
417  return NULL;
418 }
419 
420 static inline WCHAR *ntdll_wcsrchr( const WCHAR *str, WCHAR ch )
421 {
422  WCHAR *ret = NULL;
423  do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
424  return ret;
425 }
426 
427 static inline WCHAR *ntdll_wcspbrk( const WCHAR *str, const WCHAR *accept )
428 {
429  for ( ; *str; str++) if (ntdll_wcschr( accept, *str )) return (WCHAR *)(ULONG_PTR)str;
430  return NULL;
431 }
432 
433 static inline WCHAR ntdll_towupper( WCHAR ch )
434 {
435  return ch + uctable[uctable[uctable[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0x0f)];
436 }
437 
438 static inline WCHAR ntdll_towlower( WCHAR ch )
439 {
440  return ch + lctable[lctable[lctable[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0x0f)];
441 }
442 
443 static inline WCHAR *ntdll_wcsupr( WCHAR *str )
444 {
445  WCHAR *ret;
446  for (ret = str; *str; str++) *str = ntdll_towupper(*str);
447  return ret;
448 }
449 
450 static inline int ntdll_wcsicmp( const WCHAR *str1, const WCHAR *str2 )
451 {
452  int ret;
453  for (;;)
454  {
455  if ((ret = ntdll_towupper( *str1 ) - ntdll_towupper( *str2 )) || !*str1) return ret;
456  str1++;
457  str2++;
458  }
459 }
460 
461 static inline int ntdll_wcsnicmp( const WCHAR *str1, const WCHAR *str2, int n )
462 {
463  int ret;
464  for (ret = 0; n > 0; n--, str1++, str2++)
465  if ((ret = ntdll_towupper(*str1) - ntdll_towupper(*str2)) || !*str1) break;
466  return ret;
467 }
468 
469 #define wcslen(str) ntdll_wcslen(str)
470 #define wcscpy(dst,src) ntdll_wcscpy(dst,src)
471 #define wcscat(dst,src) ntdll_wcscat(dst,src)
472 #define wcscmp(s1,s2) ntdll_wcscmp(s1,s2)
473 #define wcsncmp(s1,s2,n) ntdll_wcsncmp(s1,s2,n)
474 #define wcschr(str,ch) ntdll_wcschr(str,ch)
475 #define wcsrchr(str,ch) ntdll_wcsrchr(str,ch)
476 #define wcspbrk(str,ac) ntdll_wcspbrk(str,ac)
477 #define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2)
478 #define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n)
479 #define wcsupr(str) ntdll_wcsupr(str)
480 #define towupper(c) ntdll_towupper(c)
481 #define towlower(c) ntdll_towlower(c)
482 
483 #endif /* __NTDLL_UNIX_PRIVATE_H */
unsigned long long ULONG64
Definition: basetsd.h:99
unsigned long ULONG_PTR
Definition: basetsd.h:130
ULONG_PTR SIZE_T
Definition: basetsd.h:264
LONG NTSTATUS
Definition: bcrypt.h:40
#define WINAPI
Definition: bcrypt.h:23
Definition: output.pm:7
Definition: type.pm:7
#define DECLSPEC_NORETURN
Definition: corecrt.h:136
__time32_t time_t
Definition: corecrt.h:233
static void * context_ptr(context_t *context)
unsigned char ch[4][2]
Definition: console.c:108
void * memcpy(void *dst, const void *src, size_t n)
Definition: string.c:2580
void * memset(void *dst, int c, size_t n)
Definition: string.c:2588
const char * home_dir
Definition: loader.c:123
void(* pLdrInitializeThunk)(CONTEXT *, void **, ULONG_PTR, ULONG_PTR)
Definition: loader.c:101
NTSTATUS(* pKiUserExceptionDispatcher)(EXCEPTION_RECORD *, CONTEXT *)
Definition: loader.c:100
void(* pRtlUserThreadStart)(PRTL_THREAD_START_ROUTINE entry, void *arg)
Definition: loader.c:102
const char * build_dir
Definition: loader.c:125
void(* pKiUserApcDispatcher)(CONTEXT *, ULONG_PTR, ULONG_PTR, ULONG_PTR, PNTAPCFUNC)
Definition: loader.c:99
const char * data_dir
Definition: loader.c:124
const char * config_dir
Definition: loader.c:126
const char * user_name
Definition: loader.c:128
const char ** dll_paths
Definition: loader.c:127
void(* pDbgUiRemoteBreakin)(void *arg)
Definition: loader.c:97
NTSTATUS(* pKiRaiseUserExceptionDispatcher)(void)
Definition: loader.c:98
sigset_t server_block_set
Definition: server.c:112
unsigned int server_cpus
Definition: server.c:106
BOOL process_exiting
Definition: server.c:108
timeout_t server_start_time
Definition: server.c:110
unsigned int UINT
Definition: dxgicommon.idl:20
long BOOL
Definition: dxgitype.idl:24
static const char * debugstr_wn(const WCHAR *wstr, unsigned int n)
Definition: emf.c:48
NTSTATUS status
Definition: except.c:81
GLuint err
Definition: glu.c:32
const char * str
Definition: glu.c:32
static unsigned char * in_buffer
Definition: iccvid.c:87
static int access(const char *path, int mode)
Definition: io.h:110
BYTE flags
Definition: ioports.c:48
static const struct _KUSER_SHARED_DATA * user_shared_data
Definition: sync.c:45
struct version_info info
Definition: version.c:140
BOOL is_wow64
Definition: main.c:37
const IMAGE_NT_HEADERS * nt
Definition: loader.c:73
MonoAssembly int argc
static void size_t len
ULONG start
Definition: error.c:1729
ULONG offset
Definition: error.c:1729
USHORT * data
Definition: env.c:81
USHORT * lctable
Definition: env.c:65
SIZE_T startup_info_size
Definition: env.c:66
int main_argc
Definition: env.c:68
USHORT * uctable
Definition: env.c:65
WCHAR ** main_wargv
Definition: env.c:71
char ** main_envp
Definition: env.c:70
char ** main_argv
Definition: env.c:69
PSecurityUserData *typedef PSECPKG_EXTENDED_INFORMATION *typedef ULONG
Definition: ntsecpkg.h:377
HRESULT(* func)(HTMLDocumentNode *, DWORD, VARIANT *, VARIANT *)
Definition: olecmd.c:734
select_op
long long timeout_t
cpu_type
@ CPU_ARM
@ CPU_x86_64
@ CPU_x86
@ CPU_ARM64
#define SERVER_CTX_YMM_REGISTERS
server_fd_type
unsigned int data_size_t
ULONG Length
Definition: winnt.h:1402
LONG Offset
Definition: winnt.h:1401
CONTEXT_CHUNK XState
Definition: winnt.h:1409
CONTEXT_CHUNK All
Definition: winnt.h:1407
CONTEXT_CHUNK Legacy
Definition: winnt.h:1408
Definition: winternl.h:396
USHORT Length
Definition: ntsecapi.h:154
ULONG64 Mask
Definition: winnt.h:1393
YMMCONTEXT YmmContext
Definition: winnt.h:1396
ULONG64 CompactionMask
Definition: winnt.h:1394
Definition: cookie.c:202
Definition: inflate.c:134
struct context_t::@1658::@1683 ymm_high_regs
union context_t::@1658 ymm
unsigned int flags
char strings[1024]
Definition: unix_private.h:43
unsigned int out_pos
Definition: unix_private.h:42
unsigned int str_pos
Definition: unix_private.h:41
Definition: change.c:84
Definition: filter.c:184
Definition: fd.c:176
Definition: list.h:27
Definition: msvcp90.h:319
Definition: name.c:36
void * cpu_data[16]
Definition: unix_private.h:50
PRTL_THREAD_START_ROUTINE start
Definition: unix_private.h:58
struct debug_info * debug_info
Definition: unix_private.h:51
struct list entry
Definition: unix_private.h:57
pthread_t pthread_id
Definition: unix_private.h:56
Definition: ticket.c:41
Definition: task.c:44
CONTEXT c
Definition: unix_private.h:303
ULONG64 host_compaction_mask
Definition: unix_private.h:305
CONTEXT_EX c_ex
Definition: unix_private.h:304
static time_t time(time_t *t)
Definition: time.h:105
#define off_t
Definition: types.h:60
int ssize_t
Definition: types.h:71
#define NULL
Definition: ungif.h:66
Definition: pdh_main.c:90
void signal_init_process(void) DECLSPEC_HIDDEN
NTSTATUS CDECL fast_RtlAcquireSRWLockShared(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2609
static int ntdll_wcsnicmp(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unix_private.h:461
void virtual_fill_image_information(const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info) DECLSPEC_HIDDEN
Definition: virtual.c:4095
char ** build_envp(const WCHAR *envW) DECLSPEC_HIDDEN
Definition: env.c:766
#define TICKSPERSEC
Definition: unix_private.h:253
static WCHAR * ntdll_wcscpy(WCHAR *dst, const WCHAR *src)
Definition: unix_private.h:388
void virtual_map_user_shared_data(void) DECLSPEC_HIDDEN
Definition: virtual.c:2797
void CDECL get_initial_console(RTL_USER_PROCESS_PARAMETERS *params) DECLSPEC_HIDDEN
Definition: env.c:1248
static const SIZE_T signal_stack_mask
Definition: unix_private.h:70
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
Definition: tape.c:520
void * virtual_setup_exception(void *stack_ptr, size_t size, EXCEPTION_RECORD *rec) DECLSPEC_HIDDEN
Definition: virtual.c:2894
static WCHAR * ntdll_wcsrchr(const WCHAR *str, WCHAR ch)
Definition: unix_private.h:420
static void * get_signal_stack(void)
Definition: unix_private.h:282
void virtual_init(void) DECLSPEC_HIDDEN
Definition: virtual.c:2376
unsigned int server_wait(const select_op_t *select_op, data_size_t size, UINT flags, const LARGE_INTEGER *timeout) DECLSPEC_HIDDEN
Definition: server.c:690
static const SIZE_T page_size
Definition: unix_private.h:69
void CDECL get_initial_directory(UNICODE_STRING *dir) DECLSPEC_HIDDEN
Definition: env.c:1292
unsigned int server_select(const select_op_t *select_op, data_size_t size, UINT flags, timeout_t abs_timeout, CONTEXT *context, pthread_mutex_t *mutex, user_apc_t *user_apc) DECLSPEC_HIDDEN
Definition: server.c:604
void WINAPI call_user_exception_dispatcher(EXCEPTION_RECORD *rec, CONTEXT *context, NTSTATUS(WINAPI *dispatcher)(EXCEPTION_RECORD *, CONTEXT *)) DECLSPEC_HIDDEN
void exec_process(NTSTATUS status) DECLSPEC_HIDDEN
Definition: process.c:616
void(WINAPI *pDbgUiRemoteBreakin)(void *arg) DECLSPEC_HIDDEN
NTSTATUS CDECL fast_RtlTryAcquireSRWLockExclusive(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2594
USHORT *CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN
Definition: env.c:1359
static const char * debugstr_us(const UNICODE_STRING *us)
Definition: unix_private.h:264
#define SECS_1601_TO_1970
Definition: unix_private.h:254
static IMAGE_NT_HEADERS * get_exe_nt_header(void)
Definition: unix_private.h:276
void wait_suspend(CONTEXT *context) DECLSPEC_HIDDEN
Definition: thread.c:341
NTSTATUS CDECL get_startup_info(startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size) DECLSPEC_HIDDEN
Definition: env.c:1170
void init_environment(int argc, char *argv[], char *envp[]) DECLSPEC_HIDDEN
Definition: env.c:1046
NTSTATUS errno_to_status(int err) DECLSPEC_HIDDEN
Definition: file.c:333
void abort_thread(int status) DECLSPEC_HIDDEN
Definition: thread.c:285
void WINAPI call_user_apc_dispatcher(CONTEXT *context_ptr, ULONG_PTR ctx, ULONG_PTR arg1, ULONG_PTR arg2, PNTAPCFUNC func, void(WINAPI *dispatcher)(CONTEXT *, ULONG_PTR, ULONG_PTR, ULONG_PTR, PNTAPCFUNC)) DECLSPEC_HIDDEN
static WCHAR * ntdll_wcschr(const WCHAR *str, WCHAR ch)
Definition: unix_private.h:414
PNTAPCFUNC DECLSPEC_HIDDEN
Definition: unix_private.h:84
C_ASSERT(sizeof(struct ntdll_thread_data)<=sizeof(((TEB *) 0) ->GdiTebBatch))
DWORD ntdll_umbstowcs(const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen) DECLSPEC_HIDDEN
Definition: locale.c:592
SIZE_T virtual_uninterrupted_read_memory(const void *addr, void *buffer, SIZE_T size) DECLSPEC_HIDDEN
Definition: virtual.c:3168
NTSTATUS alloc_object_attributes(const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret, data_size_t *ret_len) DECLSPEC_HIDDEN
Definition: sync.c:206
void server_leave_uninterrupted_section(pthread_mutex_t *mutex, sigset_t *sigset) DECLSPEC_HIDDEN
Definition: server.c:308
void virtual_free_teb(TEB *teb) DECLSPEC_HIDDEN
Definition: virtual.c:2661
NTSTATUS exec_wineloader(char **argv, int socketfd, const pe_image_info_t *pe_info) DECLSPEC_HIDDEN
Definition: loader.c:484
void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN
void CDECL set_show_dot_files(BOOL enable) DECLSPEC_HIDDEN
Definition: file.c:3500
static void ascii_to_unicode(WCHAR *dst, const char *src, size_t len)
Definition: unix_private.h:271
NTSTATUS get_thread_context(HANDLE handle, context_t *context, unsigned int flags, BOOL *self) DECLSPEC_HIDDEN
Definition: thread.c:603
void * anon_mmap_fixed(void *start, size_t size, int prot, int flags) DECLSPEC_HIDDEN
Definition: virtual.c:213
NTSTATUS CDECL unwind_builtin_dll(ULONG type, struct _DISPATCHER_CONTEXT *dispatch, CONTEXT *context) DECLSPEC_HIDDEN
NTSTATUS CDECL fast_RtlAcquireSRWLockExclusive(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2599
LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN
NTSTATUS open_unix_file(HANDLE *handle, const char *unix_name, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, ULONG attributes, ULONG sharing, ULONG disposition, ULONG options, void *ea_buffer, ULONG ea_length) DECLSPEC_HIDDEN
Definition: file.c:3511
static ULONGLONG ticks_from_time_t(time_t time)
Definition: unix_private.h:256
void abort_process(int status) DECLSPEC_HIDDEN
Definition: thread.c:296
size_t server_init_thread(void *entry_point, BOOL *suspend) DECLSPEC_HIDDEN
Definition: server.c:1530
NTSTATUS virtual_handle_fault(void *addr, DWORD err, void *stack) DECLSPEC_HIDDEN
Definition: virtual.c:2853
void set_syscall_frame(void *frame) DECLSPEC_HIDDEN
BOOL virtual_is_valid_code_address(const void *addr, SIZE_T size) DECLSPEC_HIDDEN
Definition: virtual.c:3080
NTSTATUS(WINAPI *pKiRaiseUserExceptionDispatcher)(void) DECLSPEC_HIDDEN
static XSTATE * xstate_from_context(const CONTEXT *context)
Definition: unix_private.h:372
NTSTATUS CDECL get_initial_environment(WCHAR **wargv[], WCHAR *env, SIZE_T *size) DECLSPEC_HIDDEN
Definition: env.c:1082
static void context_init_xstate(CONTEXT *context, void *xstate_buffer)
Definition: unix_private.h:376
void virtual_set_force_exec(BOOL enable) DECLSPEC_HIDDEN
Definition: virtual.c:3228
NTSTATUS virtual_alloc_thread_stack(INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size) DECLSPEC_HIDDEN
Definition: virtual.c:2728
unsigned int virtual_locked_server_call(void *req_ptr) DECLSPEC_HIDDEN
Definition: virtual.c:2973
TEB * virtual_alloc_first_teb(void) DECLSPEC_HIDDEN
Definition: virtual.c:2566
static const SIZE_T teb_offset
Definition: unix_private.h:77
NTSTATUS virtual_uninterrupted_write_memory(void *addr, const void *buffer, SIZE_T size) DECLSPEC_HIDDEN
Definition: virtual.c:3204
void fill_vm_counters(VM_COUNTERS_EX *pvmi, int unix_pid) DECLSPEC_HIDDEN
Definition: process.c:1162
void signal_init_thread(TEB *teb) DECLSPEC_HIDDEN
void start_server(BOOL debug) DECLSPEC_HIDDEN
Definition: loader.c:582
static WCHAR * ntdll_wcsupr(WCHAR *str)
Definition: unix_private.h:443
NTSTATUS context_from_server(CONTEXT *to, const context_t *from) DECLSPEC_HIDDEN
NTSTATUS unix_to_nt_file_name(const char *name, WCHAR **nt) DECLSPEC_HIDDEN
Definition: file.c:3394
void init_cpu_info(void) DECLSPEC_HIDDEN
Definition: system.c:478
NTSTATUS CDECL fast_RtlWakeConditionVariable(RTL_CONDITION_VARIABLE *variable, int count) DECLSPEC_HIDDEN
Definition: sync.c:2624
void * anon_mmap_alloc(size_t size, int prot) DECLSPEC_HIDDEN
Definition: virtual.c:219
NTSTATUS CDECL fast_RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *crit) DECLSPEC_HIDDEN
Definition: sync.c:2223
NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2604
NTSTATUS serial_FlushBuffersFile(int fd) DECLSPEC_HIDDEN
Definition: serial.c:1386
int ntdll_wcstoumbs(const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict) DECLSPEC_HIDDEN
Definition: locale.c:607
unsigned int server_queue_process_apc(HANDLE process, const apc_call_t *call, apc_result_t *result) DECLSPEC_HIDDEN
Definition: server.c:733
void CDECL get_locales(WCHAR *sys, WCHAR *user) DECLSPEC_HIDDEN
Definition: env.c:1370
void init_files(void) DECLSPEC_HIDDEN
Definition: file.c:2732
NTSTATUS virtual_alloc_teb(TEB **ret_teb) DECLSPEC_HIDDEN
Definition: virtual.c:2609
static struct ntdll_thread_data * ntdll_get_thread_data(void)
Definition: unix_private.h:64
NTSTATUS get_thread_ldt_entry(HANDLE handle, void *data, ULONG len, ULONG *ret_len) DECLSPEC_HIDDEN
NTSTATUS CDECL fast_RtlReleaseSRWLockExclusive(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2614
ssize_t virtual_locked_pread(int fd, void *addr, size_t size, off_t offset) DECLSPEC_HIDDEN
void signal_start_thread(PRTL_THREAD_START_ROUTINE entry, void *arg, BOOL suspend, void *thunk, TEB *teb) DECLSPEC_HIDDEN
void server_enter_uninterrupted_section(pthread_mutex_t *mutex, sigset_t *sigset) DECLSPEC_HIDDEN
Definition: server.c:298
void * get_syscall_frame(void) DECLSPEC_HIDDEN
static int ntdll_wcscmp(const WCHAR *str1, const WCHAR *str2)
Definition: unix_private.h:401
ULONG_PTR
Definition: unix_private.h:84
NTSTATUS nt_to_unix_file_name(const UNICODE_STRING *nameW, char **name_ret, UINT disposition) DECLSPEC_HIDDEN
Definition: file.c:3259
NTSTATUS CDECL fast_RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *crit) DECLSPEC_HIDDEN
Definition: sync.c:2218
void WINAPI call_raise_user_exception_dispatcher(NTSTATUS(WINAPI *dispatcher)(void)) DECLSPEC_HIDDEN
void signal_init_threading(void) DECLSPEC_HIDDEN
void signal_exit_thread(int status, void(*func)(int)) DECLSPEC_HIDDEN
static WCHAR * ntdll_wcspbrk(const WCHAR *str, const WCHAR *accept)
Definition: unix_private.h:427
NTSTATUS CDECL fast_RtlReleaseSRWLockShared(RTL_SRWLOCK *lock) DECLSPEC_HIDDEN
Definition: sync.c:2619
static int ntdll_wcsncmp(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unix_private.h:407
ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN
Definition: virtual.c:2442
void dbg_init(void) DECLSPEC_HIDDEN
Definition: debug.c:293
ULONG_PTR get_image_address(void) DECLSPEC_HIDDEN
Definition: loader.c:1467
void virtual_get_system_info(SYSTEM_BASIC_INFORMATION *info) DECLSPEC_HIDDEN
Definition: virtual.c:2452
static void mutex_unlock(pthread_mutex_t *mutex)
Definition: unix_private.h:292
NTSTATUS CDECL fast_wait_cv(RTL_CONDITION_VARIABLE *variable, const void *value, const LARGE_INTEGER *timeout) DECLSPEC_HIDDEN
Definition: sync.c:2629
static WCHAR ntdll_towlower(WCHAR ch)
Definition: unix_private.h:438
NTSTATUS signal_alloc_thread(TEB *teb) DECLSPEC_HIDDEN
BOOL virtual_check_buffer_for_write(void *ptr, SIZE_T size) DECLSPEC_HIDDEN
Definition: virtual.c:3133
NTSTATUS context_to_server(context_t *to, const CONTEXT *from) DECLSPEC_HIDDEN
static const SIZE_T signal_stack_size
Definition: unix_private.h:78
void signal_free_thread(TEB *teb) DECLSPEC_HIDDEN
static const SIZE_T teb_size
Definition: unix_private.h:76
BOOL get_thread_times(int unix_pid, int unix_tid, LARGE_INTEGER *kernel_time, LARGE_INTEGER *user_time) DECLSPEC_HIDDEN
Definition: thread.c:808
NTSTATUS virtual_clear_tls_index(ULONG index) DECLSPEC_HIDDEN
Definition: virtual.c:2692
static WCHAR * ntdll_wcscat(WCHAR *dst, const WCHAR *src)
Definition: unix_private.h:395
int server_pipe(int fd[2]) DECLSPEC_HIDDEN
Definition: server.c:1118
NTSTATUS virtual_create_builtin_view(void *module) DECLSPEC_HIDDEN
Definition: virtual.c:2486
void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN
Definition: virtual.c:3277
BOOL virtual_check_buffer_for_read(const void *ptr, SIZE_T size) DECLSPEC_HIDDEN
Definition: virtual.c:3099
NTSTATUS set_thread_context(HANDLE handle, const context_t *context, BOOL *self) DECLSPEC_HIDDEN
Definition: thread.c:583
static int ntdll_wcsicmp(const WCHAR *str1, const WCHAR *str2)
Definition: unix_private.h:450
int server_get_unix_fd(HANDLE handle, unsigned int wanted_access, int *unix_fd, int *needs_close, enum server_fd_type *type, unsigned int *options) DECLSPEC_HIDDEN
Definition: server.c:1007
unsigned int server_call_unlocked(void *req_ptr) DECLSPEC_HIDDEN
Definition: server.c:268
NTSTATUS CDECL fast_RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *crit, int timeout) DECLSPEC_HIDDEN
Definition: sync.c:2213
NTSTATUS send_debug_event(EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance) DECLSPEC_HIDDEN
Definition: thread.c:356
ssize_t virtual_locked_read(int fd, void *addr, size_t size) DECLSPEC_HIDDEN
Definition: virtual.c:2999
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
Definition: serial.c:1342
void server_init_process(void) DECLSPEC_HIDDEN
Definition: server.c:1417
void server_init_process_done(void) DECLSPEC_HIDDEN
Definition: server.c:1479
void exit_process(int status) DECLSPEC_HIDDEN
Definition: thread.c:329
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
Definition: cdrom.c:2823
static size_t ntdll_wcslen(const WCHAR *str)
Definition: unix_private.h:381
NTSTATUS CDECL get_dynamic_environment(WCHAR *env, SIZE_T *size) DECLSPEC_HIDDEN
Definition: env.c:1196
void virtual_set_large_address_space(void) DECLSPEC_HIDDEN
Definition: virtual.c:3317
static TEB64 * NtCurrentTeb64(void)
Definition: unix_private.h:298
static WCHAR ntdll_towupper(WCHAR ch)
Definition: unix_private.h:433
static void mutex_lock(pthread_mutex_t *mutex)
Definition: unix_private.h:287
#define CDECL
Definition: windef.h:198
unsigned char BYTE
Definition: windef.h:250
unsigned int DWORD
Definition: windef.h:261
unsigned short USHORT
Definition: windef.h:239
#define enable(id)
Definition: winecfg.h:125
DWORD ACCESS_MASK
Definition: winnt.h:4351
unsigned short WCHAR
Definition: winnt.h:468
int LONG
Definition: winnt.h:459
unsigned long long ULONGLONG
Definition: winnt.h:485
signed long long LONGLONG
Definition: winnt.h:484
struct _TEB * NtCurrentTeb(void)
struct _XSTATE XSTATE
void(* PRTL_THREAD_START_ROUTINE)(LPVOID)
Definition: winternl.h:2279
void(* PNTAPCFUNC)(ULONG_PTR, ULONG_PTR, ULONG_PTR)
Definition: winternl.h:2278
void(* PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG)
Definition: winternl.h:1477
int prot
Definition: socket.c:6314