ReactOS 0.4.15-dev-5893-g1bb4167
crtdbg.h
Go to the documentation of this file.
1
6#include <crtdefs.h>
7
8#ifndef _INC_CRTDBG
9#define _INC_CRTDBG
10
11#pragma pack(push,_CRT_PACKING)
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17 typedef void *_HFILE;
18
19#define _CRT_WARN 0
20#define _CRT_ERROR 1
21#define _CRT_ASSERT 2
22#define _CRT_ERRCNT 3
23
24#define _CRTDBG_MODE_FILE 0x1
25#define _CRTDBG_MODE_DEBUG 0x2
26#define _CRTDBG_MODE_WNDW 0x4
27#define _CRTDBG_REPORT_MODE -1
28
29#define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
30#define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
31#define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
32#define _CRTDBG_FILE_STDERR ((_HFILE)-5)
33#define _CRTDBG_REPORT_FILE ((_HFILE)-6)
34
35 typedef int (__cdecl *_CRT_REPORT_HOOK)(int,char *,int *);
36 typedef int (__cdecl *_CRT_REPORT_HOOKW)(int,wchar_t *,int *);
37
38#define _CRT_RPTHOOK_INSTALL 0
39#define _CRT_RPTHOOK_REMOVE 1
40
41#define _HOOK_ALLOC 1
42#define _HOOK_REALLOC 2
43#define _HOOK_FREE 3
44
45 typedef int (__cdecl *_CRT_ALLOC_HOOK)(int,void *,size_t,int,long,const unsigned char *,int);
46
47#define _CRTDBG_ALLOC_MEM_DF 0x01
48#define _CRTDBG_DELAY_FREE_MEM_DF 0x02
49#define _CRTDBG_CHECK_ALWAYS_DF 0x04
50#define _CRTDBG_RESERVED_DF 0x08
51#define _CRTDBG_CHECK_CRT_DF 0x10
52#define _CRTDBG_LEAK_CHECK_DF 0x20
53
54#define _CRTDBG_CHECK_EVERY_16_DF 0x00100000
55#define _CRTDBG_CHECK_EVERY_128_DF 0x00800000
56#define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000
57
58#define _CRTDBG_CHECK_DEFAULT_DF 0
59
60#define _CRTDBG_REPORT_FLAG -1
61
62#define _BLOCK_TYPE(block) (block & 0xFFFF)
63#define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
64
65#define _FREE_BLOCK 0
66#define _NORMAL_BLOCK 1
67#define _CRT_BLOCK 2
68#define _IGNORE_BLOCK 3
69#define _CLIENT_BLOCK 4
70#define _MAX_BLOCKS 5
71
72 typedef void (__cdecl *_CRT_DUMP_CLIENT)(void *,size_t);
73
74 struct _CrtMemBlockHeader;
75
76 typedef struct _CrtMemState {
77 struct _CrtMemBlockHeader *pBlockHeader;
83
84// Debug reporting functions
85
86#ifdef _DEBUG
87
88 int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format, ...);
89 int __cdecl _CrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format, ...);
90
91#endif
92
93
94
95
96// Assertion and error reporting
97
98#ifndef _DEBUG
99
100 #define _CrtDbgBreak() ((void)0)
101
102 #ifndef _ASSERT_EXPR
103 #define _ASSERT_EXPR(expr,expr_str) ((void)0)
104 #endif
105
106 #ifndef _ASSERT
107 #define _ASSERT(expr) ((void)0)
108 #endif
109
110 #ifndef _ASSERTE
111 #define _ASSERTE(expr) ((void)0)
112 #endif
113
114
115 #define _RPT0(rptno,msg)
116 #define _RPTN(rptno,msg,...)
117
118 #define _RPTW0(rptno,msg)
119 #define _RPTWN(rptno,msg,...)
120
121 #define _RPTF0(rptno,msg)
122 #define _RPTFN(rptno,msg,...)
123
124 #define _RPTFW0(rptno,msg)
125 #define _RPTFWN(rptno,msg,...)
126
127
128#else // _DEBUG
129
130 #define _CrtDbgBreak() __debugbreak()
131
132 #ifndef _ASSERT_EXPR
133 #define _ASSERT_EXPR(expr,expr_str) \
134 (void)((!!(expr)) || (_CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%ls", expr_str) != 1) || (_CrtDbgBreak(), 0))
135 #endif
136
137 #ifndef _ASSERT
138 #define _ASSERT(expr) _ASSERT_EXPR((expr), NULL)
139 #endif
140
141 #ifndef _ASSERTE
142 #define _ASSERTE(expr) _ASSERT_EXPR((expr), _CRT_WIDE(#expr))
143 #endif
144
145 #define _RPT_BASE(...) \
146 (void)((_CrtDbgReport(__VA_ARGS__) != 1) || (_CrtDbgBreak(), 0))
147
148 #define _RPT_BASEW(...) \
149 (void)((_CrtDbgReportW(__VA_ARGS__) != 1) || (_CrtDbgBreak(), 0))
150
151
152 #define _RPT0(rptno,msg) _RPT_BASE(rptno, NULL, 0, NULL, "%s", msg)
153 #define _RPTN(rptno,msg,...) _RPT_BASE(rptno, NULL, 0, NULL, msg, __VA_ARGS__)
154
155 #define _RPTW0(rptno,msg) _RPT_BASEW(rptno, NULL, 0, NULL, L"%s", msg)
156 #define _RPTWN(rptno,msg,...) _RPT_BASEW(rptno, NULL, 0, NULL, msg, __VA_ARGS__)
157
158 #define _RPTF0(rptno,msg) _RPT_BASE(rptno, __FILE__, __LINE__, NULL, "%s", msg)
159 #define _RPTFN(rptno,msg,...) _RPT_BASE(rptno, __FILE__, __LINE__, NULL, msg, __VA_ARGS__)
160
161 #define _RPTFW0(rptno,msg) _RPT_BASEW(rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%s", msg)
162 #define _RPTFWN(rptno,msg,...) _RPT_BASEW(rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, __VA_ARGS__)
163
164#endif
165
166
167#define _RPT1 _RPTN
168#define _RPT2 _RPTN
169#define _RPT3 _RPTN
170#define _RPT4 _RPTN
171#define _RPT5 _RPTN
172
173
174#define _RPTW1 _RPTWN
175#define _RPTW2 _RPTWN
176#define _RPTW3 _RPTWN
177#define _RPTW4 _RPTWN
178#define _RPTW5 _RPTWN
179
180
181#define _RPTF1 _RPTFN
182#define _RPTF2 _RPTFN
183#define _RPTF3 _RPTFN
184#define _RPTF4 _RPTFN
185#define _RPTF5 _RPTFN
186
187
188#define _RPTFW1 _RPTFWN
189#define _RPTFW2 _RPTFWN
190#define _RPTFW3 _RPTFWN
191#define _RPTFW4 _RPTFWN
192#define _RPTFW5 _RPTFWN
193
194
195
196#define _malloc_dbg(s,t,f,l) malloc(s)
197#define _calloc_dbg(c,s,t,f,l) calloc(c,s)
198#define _realloc_dbg(p,s,t,f,l) realloc(p,s)
199#define _recalloc_dbg(p,c,s,t,f,l) _recalloc(p,c,s)
200#define _expand_dbg(p,s,t,f,l) _expand(p,s)
201#define _free_dbg(p,t) free(p)
202#define _msize_dbg(p,t) _msize(p)
203
204#define _aligned_malloc_dbg(s,a,f,l) _aligned_malloc(s,a)
205#define _aligned_realloc_dbg(p,s,a,f,l) _aligned_realloc(p,s,a)
206#define _aligned_recalloc_dbg(p,c,s,a,f,l) _aligned_realloc(p,c,s,a)
207#define _aligned_free_dbg(p) _aligned_free(p)
208#define _aligned_offset_malloc_dbg(s,a,o,f,l) _aligned_offset_malloc(s,a,o)
209#define _aligned_offset_realloc_dbg(p,s,a,o,f,l) _aligned_offset_realloc(p,s,a,o)
210#define _aligned_offset_recalloc_dbg(p,c,s,a,o,f,l) _aligned_offset_recalloc(p,c,s,a,o)
211
212#define _malloca_dbg(s,t,f,l) _malloca(s)
213#define _freea_dbg(p,t) _freea(p)
214
215#define _strdup_dbg(s,t,f,l) _strdup(s)
216#define _wcsdup_dbg(s,t,f,l) _wcsdup(s)
217#define _mbsdup_dbg(s,t,f,l) _mbsdup(s)
218#define _tempnam_dbg(s1,s2,t,f,l) _tempnam(s1,s2)
219#define _wtempnam_dbg(s1,s2,t,f,l) _wtempnam(s1,s2)
220#define _fullpath_dbg(s1,s2,le,t,f,l) _fullpath(s1,s2,le)
221#define _wfullpath_dbg(s1,s2,le,t,f,l) _wfullpath(s1,s2,le)
222#define _getcwd_dbg(s,le,t,f,l) _getcwd(s,le)
223#define _wgetcwd_dbg(s,le,t,f,l) _wgetcwd(s,le)
224#define _getdcwd_dbg(d,s,le,t,f,l) _getdcwd(d,s,le)
225#define _wgetdcwd_dbg(d,s,le,t,f,l) _wgetdcwd(d,s,le)
226#define _getdcwd_lk_dbg(d,s,le,t,f,l) _getdcwd_nolock(d,s,le)
227#define _wgetdcwd_lk_dbg(d,s,le,t,f,l) _wgetdcwd_nolock(d,s,le)
228
229#define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
230#define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0)
231#define _CrtSetReportHook2(t,f) ((int)0)
232#define _CrtSetReportHookW2(t,f) ((int)0)
233#define _CrtSetReportMode(t,f) ((int)0)
234#define _CrtSetReportFile(t,f) ((_HFILE)0)
235
236#define _CrtSetBreakAlloc(a) ((long)0)
237#define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
238#define _CrtGetAllocHook() ((_CRT_ALLOC_HOOK)0)
239#define _CrtCheckMemory() ((int)1)
240#define _CrtSetDbgFlag(f) ((int)0)
241#define _CrtDoForAllClientObjects(f,c) ((void)0)
242#define _CrtIsValidPointer(p,n,r) ((int)1)
243#define _CrtIsValidHeapPointer(p) ((int)1)
244#define _CrtIsMemoryBlock(p,t,r,f,l) ((int)1)
245#define _CrtReportBlockType(p) ((int)-1)
246#define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
247#define _CrtGetDumpClient() ((_CRT_DUMP_CLIENT)0)
248#define _CrtMemCheckpoint(s) ((void)0)
249#define _CrtMemDifference(s1,s2,s3) ((int)0)
250#define _CrtMemDumpAllObjectsSince(s) ((void)0)
251#define _CrtMemDumpStatistics(s) ((void)0)
252#define _CrtDumpMemoryLeaks() ((int)0)
253#define _CrtSetDebugFillThreshold(t) ((size_t)0)
254#define _CrtSetCheckCount(f) ((int)0)
255#define _CrtGetCheckCount() ((int)0)
256
257#ifdef __cplusplus
258}
259
260 void *__cdecl operator new[](size_t _Size);
261 inline void *__cdecl operator new(size_t _Size,int,const char *,int) { return ::operator new(_Size); }
262 inline void *__cdecl operator new[](size_t _Size,int,const char *,int) { return ::operator new[](_Size); }
263 void __cdecl operator delete[](void *) throw();
264 inline void __cdecl operator delete(void *_P,int,const char *,int) throw() { ::operator delete(_P); }
265 inline void __cdecl operator delete[](void *_P,int,const char *,int) throw() { ::operator delete[](_P); }
266#endif
267
268#pragma pack(pop)
269
270#include <sec_api/crtdbg_s.h>
271
272#endif
#define __cdecl
Definition: accygwin.h:79
void(__cdecl * _CRT_DUMP_CLIENT)(void *, size_t)
Definition: crtdbg.h:72
int(__cdecl * _CRT_REPORT_HOOKW)(int, wchar_t *, int *)
Definition: crtdbg.h:36
void * _HFILE
Definition: crtdbg.h:17
#define _MAX_BLOCKS
Definition: crtdbg.h:70
int(__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int)
Definition: crtdbg.h:45
int(__cdecl * _CRT_REPORT_HOOK)(int, char *, int *)
Definition: crtdbg.h:35
EXTERN_C int __cdecl _CrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format,...)
Definition: dbgrpt.cpp:316
EXTERN_C int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format,...)
Definition: dbgrpt.cpp:264
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
__kernel_size_t size_t
Definition: linux.h:237
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
const char * filename
Definition: ioapi.h:137
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Size
Definition: malloc.h:109
#define long
Definition: qsort.c:33
struct _CrtMemBlockHeader * pBlockHeader
Definition: crtdbg.h:77
size_t lSizes[_MAX_BLOCKS]
Definition: crtdbg.h:79
size_t lHighWaterCount
Definition: crtdbg.h:80
size_t lTotalCount
Definition: crtdbg.h:81
size_t lCounts[_MAX_BLOCKS]
Definition: crtdbg.h:78
operator