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