ncrypt: Add NCryptIsKeyHandle stub.
[wine.git] / include / windef.h
blob521c3ab451236e88cdf0a5119bd35094e44f450e
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 #if !defined(_MSC_VER) && !defined(__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 # else
62 # error You need to define __stdcall for your compiler
63 # endif
64 # elif defined(__x86_64__) && defined (__GNUC__)
65 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
66 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
67 # else
68 # define __stdcall __attribute__((ms_abi))
69 # endif
70 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
71 # define __stdcall __attribute__((pcs("aapcs-vfp")))
72 # elif defined(__aarch64__) && defined (__GNUC__)
73 # define __stdcall __attribute__((ms_abi))
74 # else /* __i386__ */
75 # define __stdcall
76 # endif /* __i386__ */
77 #endif /* __stdcall */
79 #if !defined(_MSC_VER) && !defined(__cdecl)
80 # if defined(__i386__) && defined(__GNUC__)
81 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
82 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
83 # else
84 # define __cdecl __attribute__((__cdecl__))
85 # endif
86 # elif defined(__x86_64__) && defined (__GNUC__)
87 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
88 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
89 # else
90 # define __cdecl __attribute__((ms_abi))
91 # endif
92 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
93 # define __cdecl __attribute__((pcs("aapcs-vfp")))
94 # elif defined(__aarch64__) && defined (__GNUC__)
95 # define __cdecl __attribute__((ms_abi))
96 # else
97 # define __cdecl
98 # endif
99 #endif /* __cdecl */
101 #if !defined(_MSC_VER) && !defined(__fastcall)
102 # define __fastcall __stdcall
103 #endif
105 #if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall)
106 # define __thiscall __stdcall
107 #endif
109 #ifndef __ms_va_list
110 # if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
111 # define __ms_va_list __builtin_ms_va_list
112 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
113 # define __ms_va_end(list) __builtin_ms_va_end(list)
114 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
115 # else
116 # define __ms_va_list va_list
117 # define __ms_va_start(list,arg) va_start(list,arg)
118 # define __ms_va_end(list) va_end(list)
119 # ifdef va_copy
120 # define __ms_va_copy(dest,src) va_copy(dest,src)
121 # else
122 # define __ms_va_copy(dest,src) ((dest) = (src))
123 # endif
124 # endif
125 #endif
127 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
128 # define WINAPIV __attribute__((pcs("aapcs")))
129 #else
130 # define WINAPIV __cdecl
131 #endif
133 #ifdef __WINESRC__
134 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
135 #else
136 #define __ONLY_IN_WINELIB(x) x
137 #endif
139 #ifndef _MSC_VER
140 #ifndef _stdcall
141 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
142 #endif
143 #ifndef _fastcall
144 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
145 #endif
146 #ifndef __fastcall
147 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
148 #endif
149 #ifndef cdecl
150 #define cdecl __ONLY_IN_WINELIB(__cdecl)
151 #endif
152 #ifndef _cdecl
153 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
154 #endif
155 #endif /* _MSC_VER */
157 #ifndef pascal
158 #define pascal __ONLY_IN_WINELIB(__stdcall)
159 #endif
160 #ifndef _pascal
161 #define _pascal __ONLY_IN_WINELIB(__stdcall)
162 #endif
163 #ifndef __export
164 #define __export __ONLY_IN_WINELIB(__stdcall)
165 #endif
166 #ifndef near
167 #define near __ONLY_IN_WINELIB(/* nothing */)
168 #endif
169 #ifndef far
170 #define far __ONLY_IN_WINELIB(/* nothing */)
171 #endif
172 #ifndef _near
173 #define _near __ONLY_IN_WINELIB(/* nothing */)
174 #endif
175 #ifndef _far
176 #define _far __ONLY_IN_WINELIB(/* nothing */)
177 #endif
178 #ifndef NEAR
179 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
180 #endif
181 #ifndef FAR
182 #define FAR __ONLY_IN_WINELIB(/* nothing */)
183 #endif
185 #ifndef _MSC_VER
186 # ifndef _declspec
187 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
188 # endif
189 # ifndef __declspec
190 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
191 # endif
192 #endif
194 #ifdef _MSC_VER
195 # define inline __inline
196 #endif
198 #define CALLBACK __stdcall
199 #define WINAPI __stdcall
200 #define APIPRIVATE __stdcall
201 #define PASCAL __stdcall
202 #define CDECL __cdecl
203 #define _CDECL __cdecl
204 #define APIENTRY WINAPI
205 #define CONST __ONLY_IN_WINELIB(const)
207 /* Misc. constants. */
209 #undef NULL
210 #ifdef __cplusplus
211 #define NULL 0
212 #else
213 #define NULL ((void*)0)
214 #endif
216 #ifdef FALSE
217 #undef FALSE
218 #endif
219 #define FALSE 0
221 #ifdef TRUE
222 #undef TRUE
223 #endif
224 #define TRUE 1
226 #ifndef IN
227 #define IN
228 #endif
230 #ifndef OUT
231 #define OUT
232 #endif
234 #ifndef OPTIONAL
235 #define OPTIONAL
236 #endif
238 /* Standard data types */
240 #ifndef BASETYPES
241 #define BASETYPES
242 typedef unsigned char UCHAR, *PUCHAR;
243 typedef unsigned short USHORT, *PUSHORT;
244 #ifdef WINE_USE_LONG
245 typedef unsigned long ULONG, *PULONG;
246 #else
247 typedef unsigned int ULONG, *PULONG;
248 #endif
249 #endif
251 typedef void *LPVOID;
252 typedef const void *LPCVOID;
253 typedef int BOOL, *PBOOL, *LPBOOL;
254 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
255 typedef unsigned short WORD, *PWORD, *LPWORD;
256 typedef int INT, *PINT, *LPINT;
257 typedef unsigned int UINT, *PUINT;
258 typedef float FLOAT, *PFLOAT;
259 typedef char *PSZ;
260 #ifdef WINE_USE_LONG
261 typedef long *LPLONG;
262 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
263 #else
264 typedef int *LPLONG;
265 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
266 #endif
268 /* Macros to map Winelib names to the correct implementation name */
269 /* Note that Winelib is purely Win32. */
271 #ifdef __WINESRC__
272 #define WINE_NO_UNICODE_MACROS 1
273 #define WINE_STRICT_PROTOTYPES 1
274 #endif
276 #ifdef WINE_NO_UNICODE_MACROS
277 # define WINELIB_NAME_AW(func) \
278 func##_must_be_suffixed_with_W_or_A_in_this_context \
279 func##_must_be_suffixed_with_W_or_A_in_this_context
280 #else /* WINE_NO_UNICODE_MACROS */
281 # ifdef UNICODE
282 # define WINELIB_NAME_AW(func) func##W
283 # else
284 # define WINELIB_NAME_AW(func) func##A
285 # endif
286 #endif /* WINE_NO_UNICODE_MACROS */
288 #ifdef WINE_NO_UNICODE_MACROS
289 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
290 #else
291 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
292 #endif
294 #include <winnt.h>
296 /* Polymorphic types */
298 typedef UINT_PTR WPARAM;
299 typedef LONG_PTR LPARAM;
300 typedef LONG_PTR LRESULT;
302 /* Integer types */
304 typedef WORD ATOM;
305 typedef DWORD COLORREF, *LPCOLORREF;
308 /* Handle types */
310 typedef int HFILE;
311 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
312 DECLARE_HANDLE(HACCEL);
313 DECLARE_HANDLE(HBITMAP);
314 DECLARE_HANDLE(HBRUSH);
315 DECLARE_HANDLE(HCOLORSPACE);
316 DECLARE_HANDLE(HDC);
317 DECLARE_HANDLE(HDESK);
318 DECLARE_HANDLE(HENHMETAFILE);
319 DECLARE_HANDLE(HFONT);
320 DECLARE_HANDLE(HGLRC);
321 DECLARE_HANDLE(HHOOK);
322 DECLARE_HANDLE(HICON);
323 DECLARE_HANDLE(HINSTANCE);
324 DECLARE_HANDLE(HKEY);
325 typedef HKEY *PHKEY;
326 DECLARE_HANDLE(HKL);
327 DECLARE_HANDLE(HMENU);
328 DECLARE_HANDLE(HMETAFILE);
329 DECLARE_HANDLE(HMONITOR);
330 DECLARE_HANDLE(HPALETTE);
331 DECLARE_HANDLE(HPEN);
332 DECLARE_HANDLE(HRGN);
333 DECLARE_HANDLE(HRSRC);
334 DECLARE_HANDLE(HTASK);
335 DECLARE_HANDLE(HWINEVENTHOOK);
336 DECLARE_HANDLE(HWINSTA);
337 DECLARE_HANDLE(HWND);
339 /* Handle types that must remain interchangeable even with strict on */
341 typedef HINSTANCE HMODULE;
342 typedef HANDLE HGDIOBJ;
343 typedef HANDLE HGLOBAL;
344 typedef HANDLE HLOCAL;
345 typedef HANDLE GLOBALHANDLE;
346 typedef HANDLE LOCALHANDLE;
347 typedef HICON HCURSOR;
349 /* Callback function pointers types */
351 #ifdef WINE_STRICT_PROTOTYPES
352 typedef INT_PTR (CALLBACK *FARPROC)(void);
353 typedef INT_PTR (CALLBACK *NEARPROC)(void);
354 typedef INT_PTR (CALLBACK *PROC)(void);
355 #else
356 typedef INT_PTR (CALLBACK *FARPROC)();
357 typedef INT_PTR (CALLBACK *NEARPROC)();
358 typedef INT_PTR (CALLBACK *PROC)();
359 #endif
361 /* Macros to split words and longs. */
363 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
364 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
366 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
367 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
369 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
370 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
372 /* min and max macros */
373 #ifndef NOMINMAX
374 #ifndef max
375 #define max(a,b) (((a) > (b)) ? (a) : (b))
376 #endif
377 #ifndef min
378 #define min(a,b) (((a) < (b)) ? (a) : (b))
379 #endif
380 #endif /* NOMINMAX */
382 #ifdef MAX_PATH /* Work-around for Mingw */
383 #undef MAX_PATH
384 #endif /* MAX_PATH */
386 #define MAX_PATH 260
387 #define HFILE_ERROR ((HFILE)-1)
389 /* The SIZE structure */
390 typedef struct tagSIZE
392 LONG cx;
393 LONG cy;
394 } SIZE, *PSIZE, *LPSIZE;
396 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
398 /* The POINT structure */
399 typedef struct tagPOINT
401 LONG x;
402 LONG y;
403 } POINT, *PPOINT, *LPPOINT;
405 typedef struct _POINTL
407 LONG x;
408 LONG y;
409 } POINTL, *PPOINTL;
411 /* The POINTS structure */
413 typedef struct tagPOINTS
415 #ifdef WORDS_BIGENDIAN
416 SHORT y;
417 SHORT x;
418 #else
419 SHORT x;
420 SHORT y;
421 #endif
422 } POINTS, *PPOINTS, *LPPOINTS;
424 typedef struct _FILETIME {
425 #ifdef WORDS_BIGENDIAN
426 DWORD dwHighDateTime;
427 DWORD dwLowDateTime;
428 #else
429 DWORD dwLowDateTime;
430 DWORD dwHighDateTime;
431 #endif
432 } FILETIME, *PFILETIME, *LPFILETIME;
433 #define _FILETIME_
435 /* The RECT structure */
436 typedef struct tagRECT
438 LONG left;
439 LONG top;
440 LONG right;
441 LONG bottom;
442 } RECT, *PRECT, *LPRECT;
443 typedef const RECT *LPCRECT;
445 typedef struct _RECTL
447 LONG left;
448 LONG top;
449 LONG right;
450 LONG bottom;
451 } RECTL, *PRECTL, *LPRECTL;
453 typedef const RECTL *LPCRECTL;
455 /* DPI awareness */
456 typedef enum DPI_AWARENESS
458 DPI_AWARENESS_INVALID = -1,
459 DPI_AWARENESS_UNAWARE = 0,
460 DPI_AWARENESS_SYSTEM_AWARE,
461 DPI_AWARENESS_PER_MONITOR_AWARE
462 } DPI_AWARENESS;
464 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
465 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
466 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
467 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
468 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
470 #ifdef __cplusplus
472 #endif
474 #endif /* _WINDEF_ */