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)
105 # define __fastcall __stdcall
110 # define __thiscall __stdcall
114 # if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
115 # define __ms_va_list __builtin_ms_va_list
116 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
117 # define __ms_va_end(list) __builtin_ms_va_end(list)
118 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
120 # define __ms_va_list va_list
121 # define __ms_va_start(list,arg) va_start(list,arg)
122 # define __ms_va_end(list) va_end(list)
124 # define __ms_va_copy(dest,src) va_copy(dest,src)
126 # define __ms_va_copy(dest,src) ((dest) = (src))
131 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
132 # define WINAPIV __attribute__((pcs("aapcs")))
134 # define WINAPIV __cdecl
138 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
140 #define __ONLY_IN_WINELIB(x) x
144 #define pascal __ONLY_IN_WINELIB(__stdcall)
147 #define _pascal __ONLY_IN_WINELIB(__stdcall)
150 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
153 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
156 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
159 #define __export __ONLY_IN_WINELIB(__stdcall)
162 #define cdecl __ONLY_IN_WINELIB(__cdecl)
165 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
169 #define near __ONLY_IN_WINELIB(/* nothing */)
172 #define far __ONLY_IN_WINELIB(/* nothing */)
175 #define _near __ONLY_IN_WINELIB(/* nothing */)
178 #define _far __ONLY_IN_WINELIB(/* nothing */)
181 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
184 #define FAR __ONLY_IN_WINELIB(/* nothing */)
189 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
192 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
197 # define inline __inline
200 #define CALLBACK __stdcall
201 #define WINAPI __stdcall
202 #define APIPRIVATE __stdcall
203 #define PASCAL __stdcall
204 #define CDECL __cdecl
205 #define _CDECL __cdecl
206 #define APIENTRY WINAPI
207 #define CONST __ONLY_IN_WINELIB(const)
209 /* Misc. constants. */
215 #define NULL ((void*)0)
240 /* Standard data types */
244 typedef unsigned char UCHAR
, *PUCHAR
;
245 typedef unsigned short USHORT
, *PUSHORT
;
247 typedef unsigned long ULONG
, *PULONG
;
249 typedef unsigned int ULONG
, *PULONG
;
253 typedef void *LPVOID
;
254 typedef const void *LPCVOID
;
255 typedef int BOOL
, *PBOOL
, *LPBOOL
;
256 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
257 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
258 typedef int INT
, *PINT
, *LPINT
;
259 typedef unsigned int UINT
, *PUINT
;
260 typedef float FLOAT
, *PFLOAT
;
263 typedef long *LPLONG
;
264 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
267 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
270 /* Macros to map Winelib names to the correct implementation name */
271 /* Note that Winelib is purely Win32. */
274 #define WINE_NO_UNICODE_MACROS 1
275 #define WINE_STRICT_PROTOTYPES 1
278 #ifdef WINE_NO_UNICODE_MACROS
279 # define WINELIB_NAME_AW(func) \
280 func##_must_be_suffixed_with_W_or_A_in_this_context \
281 func##_must_be_suffixed_with_W_or_A_in_this_context
282 #else /* WINE_NO_UNICODE_MACROS */
284 # define WINELIB_NAME_AW(func) func##W
286 # define WINELIB_NAME_AW(func) func##A
288 #endif /* WINE_NO_UNICODE_MACROS */
290 #ifdef WINE_NO_UNICODE_MACROS
291 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
293 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
298 /* Polymorphic types */
300 typedef UINT_PTR WPARAM
;
301 typedef LONG_PTR LPARAM
;
302 typedef LONG_PTR LRESULT
;
307 typedef DWORD COLORREF
, *LPCOLORREF
;
313 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
314 DECLARE_HANDLE(HACCEL
);
315 DECLARE_HANDLE(HBITMAP
);
316 DECLARE_HANDLE(HBRUSH
);
317 DECLARE_HANDLE(HCOLORSPACE
);
319 DECLARE_HANDLE(HDESK
);
320 DECLARE_HANDLE(HENHMETAFILE
);
321 DECLARE_HANDLE(HFONT
);
322 DECLARE_HANDLE(HGLRC
);
323 DECLARE_HANDLE(HHOOK
);
324 DECLARE_HANDLE(HICON
);
325 DECLARE_HANDLE(HINSTANCE
);
326 DECLARE_HANDLE(HKEY
);
329 DECLARE_HANDLE(HMENU
);
330 DECLARE_HANDLE(HMETAFILE
);
331 DECLARE_HANDLE(HMONITOR
);
332 DECLARE_HANDLE(HPALETTE
);
333 DECLARE_HANDLE(HPEN
);
334 DECLARE_HANDLE(HRGN
);
335 DECLARE_HANDLE(HRSRC
);
336 DECLARE_HANDLE(HTASK
);
337 DECLARE_HANDLE(HWINEVENTHOOK
);
338 DECLARE_HANDLE(HWINSTA
);
339 DECLARE_HANDLE(HWND
);
341 /* Handle types that must remain interchangeable even with strict on */
343 typedef HINSTANCE HMODULE
;
344 typedef HANDLE HGDIOBJ
;
345 typedef HANDLE HGLOBAL
;
346 typedef HANDLE HLOCAL
;
347 typedef HANDLE GLOBALHANDLE
;
348 typedef HANDLE LOCALHANDLE
;
349 typedef HICON HCURSOR
;
351 /* Callback function pointers types */
353 #ifdef WINE_STRICT_PROTOTYPES
354 typedef INT_PTR (CALLBACK
*FARPROC
)(void);
355 typedef INT_PTR (CALLBACK
*NEARPROC
)(void);
356 typedef INT_PTR (CALLBACK
*PROC
)(void);
358 typedef INT_PTR (CALLBACK
*FARPROC
)();
359 typedef INT_PTR (CALLBACK
*NEARPROC
)();
360 typedef INT_PTR (CALLBACK
*PROC
)();
363 /* Macros to split words and longs. */
365 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
366 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
368 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
369 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
371 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
372 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
374 /* min and max macros */
377 #define max(a,b) (((a) > (b)) ? (a) : (b))
380 #define min(a,b) (((a) < (b)) ? (a) : (b))
382 #endif /* NOMINMAX */
384 #ifdef MAX_PATH /* Work-around for Mingw */
386 #endif /* MAX_PATH */
389 #define HFILE_ERROR ((HFILE)-1)
391 /* The SIZE structure */
392 typedef struct tagSIZE
396 } SIZE
, *PSIZE
, *LPSIZE
;
398 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
400 /* The POINT structure */
401 typedef struct tagPOINT
405 } POINT
, *PPOINT
, *LPPOINT
;
407 typedef struct _POINTL
413 /* The POINTS structure */
415 typedef struct tagPOINTS
417 #ifdef WORDS_BIGENDIAN
424 } POINTS
, *PPOINTS
, *LPPOINTS
;
426 typedef struct _FILETIME
{
427 #ifdef WORDS_BIGENDIAN
428 DWORD dwHighDateTime
;
432 DWORD dwHighDateTime
;
434 } FILETIME
, *PFILETIME
, *LPFILETIME
;
437 /* The RECT structure */
438 typedef struct tagRECT
444 } RECT
, *PRECT
, *LPRECT
;
445 typedef const RECT
*LPCRECT
;
447 typedef struct _RECTL
453 } RECTL
, *PRECTL
, *LPRECTL
;
455 typedef const RECTL
*LPCRECTL
;
458 typedef enum DPI_AWARENESS
460 DPI_AWARENESS_INVALID
= -1,
461 DPI_AWARENESS_UNAWARE
= 0,
462 DPI_AWARENESS_SYSTEM_AWARE
,
463 DPI_AWARENESS_PER_MONITOR_AWARE
466 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
467 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
468 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
469 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
470 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
476 #endif /* _WINDEF_ */