source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/mapidbg.h

Last change on this file was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 10.3 KB
RevLine 
[1166]1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef __MAPIDBG_H_
7#define __MAPIDBG_H_
8
9#define IFDBG(x)
10#define IFNDBG(x) x
11
12#ifdef __cplusplus
13#define EXTERN_C_BEGIN extern "C" {
14#define EXTERN_C_END }
15#else
16#define EXTERN_C_BEGIN
17#define EXTERN_C_END
18#endif
19
20#define dimensionof(a) (sizeof(a)/sizeof(*(a)))
21
22#define Unreferenced(a) ((void)(a))
23
24#ifndef BASETYPES
25#define BASETYPES
26 typedef unsigned __LONG32 ULONG;
27 typedef ULONG *PULONG;
28 typedef unsigned short USHORT;
29 typedef USHORT *PUSHORT;
30 typedef unsigned char UCHAR;
31 typedef UCHAR *PUCHAR;
32 typedef char *PSZ;
33#endif
34
35typedef __LONG32 SCODE;
36typedef unsigned __LONG32 DWORD;
37
38#ifdef ASSERTS_ENABLED
39#define IFTRAP(x) x
40#else
41#define IFTRAP(x) 0
42#endif
43
44#define Trap() IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Trap"))
45#define TrapSz(psz) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz))
46#define TrapSz1(psz,a1) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1))
47#define TrapSz2(psz,a1,a2) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2))
48#define TrapSz3(psz,a1,a2,a3) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3))
49#define TrapSz4(psz,a1,a2,a3,a4) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4))
50#define TrapSz5(psz,a1,a2,a3,a4,a5) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5))
51#define TrapSz6(psz,a1,a2,a3,a4,a5,a6) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6))
52#define TrapSz7(psz,a1,a2,a3,a4,a5,a6,a7) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7))
53#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))
54#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))
55
56#define Assert(t) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t),0))
57#define AssertSz(t,psz) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz),0))
58#define AssertSz1(t,psz,a1) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1),0))
59#define AssertSz2(t,psz,a1,a2) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2),0))
60#define AssertSz3(t,psz,a1,a2,a3) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3),0))
61#define AssertSz4(t,psz,a1,a2,a3,a4) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4),0))
62#define AssertSz5(t,psz,a1,a2,a3,a4,a5) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0))
63#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))
64#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))
65#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))
66#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))
67
68#define SideAssert(t) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t)),0)
69#define SideAssertSz(t,psz) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz)),0)
70#define SideAssertSz1(t,psz,a1) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1)),0)
71#define SideAssertSz2(t,psz,a1,a2) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2)),0)
72#define SideAssertSz3(t,psz,a1,a2,a3) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3)),0)
73#define SideAssertSz4(t,psz,a1,a2,a3,a4) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0)
74#define SideAssertSz5(t,psz,a1,a2,a3,a4,a5) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0)
75#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)
76#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)
77#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)
78#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)
79
80#define NFAssert(t) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t),0))
81#define NFAssertSz(t,psz) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz),0))
82#define NFAssertSz1(t,psz,a1) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1),0))
83#define NFAssertSz2(t,psz,a1,a2) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2),0))
84#define NFAssertSz3(t,psz,a1,a2,a3) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3),0))
85#define NFAssertSz4(t,psz,a1,a2,a3,a4) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4),0))
86#define NFAssertSz5(t,psz,a1,a2,a3,a4,a5) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0))
87#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))
88#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))
89#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))
90#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))
91
92#define NFSideAssert(t) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t)),0)
93#define NFSideAssertSz(t,psz) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz)),0)
94#define NFSideAssertSz1(t,psz,a1) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1)),0)
95#define NFSideAssertSz2(t,psz,a1,a2) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2)),0)
96#define NFSideAssertSz3(t,psz,a1,a2,a3) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3)),0)
97#define NFSideAssertSz4(t,psz,a1,a2,a3,a4) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0)
98#define NFSideAssertSz5(t,psz,a1,a2,a3,a4,a5) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0)
99#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)
100#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)
101#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)
102#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)
103
104#ifdef TRACES_ENABLED
105#define IFTRACE(x) x
106#define DebugTrace DebugTraceFn
107#else
108#define IFTRACE(x) 0
109#define DebugTrace 1?0:DebugTraceFn
110#endif
111
112#define DebugTraceResult(f,hr) IFTRACE(((hr) ? DebugTraceFn(#f " returns 0x%08lX %s\n",GetScode(hr),(0)) : 0))
113#define DebugTraceSc(f,sc) IFTRACE(((sc) ? DebugTraceFn(#f " returns 0x%08lX %s\n",sc,(0)) : 0))
114#define DebugTraceArg(f,s) IFTRACE(DebugTraceFn(#f ": bad parameter: " s "\n"))
115#define DebugTraceLine() IFTRACE(DebugTraceFn("File %s, Line %i \n",__FILE__,__LINE__))
116#define DebugTraceProblems(sz,rgprob) IFTRACE(DebugTraceProblemsFn(sz,rgprob))
117
118#define TraceSz(psz) IFTRACE(DebugTraceFn("~" psz))
119#define TraceSz1(psz,a1) IFTRACE(DebugTraceFn("~" psz,a1))
120#define TraceSz2(psz,a1,a2) IFTRACE(DebugTraceFn("~" psz,a1,a2))
121#define TraceSz3(psz,a1,a2,a3) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3))
122#define TraceSz4(psz,a1,a2,a3,a4) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4))
123#define TraceSz5(psz,a1,a2,a3,a4,a5) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5))
124#define TraceSz6(psz,a1,a2,a3,a4,a5,a6) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6))
125#define TraceSz7(psz,a1,a2,a3,a4,a5,a6,a7) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7))
126#define TraceSz8(psz,a1,a2,a3,a4,a5,a6,a7,a8) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8))
127#define TraceSz9(psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8,a9))
128
129EXTERN_C_BEGIN
130
131#define EXPORTDBG
132
133int EXPORTDBG __cdecl DebugTrapFn(int fFatal,char *pszFile,int iLine,char *pszFormat,...);
134int EXPORTDBG __cdecl DebugTraceFn(char *pszFormat,...);
135void EXPORTDBG __cdecl DebugTraceProblemsFn(char *sz,void *rgprob);
136char *EXPORTDBG __cdecl SzDecodeScodeFn(SCODE sc);
137char *EXPORTDBG __cdecl SzDecodeUlPropTypeFn(unsigned __LONG32 ulPropType);
138char *EXPORTDBG __cdecl SzDecodeUlPropTagFn(unsigned __LONG32 ulPropTag);
139unsigned __LONG32 EXPORTDBG __cdecl UlPropTagFromSzFn(char *psz);
140SCODE EXPORTDBG __cdecl ScodeFromSzFn(char *psz);
141void *EXPORTDBG __cdecl DBGMEM_EncapsulateFn(void *pmalloc,char *pszSubsys,int fCheckOften);
142void EXPORTDBG __cdecl DBGMEM_ShutdownFn(void *pmalloc);
143void EXPORTDBG __cdecl DBGMEM_CheckMemFn(void *pmalloc,int fReportOrphans);
144#ifdef _X86_
145void EXPORTDBG __cdecl DBGMEM_LeakHook(FARPROC pfn);
146void EXPORTDBG __cdecl GetCallStack(DWORD *,int,int);
147#endif
148void EXPORTDBG __cdecl DBGMEM_NoLeakDetectFn(void *pmalloc,void *pv);
149void EXPORTDBG __cdecl DBGMEM_SetFailureAtFn(void *pmalloc,ULONG ulFailureAt);
150SCODE EXPORTDBG __cdecl ScCheckScFn(SCODE,SCODE *,char *,char *,int);
151void *EXPORTDBG __cdecl VMAlloc(ULONG);
152void *EXPORTDBG __cdecl VMAllocEx(ULONG,ULONG);
153void *EXPORTDBG __cdecl VMRealloc(void *,ULONG);
154void *EXPORTDBG __cdecl VMReallocEx(void *,ULONG,ULONG);
155ULONG EXPORTDBG __cdecl VMGetSize(void *);
156ULONG EXPORTDBG __cdecl VMGetSizeEx(void *,ULONG);
157void EXPORTDBG __cdecl VMFree(void *);
158void EXPORTDBG __cdecl VMFreeEx(void *,ULONG);
159
160EXTERN_C_END
161
162#define SzDecodeScode(_sc) (0)
163#define SzDecodeUlPropType(_ulPropType) (0)
164#define SzDecodeUlPropTag(_ulPropTag) (0)
165#define UlPropTagFromSz(_sz) (0)
166#define ScodeFromSz(_sz) (0)
167
168#if defined(__cplusplus) && !defined(CINTERFACE)
169#define DBGMEM_Encapsulate(pmalloc,pszSubsys,fCheckOften) ((pmalloc)->AddRef(),(pmalloc))
170#define DBGMEM_Shutdown(pmalloc) ((pmalloc)->Release())
171#else
172#define DBGMEM_Encapsulate(pmalloc,pszSubsys,fCheckOften) ((pmalloc)->lpVtbl->AddRef(pmalloc),(pmalloc))
173#define DBGMEM_Shutdown(pmalloc) ((pmalloc)->lpVtbl->Release(pmalloc))
174#endif
175#define DBGMEM_CheckMem(pm,f)
176#define DBGMEM_NoLeakDetect(pm,pv)
177#define DBGMEM_SetFailureAt(pm,ul)
178
179#define ScCheckSc(sc,fn) (sc)
180#define HrCheckHr(hr,fn) (hr)
181
182#define HrCheckSc(sc,fn) ResultFromScode(ScCheckSc(sc,fn))
183
184#endif
Note: See TracBrowser for help on using the repository browser.