gdiplus: Use the given HPALETTE in GdipCreateBitmapFromHBITMAP.
[wine/multimedia.git] / include / windef.h
blob8f5ea304eeecc6405bf72ea40b6f2a653f4bf5d7
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(_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 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
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 # define __stdcall __attribute__((ms_abi))
68 # else /* __i386__ */
69 # define __stdcall
70 # endif /* __i386__ */
71 #endif /* __stdcall */
73 #ifndef __cdecl
74 # if defined(__i386__) && defined(__GNUC__)
75 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
76 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
77 # else
78 # define __cdecl __attribute__((__cdecl__))
79 # endif
80 # elif defined(__x86_64__) && defined (__GNUC__)
81 # define __cdecl __attribute__((ms_abi))
82 # elif !defined(_MSC_VER)
83 # define __cdecl
84 # endif
85 #endif /* __cdecl */
87 #ifndef __ms_va_list
88 # if defined(__x86_64__) && defined (__GNUC__)
89 # define __ms_va_list __builtin_ms_va_list
90 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
91 # define __ms_va_end(list) __builtin_ms_va_end(list)
92 # else
93 # define __ms_va_list va_list
94 # define __ms_va_start(list,arg) va_start(list,arg)
95 # define __ms_va_end(list) va_end(list)
96 # endif
97 #endif
99 #ifdef __WINESRC__
100 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
101 #else
102 #define __ONLY_IN_WINELIB(x) x
103 #endif
105 #ifndef pascal
106 #define pascal __ONLY_IN_WINELIB(__stdcall)
107 #endif
108 #ifndef _pascal
109 #define _pascal __ONLY_IN_WINELIB(__stdcall)
110 #endif
111 #ifndef _stdcall
112 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
113 #endif
114 #ifndef _fastcall
115 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
116 #endif
117 #ifndef __fastcall
118 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
119 #endif
120 #ifndef __export
121 #define __export __ONLY_IN_WINELIB(__stdcall)
122 #endif
123 #ifndef cdecl
124 #define cdecl __ONLY_IN_WINELIB(__cdecl)
125 #endif
126 #ifndef _cdecl
127 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
128 #endif
130 #ifndef near
131 #define near __ONLY_IN_WINELIB(/* nothing */)
132 #endif
133 #ifndef far
134 #define far __ONLY_IN_WINELIB(/* nothing */)
135 #endif
136 #ifndef _near
137 #define _near __ONLY_IN_WINELIB(/* nothing */)
138 #endif
139 #ifndef _far
140 #define _far __ONLY_IN_WINELIB(/* nothing */)
141 #endif
142 #ifndef NEAR
143 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
144 #endif
145 #ifndef FAR
146 #define FAR __ONLY_IN_WINELIB(/* nothing */)
147 #endif
149 #ifndef _MSC_VER
150 # ifndef _declspec
151 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
152 # endif
153 # ifndef __declspec
154 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
155 # endif
156 #endif
158 #ifdef _MSC_VER
159 # define inline __inline
160 #endif
162 #define CALLBACK __stdcall
163 #define WINAPI __stdcall
164 #define APIPRIVATE __stdcall
165 #define PASCAL __stdcall
166 #define CDECL __cdecl
167 #define _CDECL __cdecl
168 #define WINAPIV __cdecl
169 #define APIENTRY WINAPI
170 #define CONST const
172 /* Misc. constants. */
174 #undef NULL
175 #ifdef __cplusplus
176 #define NULL 0
177 #else
178 #define NULL ((void*)0)
179 #endif
181 #ifdef FALSE
182 #undef FALSE
183 #endif
184 #define FALSE 0
186 #ifdef TRUE
187 #undef TRUE
188 #endif
189 #define TRUE 1
191 #ifndef IN
192 #define IN
193 #endif
195 #ifndef OUT
196 #define OUT
197 #endif
199 #ifndef OPTIONAL
200 #define OPTIONAL
201 #endif
203 /* Standard data types */
205 typedef void *LPVOID;
206 typedef const void *LPCVOID;
207 typedef int BOOL, *PBOOL, *LPBOOL;
208 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
209 typedef unsigned char UCHAR, *PUCHAR;
210 typedef unsigned short WORD, *PWORD, *LPWORD;
211 typedef unsigned short USHORT, *PUSHORT;
212 typedef int INT, *PINT, *LPINT;
213 typedef unsigned int UINT, *PUINT;
214 typedef float FLOAT, *PFLOAT;
215 typedef char *PSZ;
216 #ifdef _MSC_VER
217 typedef long *LPLONG;
218 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
219 typedef unsigned long ULONG, *PULONG;
220 #else
221 typedef int *LPLONG;
222 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
223 typedef unsigned int ULONG, *PULONG;
224 #endif
226 /* Macros to map Winelib names to the correct implementation name */
227 /* Note that Winelib is purely Win32. */
229 #ifdef __WINESRC__
230 #define WINE_NO_UNICODE_MACROS 1
231 #define WINE_STRICT_PROTOTYPES 1
232 #endif
234 #ifdef WINE_NO_UNICODE_MACROS
235 # define WINELIB_NAME_AW(func) \
236 func##_must_be_suffixed_with_W_or_A_in_this_context \
237 func##_must_be_suffixed_with_W_or_A_in_this_context
238 #else /* WINE_NO_UNICODE_MACROS */
239 # ifdef UNICODE
240 # define WINELIB_NAME_AW(func) func##W
241 # else
242 # define WINELIB_NAME_AW(func) func##A
243 # endif
244 #endif /* WINE_NO_UNICODE_MACROS */
246 #ifdef WINE_NO_UNICODE_MACROS
247 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
248 #else
249 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
250 #endif
252 #include <winnt.h>
254 /* Polymorphic types */
256 typedef UINT_PTR WPARAM;
257 typedef LONG_PTR LPARAM;
258 typedef LONG_PTR LRESULT;
260 /* Integer types */
262 typedef WORD ATOM;
263 typedef DWORD COLORREF, *LPCOLORREF;
266 /* Handle types */
268 typedef int HFILE;
269 DECLARE_HANDLE(HACCEL);
270 DECLARE_HANDLE(HBITMAP);
271 DECLARE_HANDLE(HBRUSH);
272 DECLARE_HANDLE(HCOLORSPACE);
273 DECLARE_HANDLE(HDC);
274 DECLARE_HANDLE(HDESK);
275 DECLARE_HANDLE(HENHMETAFILE);
276 DECLARE_HANDLE(HFONT);
277 DECLARE_HANDLE(HGLRC);
278 DECLARE_HANDLE(HHOOK);
279 DECLARE_HANDLE(HICON);
280 DECLARE_HANDLE(HINSTANCE);
281 DECLARE_HANDLE(HKEY);
282 typedef HKEY *PHKEY;
283 DECLARE_HANDLE(HKL);
284 DECLARE_HANDLE(HMENU);
285 DECLARE_HANDLE(HMETAFILE);
286 DECLARE_HANDLE(HMONITOR);
287 DECLARE_HANDLE(HPALETTE);
288 DECLARE_HANDLE(HPEN);
289 DECLARE_HANDLE(HRGN);
290 DECLARE_HANDLE(HRSRC);
291 DECLARE_HANDLE(HTASK);
292 DECLARE_HANDLE(HWINEVENTHOOK);
293 DECLARE_HANDLE(HWINSTA);
294 DECLARE_HANDLE(HWND);
296 /* Handle types that must remain interchangeable even with strict on */
298 typedef HINSTANCE HMODULE;
299 typedef HANDLE HGDIOBJ;
300 typedef HANDLE HGLOBAL;
301 typedef HANDLE HLOCAL;
302 typedef HANDLE GLOBALHANDLE;
303 typedef HANDLE LOCALHANDLE;
304 typedef HICON HCURSOR;
306 /* Callback function pointers types */
308 #ifdef WINE_STRICT_PROTOTYPES
309 typedef INT_PTR (CALLBACK *FARPROC)(void);
310 typedef INT_PTR (CALLBACK *NEARPROC)(void);
311 typedef INT_PTR (CALLBACK *PROC)(void);
312 #else
313 typedef INT_PTR (CALLBACK *FARPROC)();
314 typedef INT_PTR (CALLBACK *NEARPROC)();
315 typedef INT_PTR (CALLBACK *PROC)();
316 #endif
318 /* Macros to split words and longs. */
320 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
321 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
323 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
324 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
326 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
327 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
329 /* min and max macros */
330 #ifndef NOMINMAX
331 #ifndef max
332 #define max(a,b) (((a) > (b)) ? (a) : (b))
333 #endif
334 #ifndef min
335 #define min(a,b) (((a) < (b)) ? (a) : (b))
336 #endif
337 #endif /* NOMINMAX */
339 #ifdef MAX_PATH /* Work-around for Mingw */
340 #undef MAX_PATH
341 #endif /* MAX_PATH */
343 #define MAX_PATH 260
344 #define HFILE_ERROR ((HFILE)-1)
346 /* The SIZE structure */
347 typedef struct tagSIZE
349 LONG cx;
350 LONG cy;
351 } SIZE, *PSIZE, *LPSIZE;
353 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
355 /* The POINT structure */
356 typedef struct tagPOINT
358 LONG x;
359 LONG y;
360 } POINT, *PPOINT, *LPPOINT;
362 typedef struct _POINTL
364 LONG x;
365 LONG y;
366 } POINTL, *PPOINTL;
368 /* The POINTS structure */
370 typedef struct tagPOINTS
372 #ifdef WORDS_BIGENDIAN
373 SHORT y;
374 SHORT x;
375 #else
376 SHORT x;
377 SHORT y;
378 #endif
379 } POINTS, *PPOINTS, *LPPOINTS;
381 typedef struct _FILETIME {
382 #ifdef WORDS_BIGENDIAN
383 DWORD dwHighDateTime;
384 DWORD dwLowDateTime;
385 #else
386 DWORD dwLowDateTime;
387 DWORD dwHighDateTime;
388 #endif
389 } FILETIME, *PFILETIME, *LPFILETIME;
390 #define _FILETIME_
392 /* The RECT structure */
393 typedef struct tagRECT
395 LONG left;
396 LONG top;
397 LONG right;
398 LONG bottom;
399 } RECT, *PRECT, *LPRECT;
400 typedef const RECT *LPCRECT;
402 typedef struct _RECTL
404 LONG left;
405 LONG top;
406 LONG right;
407 LONG bottom;
408 } RECTL, *PRECTL, *LPRECTL;
410 typedef const RECTL *LPCRECTL;
412 #ifdef __cplusplus
414 #endif
416 #endif /* _WINDEF_ */