System classes must not have the CS_GLOBALCLASS style.
[wine.git] / include / windef.h
blob809fdd3f925e6f6b266247b70d76aeb51ddc7bc4
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
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(__i386__) && !defined(_X86_)
41 # define _X86_
42 #endif
44 #ifndef __stdcall
45 # ifdef __i386__
46 # ifdef __GNUC__
47 # define __stdcall __attribute__((__stdcall__))
48 # elif defined(_MSC_VER)
49 /* Nothing needs to be done. __stdcall already exists */
50 # else
51 # error You need to define __stdcall for your compiler
52 # endif
53 # else /* __i386__ */
54 # define __stdcall
55 # endif /* __i386__ */
56 #endif /* __stdcall */
58 #ifndef __cdecl
59 # if defined(__i386__) && defined(__GNUC__)
60 # define __cdecl __attribute__((__cdecl__))
61 # elif !defined(_MSC_VER)
62 # define __cdecl
63 # endif
64 #endif /* __stdcall */
66 #ifdef __WINESRC__
67 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
68 #else
69 #define __ONLY_IN_WINELIB(x) x
70 #endif
72 #ifndef pascal
73 #define pascal __ONLY_IN_WINELIB(__stdcall)
74 #endif
75 #ifndef _pascal
76 #define _pascal __ONLY_IN_WINELIB(__stdcall)
77 #endif
78 #ifndef _stdcall
79 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
80 #endif
81 #ifndef _fastcall
82 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
83 #endif
84 #ifndef __fastcall
85 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
86 #endif
87 #ifndef __export
88 #define __export __ONLY_IN_WINELIB(__stdcall)
89 #endif
90 #ifndef cdecl
91 #define cdecl __ONLY_IN_WINELIB(__cdecl)
92 #endif
93 #ifndef _cdecl
94 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
95 #endif
97 #ifndef near
98 #define near __ONLY_IN_WINELIB()
99 #endif
100 #ifndef far
101 #define far __ONLY_IN_WINELIB()
102 #endif
103 #ifndef _near
104 #define _near __ONLY_IN_WINELIB()
105 #endif
106 #ifndef _far
107 #define _far __ONLY_IN_WINELIB()
108 #endif
109 #ifndef NEAR
110 #define NEAR __ONLY_IN_WINELIB()
111 #endif
112 #ifndef FAR
113 #define FAR __ONLY_IN_WINELIB()
114 #endif
116 #ifndef _MSC_VER
117 # ifndef _declspec
118 # define _declspec(x) __ONLY_IN_WINELIB()
119 # endif
120 # ifndef __declspec
121 # define __declspec(x) __ONLY_IN_WINELIB()
122 # endif
123 #endif
125 #define CALLBACK __stdcall
126 #define WINAPI __stdcall
127 #define APIPRIVATE __stdcall
128 #define PASCAL __stdcall
129 #define CDECL __cdecl
130 #define _CDECL __cdecl
131 #define WINAPIV __cdecl
132 #define APIENTRY WINAPI
133 #define CONST const
135 /* Misc. constants. */
137 #undef NULL
138 #ifdef __cplusplus
139 #define NULL 0
140 #else
141 #define NULL ((void*)0)
142 #endif
144 #ifdef FALSE
145 #undef FALSE
146 #endif
147 #define FALSE 0
149 #ifdef TRUE
150 #undef TRUE
151 #endif
152 #define TRUE 1
154 #ifndef IN
155 #define IN
156 #endif
158 #ifndef OUT
159 #define OUT
160 #endif
162 #ifndef OPTIONAL
163 #define OPTIONAL
164 #endif
166 /* Standard data types */
168 typedef void *LPVOID;
169 typedef const void *LPCVOID;
170 typedef int BOOL, *PBOOL, *LPBOOL;
171 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
172 typedef unsigned char UCHAR, *PUCHAR;
173 typedef unsigned short WORD, *PWORD, *LPWORD;
174 typedef unsigned short USHORT, *PUSHORT;
175 typedef int INT, *PINT, *LPINT;
176 typedef unsigned int UINT, *PUINT;
177 typedef long *LPLONG;
178 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
179 typedef unsigned long ULONG, *PULONG;
180 typedef float FLOAT, *PFLOAT;
182 /* Macros to map Winelib names to the correct implementation name */
183 /* Note that Winelib is purely Win32. */
185 #ifdef __WINESRC__
186 # define WINELIB_NAME_AW(func) \
187 func##_must_be_suffixed_with_W_or_A_in_this_context \
188 func##_must_be_suffixed_with_W_or_A_in_this_context
189 #else /* __WINESRC__ */
190 # ifdef UNICODE
191 # define WINELIB_NAME_AW(func) func##W
192 # else
193 # define WINELIB_NAME_AW(func) func##A
194 # endif /* UNICODE */
195 #endif /* __WINESRC__ */
197 #ifdef __WINESRC__
198 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
199 #else /* __WINESRC__ */
200 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
201 #endif /* __WINESRC__ */
203 #include <winnt.h>
205 /* Polymorphic types */
207 typedef UINT_PTR WPARAM;
208 typedef LONG_PTR LPARAM;
209 typedef LONG_PTR LRESULT;
211 /* Integer types */
213 typedef WORD ATOM;
214 typedef DWORD COLORREF, *LPCOLORREF;
217 /* Handle types */
219 typedef int HFILE;
220 DECLARE_HANDLE(HACCEL);
221 DECLARE_HANDLE(HBITMAP);
222 DECLARE_HANDLE(HBRUSH);
223 DECLARE_HANDLE(HCOLORSPACE);
224 DECLARE_HANDLE(HDC);
225 DECLARE_HANDLE(HDESK);
226 DECLARE_HANDLE(HENHMETAFILE);
227 DECLARE_HANDLE(HFONT);
228 DECLARE_HANDLE(HHOOK);
229 DECLARE_HANDLE(HICON);
230 DECLARE_HANDLE(HINSTANCE);
231 DECLARE_HANDLE(HKEY);
232 typedef HKEY *PHKEY;
233 DECLARE_HANDLE(HKL);
234 DECLARE_HANDLE(HMENU);
235 DECLARE_HANDLE(HMETAFILE);
236 DECLARE_HANDLE(HMONITOR);
237 DECLARE_HANDLE(HPALETTE);
238 DECLARE_HANDLE(HPEN);
239 DECLARE_HANDLE(HRGN);
240 DECLARE_HANDLE(HRSRC);
241 DECLARE_HANDLE(HTASK);
242 DECLARE_HANDLE(HWINEVENTHOOK);
243 DECLARE_HANDLE(HWINSTA);
244 DECLARE_HANDLE(HWND);
246 /* Handle types that must remain interchangeable even with strict on */
248 typedef HINSTANCE HMODULE;
249 typedef HANDLE HGDIOBJ;
250 typedef HANDLE HGLOBAL;
251 typedef HANDLE HLOCAL;
252 typedef HANDLE GLOBALHANDLE;
253 typedef HANDLE LOCALHANDLE;
254 typedef HICON HCURSOR;
256 /* Callback function pointers types */
258 typedef INT (CALLBACK *FARPROC)();
259 typedef INT (CALLBACK *PROC)();
262 /* Macros to split words and longs. */
264 #define LOBYTE(w) ((BYTE)(WORD)(w))
265 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
267 #define LOWORD(l) ((WORD)(DWORD)(l))
268 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
270 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
271 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
273 /* min and max macros */
274 #ifndef NOMINMAX
275 #ifndef max
276 #define max(a,b) (((a) > (b)) ? (a) : (b))
277 #endif
278 #ifndef min
279 #define min(a,b) (((a) < (b)) ? (a) : (b))
280 #endif
281 #endif /* NOMINMAX */
283 #ifdef MAX_PATH /* Work-around for Mingw */
284 #undef MAX_PATH
285 #endif /* MAX_PATH */
287 #define MAX_PATH 260
288 #define HFILE_ERROR ((HFILE)-1)
290 /* The SIZE structure */
291 typedef struct tagSIZE
293 LONG cx;
294 LONG cy;
295 } SIZE, *PSIZE, *LPSIZE;
297 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
299 /* The POINT structure */
300 typedef struct tagPOINT
302 LONG x;
303 LONG y;
304 } POINT, *PPOINT, *LPPOINT;
306 typedef struct _POINTL
308 LONG x;
309 LONG y;
310 } POINTL;
312 /* The POINTS structure */
314 typedef struct tagPOINTS
316 SHORT x;
317 SHORT y;
318 } POINTS, *PPOINTS, *LPPOINTS;
320 /* The RECT structure */
321 typedef struct tagRECT
323 LONG left;
324 LONG top;
325 LONG right;
326 LONG bottom;
327 } RECT, *PRECT, *LPRECT;
328 typedef const RECT *LPCRECT;
330 typedef struct tagRECTL
332 LONG left;
333 LONG top;
334 LONG right;
335 LONG bottom;
336 } RECTL, *PRECTL, *LPRECTL;
338 typedef const RECTL *LPCRECTL;
340 #ifdef __cplusplus
342 #endif
344 #endif /* __WINE_WINDEF_H */