ddraw: Move the wined3d_texture_update_desc() call into ddraw_surface_create_wined3d_...
[wine.git] / dlls / ntdll / ntdll_misc.h
blobf6b77b79cde748ab8af9cc7985e5732951545650
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 <stdlib.h>
24 #include <sys/types.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winnt.h"
29 #include "winternl.h"
30 #include "unixlib.h"
31 #include "wine/asm.h"
33 #define DECLARE_CRITICAL_SECTION(cs) \
34 static RTL_CRITICAL_SECTION cs; \
35 static RTL_CRITICAL_SECTION_DEBUG cs##_debug = \
36 { 0, 0, &cs, { &cs##_debug.ProcessLocksList, &cs##_debug.ProcessLocksList }, \
37 0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \
38 static RTL_CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 };
40 #define MAX_NT_PATH_LENGTH 277
42 #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
43 static const UINT_PTR page_size = 0x1000;
44 #else
45 extern UINT_PTR page_size DECLSPEC_HIDDEN;
46 #endif
48 /* exceptions */
49 extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ) DECLSPEC_HIDDEN;
50 extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ) DECLSPEC_HIDDEN;
51 extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr ) DECLSPEC_HIDDEN;
53 extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
54 extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
55 extern void WINAPI KiUserApcDispatcher(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
56 extern void WINAPI KiUserCallbackDispatcher(ULONG,void*,ULONG) DECLSPEC_HIDDEN;
57 extern void (WINAPI *pWow64PrepareForException)( EXCEPTION_RECORD *rec, CONTEXT *context ) DECLSPEC_HIDDEN;
59 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
60 extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_DATA_TABLE_ENTRY **module ) DECLSPEC_HIDDEN;
61 #endif
63 /* debug helpers */
64 extern LPCSTR debugstr_us( const UNICODE_STRING *str ) DECLSPEC_HIDDEN;
65 extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
66 extern void set_native_thread_name( DWORD tid, const char *name ) DECLSPEC_HIDDEN;
68 /* init routines */
69 extern void version_init(void) DECLSPEC_HIDDEN;
70 extern void debug_init(void) DECLSPEC_HIDDEN;
71 extern void actctx_init(void) DECLSPEC_HIDDEN;
72 extern void locale_init(void) DECLSPEC_HIDDEN;
73 extern void init_user_process_params(void) DECLSPEC_HIDDEN;
74 extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
75 extern void get_resource_lcids( LANGID *user, LANGID *user_neutral, LANGID *system ) DECLSPEC_HIDDEN;
77 /* module handling */
78 extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
79 extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
80 DWORD exp_size, FARPROC proc, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
81 extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
82 FARPROC origfun, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
83 extern void RELAY_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
84 extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
85 extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
86 extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
88 extern void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) DECLSPEC_HIDDEN;
90 extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
92 extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, va_list args ) DECLSPEC_HIDDEN;
93 extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, va_list args ) DECLSPEC_HIDDEN;
95 struct dllredirect_data
97 ULONG size;
98 ULONG flags;
99 ULONG total_len;
100 ULONG paths_count;
101 ULONG paths_offset;
102 struct { ULONG len; ULONG offset; } paths[1];
105 #define DLL_REDIRECT_PATH_INCLUDES_BASE_NAME 1
106 #define DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT 2
107 #define DLL_REDIRECT_PATH_EXPAND 4
108 #define DLL_REDIRECT_PATH_SYSTEM_DEFAULT_REDIRECTED_SYSTEM32_DLL 8
110 #ifdef _WIN64
111 static inline TEB64 *NtCurrentTeb64(void) { return NULL; }
112 #else
113 static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
114 #endif
116 #define HASH_STRING_ALGORITHM_DEFAULT 0
117 #define HASH_STRING_ALGORITHM_X65599 1
118 #define HASH_STRING_ALGORITHM_INVALID 0xffffffff
120 NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
122 /* convert from straight ASCII to Unicode without depending on the current codepage */
123 static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
125 while (len--) *dst++ = (unsigned char)*src++;
128 /* FLS data */
129 extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN;
130 extern void heap_thread_detach(void) DECLSPEC_HIDDEN;
132 #endif