iphlpapi: Add partial implementation of GetIfTable2Ex.
[wine.git] / include / windef.h
blobe77b1ca0e0053f56bda41c7ef9b7911af1219e7e
1 /*
2 * Basic types definitions
4 * Copyright 1996 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 _WINDEF_
22 #define _WINDEF_
24 #ifndef WINVER
25 #define WINVER 0x0500
26 #endif
28 #ifndef NO_STRICT
29 # ifndef STRICT
30 # define STRICT
31 # endif /* STRICT */
32 #endif /* NO_STRICT */
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Calling conventions definitions */
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
41 #define _WIN64
42 #endif
44 #ifndef _WIN64
45 # if defined(__i386__) && !defined(_X86_)
46 # define _X86_
47 # endif
48 # if defined(_X86_) && !defined(__i386__)
49 # define __i386__
50 # endif
51 #endif
53 #ifndef __stdcall
54 # ifdef __i386__
55 # ifdef __GNUC__
56 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
57 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
58 # else
59 # define __stdcall __attribute__((__stdcall__))
60 # endif
61 # elif defined(_MSC_VER)
62 /* Nothing needs to be done. __stdcall already exists */
63 # else
64 # error You need to define __stdcall for your compiler
65 # endif
66 # elif defined(__x86_64__) && defined (__GNUC__)
67 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
68 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
69 # else
70 # define __stdcall __attribute__((ms_abi))
71 # endif
72 # else /* __i386__ */
73 # define __stdcall
74 # endif /* __i386__ */
75 #endif /* __stdcall */
77 #ifndef __cdecl
78 # if defined(__i386__) && defined(__GNUC__)
79 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
80 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
81 # else
82 # define __cdecl __attribute__((__cdecl__))
83 # endif
84 # elif defined(__x86_64__) && defined (__GNUC__)
85 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
86 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
87 # else
88 # define __cdecl __attribute__((ms_abi))
89 # endif
90 # elif !defined(_MSC_VER)
91 # define __cdecl
92 # endif
93 #endif /* __cdecl */
95 #ifndef __ms_va_list
96 # if defined(__x86_64__) && defined (__GNUC__)
97 # define __ms_va_list __builtin_ms_va_list
98 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
99 # define __ms_va_end(list) __builtin_ms_va_end(list)
100 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
101 # else
102 # define __ms_va_list va_list
103 # define __ms_va_start(list,arg) va_start(list,arg)
104 # define __ms_va_end(list) va_end(list)
105 # ifdef va_copy
106 # define __ms_va_copy(dest,src) va_copy(dest,src)
107 # else
108 # define __ms_va_copy(dest,src) ((dest) = (src))
109 # endif
110 # endif
111 #endif
113 #ifdef __WINESRC__
114 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
115 #else
116 #define __ONLY_IN_WINELIB(x) x
117 #endif
119 #ifndef pascal
120 #define pascal __ONLY_IN_WINELIB(__stdcall)
121 #endif
122 #ifndef _pascal
123 #define _pascal __ONLY_IN_WINELIB(__stdcall)
124 #endif
125 #ifndef _stdcall
126 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
127 #endif
128 #ifndef _fastcall
129 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
130 #endif
131 #ifndef __fastcall
132 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
133 #endif
134 #ifndef __export
135 #define __export __ONLY_IN_WINELIB(__stdcall)
136 #endif
137 #ifndef cdecl
138 #define cdecl __ONLY_IN_WINELIB(__cdecl)
139 #endif
140 #ifndef _cdecl
141 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
142 #endif
144 #ifndef near
145 #define near __ONLY_IN_WINELIB(/* nothing */)
146 #endif
147 #ifndef far
148 #define far __ONLY_IN_WINELIB(/* nothing */)
149 #endif
150 #ifndef _near
151 #define _near __ONLY_IN_WINELIB(/* nothing */)
152 #endif
153 #ifndef _far
154 #define _far __ONLY_IN_WINELIB(/* nothing */)
155 #endif
156 #ifndef NEAR
157 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
158 #endif
159 #ifndef FAR
160 #define FAR __ONLY_IN_WINELIB(/* nothing */)
161 #endif
163 #ifndef _MSC_VER
164 # ifndef _declspec
165 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
166 # endif
167 # ifndef __declspec
168 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
169 # endif
170 #endif
172 #ifdef _MSC_VER
173 # define inline __inline
174 #endif
176 #define CALLBACK __stdcall
177 #define WINAPI __stdcall
178 #define APIPRIVATE __stdcall
179 #define PASCAL __stdcall
180 #define CDECL __cdecl
181 #define _CDECL __cdecl
182 #define WINAPIV __cdecl
183 #define APIENTRY WINAPI
184 #define CONST __ONLY_IN_WINELIB(const)
186 /* Misc. constants. */
188 #undef NULL
189 #ifdef __cplusplus
190 #define NULL 0
191 #else
192 #define NULL ((void*)0)
193 #endif
195 #ifdef FALSE
196 #undef FALSE
197 #endif
198 #define FALSE 0
200 #ifdef TRUE
201 #undef TRUE
202 #endif
203 #define TRUE 1
205 #ifndef IN
206 #define IN
207 #endif
209 #ifndef OUT
210 #define OUT
211 #endif
213 #ifndef OPTIONAL
214 #define OPTIONAL
215 #endif
217 /* Standard data types */
219 typedef void *LPVOID;
220 typedef const void *LPCVOID;
221 typedef int BOOL, *PBOOL, *LPBOOL;
222 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
223 typedef unsigned char UCHAR, *PUCHAR;
224 typedef unsigned short WORD, *PWORD, *LPWORD;
225 typedef unsigned short USHORT, *PUSHORT;
226 typedef int INT, *PINT, *LPINT;
227 typedef unsigned int UINT, *PUINT;
228 typedef float FLOAT, *PFLOAT;
229 typedef char *PSZ;
230 #ifdef _MSC_VER
231 typedef long *LPLONG;
232 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
233 typedef unsigned long ULONG, *PULONG;
234 #else
235 typedef int *LPLONG;
236 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
237 typedef unsigned int ULONG, *PULONG;
238 #endif
240 /* Macros to map Winelib names to the correct implementation name */
241 /* Note that Winelib is purely Win32. */
243 #ifdef __WINESRC__
244 #define WINE_NO_UNICODE_MACROS 1
245 #define WINE_STRICT_PROTOTYPES 1
246 #endif
248 #ifdef WINE_NO_UNICODE_MACROS
249 # define WINELIB_NAME_AW(func) \
250 func##_must_be_suffixed_with_W_or_A_in_this_context \
251 func##_must_be_suffixed_with_W_or_A_in_this_context
252 #else /* WINE_NO_UNICODE_MACROS */
253 # ifdef UNICODE
254 # define WINELIB_NAME_AW(func) func##W
255 # else
256 # define WINELIB_NAME_AW(func) func##A
257 # endif
258 #endif /* WINE_NO_UNICODE_MACROS */
260 #ifdef WINE_NO_UNICODE_MACROS
261 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
262 #else
263 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
264 #endif
266 #include <winnt.h>
268 /* Polymorphic types */
270 typedef UINT_PTR WPARAM;
271 typedef LONG_PTR LPARAM;
272 typedef LONG_PTR LRESULT;
274 /* Integer types */
276 typedef WORD ATOM;
277 typedef DWORD COLORREF, *LPCOLORREF;
280 /* Handle types */
282 typedef int HFILE;
283 DECLARE_HANDLE(HACCEL);
284 DECLARE_HANDLE(HBITMAP);
285 DECLARE_HANDLE(HBRUSH);
286 DECLARE_HANDLE(HCOLORSPACE);
287 DECLARE_HANDLE(HDC);
288 DECLARE_HANDLE(HDESK);
289 DECLARE_HANDLE(HENHMETAFILE);
290 DECLARE_HANDLE(HFONT);
291 DECLARE_HANDLE(HGLRC);
292 DECLARE_HANDLE(HHOOK);
293 DECLARE_HANDLE(HICON);
294 DECLARE_HANDLE(HINSTANCE);
295 DECLARE_HANDLE(HKEY);
296 typedef HKEY *PHKEY;
297 DECLARE_HANDLE(HKL);
298 DECLARE_HANDLE(HMENU);
299 DECLARE_HANDLE(HMETAFILE);
300 DECLARE_HANDLE(HMONITOR);
301 DECLARE_HANDLE(HPALETTE);
302 DECLARE_HANDLE(HPEN);
303 DECLARE_HANDLE(HRGN);
304 DECLARE_HANDLE(HRSRC);
305 DECLARE_HANDLE(HTASK);
306 DECLARE_HANDLE(HWINEVENTHOOK);
307 DECLARE_HANDLE(HWINSTA);
308 DECLARE_HANDLE(HWND);
310 /* Handle types that must remain interchangeable even with strict on */
312 typedef HINSTANCE HMODULE;
313 typedef HANDLE HGDIOBJ;
314 typedef HANDLE HGLOBAL;
315 typedef HANDLE HLOCAL;
316 typedef HANDLE GLOBALHANDLE;
317 typedef HANDLE LOCALHANDLE;
318 typedef HICON HCURSOR;
320 /* Callback function pointers types */
322 #ifdef WINE_STRICT_PROTOTYPES
323 typedef INT_PTR (CALLBACK *FARPROC)(void);
324 typedef INT_PTR (CALLBACK *NEARPROC)(void);
325 typedef INT_PTR (CALLBACK *PROC)(void);
326 #else
327 typedef INT_PTR (CALLBACK *FARPROC)();
328 typedef INT_PTR (CALLBACK *NEARPROC)();
329 typedef INT_PTR (CALLBACK *PROC)();
330 #endif
332 /* Macros to split words and longs. */
334 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
335 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
337 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
338 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
340 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
341 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
343 /* min and max macros */
344 #ifndef NOMINMAX
345 #ifndef max
346 #define max(a,b) (((a) > (b)) ? (a) : (b))
347 #endif
348 #ifndef min
349 #define min(a,b) (((a) < (b)) ? (a) : (b))
350 #endif
351 #endif /* NOMINMAX */
353 #ifdef MAX_PATH /* Work-around for Mingw */
354 #undef MAX_PATH
355 #endif /* MAX_PATH */
357 #define MAX_PATH 260
358 #define HFILE_ERROR ((HFILE)-1)
360 /* The SIZE structure */
361 typedef struct tagSIZE
363 LONG cx;
364 LONG cy;
365 } SIZE, *PSIZE, *LPSIZE;
367 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
369 /* The POINT structure */
370 typedef struct tagPOINT
372 LONG x;
373 LONG y;
374 } POINT, *PPOINT, *LPPOINT;
376 typedef struct _POINTL
378 LONG x;
379 LONG y;
380 } POINTL, *PPOINTL;
382 /* The POINTS structure */
384 typedef struct tagPOINTS
386 #ifdef WORDS_BIGENDIAN
387 SHORT y;
388 SHORT x;
389 #else
390 SHORT x;
391 SHORT y;
392 #endif
393 } POINTS, *PPOINTS, *LPPOINTS;
395 typedef struct _FILETIME {
396 #ifdef WORDS_BIGENDIAN
397 DWORD dwHighDateTime;
398 DWORD dwLowDateTime;
399 #else
400 DWORD dwLowDateTime;
401 DWORD dwHighDateTime;
402 #endif
403 } FILETIME, *PFILETIME, *LPFILETIME;
404 #define _FILETIME_
406 /* The RECT structure */
407 typedef struct tagRECT
409 LONG left;
410 LONG top;
411 LONG right;
412 LONG bottom;
413 } RECT, *PRECT, *LPRECT;
414 typedef const RECT *LPCRECT;
416 typedef struct _RECTL
418 LONG left;
419 LONG top;
420 LONG right;
421 LONG bottom;
422 } RECTL, *PRECTL, *LPRECTL;
424 typedef const RECTL *LPCRECTL;
426 #ifdef __cplusplus
428 #endif
430 #endif /* _WINDEF_ */