windef.h 7.56 KB
Newer Older
1 2 3 4
/*
 * Basic types definitions
 *
 * Copyright 1996 Alexandre Julliard
5 6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20

21 22
#ifndef _WINDEF_
#define _WINDEF_
23

24
#ifndef WINVER
25
#define WINVER 0x0500
26
#endif
27

28 29 30 31 32 33
#ifndef NO_STRICT
# ifndef STRICT
#  define STRICT
# endif /* STRICT */
#endif /* NO_STRICT */

34 35 36 37 38 39
#ifdef __cplusplus
extern "C" {
#endif

/* Calling conventions definitions */

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#if defined(__i386__) && !defined(_X86_)
# define _X86_
#endif

#ifndef __stdcall
# ifdef __i386__
#  ifdef __GNUC__
#   define __stdcall __attribute__((__stdcall__))
#  elif defined(_MSC_VER)
    /* Nothing needs to be done. __stdcall already exists */
#  else
#   error You need to define __stdcall for your compiler
#  endif
# else  /* __i386__ */
#  define __stdcall
# endif  /* __i386__ */
#endif /* __stdcall */

#ifndef __cdecl
# if defined(__i386__) && defined(__GNUC__)
#  define __cdecl __attribute__((__cdecl__))
# elif !defined(_MSC_VER)
#  define __cdecl
63
# endif
64
#endif /* __stdcall */
65

66 67 68 69 70
#ifdef __WINESRC__
#define __ONLY_IN_WINELIB(x)	do_not_use_this_in_wine
#else
#define __ONLY_IN_WINELIB(x)	x
#endif
71 72

#ifndef pascal
73
#define pascal      __ONLY_IN_WINELIB(__stdcall)
74 75
#endif
#ifndef _pascal
76
#define _pascal	    __ONLY_IN_WINELIB(__stdcall)
77 78
#endif
#ifndef _stdcall
79
#define _stdcall    __ONLY_IN_WINELIB(__stdcall)
80 81
#endif
#ifndef _fastcall
82
#define _fastcall   __ONLY_IN_WINELIB(__stdcall)
83 84
#endif
#ifndef __fastcall
85
#define __fastcall  __ONLY_IN_WINELIB(__stdcall)
86 87
#endif
#ifndef __export
88
#define __export    __ONLY_IN_WINELIB(__stdcall)
89 90
#endif
#ifndef cdecl
91
#define cdecl       __ONLY_IN_WINELIB(__cdecl)
92 93
#endif
#ifndef _cdecl
94
#define _cdecl      __ONLY_IN_WINELIB(__cdecl)
95 96 97
#endif

#ifndef near
98
#define near        __ONLY_IN_WINELIB()
99 100
#endif
#ifndef far
101
#define far         __ONLY_IN_WINELIB()
102 103
#endif
#ifndef _near
104
#define _near       __ONLY_IN_WINELIB()
105 106
#endif
#ifndef _far
107
#define _far        __ONLY_IN_WINELIB()
108 109
#endif
#ifndef NEAR
110
#define NEAR        __ONLY_IN_WINELIB()
111 112
#endif
#ifndef FAR
113
#define FAR         __ONLY_IN_WINELIB()
114 115
#endif

116 117 118 119 120 121 122
#ifndef _MSC_VER
# ifndef _declspec
#  define _declspec(x)    __ONLY_IN_WINELIB()
# endif
# ifndef __declspec
#  define __declspec(x)   __ONLY_IN_WINELIB()
# endif
123 124 125 126 127 128 129 130 131 132 133
#endif

#define CALLBACK    __stdcall
#define WINAPI      __stdcall
#define APIPRIVATE  __stdcall
#define PASCAL      __stdcall
#define CDECL       __cdecl
#define _CDECL      __cdecl
#define WINAPIV     __cdecl
#define APIENTRY    WINAPI
#define CONST       const
134

135
/* Misc. constants. */
136

137
#undef NULL
138
#ifdef __cplusplus
139 140 141 142 143 144 145
#define NULL  0
#else
#define NULL  ((void*)0)
#endif

#ifdef FALSE
#undef FALSE
146
#endif
147
#define FALSE 0
148

149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
#ifdef TRUE
#undef TRUE
#endif
#define TRUE  1

#ifndef IN
#define IN
#endif

#ifndef OUT
#define OUT
#endif

#ifndef OPTIONAL
#define OPTIONAL
#endif

/* Standard data types */

typedef void                                   *LPVOID;
typedef const void                             *LPCVOID;
typedef int             BOOL,       *PBOOL,    *LPBOOL;
typedef unsigned char   BYTE,       *PBYTE,    *LPBYTE;
typedef unsigned char   UCHAR,      *PUCHAR;
typedef unsigned short  WORD,       *PWORD,    *LPWORD;
typedef unsigned short  USHORT,     *PUSHORT;
typedef int             INT,        *PINT,     *LPINT;
typedef unsigned int    UINT,       *PUINT;
typedef long                                   *LPLONG;
typedef unsigned long   DWORD,      *PDWORD,   *LPDWORD;
typedef unsigned long   ULONG,      *PULONG;
typedef float           FLOAT,      *PFLOAT;
Francois Gouget's avatar
Francois Gouget committed
181
typedef char                        *PSZ;
182

183 184 185
/* Macros to map Winelib names to the correct implementation name */
/* Note that Winelib is purely Win32.                             */

186
#ifdef __WINESRC__
187 188 189
# define WINELIB_NAME_AW(func) \
    func##_must_be_suffixed_with_W_or_A_in_this_context \
    func##_must_be_suffixed_with_W_or_A_in_this_context
190
#else  /* __WINESRC__ */
191 192 193 194 195
# ifdef UNICODE
#  define WINELIB_NAME_AW(func) func##W
# else
#  define WINELIB_NAME_AW(func) func##A
# endif  /* UNICODE */
196
#endif  /* __WINESRC__ */
197

198
#ifdef __WINESRC__
199
# define DECL_WINELIB_TYPE_AW(type)  /* nothing */
200
#else   /* __WINESRC__ */
201
# define DECL_WINELIB_TYPE_AW(type)  typedef WINELIB_NAME_AW(type) type;
202
#endif  /* __WINESRC__ */
203

204
#include <winnt.h>
205

206 207 208 209 210 211
/* Polymorphic types */

typedef UINT_PTR        WPARAM;
typedef LONG_PTR        LPARAM;
typedef LONG_PTR        LRESULT;

212
/* Integer types */
213

214
typedef WORD            ATOM;
215 216
typedef DWORD           COLORREF, *LPCOLORREF;

217

218
/* Handle types */
219

220
typedef int HFILE;
221
DECLARE_HANDLE(HACCEL);
222 223
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
224
DECLARE_HANDLE(HCOLORSPACE);
225
DECLARE_HANDLE(HDC);
226
DECLARE_HANDLE(HDESK);
227
DECLARE_HANDLE(HENHMETAFILE);
228
DECLARE_HANDLE(HFONT);
229
DECLARE_HANDLE(HGLRC);
230
DECLARE_HANDLE(HHOOK);
231
DECLARE_HANDLE(HICON);
232
DECLARE_HANDLE(HINSTANCE);
233
DECLARE_HANDLE(HKEY);
234
typedef HKEY *PHKEY;
235
DECLARE_HANDLE(HKL);
236
DECLARE_HANDLE(HMENU);
237
DECLARE_HANDLE(HMETAFILE);
238
DECLARE_HANDLE(HMONITOR);
239
DECLARE_HANDLE(HPALETTE);
240 241
DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HRGN);
242
DECLARE_HANDLE(HRSRC);
243
DECLARE_HANDLE(HTASK);
244
DECLARE_HANDLE(HWINEVENTHOOK);
245
DECLARE_HANDLE(HWINSTA);
246
DECLARE_HANDLE(HWND);
247

