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 */
34 #ifndef __has_attribute
35 #define __has_attribute(x) 0
42 /* Calling conventions definitions */
44 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
49 # if defined(__i386__) && !defined(_X86_)
52 # if defined(_X86_) && !defined(__i386__)
57 #if !defined(_MSC_VER) && !defined(__MINGW32__)
67 #elif defined(__GNUC__)
69 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
70 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
72 # define __stdcall __attribute__((__stdcall__))
74 # elif defined(__x86_64__)
75 # if __has_attribute(__force_align_arg_pointer__)
76 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
78 # define __stdcall __attribute__((ms_abi))
80 # define __ms_va_list __builtin_ms_va_list
81 # elif defined(__arm__) && !defined(__SOFTFP__) && !defined(__CYGWIN__)
82 # define __stdcall __attribute__((pcs("aapcs-vfp")))
83 # define WINAPIV __attribute__((pcs("aapcs")))
84 # elif defined(__aarch64__) && __has_attribute(ms_abi)
85 # define __stdcall __attribute__((ms_abi))
86 # define __ms_va_list __builtin_ms_va_list
89 # endif /* __i386__ */
91 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
92 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
94 # define __cdecl __attribute__((__cdecl__))
97 # define __cdecl __stdcall
99 # define __fastcall __stdcall
100 # define __thiscall __stdcall
101 #elif !defined(RC_INVOKED)
102 # error You need to define __stdcall for your compiler
103 #endif /* WINE_UNIX_LIB */
105 #endif /* _MSC_VER || __MINGW32__ */
107 #if !defined(__ms_va_list) && !defined(WINE_UNIX_LIB)
108 # define __ms_va_list va_list
112 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
114 #define __ONLY_IN_WINELIB(x) x
119 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
122 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
125 #define cdecl __ONLY_IN_WINELIB(__cdecl)
128 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
130 #endif /* _MSC_VER */
133 #define pascal __ONLY_IN_WINELIB(__stdcall)
136 #define _pascal __ONLY_IN_WINELIB(__stdcall)
139 #define __export __ONLY_IN_WINELIB(__stdcall)
142 #define near __ONLY_IN_WINELIB(/* nothing */)
145 #define far __ONLY_IN_WINELIB(/* nothing */)
148 #define _near __ONLY_IN_WINELIB(/* nothing */)
151 #define _far __ONLY_IN_WINELIB(/* nothing */)
154 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
157 #define FAR __ONLY_IN_WINELIB(/* nothing */)
162 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
165 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
170 # define inline __inline
173 #define CALLBACK __stdcall
174 #define WINAPI __stdcall
175 #define APIPRIVATE __stdcall
176 #define PASCAL __stdcall
177 #define CDECL __cdecl
178 #define _CDECL __cdecl
179 #define APIENTRY WINAPI
180 #define CONST __ONLY_IN_WINELIB(const)
182 # define WINAPIV CDECL
185 /* Misc. constants. */
191 #define NULL ((void*)0)
216 /* Standard data types */
220 typedef unsigned char UCHAR
, *PUCHAR
;
221 typedef unsigned short USHORT
, *PUSHORT
;
222 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
223 typedef unsigned long ULONG
, *PULONG
;
225 typedef unsigned int ULONG
, *PULONG
;
229 typedef void *LPVOID
;
230 typedef const void *LPCVOID
;
231 typedef int BOOL
, *PBOOL
, *LPBOOL
;
232 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
233 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
234 typedef int INT
, *PINT
, *LPINT
;
235 typedef unsigned int UINT
, *PUINT
;
236 typedef float FLOAT
, *PFLOAT
;
238 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
239 typedef long *LPLONG
;
240 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
243 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
246 /* Macros to map Winelib names to the correct implementation name */
247 /* Note that Winelib is purely Win32. */
250 #define WINE_NO_UNICODE_MACROS 1
251 #define WINE_STRICT_PROTOTYPES 1
254 #ifdef WINE_NO_UNICODE_MACROS
255 # define WINELIB_NAME_AW(func) \
256 func##_must_be_suffixed_with_W_or_A_in_this_context \
257 func##_must_be_suffixed_with_W_or_A_in_this_context
258 #else /* WINE_NO_UNICODE_MACROS */
260 # define WINELIB_NAME_AW(func) func##W
262 # define WINELIB_NAME_AW(func) func##A
264 #endif /* WINE_NO_UNICODE_MACROS */
266 #ifdef WINE_NO_UNICODE_MACROS
267 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
269 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
274 /* Polymorphic types */
276 typedef UINT_PTR WPARAM
;
277 typedef LONG_PTR LPARAM
;
278 typedef LONG_PTR LRESULT
;
283 typedef DWORD COLORREF
, *LPCOLORREF
;
289 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
290 DECLARE_HANDLE(HACCEL
);
291 DECLARE_HANDLE(HBITMAP
);
292 DECLARE_HANDLE(HBRUSH
);
293 DECLARE_HANDLE(HCOLORSPACE
);
295 DECLARE_HANDLE(HDESK
);
296 DECLARE_HANDLE(HENHMETAFILE
);
297 DECLARE_HANDLE(HFONT
);
298 DECLARE_HANDLE(HGLRC
);
299 DECLARE_HANDLE(HHOOK
);
300 DECLARE_HANDLE(HICON
);
301 DECLARE_HANDLE(HINSTANCE
);
302 DECLARE_HANDLE(HKEY
);
305 DECLARE_HANDLE(HMENU
);
306 DECLARE_HANDLE(HMETAFILE
);
307 DECLARE_HANDLE(HMONITOR
);
308 DECLARE_HANDLE(HPALETTE
);
309 DECLARE_HANDLE(HPEN
);
310 DECLARE_HANDLE(HRGN
);
311 DECLARE_HANDLE(HRSRC
);
312 DECLARE_HANDLE(HTASK
);
313 DECLARE_HANDLE(HWINEVENTHOOK
);
314 DECLARE_HANDLE(HWINSTA
);
315 DECLARE_HANDLE(HWND
);
317 /* Handle types that must remain interchangeable even with strict on */
319 typedef HINSTANCE HMODULE
;
320 typedef HANDLE HGDIOBJ
;
321 typedef HANDLE HGLOBAL
;
322 typedef HANDLE HLOCAL
;
323 typedef HANDLE GLOBALHANDLE
;
324 typedef HANDLE LOCALHANDLE
;
325 typedef HICON HCURSOR
;
327 /* Callback function pointers types */
329 #ifdef WINE_STRICT_PROTOTYPES
330 typedef INT_PTR (CALLBACK
*FARPROC
)(void);
331 typedef INT_PTR (CALLBACK
*NEARPROC
)(void);
332 typedef INT_PTR (CALLBACK
*PROC
)(void);
334 typedef INT_PTR (CALLBACK
*FARPROC
)();
335 typedef INT_PTR (CALLBACK
*NEARPROC
)();
336 typedef INT_PTR (CALLBACK
*PROC
)();
339 /* Macros to split words and longs. */
341 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
342 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
344 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
345 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
347 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
348 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
350 /* min and max macros */
353 #define max(a,b) (((a) > (b)) ? (a) : (b))
356 #define min(a,b) (((a) < (b)) ? (a) : (b))
358 #endif /* NOMINMAX */
360 #ifdef MAX_PATH /* Work-around for Mingw */
362 #endif /* MAX_PATH */
365 #define HFILE_ERROR ((HFILE)-1)
367 /* The SIZE structure */
368 typedef struct tagSIZE
372 } SIZE
, *PSIZE
, *LPSIZE
;
374 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
376 /* The POINT structure */
377 typedef struct tagPOINT
381 } POINT
, *PPOINT
, *LPPOINT
;
383 typedef struct _POINTL
389 /* The POINTS structure */
391 typedef struct tagPOINTS
395 } POINTS
, *PPOINTS
, *LPPOINTS
;
397 typedef struct _FILETIME
{
399 DWORD dwHighDateTime
;
400 } FILETIME
, *PFILETIME
, *LPFILETIME
;
403 /* The RECT structure */
404 typedef struct tagRECT
410 } RECT
, *PRECT
, *LPRECT
;
411 typedef const RECT
*LPCRECT
;
413 typedef struct _RECTL
419 } RECTL
, *PRECTL
, *LPRECTL
;
421 typedef const RECTL
*LPCRECTL
;
424 typedef enum DPI_AWARENESS
426 DPI_AWARENESS_INVALID
= -1,
427 DPI_AWARENESS_UNAWARE
= 0,
428 DPI_AWARENESS_SYSTEM_AWARE
,
429 DPI_AWARENESS_PER_MONITOR_AWARE
432 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
433 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
434 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
435 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
436 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
443 DPI_HOSTING_BEHAVIOR_INVALID
= -1,
444 DPI_HOSTING_BEHAVIOR_DEFAULT
= 0,
445 DPI_HOSTING_BEHAVIOR_MIXED
= 1
446 } DPI_HOSTING_BEHAVIOR
;
448 #endif /* _WINDEF_ */