msoem.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 8k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. /*****************************************************************************
  2.     msoem.h
  3.     Owner: DaleG
  4.     Copyright (c) 1997 Microsoft Corporation
  5.     Typedef file for Rules Engine of Event Monitor.
  6. *****************************************************************************/
  7. #ifndef MSOEM_H
  8. #define MSOEM_H
  9. #ifndef MSO_H
  10. #pragma message ("MsoEM.h file included before Mso.h.  Including Mso.h.")
  11. #include "mso.h"
  12. #endif
  13. MSOEXTERN_C_BEGIN   // ***************** Begin extern "C" ********************
  14. #include "msoemtyp.h"
  15. //---------------------------------------------------------------------------
  16. // Define useful macros (mostly stolen from Word)
  17. // REVIEW daleg: these need to be Mso-ized
  18. //---------------------------------------------------------------------------
  19. #if !WORD_BUILD  &&  !STANDALONE_WORD
  20. #ifndef DEBUGASSERTSZ
  21. #define DEBUGASSERTSZ       VSZASSERT
  22. #endif /* !DEBUGASSERTSZ */
  23. ///#define FNeNcLpxch(lpch1, lpch2, cch) FNeNcRgxch(lpch1, lpch2, cch)
  24. #define SzFromStz(stz)          ((stz)+1)
  25. #define XszFromXstz(xstz)       ((xstz)+1)
  26. #if !ACCESS_BUILD
  27. #define CchSz(sz)               MsoCchSzLen(sz)
  28. #ifndef CchWz
  29. #define CchWz(wz)               MsoCchWzLen(wz)
  30. #endif /* !CchWz */
  31. #endif /* !ACCESS_BUILD */
  32. #define XszFromXstz(xstz)       ((xstz)+1)
  33. #define RgxchFromXstz(xstz)     ((xstz)+1)
  34. #define CchXstz(xstz)           CchXst(xstz)
  35. #define CchXst(xst)             (*xst)
  36. #define cbMaxSz     256
  37. #define cbMaxStz    257
  38. #define cchMaxSz    255
  39. #define cbMaxSz     256
  40. #ifndef WORD_BUILD
  41. #ifndef fTrue
  42. #define fTrue 1
  43. #endif
  44. #ifndef fFalse
  45. #define fFalse 0
  46. #endif
  47. #define tYes    1      /* much like fTrue */
  48. #define tNo     0      /* much like fFalse */
  49. #define tMaybe  (-1)   /* the "different" state */
  50. #define iNil (-1)
  51. #endif /* !WORD_BUILD */
  52. #undef wValue
  53. #define STATIC
  54. // Return "low" value of a split value
  55. #define W1OfPsv(psv)            ((psv)->wValue1)
  56. // Set "low" value of a split value
  57. #define SetW1OfPsv(psv, w)      ((psv)->wValue1 = (w))
  58. // Increment "low" value of a split value
  59. #define IncrW1OfPsv(psv, w)     ((psv)->wValue1 += (w))
  60. // Return "high" value of a split value
  61. #define W2OfPsv(psv)            ((psv)->wValue2)
  62. // Set "high" value of a split value
  63. #define SetW2OfPsv(psv, w)      ((psv)->wValue2 = (w))
  64. // Increment "high" value of a split value
  65. #define IncrW2OfPsv(psv, w)     ((psv)->wValue2 += (w))
  66. // Merge two shorts into a long, compatible with SVL
  67. #define SvlFromWW(wValue2, wValue1) 
  68.             (((long) (wValue2) << 16) + ((long) (wValue1)))
  69. #define PbCopyRgb(pbFrom, pbTo, cb) 
  70.             (((unsigned char *) memmove((pbTo), (pbFrom), (cb))) + (cb))
  71. #define PbCopyRgbNo(pbFrom, pbTo, cb) 
  72.             (memcpy((pbTo), (pbFrom), (cb)), (pbTo) + (cb))
  73. #define CopyRgb(pbFrom, pbTo, cb)       memmove(pbTo, pbFrom, cb)
  74. #define CopyRgbNo(pbFrom, pbTo, cb)     memcpy(pbTo, pbFrom, cb)
  75. #define CopyRgxch(pxchFrom, pxchTo, cch) 
  76.             CopyRgb(pxchFrom,pxchTo,(cch)*cbXchar)
  77. #define ClearLp(lpv, type) 
  78.             MsoMemset((lpv), '', sizeof(type))
  79. #define ClearLprg(lpv, type, iMax) 
  80.             MsoMemset((lpv), '', sizeof(type) * (iMax))
  81. #define CopyLprg(lpvFrom, lpvTo, type, iMax) 
  82.             CopyRgb((lpvFrom), (lpvTo), (unsigned int)(sizeof(type) * (iMax)))
  83. #define IMaxRg(dcl, type) 
  84.             (sizeof(dcl) / sizeof(type))
  85. #define ClearLprgBlocked(lpv, type, iMax) 
  86.             MsoMemset((lpv), '', (sizeof(type) * (iMax) + sizeof(void *)))
  87. #define IMaxRgBlocked(dcl, type) 
  88.             ((sizeof(dcl) / sizeof(type)) - sizeof(void *))
  89. #endif /* !WORD_BUILD */
  90. // Allocate storage for a given type, return pointer
  91. #define MsoPNewEm(type) 
  92.             ((type *) MsoPvAllocEmCb((unsigned int) sizeof(type)))
  93. // Zero storage for a type, given pointer
  94. #define MsoClearPv(pv, type) 
  95.             MsoClearPvCb((pv), sizeof(type))
  96. // Zero storage for number bytes given
  97. #define MsoClearPvCb(pv, cb) 
  98.             MsoMemset((pv), '', (cb))
  99. // Allocate storage for an array of a given type, return pointer
  100. #define MsoPNewEmRg(type, iMax) 
  101.             ((type *) MsoPvAllocEmCb((unsigned int)(sizeof(type) * (iMax))))
  102. // Zero storage for an array of a type, given pointer
  103. #define MsoClearRg(pv, type, iMax) 
  104.             MsoMemset((pv), '', sizeof(type) * (iMax))
  105. // Copy storage for an array of a type, given pointers
  106. #define MsoCopyRg(rgFrom, rgTo, type, iMax) 
  107.             MsoMemmove((rgTo), (rgFrom), sizeof(type) * (iMax))
  108. // Copy storage for an array of a type, given pointers, checking for overlaps
  109. #define MsoCopyRgNo(rgFrom, rgTo, type, iMax) 
  110.             MsoMemcpy((rgTo), (rgFrom), sizeof(type) * (iMax))
  111. // Copy an array of Unicode characters
  112. #define MsoCopyRgwch(rgFrom, rgTo, cch) 
  113.             MsoCopyRg((rgFrom), (rgTo), WCHAR, (cch))
  114. // Return maximum number of bytes used by array, given *definition*
  115. #define MsoIMaxRg(rg) 
  116.             (sizeof(rg) / sizeof(rg[0]))
  117. // Allocate storage for a given type, but specifying size, return pointer
  118. #define MsoPNewEmCb(type, cb) 
  119.             ((type *) MsoPvAllocEmCb((unsigned int)(cb)))
  120. // Allocate (far) LINKED BLOCK storage for an array of type, return ptr
  121. // This is a rg of the type, but with a pointer linking it to next alloc
  122. #define MsoPNewEmRgBlocked(type_blk, type, iMax) 
  123.             ((type_blk *) MsoPvAllocEmCb 
  124.                 ((unsigned int) (sizeof(type) * (iMax) + sizeof(void *))))
  125. #define MsoPReallocEm(pv, type, cb) 
  126.             ((type *) MsoPvReallocEmPvCb((pv), (unsigned int) (cb)))
  127. #define MsoPReallocEmRg(pv, type, iMax) 
  128.             ((type *) 
  129.                 MsoPvReallocEmPvCb 
  130.                     ((pv), (unsigned int) (sizeof(type) * (iMax))))
  131. #define MsoPvReallocEmPvCb(pv, cb) 
  132.             (void *)MsoPvRealloc(pv, cb)
  133. #define MsoPvAllocEmCb(cb)      (void *)MsoPvAlloc((cb), msodgMisc )
  134. #define MsoFreeEmPv(pv)     { if (pv) MsoFreePv(pv); }
  135. #define MsoFreeEmPvClear(pv)    MsoFreeEmPpv(&(pv))
  136. #define MsoFreeEmPpv(ppv)   {   
  137.                                 MsoFreeEmPv(*(void **) (ppv));  
  138.                                 *(void * UNALIGNED *) (ppv) = NULL; 
  139.                                 }
  140. #define MsoPbCopyRgb(pbFrom, pbTo, cb)  
  141.             (((unsigned char *) MsoMemmove((pbTo), (pbFrom), (cb))) + (cb))
  142. #define MsoPbCopyRgbNo(pbFrom, pbTo, cb) 
  143.             (MsoMemcpy((pbTo), (pbFrom), (cb)), (pbTo) + (cb))
  144. // Return whether x is between lo and hi values, inclusive.
  145. #define MsoFBetween(x, lo, hi)      ((x) >= (lo)  &&  (x) <= (hi))
  146. // REVIEW: consider the following minutely faster but more dangerous version
  147. //#define MsoFBetween(x, lo, hi)        ((unsigned)((x) - (lo)) <= (hi) - (lo))
  148. #include "msodbglg.h"
  149. #ifdef STANDALONE
  150. #define MsoPvAlloc(cb, dg)      malloc(cb)
  151. #define MsoFreePv(pv)           free(pv)
  152. #define MsoPvRealloc(pv, cb)    realloc((pv), (cb))
  153. #endif /* STANDALONE */
  154. #if !defined(WORD_BUILD)  &&  !defined(WORD_H)
  155. #ifndef CommSz
  156. #define CommSz(sz)          OutputDebugStringA(sz)
  157. #endif /* !CommSz */
  158. #ifndef ACCESS_BUILD
  159. typedef void           *DOC;                            // Define object
  160. #define docNil  ((DOC) NULL)
  161. #else /* ACCESS_BUILD */
  162. #define pdocNil     ((DOC *) NULL)
  163. #endif /* !ACCESS_BUILD */
  164. #define cpNil ((MSOCP) -1)
  165. #define cp0 ((MSOCP) 0)
  166. ///typedef unsigned short BF;
  167. typedef unsigned char uchar;
  168. typedef unsigned int uint;
  169. typedef unsigned short ushort;
  170. typedef unsigned long ulong;
  171. #endif /* !WORD_BUILD  &&  !WORD_H */
  172. #ifdef OFFICE_BUILD
  173. MSOAPI_(BOOL) MsoFInitOfficeEm(struct MSOINST *pinst);  // Init MSO Em
  174. // Query type in FEmNotifyAction(msoemssAppEm,..)
  175. #define msonaAppEmUseMso        1                       // App needs MSO EM?
  176. #endif /* !OFFICE_BUILD */
  177. MSOAPI_(int) MsoLRuleParsePwch(                         // Parse string w/rules
  178.     WCHAR              *pwch,
  179.     int                 cch,
  180.     int                 rulevt,
  181.     int                 rulg
  182.     );
  183. #ifdef DEBUG
  184. MSOAPI_(int) MsoLRuleParseFile(                         // Parse file w/rules
  185.     char               *rgchPath,
  186.     int                 rulevt,
  187.     int                 rulg
  188.     );
  189. #ifdef OFFICE_BUILD
  190. BOOL FWriteEmBe(LPARAM lParam, struct MSOINST *pinst);  // Mark MSO Em memory
  191. #endif /* OFFICE_BUILD */
  192. #endif /* DEBUG */
  193. MSOEXTERN_C_END     // ****************** End extern "C" *********************
  194. #endif /* !MSOEM_H */