248 249 250 251 252 253
/* Handle types that must remain interchangeable even with strict on */

typedef HINSTANCE HMODULE;
typedef HANDLE HGDIOBJ;
typedef HANDLE HGLOBAL;
typedef HANDLE HLOCAL;
254 255
typedef HANDLE GLOBALHANDLE;
typedef HANDLE LOCALHANDLE;
256
typedef HICON HCURSOR;
257

258 259
/* Callback function pointers types */

260 261
typedef INT     (CALLBACK *FARPROC)();
typedef INT     (CALLBACK *PROC)();
262

263

264 265 266 267 268 269 270 271 272 273 274
/* Macros to split words and longs. */

#define LOBYTE(w)              ((BYTE)(WORD)(w))
#define HIBYTE(w)              ((BYTE)((WORD)(w) >> 8))

#define LOWORD(l)              ((WORD)(DWORD)(l))
#define HIWORD(l)              ((WORD)((DWORD)(l) >> 16))

#define MAKEWORD(low,high)     ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
#define MAKELONG(low,high)     ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))

275
/* min and max macros */
276
#ifndef NOMINMAX
277
#ifndef max
278
#define max(a,b)   (((a) > (b)) ? (a) : (b))
279 280
#endif
#ifndef min
281
#define min(a,b)   (((a) < (b)) ? (a) : (b))
282
#endif
283
#endif  /* NOMINMAX */
284

285 286 287 288
#ifdef MAX_PATH /* Work-around for Mingw */ 
#undef MAX_PATH
#endif /* MAX_PATH */

289
#define MAX_PATH        260
290
#define HFILE_ERROR     ((HFILE)-1)
291

292 293 294
/* The SIZE structure */
typedef struct tagSIZE
{
295 296
    LONG cx;
    LONG cy;
297 298 299 300 301 302 303 304 305 306
} SIZE, *PSIZE, *LPSIZE;

typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;

/* The POINT structure */
typedef struct tagPOINT
{
    LONG  x;
    LONG  y;
} POINT, *PPOINT, *LPPOINT;
307 308 309

typedef struct _POINTL
{
310 311
    LONG x;
    LONG y;
312
} POINTL, *PPOINTL;
313

314 315 316 317
/* The POINTS structure */

typedef struct tagPOINTS
{
318 319
    SHORT x;
    SHORT y;
320 321 322 323 324
} POINTS, *PPOINTS, *LPPOINTS;

/* The RECT structure */
typedef struct tagRECT
{
325 326 327 328
    LONG left;
    LONG top;
    LONG right;
    LONG bottom;
329 330 331
} RECT, *PRECT, *LPRECT;
typedef const RECT *LPCRECT;

332
typedef struct _RECTL
333 334
{
    LONG left;
335
    LONG top;
336 337 338 339 340 341 342 343 344
    LONG right;
    LONG bottom;
} RECTL, *PRECTL, *LPRECTL;

typedef const RECTL *LPCRECTL;

#ifdef __cplusplus
}
#endif
345

346
#endif /* _WINDEF_ */