Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
5.0 KiB

  1. /***************************************************************************\*
  2. *
  3. * MISC.H
  4. *
  5. * Copyright (C) Microsoft Corporation 1988 - 1994.
  6. * All Rights reserved.
  7. *
  8. *****************************************************************************
  9. *
  10. * Module Description: Include file defining basic types and constants.
  11. * Windows/PM version.
  12. *
  13. *****************************************************************************
  14. *
  15. * Known Bugs:
  16. *
  17. ****************************************************************************/
  18. #ifndef __MISC_H__
  19. #define __MISC_H__
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #define NOCOMM
  24. /* extended keywords */
  25. #ifndef PRIVATE
  26. #ifdef _DEBUG
  27. #define PRIVATE
  28. #else
  29. #define PRIVATE static
  30. #endif
  31. #endif
  32. #ifdef PUBLIC
  33. #undef PUBLIC
  34. #endif
  35. #define PUBLIC
  36. #ifdef _32BIT
  37. #define HUGE
  38. #else
  39. #define HUGE huge
  40. #endif
  41. #ifndef CDECL
  42. #define CDECL cdecl
  43. #endif
  44. #define pNil (0)
  45. #define qNil (0)
  46. #define hNil (0)
  47. #define lhNil (0)
  48. #define dwNil (0xFFFFFFFF)
  49. // basic types
  50. #ifndef VOID
  51. #define VOID void
  52. typedef long LONG;
  53. #endif
  54. /* Huge pointer stuff */
  55. typedef VOID HUGE * RV;
  56. typedef BYTE HUGE * RB;
  57. typedef LONG HUGE * RL;
  58. #define rNil ((RV) 0L)
  59. #ifndef SHORT
  60. typedef short SHORT;
  61. typedef char CHAR;
  62. #endif
  63. #ifndef BASETYPES
  64. #define BASETYPES
  65. typedef unsigned long ULONG;
  66. typedef ULONG *PULONG;
  67. typedef unsigned short USHORT;
  68. typedef USHORT *PUSHORT;
  69. typedef unsigned char UCHAR;
  70. typedef UCHAR *PUCHAR;
  71. typedef char *PSZ;
  72. #endif /* !BASETYPES */
  73. typedef unsigned short WORD;
  74. typedef unsigned short UWORD;
  75. // pointer types
  76. typedef char FAR * QCH; // Guaranteed far pointer - not an SZ, ST or LPSTR
  77. typedef char FAR * LPCHAR;
  78. typedef BYTE FAR * QB;
  79. typedef BYTE FAR * LPB;
  80. typedef VOID FAR * QV;
  81. typedef SHORT FAR * QI;
  82. typedef WORD FAR * QW;
  83. typedef LONG FAR * QL;
  84. typedef WORD FAR * QUI;
  85. typedef ULONG FAR * QUL;
  86. typedef DWORD FAR * QDW;
  87. typedef char * PCH; // "Native" pointer - not SZ, ST or NPSTR
  88. typedef VOID * PV;
  89. typedef SHORT * PI;
  90. typedef WORD * PW;
  91. typedef LONG * PL;
  92. // string types:
  93. typedef unsigned char FAR * SZ; // 0-terminated string
  94. typedef unsigned char FAR * ST; // byte count prefixed string
  95. // other types
  96. //#ifndef ITWRAP
  97. //typedef HANDLE HFS; /* Handle to a file system */
  98. //#endif
  99. typedef DWORD HASH; /* Hash value */
  100. typedef void (CALLBACK* MVCBPROC)();
  101. /* points and rectangles */
  102. typedef POINT PT;
  103. typedef POINT FAR * QPT;
  104. typedef POINT * PPT;
  105. typedef POINT NEAR * NPPT;
  106. typedef RECT RCT;
  107. typedef RECT FAR * QRCT;
  108. typedef RECT * PRCT;
  109. typedef RECT NEAR * NPRCT;
  110. // This from de.h -- the QDE struct ptr type is passed around alot,
  111. // so it is "opaquely" defined here so the type is always available.
  112. typedef struct de_tag FAR *QDE;
  113. #define Unreferenced( var ) (var) /* Get rid of compiler warnings */
  114. #define LSizeOf( t ) (LONG)sizeof( t )
  115. /* MAC support function's prototype */
  116. WORD PASCAL FAR GetMacWord (BYTE FAR *);
  117. VOID PASCAL FAR SetMacWord (BYTE FAR *, WORD);
  118. DWORD PASCAL FAR GetMacLong (BYTE FAR *);
  119. VOID PASCAL FAR SetMacLong (BYTE FAR *, DWORD);
  120. WORD PASCAL FAR SwapWord (WORD);
  121. DWORD PASCAL FAR SwapLong (DWORD);
  122. #if defined( _32BIT )
  123. #ifndef _MAC
  124. // SMALL_RECT is not defined for _MAC
  125. /*
  126. * Win32 uses 32 bit coordinates in RECT structures. The disk files
  127. * use the Win 16 version, which has 16 bit coordinates. The NT version
  128. * maps these when reading in, and the following macros do the conversion.
  129. */
  130. typedef SMALL_RECT SRCT, FAR *QSRCT, *PSRCT, NEAR *NPSRCT ;
  131. #define COPY_SRCT_TO_RCT(a,b) { (b).left = (INT)(a).left; \
  132. (b).top = (INT)(a).top; \
  133. (b).right = (INT)(a).right; \
  134. (b).bottom = (INT)(a).bottom); \
  135. }
  136. #define COPY_RCT_TO_SRCT(a,b) { (b).left = (short)(a).left; \
  137. (b).top = (short)(a).top; \
  138. (b).right = (short)(a).right; \
  139. (b).bottom = (short)(a).bottom; \
  140. }
  141. #endif
  142. #ifndef DEFINED_SHORT_RECT
  143. typedef struct _SHORT_RECT { /* srct */
  144. short left;
  145. short top;
  146. short right;
  147. short bottom;
  148. } SHORT_RECT, HUGE * HUSHORT_RECT;
  149. // for win32
  150. #define DEFINED_SHORT_RECT
  151. #endif
  152. // changed LPRECT for huge support
  153. typedef RECT HUGE * HURECT;
  154. #ifndef DEFINED_WMF_HEADER
  155. // standard metafile header (page maker?)
  156. typedef struct
  157. {
  158. DWORD key;
  159. WORD hmf;
  160. SHORT_RECT bbox;
  161. WORD inch;
  162. DWORD Unused1;
  163. WORD CheckSum;
  164. } WMF_HEADER;
  165. #define DEFINED_WMF_HEADER
  166. #endif
  167. #ifndef DEFINED_MFH16
  168. // standard metafile header (page maker?)
  169. typedef struct
  170. {
  171. DWORD dwKey;
  172. WORD hMF;
  173. SHORT_RECT rcBound;
  174. WORD wUnitsPerInch;
  175. DWORD dwReserved;
  176. WORD wChecksum;
  177. } MFH16, FAR *LPMFH16;
  178. #define DEFINED_MFH16
  179. #endif
  180. #endif // defined( _32BIT )
  181. #ifdef __cplusplus
  182. }
  183. #endif
  184. #endif //__MISC_H__
  185. // EOF