windef.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. /*
  2. * Basic types definitions
  3. *
  4. * Copyright 1996 Alexandre Julliard
  5. *
  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.
  10. *
  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.
  15. *
  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
  19. */
  20. #ifndef _WINDEF_
  21. #define _WINDEF_
  22. #ifndef WINVER
  23. #define WINVER 0x0500
  24. #endif
  25. #ifndef NO_STRICT
  26. # ifndef STRICT
  27. # define STRICT
  28. # endif /* STRICT */
  29. #endif /* NO_STRICT */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* Calling conventions definitions */
  34. #if defined(__i386__) && !defined(_X86_)
  35. # define _X86_
  36. #endif
  37. #ifndef __stdcall
  38. # ifdef __i386__
  39. # ifdef __GNUC__
  40. # define __stdcall __attribute__((__stdcall__))
  41. # elif defined(_MSC_VER)
  42. /* Nothing needs to be done. __stdcall already exists */
  43. # else
  44. # error You need to define __stdcall for your compiler
  45. # endif
  46. # else /* __i386__ */
  47. # define __stdcall
  48. # endif /* __i386__ */
  49. #endif /* __stdcall */
  50. #ifndef __cdecl
  51. # if defined(__i386__) && defined(__GNUC__)
  52. # define __cdecl __attribute__((__cdecl__))
  53. # elif !defined(_MSC_VER)
  54. # define __cdecl
  55. # endif
  56. #endif /* __stdcall */
  57. #ifdef __WINESRC__
  58. #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
  59. #else
  60. #define __ONLY_IN_WINELIB(x) x
  61. #endif
  62. #ifndef pascal
  63. #define pascal __ONLY_IN_WINELIB(__stdcall)
  64. #endif
  65. #ifndef _pascal
  66. #define _pascal __ONLY_IN_WINELIB(__stdcall)
  67. #endif
  68. #ifndef _stdcall
  69. #define _stdcall __ONLY_IN_WINELIB(__stdcall)
  70. #endif
  71. #ifndef _fastcall
  72. #define _fastcall __ONLY_IN_WINELIB(__stdcall)
  73. #endif
  74. #ifndef __fastcall
  75. #define __fastcall __ONLY_IN_WINELIB(__stdcall)
  76. #endif
  77. #ifndef __export
  78. #define __export __ONLY_IN_WINELIB(__stdcall)
  79. #endif
  80. #ifndef cdecl
  81. #define cdecl __ONLY_IN_WINELIB(__cdecl)
  82. #endif
  83. #ifndef _cdecl
  84. #define _cdecl __ONLY_IN_WINELIB(__cdecl)
  85. #endif
  86. #ifndef near
  87. #define near __ONLY_IN_WINELIB()
  88. #endif
  89. #ifndef far
  90. #define far __ONLY_IN_WINELIB()
  91. #endif
  92. #ifndef _near
  93. #define _near __ONLY_IN_WINELIB()
  94. #endif
  95. #ifndef _far
  96. #define _far __ONLY_IN_WINELIB()
  97. #endif
  98. #ifndef NEAR
  99. #define NEAR __ONLY_IN_WINELIB()
  100. #endif
  101. #ifndef FAR
  102. #define FAR __ONLY_IN_WINELIB()
  103. #endif
  104. #ifndef _MSC_VER
  105. # ifndef _declspec
  106. # define _declspec(x) __ONLY_IN_WINELIB()
  107. # endif
  108. # ifndef __declspec
  109. # define __declspec(x) __ONLY_IN_WINELIB()
  110. # endif
  111. #endif
  112. #define CALLBACK __stdcall
  113. #define WINAPI __stdcall
  114. #define APIPRIVATE __stdcall
  115. #define PASCAL __stdcall
  116. #define CDECL __cdecl
  117. #define _CDECL __cdecl
  118. #define WINAPIV __cdecl
  119. #define APIENTRY WINAPI
  120. #define CONST const
  121. /* Misc. constants. */
  122. #undef NULL
  123. #ifdef __cplusplus
  124. #define NULL 0
  125. #else
  126. #define NULL ((void*)0)
  127. #endif
  128. #ifdef FALSE
  129. #undef FALSE
  130. #endif
  131. #define FALSE 0
  132. #ifdef TRUE
  133. #undef TRUE
  134. #endif
  135. #define TRUE 1
  136. #ifndef IN
  137. #define IN
  138. #endif
  139. #ifndef OUT
  140. #define OUT
  141. #endif
  142. #ifndef OPTIONAL
  143. #define OPTIONAL
  144. #endif
  145. /* Standard data types */
  146. typedef void *LPVOID;
  147. typedef const void *LPCVOID;
  148. typedef int BOOL, *PBOOL, *LPBOOL;
  149. typedef unsigned char BYTE, *PBYTE, *LPBYTE;
  150. typedef unsigned char UCHAR, *PUCHAR;
  151. typedef unsigned short WORD, *PWORD, *LPWORD;
  152. typedef unsigned short USHORT, *PUSHORT;
  153. typedef int INT, *PINT, *LPINT;
  154. typedef unsigned int UINT, *PUINT;
  155. typedef long *LPLONG;
  156. typedef unsigned long DWORD, *PDWORD, *LPDWORD;
  157. typedef unsigned long ULONG, *PULONG;
  158. typedef float FLOAT, *PFLOAT;
  159. typedef char *PSZ;
  160. /* Macros to map Winelib names to the correct implementation name */
  161. /* Note that Winelib is purely Win32. */
  162. #ifdef __WINESRC__
  163. # define WINELIB_NAME_AW(func) \
  164. func##_must_be_suffixed_with_W_or_A_in_this_context \
  165. func##_must_be_suffixed_with_W_or_A_in_this_context
  166. #else /* __WINESRC__ */
  167. # ifdef UNICODE
  168. # define WINELIB_NAME_AW(func) func##W
  169. # else
  170. # define WINELIB_NAME_AW(func) func##A
  171. # endif /* UNICODE */
  172. #endif /* __WINESRC__ */
  173. #ifdef __WINESRC__
  174. # define DECL_WINELIB_TYPE_AW(type) /* nothing */
  175. #else /* __WINESRC__ */
  176. # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
  177. #endif /* __WINESRC__ */
  178. #include <winnt.h>
  179. /* Polymorphic types */
  180. typedef UINT_PTR WPARAM;
  181. typedef LONG_PTR LPARAM;
  182. typedef LONG_PTR LRESULT;
  183. /* Integer types */
  184. typedef WORD ATOM;
  185. typedef DWORD COLORREF, *LPCOLORREF;
  186. /* Handle types */
  187. typedef int HFILE;
  188. DECLARE_HANDLE(HACCEL);
  189. DECLARE_HANDLE(HBITMAP);
  190. DECLARE_HANDLE(HBRUSH);
  191. DECLARE_HANDLE(HCOLORSPACE);
  192. DECLARE_HANDLE(HDC);
  193. DECLARE_HANDLE(HDESK);
  194. DECLARE_HANDLE(HENHMETAFILE);
  195. DECLARE_HANDLE(HFONT);
  196. DECLARE_HANDLE(HGLRC);
  197. DECLARE_HANDLE(HHOOK);
  198. DECLARE_HANDLE(HICON);
  199. DECLARE_HANDLE(HINSTANCE);
  200. DECLARE_HANDLE(HKEY);
  201. typedef HKEY *PHKEY;
  202. DECLARE_HANDLE(HKL);
  203. DECLARE_HANDLE(HMENU);
  204. DECLARE_HANDLE(HMETAFILE);
  205. DECLARE_HANDLE(HMONITOR);
  206. DECLARE_HANDLE(HPALETTE);
  207. DECLARE_HANDLE(HPEN);
  208. DECLARE_HANDLE(HRGN);
  209. DECLARE_HANDLE(HRSRC);
  210. DECLARE_HANDLE(HTASK);
  211. DECLARE_HANDLE(HWINEVENTHOOK);
  212. DECLARE_HANDLE(HWINSTA);
  213. DECLARE_HANDLE(HWND);
  214. /* Handle types that must remain interchangeable even with strict on */
  215. typedef HINSTANCE HMODULE;
  216. typedef HANDLE HGDIOBJ;
  217. typedef HANDLE HGLOBAL;
  218. typedef HANDLE HLOCAL;
  219. typedef HANDLE GLOBALHANDLE;
  220. typedef HANDLE LOCALHANDLE;
  221. typedef HICON HCURSOR;
  222. /* Callback function pointers types */
  223. typedef INT (CALLBACK *FARPROC)();
  224. typedef INT (CALLBACK *PROC)();
  225. /* Macros to split words and longs. */
  226. #define LOBYTE(w) ((BYTE)(WORD)(w))
  227. #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
  228. #define LOWORD(l) ((WORD)(DWORD)(l))
  229. #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
  230. #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
  231. #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
  232. /* min and max macros */
  233. #ifndef NOMINMAX
  234. #ifndef max
  235. #define max(a,b) (((a) > (b)) ? (a) : (b))
  236. #endif
  237. #ifndef min
  238. #define min(a,b) (((a) < (b)) ? (a) : (b))
  239. #endif
  240. #endif /* NOMINMAX */
  241. #ifdef MAX_PATH /* Work-around for Mingw */
  242. #undef MAX_PATH
  243. #endif /* MAX_PATH */
  244. #define MAX_PATH 260
  245. #define HFILE_ERROR ((HFILE)-1)
  246. /* The SIZE structure */
  247. typedef struct tagSIZE
  248. {
  249. LONG cx;
  250. LONG cy;
  251. } SIZE, *PSIZE, *LPSIZE;
  252. typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
  253. /* The POINT structure */
  254. typedef struct tagPOINT
  255. {
  256. LONG x;
  257. LONG y;
  258. } POINT, *PPOINT, *LPPOINT;
  259. typedef struct _POINTL
  260. {
  261. LONG x;
  262. LONG y;
  263. } POINTL, *PPOINTL;
  264. /* The POINTS structure */
  265. typedef struct tagPOINTS
  266. {
  267. SHORT x;
  268. SHORT y;
  269. } POINTS, *PPOINTS, *LPPOINTS;
  270. /* The RECT structure */
  271. typedef struct tagRECT
  272. {
  273. LONG left;
  274. LONG top;
  275. LONG right;
  276. LONG bottom;
  277. } RECT, *PRECT, *LPRECT;
  278. typedef const RECT *LPCRECT;
  279. typedef struct _RECTL
  280. {
  281. LONG left;
  282. LONG top;
  283. LONG right;
  284. LONG bottom;
  285. } RECTL, *PRECTL, *LPRECTL;
  286. typedef const RECTL *LPCRECTL;
  287. #ifdef __cplusplus
  288. }
  289. #endif
  290. #endif /* _WINDEF_ */