wow64: Add thunks for the I/O completion syscalls.
[wine.git] / dlls / ntdll / ntdll_misc.h
blobacb927a91712d234cc2becab0e3c734c7de9bb41
1 /*
2 * Copyright 2000 Juergen Schmied
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_NTDLL_MISC_H
20 #define __WINE_NTDLL_MISC_H
22 #include <stdarg.h>
23 #include <sys/types.h>
25 #include "windef.h"
26 #include "winnt.h"
27 #include "winternl.h"
28 #include "unixlib.h"
29 #include "wine/asm.h"
31 #define DECLARE_CRITICAL_SECTION(cs) \
32 static RTL_CRITICAL_SECTION cs; \
33 static RTL_CRITICAL_SECTION_DEBUG cs##_debug = \
34 { 0, 0, &cs, { &cs##_debug.ProcessLocksList, &cs##_debug.ProcessLocksList }, \
35 0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \
36 static RTL_CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 };
38 #define MAX_NT_PATH_LENGTH 277
40 #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
41 static const UINT_PTR page_size = 0x1000;
42 #else
43 extern UINT_PTR page_size DECLSPEC_HIDDEN;
44 #endif
46 /* exceptions */
47 extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ) DECLSPEC_HIDDEN;
48 extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ) DECLSPEC_HIDDEN;
49 extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr ) DECLSPEC_HIDDEN;
51 extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
52 extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
53 extern void WINAPI KiUserApcDispatcher(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
55 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
56 extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_DATA_TABLE_ENTRY **module ) DECLSPEC_HIDDEN;
57 #endif
59 /* debug helpers */
60 extern LPCSTR debugstr_us( const UNICODE_STRING *str ) DECLSPEC_HIDDEN;
61 extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
63 /* init routines */
64 extern void version_init(void) DECLSPEC_HIDDEN;
65 extern void debug_init(void) DECLSPEC_HIDDEN;
66 extern void actctx_init(void) DECLSPEC_HIDDEN;
67 extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
68 extern void init_user_process_params(void) DECLSPEC_HIDDEN;
69 extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
71 /* module handling */
72 extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
73 extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
74 DWORD exp_size, FARPROC proc, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
75 extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
76 FARPROC origfun, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
77 extern void RELAY_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
78 extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
79 extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
80 extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
81 extern HMODULE kernel32_handle DECLSPEC_HIDDEN;
83 extern void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) DECLSPEC_HIDDEN;
84 extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
86 extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
88 extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
89 extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
91 struct dllredirect_data
93 ULONG size;
94 ULONG flags;
95 ULONG total_len;
96 ULONG paths_count;
97 ULONG paths_offset;
98 struct { ULONG len; ULONG offset; } paths[1];
101 #define DLL_REDIRECT_PATH_INCLUDES_BASE_NAME 1
102 #define DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT 2
103 #define DLL_REDIRECT_PATH_EXPAND 4
104 #define DLL_REDIRECT_PATH_SYSTEM_DEFAULT_REDIRECTED_SYSTEM32_DLL 8
106 #ifdef _WIN64
107 static inline TEB64 *NtCurrentTeb64(void) { return NULL; }
108 #else
109 static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
110 #endif
112 #define HASH_STRING_ALGORITHM_DEFAULT 0
113 #define HASH_STRING_ALGORITHM_X65599 1
114 #define HASH_STRING_ALGORITHM_INVALID 0xffffffff
116 NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
118 /* convert from straight ASCII to Unicode without depending on the current codepage */
119 static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
121 while (len--) *dst++ = (unsigned char)*src++;
124 /* FLS data */
125 extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN;
127 #endif