2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
7 #ifndef __WINE_WINDEF_H
8 #define __WINE_WINDEF_H
24 /* Macros to map Winelib names to the correct implementation name */
25 /* depending on __WINE__ and UNICODE macros. */
26 /* Note that Winelib is purely Win32. */
29 # define WINELIB_NAME_AW(func) \
30 func##_must_be_suffixed_with_W_or_A_in_this_context \
31 func##_must_be_suffixed_with_W_or_A_in_this_context
34 # define WINELIB_NAME_AW(func) func##W
36 # define WINELIB_NAME_AW(func) func##A
41 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
43 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
52 typedef WORD CATCHBUF
[9];
53 typedef WORD
*LPCATCHBUF
;
55 /* Handle types that exist both in Win16 and Win32. */
58 DECLARE_OLD_HANDLE(HACCEL
);
59 DECLARE_OLD_HANDLE(HBITMAP
);
60 DECLARE_OLD_HANDLE(HBRUSH
);
61 DECLARE_HANDLE(HCOLORSPACE
);
62 DECLARE_OLD_HANDLE(HDC
);
63 DECLARE_HANDLE(HDESK
);
64 DECLARE_OLD_HANDLE(HENHMETAFILE
);
65 DECLARE_OLD_HANDLE(HFONT
);
66 DECLARE_OLD_HANDLE(HHOOK
);
67 DECLARE_OLD_HANDLE(HICON
);
68 DECLARE_OLD_HANDLE(HINSTANCE
);
69 DECLARE_OLD_HANDLE(HKEY
);
70 DECLARE_OLD_HANDLE(HKL
);
71 DECLARE_OLD_HANDLE(HMENU
);
72 DECLARE_OLD_HANDLE(HMETAFILE
);
73 DECLARE_OLD_HANDLE(HMONITOR
);
74 DECLARE_OLD_HANDLE(HPALETTE
);
75 DECLARE_OLD_HANDLE(HPEN
);
76 DECLARE_OLD_HANDLE(HRGN
);
77 DECLARE_OLD_HANDLE(HRSRC
);
78 DECLARE_OLD_HANDLE(HTASK
);
79 DECLARE_HANDLE(HWINSTA
);
80 DECLARE_OLD_HANDLE(HWND
);
82 /* Handle types that must remain interchangeable even with strict on */
84 typedef HINSTANCE HMODULE
;
85 typedef HANDLE HGDIOBJ
;
86 typedef HANDLE HGLOBAL
;
87 typedef HANDLE HLOCAL
;
88 typedef HANDLE GLOBALHANDLE
;
89 typedef HANDLE LOCALHANDLE
;
90 typedef HICON HCURSOR
;
92 /* Callback function pointers types */
94 typedef INT
CALLBACK (*FARPROC
)();
95 typedef INT
CALLBACK (*PROC
)();
98 /* Macros to split words and longs. */
100 #define LOBYTE(w) ((BYTE)(WORD)(w))
101 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
103 #define LOWORD(l) ((WORD)(DWORD)(l))
104 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
106 #define SLOWORD(l) ((SHORT)(LONG)(l))
107 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
109 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
110 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
111 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
112 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
113 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
114 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
116 #define SELECTOROF(ptr) (HIWORD(ptr))
117 #define OFFSETOF(ptr) (LOWORD(ptr))
120 /* macros to set parts of a DWORD (not in the Windows API) */
121 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
122 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
123 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
124 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
127 /* min and max macros */
130 #define max(a,b) (((a) > (b)) ? (a) : (b))
133 #define min(a,b) (((a) < (b)) ? (a) : (b))
135 #endif /* NOMINMAX */
138 /* FIXME: These are supposed to be in stdlib.h only */
140 #define _MAX_FNAME 256
141 #define _MAX_DIR _MAX_FNAME
142 #define _MAX_EXT _MAX_FNAME
143 #define _MAX_PATH 260
145 #define MAX_PATH _MAX_PATH
148 #define HFILE_ERROR ((HFILE)-1)
150 /* The SIZE structure */
151 typedef struct tagSIZE
155 } SIZE
, *PSIZE
, *LPSIZE
;
157 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
159 /* The POINT structure */
160 typedef struct tagPOINT
164 } POINT
, *PPOINT
, *LPPOINT
;
166 typedef struct _POINTL
172 /* The POINTS structure */
174 typedef struct tagPOINTS
178 } POINTS
, *PPOINTS
, *LPPOINTS
;
180 /* The RECT structure */
181 typedef struct tagRECT
187 } RECT
, *PRECT
, *LPRECT
;
188 typedef const RECT
*LPCRECT
;
191 typedef struct tagRECTL
197 } RECTL
, *PRECTL
, *LPRECTL
;
199 typedef const RECTL
*LPCRECTL
;
205 #endif /* __WINE_WINDEF_H */