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
32 #endif /* NO_STRICT */
38 /* Calling conventions definitions */
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
45 # if defined(__i386__) && !defined(_X86_)
48 # if defined(_X86_) && !defined(__i386__)
56 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
57 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
59 # define __stdcall __attribute__((__stdcall__))
61 # elif defined(_MSC_VER)
62 /* Nothing needs to be done. __stdcall already exists */
64 # error You need to define __stdcall for your compiler
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__))
70 # define __stdcall __attribute__((ms_abi))
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))
78 # endif /* __i386__ */
79 #endif /* __stdcall */
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__))
86 # define __cdecl __attribute__((__cdecl__))
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__))
92 # define __cdecl __attribute__((ms_abi))
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)
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)
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)
114 # define __ms_va_copy(dest,src) va_copy(dest,src)
116 # define __ms_va_copy(dest,src) ((dest) = (src))
121 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
122 # define WINAPIV __attribute__((pcs("aapcs")))
124 # define WINAPIV __cdecl
128 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
130 #define __ONLY_IN_WINELIB(x) x
134 #define pascal __ONLY_IN_WINELIB(__stdcall)
137 #define _pascal __ONLY_IN_WINELIB(__stdcall)
140 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
143 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
146 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
149 #define __export __ONLY_IN_WINELIB(__stdcall)
152 #define cdecl __ONLY_IN_WINELIB(__cdecl)
155 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
159 #define near __ONLY_IN_WINELIB(/* nothing */)
162 #define far __ONLY_IN_WINELIB(/* nothing */)
165 #define _near __ONLY_IN_WINELIB(/* nothing */)
168 #define _far __ONLY_IN_WINELIB(/* nothing */)
171 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
174 #define FAR __ONLY_IN_WINELIB(/* nothing */)
179 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
182 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
187 # define inline __inline
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. */
205 #define NULL ((void*)0)
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
;
244 typedef long *LPLONG
;
245 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
246 typedef unsigned long ULONG
, *PULONG
;
249 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
250 typedef unsigned int ULONG
, *PULONG
;
253 /* Macros to map Winelib names to the correct implementation name */
254 /* Note that Winelib is purely Win32. */
257 #define WINE_NO_UNICODE_MACROS 1
258 #define WINE_STRICT_PROTOTYPES 1
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 */
267 # define WINELIB_NAME_AW(func) func##W
269 # define WINELIB_NAME_AW(func) func##A
271 #endif /* WINE_NO_UNICODE_MACROS */
273 #ifdef WINE_NO_UNICODE_MACROS
274 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
276 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
281 /* Polymorphic types */
283 typedef UINT_PTR WPARAM
;
284 typedef LONG_PTR LPARAM
;
285 typedef LONG_PTR LRESULT
;
290 typedef DWORD COLORREF
, *LPCOLORREF
;
296 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
297 DECLARE_HANDLE(HACCEL
);
298 DECLARE_HANDLE(HBITMAP
);
299 DECLARE_HANDLE(HBRUSH
);
300 DECLARE_HANDLE(HCOLORSPACE
);
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
);
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);
341 typedef INT_PTR (CALLBACK
*FARPROC
)();
342 typedef INT_PTR (CALLBACK
*NEARPROC
)();
343 typedef INT_PTR (CALLBACK
*PROC
)();
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 */
360 #define max(a,b) (((a) > (b)) ? (a) : (b))
363 #define min(a,b) (((a) < (b)) ? (a) : (b))
365 #endif /* NOMINMAX */
367 #ifdef MAX_PATH /* Work-around for Mingw */
369 #endif /* MAX_PATH */
372 #define HFILE_ERROR ((HFILE)-1)
374 /* The SIZE structure */
375 typedef struct tagSIZE
379 } SIZE
, *PSIZE
, *LPSIZE
;
381 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
383 /* The POINT structure */
384 typedef struct tagPOINT
388 } POINT
, *PPOINT
, *LPPOINT
;
390 typedef struct _POINTL
396 /* The POINTS structure */
398 typedef struct tagPOINTS
400 #ifdef WORDS_BIGENDIAN
407 } POINTS
, *PPOINTS
, *LPPOINTS
;
409 typedef struct _FILETIME
{
410 #ifdef WORDS_BIGENDIAN
411 DWORD dwHighDateTime
;
415 DWORD dwHighDateTime
;
417 } FILETIME
, *PFILETIME
, *LPFILETIME
;
420 /* The RECT structure */
421 typedef struct tagRECT
427 } RECT
, *PRECT
, *LPRECT
;
428 typedef const RECT
*LPCRECT
;
430 typedef struct _RECTL
436 } RECTL
, *PRECTL
, *LPRECTL
;
438 typedef const RECTL
*LPCRECTL
;
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
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)
458 #endif /* _WINDEF_ */