home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / MSINC.PAK / MAPIDBG.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  25KB  |  476 lines

  1. /*
  2.  *  M A P I D B G . H
  3.  *
  4.  *  Debugging support for MAPI service providers.
  5.  *  Support functions are implemented in MAPIDBG.C.
  6.  *
  7.  *  Copyright 1993-1995 Microsoft Corporation. All Rights Reserved.
  8.  */
  9.  
  10. #ifndef __MAPIDBG_H_
  11. #define __MAPIDBG_H_
  12.  
  13. /*
  14.  * Debugging Macros -------------------------------------------------------
  15.  *
  16.  *      IFDBG(x)        Results in the expression x if DEBUG is defined, or
  17.  *                      to nothing if DEBUG is not defined
  18.  *  
  19.  *      IFNDBG(x)       Results in the expression x if DEBUG is not defined,
  20.  *                      or to nothing if DEBUG is defined
  21.  *  
  22.  *      Unreferenced(a) Causes a to be referenced so that the compiler
  23.  *                      doesn't issue warnings about unused local variables
  24.  *                      which exist but are reserved for future use (eg
  25.  *                      ulFlags in many cases)
  26.  */
  27.  
  28. #if defined(DEBUG)
  29. #define IFDBG(x)            x
  30. #define IFNDBG(x)
  31. #else
  32. #define IFDBG(x)
  33. #define IFNDBG(x)           x
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. #define EXTERN_C_BEGIN      extern "C" {
  38. #define EXTERN_C_END        }
  39. #else
  40. #define EXTERN_C_BEGIN
  41. #define EXTERN_C_END
  42. #endif
  43.  
  44. #define dimensionof(a)      (sizeof(a)/sizeof(*(a)))
  45.  
  46. #define Unreferenced(a)     ((void)(a))
  47.  
  48. typedef long SCODE;
  49. typedef unsigned long ULONG;
  50. typedef unsigned long DWORD;
  51.  
  52. /*
  53.  *   Assert Macros ---------------------------------------------------------
  54.  *  
  55.  *      Assert(a)       Displays a message indicating the file and line number
  56.  *                      of this Assert() if a == 0.  OK'ing an assert traps
  57.  *                      into the debugger.
  58.  *  
  59.  *      AssertSz(a,sz)  Works like an Assert(), but displays the string sz
  60.  *                      along with the file and line number.
  61.  *  
  62.  *      Side asserts    A side assert works like an Assert(), but evaluates
  63.  *                      'a' even when asserts are not enabled.
  64.  *  
  65.  *      NF asserts      A NF (Non-Fatal) assert works like an Assert(), but
  66.  *                      continues instead of trapping into the debugger when
  67.  *                      OK'ed.
  68.  */
  69.  
  70. #if defined(DEBUG) || defined(ASSERTS_ENABLED)
  71. #define IFTRAP(x)           x
  72. #else
  73. #define IFTRAP(x)           0
  74. #endif
  75.  
  76. #define Trap()                                          IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Trap"))
  77. #define TrapSz(psz)                                     IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz))
  78. #define TrapSz1(psz,a1)                                 IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1))
  79. #define TrapSz2(psz,a1,a2)                              IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2))
  80. #define TrapSz3(psz,a1,a2,a3)                           IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3))
  81. #define TrapSz4(psz,a1,a2,a3,a4)                        IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4))
  82. #define TrapSz5(psz,a1,a2,a3,a4,a5)                     IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5))
  83. #define TrapSz6(psz,a1,a2,a3,a4,a5,a6)                  IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6))
  84. #define TrapSz7(psz,a1,a2,a3,a4,a5,a6,a7)               IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7))
  85. #define TrapSz8(psz,a1,a2,a3,a4,a5,a6,a7,a8)            IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8))
  86. #define TrapSz9(psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)         IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9))
  87.  
  88. #define Assert(t)                                       IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t),0))
  89. #define AssertSz(t,psz)                                 IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz),0))
  90. #define AssertSz1(t,psz,a1)                             IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1),0))
  91. #define AssertSz2(t,psz,a1,a2)                          IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2),0))
  92. #define AssertSz3(t,psz,a1,a2,a3)                       IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3),0))
  93. #define AssertSz4(t,psz,a1,a2,a3,a4)                    IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4),0))
  94. #define AssertSz5(t,psz,a1,a2,a3,a4,a5)                 IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0))
  95. #define AssertSz6(t,psz,a1,a2,a3,a4,a5,a6)              IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6),0))
  96. #define AssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7)           IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7),0))
  97. #define AssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8)        IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8),0))
  98. #define AssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)     IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9),0))
  99.  
  100. #define SideAssert(t)                                   ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t)),0)
  101. #define SideAssertSz(t,psz)                             ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz)),0)
  102. #define SideAssertSz1(t,psz,a1)                         ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1)),0)
  103. #define SideAssertSz2(t,psz,a1,a2)                      ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2)),0)
  104. #define SideAssertSz3(t,psz,a1,a2,a3)                   ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3)),0)
  105. #define SideAssertSz4(t,psz,a1,a2,a3,a4)                ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0)
  106. #define SideAssertSz5(t,psz,a1,a2,a3,a4,a5)             ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0)
  107. #define SideAssertSz6(t,psz,a1,a2,a3,a4,a5,a6)          ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6)),0)
  108. #define SideAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7)       ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7)),0)
  109. #define SideAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8)    ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8)),0)
  110. #define SideAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)),0)
  111.  
  112. #define NFAssert(t)                                     IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t),0))
  113. #define NFAssertSz(t,psz)                               IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz),0))
  114. #define NFAssertSz1(t,psz,a1)                           IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1),0))
  115. #define NFAssertSz2(t,psz,a1,a2)                        IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2),0))
  116. #define NFAssertSz3(t,psz,a1,a2,a3)                     IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3),0))
  117. #define NFAssertSz4(t,psz,a1,a2,a3,a4)                  IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4),0))
  118. #define NFAssertSz5(t,psz,a1,a2,a3,a4,a5)               IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0))
  119. #define NFAssertSz6(t,psz,a1,a2,a3,a4,a5,a6)            IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6),0))
  120. #define NFAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7)         IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7),0))
  121. #define NFAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8)      IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8),0))
  122. #define NFAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)   IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9),0))
  123.  
  124. #define NFSideAssert(t)                                 ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t)),0)
  125. #define NFSideAssertSz(t,psz)                           ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz)),0)
  126. #define NFSideAssertSz1(t,psz,a1)                       ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1)),0)
  127. #define NFSideAssertSz2(t,psz,a1,a2)                    ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2)),0)
  128. #define NFSideAssertSz3(t,psz,a1,a2,a3)                 ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3)),0)
  129. #define NFSideAssertSz4(t,psz,a1,a2,a3,a4)              ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0)
  130. #define NFSideAssertSz5(t,psz,a1,a2,a3,a4,a5)           ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0)
  131. #define NFSideAssertSz6(t,psz,a1,a2,a3,a4,a5,a6)        ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6)),0)
  132. #define NFSideAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7)     ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7)),0)
  133. #define NFSideAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8)  ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8)),0)
  134. #define NFSideAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)   ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)),0)
  135.  
  136. /*
  137.  *   Trace Macros ------------------------------------------------------------
  138.  *
  139.  *      DebugTrace          Use for arbitrary formatted output. It
  140.  *                          takes exactly the same arguments as the
  141.  *                          Windows wsprintf() function.
  142.  *      DebugTraceResult    Shorthand for error tracing with an
  143.  *                          HRESULT. Arguments are the name of the
  144.  *                          function (not quoted) and the HRESULT.
  145.  *      DebugTraceSc        Shorthand for error tracing with an
  146.  *                          SCODE. Arguments are the name of the
  147.  *                          function (not quoted) and the SCODE.
  148.  *      DebugTraceArg       Shorthand for invalid parameter
  149.  *                          tracing. Arguments are the name of the
  150.  *                          function (not quoted) and a quoted
  151.  *                          string describing the bad parameter.
  152.  */
  153.  
  154. #if defined(DEBUG) || defined(TRACES_ENABLED)
  155. #define IFTRACE(x)          x
  156. #define DebugTrace          DebugTraceFn
  157. #else
  158. #define IFTRACE(x)          0
  159. #define DebugTrace          1?0:DebugTraceFn
  160. #endif
  161.  
  162. #define DebugTraceResult(f,hr)                          IFTRACE(((hr) ? DebugTraceFn(#f " returns 0x%08lX %s\n", GetScode(hr), SzDecodeScode(GetScode(hr))) : 0))
  163. #define DebugTraceSc(f,sc)                              IFTRACE(((sc) ? DebugTraceFn(#f " returns 0x%08lX %s\n", sc, SzDecodeScode(sc)) : 0))
  164. #define DebugTraceArg(f,s)                              IFTRACE(DebugTraceFn(#f ": bad parameter: " s "\n"))
  165. #define DebugTraceLine()                                IFTRACE(DebugTraceFn("File %s, Line %i  \n",__FILE__,__LINE__))
  166. #define DebugTraceProblems(sz, rgprob)                  IFTRACE(DebugTraceProblemsFn(sz, rgprob))
  167.  
  168. #define TraceSz(psz)                                    IFTRACE(DebugTraceFn("~" psz))
  169. #define TraceSz1(psz,a1)                                IFTRACE(DebugTraceFn("~" psz,a1))
  170. #define TraceSz2(psz,a1,a2)                             IFTRACE(DebugTraceFn("~" psz,a1,a2))
  171. #define TraceSz3(psz,a1,a2,a3)                          IFTRACE(DebugTraceFn("~" psz,a1,a2,a3))
  172. #define TraceSz4(psz,a1,a2,a3,a4)                       IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4))
  173. #define TraceSz5(psz,a1,a2,a3,a4,a5)                    IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5))
  174. #define TraceSz6(psz,a1,a2,a3,a4,a5,a6)                 IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6))
  175. #define TraceSz7(psz,a1,a2,a3,a4,a5,a6,a7)              IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7))
  176. #define TraceSz8(psz,a1,a2,a3,a4,a5,a6,a7,a8)           IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8))
  177. #define TraceSz9(psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)        IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8,a9))
  178.  
  179. /* Debugging Functions ---------------------------------------------------- */
  180.  
  181. EXTERN_C_BEGIN
  182.  
  183. #ifdef WIN16
  184. #define EXPORTDBG   __export
  185. #else
  186. #define EXPORTDBG
  187. #endif
  188.  
  189. int EXPORTDBG __cdecl       DebugTrapFn(int fFatal, char *pszFile, int iLine, char *pszFormat, ...);
  190. int EXPORTDBG __cdecl       DebugTraceFn(char *pszFormat, ...);
  191. void EXPORTDBG __cdecl      DebugTraceProblemsFn(char *sz, void *rgprob);
  192. char * EXPORTDBG __cdecl    SzDecodeScodeFn(SCODE sc);
  193. char * EXPORTDBG __cdecl    SzDecodeUlPropTypeFn(unsigned long ulPropType);
  194. char * EXPORTDBG __cdecl    SzDecodeUlPropTagFn(unsigned long ulPropTag);
  195. unsigned long EXPORTDBG __cdecl UlPropTagFromSzFn(char *psz);
  196. SCODE EXPORTDBG __cdecl     ScodeFromSzFn(char *psz);
  197. void * EXPORTDBG __cdecl    DBGMEM_EncapsulateFn(void * pmalloc, char *pszSubsys, int fCheckOften);
  198. void EXPORTDBG __cdecl      DBGMEM_ShutdownFn(void * pmalloc);
  199. void EXPORTDBG __cdecl      DBGMEM_CheckMemFn(void * pmalloc, int fReportOrphans);
  200. #if defined(_WIN32) && defined(_M_IX86)
  201. void EXPORTDBG __cdecl      DBGMEM_LeakHook(FARPROC pfn);
  202. void EXPORTDBG __cdecl      GetCallStack(DWORD *, int, int);
  203. #endif
  204. void EXPORTDBG __cdecl      DBGMEM_NoLeakDetectFn(void * pmalloc, void *pv);
  205. void EXPORTDBG __cdecl      DBGMEM_SetFailureAtFn(void * pmalloc, ULONG ulFailureAt);
  206. SCODE EXPORTDBG __cdecl     ScCheckScFn(SCODE, SCODE *, char *, char *, int);
  207. void * EXPORTDBG __cdecl    VMAlloc(ULONG);
  208. void * EXPORTDBG __cdecl    VMAllocEx(ULONG, ULONG);
  209. void * EXPORTDBG __cdecl    VMRealloc(void *, ULONG);
  210. void * EXPORTDBG __cdecl    VMReallocEx(void *, ULONG, ULONG);
  211. ULONG EXPORTDBG __cdecl     VMGetSize(void *);
  212. ULONG EXPORTDBG __cdecl     VMGetSizeEx(void *, ULONG);
  213. void EXPORTDBG __cdecl      VMFree(void *);
  214. void EXPORTDBG __cdecl      VMFreeEx(void *, ULONG);
  215.  
  216. EXTERN_C_END
  217.  
  218. /*
  219.  *  Debugging Macros -------------------------------------------------------
  220.  *
  221.  *      SzDecodeScode           Returns the string name of an SCODE
  222.  *      SzDecodeUlPropTag       Returns the string name of a property
  223.  *                              tag
  224.  *      UlPropTagFromSz         Given a property tag's name, returns
  225.  *                              its value
  226.  *      ScodeFromSz             Given an SCODE's name, returns its
  227.  *                              value
  228.  *  
  229.  *      DBGMEM_Encapsulate      Given an IMalloc interface, adds heap-
  230.  *                              checking functionality and returns a
  231.  *                              wrapped interface
  232.  *      DBGMEM_Shutdown         Undoes DBGMEM_Encapsulate, and prints
  233.  *                              out information on any allocations made
  234.  *                              since the interface was encapsulated
  235.  *                              that have not yet been released.
  236.  *      DBGMEM_CheckMem         Checks all memory allocated on the heap,
  237.  *                              and optionally reports leaked blocks.
  238.  *      DBGMEM_NoLeakDetect     Prevents a block from appearing on the leak
  239.  *                              report.  Pass NULL for pv to inhibit leak
  240.  *                              reports at all from this heap.
  241.  */
  242.  
  243. #ifdef DEBUG
  244.  
  245. #define SzDecodeScode(_sc)              SzDecodeScodeFn(_sc)
  246. #define SzDecodeUlPropType(_ulPropType) SzDecodeUlPropTypeFn(_ulPropType)
  247. #define SzDecodeUlPropTag(_ulPropTag)   SzDecodeUlPropTagFn(_ulPropTag)
  248. #define UlPropTagFromSz(_sz)            UlPropTagFromSzFn(_sz)
  249. #define ScodeFromSz(_sz)                ScodeFromSzFn(_sz)
  250. #define DBGMEM_Encapsulate(pm, psz, f)  DBGMEM_EncapsulateFn(pm, psz, f)
  251. #define DBGMEM_Shutdown(pm)             DBGMEM_ShutdownFn(pm)
  252. #define DBGMEM_CheckMem(pm, f)          DBGMEM_CheckMemFn(pm, f)
  253. #define DBGMEM_NoLeakDetect(pm, pv)     DBGMEM_NoLeakDetectFn(pm, pv)
  254. #define DBGMEM_SetFailureAt(pm, ul)     DBGMEM_SetFailureAtFn(pm, ul)
  255.  
  256. #else
  257.  
  258. #define SzDecodeScode(_sc)              (0)
  259. #define SzDecodeUlPropType(_ulPropType) (0)
  260. #define SzDecodeUlPropTag(_ulPropTag)   (0)
  261. #define UlPropTagFromSz(_sz)            (0)
  262. #define ScodeFromSz(_sz)                (0)
  263.  
  264. #if defined(__cplusplus) && !defined(CINTERFACE)
  265. #define DBGMEM_Encapsulate(pmalloc, pszSubsys, fCheckOften) \
  266.     ((pmalloc)->AddRef(), (pmalloc))
  267. #define DBGMEM_Shutdown(pmalloc) \
  268.     ((pmalloc)->Release())
  269. #else
  270. #define DBGMEM_Encapsulate(pmalloc, pszSubsys, fCheckOften) \
  271.     ((pmalloc)->lpVtbl->AddRef(pmalloc), (pmalloc))
  272. #define DBGMEM_Shutdown(pmalloc) \
  273.     ((pmalloc)->lpVtbl->Release(pmalloc))
  274. #endif
  275. #define DBGMEM_CheckMem(pm, f)
  276. #define DBGMEM_NoLeakDetect(pm, pv)
  277. #define DBGMEM_SetFailureAt(pm, ul)
  278.  
  279. #endif
  280.  
  281. /*
  282.  *  SCODE maps -------------------------------------------------------------
  283.  *  
  284.  *      ScCheckSc       Given an SCODE and method name, verifies
  285.  *                      that the SCODE can legally be returned from
  286.  *                      thet method. Prints out a debug string if
  287.  *                      it cannot.
  288.  *      HrCheckHr       As ScCheckSc, for functions that return
  289.  *                      HRESULT.
  290.  */
  291.  
  292. #if defined(DEBUG) && !defined(DOS)
  293. #define ScCheckSc(sc,fn)                ScCheckScFn(sc,fn##_Scodes,#fn,__FILE__, __LINE__)
  294. #define HrCheckHr(hr,fn)                HrCheckSc(GetScode(hr),fn)
  295. #else
  296. #define ScCheckSc(sc,fn)                (sc)
  297. #define HrCheckHr(hr,fn)                (hr)
  298. #endif
  299.  
  300. #define HrCheckSc(sc,fn)                ResultFromScode(ScCheckSc(sc,fn))
  301.  
  302. #if defined(DEBUG) && !defined(DOS)
  303. extern SCODE Common_Scodes[];
  304. extern SCODE MAPILogon_Scodes[];
  305. extern SCODE MAPIAllocateBuffer_Scodes[];
  306. extern SCODE MAPIAllocateMore_Scodes[];
  307. extern SCODE MAPIFreeBuffer_Scodes[];
  308.  
  309. extern SCODE IUnknown_QueryInterface_Scodes[];
  310. extern SCODE IUnknown_AddRef_Scodes[];
  311. extern SCODE IUnknown_Release_Scodes[];
  312. extern SCODE IUnknown_GetLastError_Scodes[];
  313.  
  314. extern SCODE IMAPIProp_CopyTo_Scodes[];
  315. extern SCODE IMAPIProp_CopyProps_Scodes[];
  316. extern SCODE IMAPIProp_DeleteProps_Scodes[];
  317. extern SCODE IMAPIProp_GetIDsFromNames_Scodes[];
  318. extern SCODE IMAPIProp_GetLastError_Scodes[];
  319. extern SCODE IMAPIProp_GetNamesFromIDs_Scodes[];
  320. extern SCODE IMAPIProp_GetPropList_Scodes[];
  321. extern SCODE IMAPIProp_GetProps_Scodes[];
  322. extern SCODE IMAPIProp_OpenProperty_Scodes[];
  323. extern SCODE IMAPIProp_SetProps_Scodes[];
  324. extern SCODE IMAPIProp_SaveChanges_Scodes[];
  325.  
  326. extern SCODE IStream_Read_Scodes[];
  327. extern SCODE IStream_Write_Scodes[];
  328. extern SCODE IStream_Seek_Scodes[];
  329. extern SCODE IStream_SetSize_Scodes[];
  330. extern SCODE IStream_Tell_Scodes[];
  331. extern SCODE IStream_LockRegion_Scodes[];
  332. extern SCODE IStream_UnlockRegion_Scodes[];
  333. extern SCODE IStream_Clone_Scodes[];
  334. extern SCODE IStream_CopyTo_Scodes[];
  335. extern SCODE IStream_Revert_Scodes[];
  336. extern SCODE IStream_Stat_Scodes[];
  337. extern SCODE IStream_Commit_Scodes[];
  338.  
  339. extern SCODE IMAPITable_GetLastError_Scodes[];
  340. extern SCODE IMAPITable_Advise_Scodes[];
  341. extern SCODE IMAPITable_Unadvise_Scodes[];
  342. extern SCODE IMAPITable_GetStatus_Scodes[];
  343. extern SCODE IMAPITable_SetColumns_Scodes[];
  344. extern SCODE IMAPITable_QueryColumns_Scodes[];
  345. extern SCODE IMAPITable_GetRowCount_Scodes[];
  346. extern SCODE IMAPITable_SeekRow_Scodes[];
  347. extern SCODE IMAPITable_SeekRowApprox_Scodes[];
  348. extern SCODE IMAPITable_QueryPosition_Scodes[];
  349. extern SCODE IMAPITable_FindRow_Scodes[];
  350. extern SCODE IMAPITable_Restrict_Scodes[];
  351. extern SCODE IMAPITable_CreateBookmark_Scodes[];
  352. extern SCODE IMAPITable_FreeBookmark_Scodes[];
  353. extern SCODE IMAPITable_SortTable_Scodes[];
  354. extern SCODE IMAPITable_QuerySortOrder_Scodes[];
  355. extern SCODE IMAPITable_QueryRows_Scodes[];
  356. extern SCODE IMAPITable_Abort_Scodes[];
  357. extern SCODE IMAPITable_ExpandRow_Scodes[];
  358. extern SCODE IMAPITable_CollapseRow_Scodes[];
  359. extern SCODE IMAPITable_WaitForCompletion_Scodes[];
  360. extern SCODE IMAPITable_GetCollapseState_Scodes[];
  361. extern SCODE IMAPITable_SetCollapseState_Scodes[];
  362.  
  363. extern SCODE IMAPISession_LogOff_Scodes[];
  364. extern SCODE IMAPISession_Release_Scodes[];
  365. extern SCODE IMAPISession_GetLastError_Scodes[];
  366. extern SCODE IMAPISession_GetMsgStoresTable_Scodes[];
  367. extern SCODE IMAPISession_GetStatusTable_Scodes[];
  368. extern SCODE IMAPISession_OpenMsgStore_Scodes[];
  369. extern SCODE IMAPISession_OpenAddressBook_Scodes[];
  370. extern SCODE IMAPISession_OpenEntry_Scodes[];
  371. extern SCODE IMAPISession_OpenProfileSection_Scodes[];
  372. extern SCODE IMAPISession_Advise_Scodes[];
  373. extern SCODE IMAPISession_Unadvise_Scodes[];
  374. extern SCODE IMAPISession_CompareEntryIDs_Scodes[];
  375. extern SCODE IMAPISession_MessageOptions_Scodes[];
  376. extern SCODE IMAPISession_QueryDefaultMessageOpt_Scodes[];
  377. extern SCODE IMAPISession_EnumAdrTypes_Scodes[];
  378. extern SCODE IMAPISession_QueryIdentity_Scodes[];
  379. extern SCODE IMAPISession_OpenProfileSection_Scodes[];
  380. extern SCODE IMAPISession_GetStatusTable_Scodes[];
  381.  
  382. extern SCODE IMsgStore_Advise_Scodes[] ;
  383. extern SCODE IMsgStore_Unadvise_Scodes[] ;
  384. extern SCODE IMsgStore_CompareEntryIDs_Scodes[] ;
  385. extern SCODE IMsgStore_OpenEntry_Scodes[] ;
  386. extern SCODE IMsgStore_SetReceiveFolder_Scodes[];
  387. extern SCODE IMsgStore_GetReceiveFolder_Scodes[];
  388. extern SCODE IMsgStore_GetReceiveFolderTable_Scodes[];
  389. extern SCODE IMsgStore_StoreLogoff_Scodes[];
  390. extern SCODE IMsgStore_AbortSubmit_Scodes[];
  391. extern SCODE IMsgStore_GetOutgoingQueue_Scodes[] ;
  392. extern SCODE IMsgStore_SetLockState_Scodes[] ;
  393. extern SCODE IMsgStore_FinishedMsg_Scodes[] ;
  394. extern SCODE IMsgStore_NotifyNewMail_Scodes[];
  395.  
  396. extern SCODE IMAPIFolder_GetContentsTable_Scodes[];
  397. extern SCODE IMAPIFolder_GetHierarchyTable_Scodes[];
  398. extern SCODE IMAPIFolder_SaveContentsSort_Scodes[];
  399. extern SCODE IMAPIFolder_OpenEntry_Scodes[];
  400. extern SCODE IMAPIFolder_CreateMessage_Scodes[];
  401. extern SCODE IMAPIFolder_CopyMessages_Scodes[];
  402. extern SCODE IMAPIFolder_DeleteMessages_Scodes[];
  403. extern SCODE IMAPIFolder_CreateFolder_Scodes[];
  404. extern SCODE IMAPIFolder_CopyFolder_Scodes[];
  405. extern SCODE IMAPIFolder_DeleteFolder_Scodes[];
  406. extern SCODE IMAPIFolder_SetSearchCriteria_Scodes[];
  407. extern SCODE IMAPIFolder_GetSearchCriteria_Scodes[];
  408. extern SCODE IMAPIFolder_SetReadFlags_Scodes[];
  409. extern SCODE IMAPIFolder_GetMessageStatus_Scodes[];
  410. extern SCODE IMAPIFolder_SetMessageStatus_Scodes[];
  411. extern SCODE IMAPIFolder_EmptyFolder_Scodes[];
  412.  
  413. extern SCODE IMessage_SaveChanges_Scodes[];
  414. extern SCODE IMessage_GetAttachmentTable_Scodes[];
  415. extern SCODE IMessage_OpenAttach_Scodes[];
  416. extern SCODE IMessage_CreateAttach_Scodes[];
  417. extern SCODE IMessage_DeleteAttach_Scodes[];
  418. extern SCODE IMessage_GetRecipientTable_Scodes[];
  419. extern SCODE IMessage_ModifyRecipients_Scodes[];
  420. extern SCODE IMessage_SubmitMessage_Scodes[];
  421. extern SCODE IMessage_SetReadFlag_Scodes[];
  422.  
  423. extern SCODE IAttach_SaveChanges_Scodes[];
  424.  
  425. extern SCODE IAddrBook_OpenEntry_Scodes[];
  426. extern SCODE IAddrBook_CompareEntryIDs_Scodes[];
  427. extern SCODE IAddrBook_CreateOneOff_Scodes[];
  428. extern SCODE IAddrBook_ResolveName_Scodes[];
  429. extern SCODE IAddrBook_Address_Scodes[];
  430. extern SCODE IAddrBook_Details_Scodes[];
  431. extern SCODE IAddrBook_RecipOptions_Scodes[];
  432. extern SCODE IAddrBook_QueryDefaultRecipOpt_Scodes[];
  433. extern SCODE IAddrBook_Address_Scodes[];
  434. extern SCODE IAddrBook_ButtonPress_Scodes[];
  435.  
  436. extern SCODE IABContainer_GetContentsTable_Scodes[];
  437. extern SCODE IABContainer_GetHierarchyTable_Scodes[];
  438.  
  439. extern SCODE INotifObj_ChangeEvMask_Scodes[];
  440.  
  441. extern SCODE IMAPIStatus_ChangePassword_Scodes[];
  442. extern SCODE IMAPIStatus_FlushQueues_Scodes[];
  443. extern SCODE IMAPIStatus_SettingsDialog_Scodes[];
  444. extern SCODE IMAPIStatus_ValidateState_Scodes[];
  445.  
  446. extern SCODE IMSProvider_Logon_Scodes[];
  447. extern SCODE IMSProvider_Deinit_Scodes[];
  448. extern SCODE IMSProvider_Init_Scodes[];
  449. extern SCODE IMSProvider_SpoolerLogon_Scodes[];
  450. extern SCODE IMSProvider_Shutdown_Scodes[];
  451.  
  452. extern SCODE SMAPI_MAPILogon_Scodes[];
  453. extern SCODE SMAPI_MAPILogoff_Scodes[];
  454. extern SCODE SMAPI_MAPIFreeBuffer_Scodes[];
  455. extern SCODE SMAPI_MAPISendMail_Scodes[];
  456. extern SCODE SMAPI_MAPISendDocuments_Scodes[];
  457. extern SCODE SMAPI_MAPIFindNext_Scodes[];
  458. extern SCODE SMAPI_MAPIReadMail_Scodes[];
  459. extern SCODE SMAPI_MAPISaveMail_Scodes[];
  460. extern SCODE SMAPI_MAPIDeleteMail_Scodes[];
  461. extern SCODE SMAPI_MAPIAddress_Scodes[];
  462. extern SCODE SMAPI_MAPIResolveName_Scodes[];
  463. extern SCODE SMAPI_MAPIDetails_Scodes[];
  464.  
  465. extern SCODE IMSLogon_OpenEntry_Scodes[];
  466. extern SCODE IMSLogon_OpenStatusEntry_Scodes[];
  467. extern SCODE IMSLogon_CompareEntryIDs_Scodes[];
  468. extern SCODE IMSLogon_Advise_Scodes[];
  469. extern SCODE IMSLogon_Unadvise_Scodes[];
  470. extern SCODE IMSLogon_Logoff_Scodes[];
  471. #endif
  472.  
  473. /* ------------------------------------------------------------------------ */
  474.  
  475. #endif
  476.