1 /***
2 *crtdbg.h - Supports debugging features of the C runtime library.
3 *
4 *           Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 *           Support CRT debugging features.
8 *
9 *           [Public]
10 *
11 ****/
12
13 #if        _MSC_VER > 1000
14 #pragma once
15 #endif
16
17 #include <crtdefs.h>
18
19 #ifndef _INC_CRTDBG
20 #define _INC_CRTDBG
21
22 #ifdef  _MSC_VER
23 #pragma pack(push,_CRT_PACKING)
24 #endif  /* _MSC_VER */
25
26 /* Define NULL here since we depend on it and for back-compat
27 */
28 #ifndef NULL
29 #ifdef __cplusplus
30 #define NULL      0
31 #else
32 #define NULL      ((void *)0)
33 #endif
34 #endif
35
36 #ifdef  __cplusplus
37 extern "C" {
38 #endif  /* __cplusplus */
39
40  /****************************************************************************
41  *
42  * Debug Reporting
43  *
44  ***************************************************************************/
45
46 typedef void *_HFILE; /* file handle pointer */
47
48 #define _CRT_WARN                  0
49 #define _CRT_ERROR                1
50 #define _CRT_ASSERT               2
51 #define _CRT_ERRCNT               3
52
53 #define _CRTDBG_MODE_FILE          0x1
54 #define _CRTDBG_MODE_DEBUG        0x2
55 #define _CRTDBG_MODE_WNDW          0x4
56 #define _CRTDBG_REPORT_MODE      -1
57
58 #define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
59 #define _CRTDBG_HFILE_ERROR     ((_HFILE)-2)
60 #define _CRTDBG_FILE_STDOUT     ((_HFILE)-4)
61 #define _CRTDBG_FILE_STDERR     ((_HFILE)-5)
62 #define _CRTDBG_REPORT_FILE     ((_HFILE)-6)
63
64 #if !defined(_M_CEE_PURE)
65 typedef int (__cdecl * _CRT_REPORT_HOOK)(int, char *, int *);
66 typedef int (__cdecl * _CRT_REPORT_HOOKW)(int, wchar_t *, int *);
67 #else
68 typedef int (__clrcall * _CRT_REPORT_HOOK)(int, char *, int *);
69 typedef int (__clrcall * _CRT_REPORT_HOOKW)(int, wchar_t *, int *);
70 #endif
71
72 #if defined(_M_CEE) 
73 typedef int (__clrcall *_CRT_REPORT_HOOK_M)(int, char *, int *);
74 typedef int (__clrcall *_CRT_REPORT_HOOKW_M)(int, wchar_t *, int *);
75 #endif
76
77 #define _CRT_RPTHOOK_INSTALL  0
78 #define _CRT_RPTHOOK_REMOVE     1
79
80  /****************************************************************************
81  *
82  * Heap
83  *
84  ***************************************************************************/
85
86  /****************************************************************************
87  *
88  * Client-defined allocation hook
89  *
90  ***************************************************************************/
91
92 #define _HOOK_ALLOC        1
93 #define _HOOK_REALLOC     2
94 #define _HOOK_FREE          3
95
96 #if !defined(_M_CEE_PURE)
97 typedef int (__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
98 #else
99 typedef int (__clrcall * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
100 #endif
101 #if defined(_M_CEE) 
102 typedef int (__clrcall * _CRT_ALLOC_HOOK_M)(int, void *, size_t, int, long, const unsigned char *, int);
103 #endif
104
105  /****************************************************************************
106  *
107  * Memory management
108  *
109  ***************************************************************************/
110
111 /*
112  * Bit values for _crtDbgFlag flag:
113  *
114  * These bitflags control debug heap behavior.
115  */
116
117 #define _CRTDBG_ALLOC_MEM_DF             0x01  /* Turn on debug allocation */
118 #define _CRTDBG_DELAY_FREE_MEM_DF     0x02  /* Don't actually free memory */
119 #define _CRTDBG_CHECK_ALWAYS_DF        0x04  /* Check heap every alloc/dealloc */
120 #define _CRTDBG_RESERVED_DF               0x08  /* Reserved - do not use */
121 #define _CRTDBG_CHECK_CRT_DF             0x10  /* Leak check/diff CRT blocks */
122 #define _CRTDBG_LEAK_CHECK_DF           0x20  /* Leak check at program exit */
123
124 /*
125  * Some bit values for _crtDbgFlag which correspond to frequencies for checking
126  * the the heap.
127  */
128 #define _CRTDBG_CHECK_EVERY_16_DF     0x00100000  /* check heap every 16 heap ops */
129 #define _CRTDBG_CHECK_EVERY_128_DF  0x00800000  /* check heap every 128 heap ops */
130 #define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000  /* check heap every 1024 heap ops */
131 /*
132 We do not check the heap by default at this point because the cost was too high
133 for some applications. You can still turn this feature on manually.
134 */
135 #define _CRTDBG_CHECK_DEFAULT_DF      0                  
136
137 #define _CRTDBG_REPORT_FLAG               -1      /* Query bitflag status */
138
139 #define _BLOCK_TYPE(block)                (block & 0xFFFF)
140 #define _BLOCK_SUBTYPE(block)           (block >> 16 & 0xFFFF)
141
142
143  /****************************************************************************
144  *
145  * Memory state
146  *
147  ***************************************************************************/
148
149 /* Memory block identification */
150 #define _FREE_BLOCK          0
151 #define _NORMAL_BLOCK      1
152 #define _CRT_BLOCK           2
153 #define _IGNORE_BLOCK      3
154 #define _CLIENT_BLOCK      4
155 #define _MAX_BLOCKS          5
156
157 #if !defined(_M_CEE_PURE)
158 typedef void (__cdecl * _CRT_DUMP_CLIENT)(void *, size_t);
159 #else
160 typedef void (__clrcall * _CRT_DUMP_CLIENT)(void *, size_t);
161 #endif
162 #if defined(_M_CEE)
163 typedef void (__clrcall * _CRT_DUMP_CLIENT_M)(void *, size_t);
164 #endif
165
166 struct _CrtMemBlockHeader;
167 typedef struct _CrtMemState
168 {
169              struct _CrtMemBlockHeader * pBlockHeader;
170              size_t lCounts[_MAX_BLOCKS];
171              size_t lSizes[_MAX_BLOCKS];
172              size_t lHighWaterCount;
173              size_t lTotalCount;
174 } _CrtMemState;
175
176
177  /****************************************************************************
178  *
179  * Declarations, prototype and function-like macros
180  *
181  ***************************************************************************/
182
183 /* _STATIC_ASSERT is for enforcing boolean/integral conditions at compile time.
184      Since it is purely a compile-time mechanism that generates no code, the check
185      is left in even if _DEBUG is not defined. */
186
187 #ifndef _STATIC_ASSERT
188 #define _STATIC_ASSERT(expr) typedef char __static_assert_t[ (expr) ]
189 #endif
190
191 #ifndef _DEBUG
192
193  /****************************************************************************
194  *
195  * Debug OFF
196  * Debug OFF
197  * Debug OFF
198  *
199  ***************************************************************************/
200
201 /*  We allow our basic _ASSERT macros to be overridden by pre-existing definitions. 
202       This is not the ideal mechanism, but is helpful in some scenarios and helps avoid
203       multiple definition problems */
204
205 #ifndef _ASSERT
206 #define _ASSERT(expr) ((void)0)
207 #endif 
208
209 #ifndef _ASSERTE
210 #define _ASSERTE(expr) ((void)0)
211 #endif
212
213 #ifndef _ASSERT_EXPR
214 #define _ASSERT_EXPR(expr, expr_str) ((void)0)
215 #endif
216
217 #ifndef _ASSERT_BASE
218 #define _ASSERT_BASE _ASSERT_EXPR
219 #endif
220
221 #define _RPT0(rptno, msg)
222 #define _RPTW0(rptno, msg)
223
224 #define _RPT1(rptno, msg, arg1)
225 #define _RPTW1(rptno, msg, arg1)
226
227 #define _RPT2(rptno, msg, arg1, arg2)
228 #define _RPTW2(rptno, msg, arg1, arg2)
229
230 #define _RPT3(rptno, msg, arg1, arg2, arg3)
231 #define _RPTW3(rptno, msg, arg1, arg2, arg3)
232
233 #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4)
234 #define _RPTW4(rptno, msg, arg1, arg2, arg3, arg4)
235
236 #define _RPT5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
237 #define _RPTW5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
238
239
240 #define _RPTF0(rptno, msg)
241 #define _RPTFW0(rptno, msg)
242
243 #define _RPTF1(rptno, msg, arg1)
244 #define _RPTFW1(rptno, msg, arg1)
245
246 #define _RPTF2(rptno, msg, arg1, arg2)
247 #define _RPTFW2(rptno, msg, arg1, arg2)
248
249 #define _RPTF3(rptno, msg, arg1, arg2, arg3)
250 #define _RPTFW3(rptno, msg, arg1, arg2, arg3)
251
252 #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
253 #define _RPTFW4(rptno, msg, arg1, arg2, arg3, arg4)
254
255 #define _RPTF5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
256 #define _RPTFW5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
257
258 #define _malloc_dbg(s, t, f, l)               malloc(s)
259 #define _calloc_dbg(c, s, t, f, l)          calloc(c, s)
260 #define _realloc_dbg(p, s, t, f, l)        realloc(p, s)
261 #define _recalloc_dbg(p, c, s, t, f, l) _recalloc(p, c, s)
262 #define _expand_dbg(p, s, t, f, l)          _expand(p, s)
263 #define _free_dbg(p, t)                            free(p)
264 #define _msize_dbg(p, t)                          _msize(p)
265
266 #define _aligned_msize_dbg(p, a, o)                                         _aligned_msize(p, a, o)
267 #define _aligned_malloc_dbg(s, a, f, l)                                   _aligned_malloc(s, a)
268 #define _aligned_realloc_dbg(p, s, a, f, l)                            _aligned_realloc(p, s, a)
269 #define _aligned_recalloc_dbg(p, c, s, a, f, l)                     _aligned_recalloc(p, c, s, a)
270 #define _aligned_free_dbg(p)                                          _aligned_free(p)
271 #define _aligned_offset_malloc_dbg(s, a, o, f, l)                  _aligned_offset_malloc(s, a, o)
272 #define _aligned_offset_realloc_dbg(p, s, a, o, f, l)           _aligned_offset_realloc(p, s, a, o)
273 #define _aligned_offset_recalloc_dbg(p, c, s, a, o, f, l)     _aligned_offset_recalloc(p, c, s, a, o)
274
275 #define _malloca_dbg(s, t, f, l)             _malloca(s)
276 #define _freea_dbg(p, t)                          _freea(p)
277
278 #define _strdup_dbg(s, t, f, l)               _strdup(s)
279 #define _wcsdup_dbg(s, t, f, l)               _wcsdup(s)
280 #define _mbsdup_dbg(s, t, f, l)               _mbsdup(s)
281 #define _tempnam_dbg(s1, s2, t, f, l)     _tempnam(s1, s2)
282 #define _wtempnam_dbg(s1, s2, t, f, l)  _wtempnam(s1, s2)
283 #define _fullpath_dbg(s1, s2, le, t, f, l)  _fullpath(s1, s2, le)
284 #define _wfullpath_dbg(s1, s2, le, t, f, l) _wfullpath(s1, s2, le)
285 #define _getcwd_dbg(s, le, t, f, l)        _getcwd(s, le)
286 #define _wgetcwd_dbg(s, le, t, f, l)      _wgetcwd(s, le)
287 #define _getdcwd_dbg(d, s, le, t, f, l)        _getdcwd(d, s, le)
288 #define _wgetdcwd_dbg(d, s, le, t, f, l)      _wgetdcwd(d, s, le)
289 #define _getdcwd_lk_dbg(d, s, le, t, f, l)  _getdcwd_nolock(d, s, le)
290 #define _wgetdcwd_lk_dbg(d, s, le, t, f, l) _wgetdcwd_nolock(d, s, le)
291 #define _dupenv_s_dbg(ps1, size, s2, t, f, l)  _dupenv_s(ps1, size, s2)
292 #define _wdupenv_s_dbg(ps1, size, s2, t, f, l) _wdupenv_s(ps1, size, s2)
293
294 #define _CrtSetReportHook(f)                          ((_CRT_REPORT_HOOK)0)
295 #define _CrtGetReportHook()                            ((_CRT_REPORT_HOOK)0)
296 #define _CrtSetReportHook2(t, f)                    ((int)0)
297 #define _CrtSetReportHookW2(t, f)                  ((int)0)
298 #define _CrtSetReportMode(t, f)                     ((int)0)
299 #define _CrtSetReportFile(t, f)                     ((_HFILE)0)
300
301 #define _CrtDbgBreak()                                    ((void)0)
302
303 #define _CrtSetBreakAlloc(a)                          ((long)0)
304
305 #define _CrtSetAllocHook(f)                            ((_CRT_ALLOC_HOOK)0)
306 #define _CrtGetAllocHook()                              ((_CRT_ALLOC_HOOK)0)
307
308 #define _CrtCheckMemory()                               ((int)1)
309 #define _CrtSetDbgFlag(f)                               ((int)0)
310 #define _CrtDoForAllClientObjects(f, c)        ((void)0)
311 #define _CrtIsValidPointer(p, n, r)               ((int)1)
312 #define _CrtIsValidHeapPointer(p)                  ((int)1)
313 #define _CrtIsMemoryBlock(p, t, r, f, l)      ((int)1)
314 #define _CrtReportBlockType(p)                       ((int)-1)
315
316 #define _CrtSetDumpClient(f)                          ((_CRT_DUMP_CLIENT)0)
317 #define _CrtGetDumpClient()                            ((_CRT_DUMP_CLIENT)0)
318
319 #define _CrtMemCheckpoint(s)                          ((void)0)
320 #define _CrtMemDifference(s1, s2, s3)           ((int)0)
321 #define _CrtMemDumpAllObjectsSince(s)           ((void)0)
322 #define _CrtMemDumpStatistics(s)                    ((void)0)
323 #define _CrtDumpMemoryLeaks()                         ((int)0)
324 #define _CrtSetDebugFillThreshold(t)             ((size_t)0)
325
326 #define _CrtSetCheckCount(f)                          ((int)0)
327 #define _CrtGetCheckCount()                            ((int)0)
328
329 #else     /* _DEBUG */
330
331
332  /****************************************************************************
333  *
334  * Debug ON
335  * Debug ON
336  * Debug ON
337  *
338  ***************************************************************************/
339
340
341 /* Define _MRTIMP */
342
343 #ifndef _MRTIMP
344 #define _MRTIMP __declspec(dllimport)
345 #endif  /* _MRTIMP */
346
347 /* Define _CRTIMP */
348
349 #ifndef _CRTIMP
350 #ifdef  _DLL
351 #define _CRTIMP __declspec(dllimport)
352 #else     /* ndef _DLL */
353 #define _CRTIMP
354 #endif  /* _DLL */
355 #endif  /* _CRTIMP */
356
357  /****************************************************************************
358  *
359  * Debug Reporting
360  *
361  ***************************************************************************/
362
363 #if !defined(_M_CEE_PURE)
364 _CRTIMP extern long _crtAssertBusy;
365 #endif /* !defined(_M_CEE_PURE) */
366
367 #if !defined(_M_CEE_PURE)
368 _CRTIMP _CRT_REPORT_HOOK __cdecl _CrtGetReportHook(
369       void
370       );
371 #endif
372
373 /* _CrtSetReportHook[[W]2]:
374  * For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
375  * For pure and native, we just need clrcall and cdecl, respectively.
376  */
377 #if !defined(_M_CEE_PURE)
378 _CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
379       _In_opt_ _CRT_REPORT_HOOK _PFnNewHook
380              );
381
382 _CRTIMP int __cdecl _CrtSetReportHook2(
383              _In_ int _Mode,
384              _In_opt_ _CRT_REPORT_HOOK _PFnNewHook
385              );
386
387 _CRTIMP int __cdecl _CrtSetReportHookW2(
388              _In_ int _Mode,
389              _In_opt_ _CRT_REPORT_HOOKW _PFnNewHook
390              );
391 #else
392 extern "C++"
393 {
394 _MRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
395              _In_opt_ _CRT_REPORT_HOOK _PFnNewHook
396              );
397
398 _MRTIMP int __cdecl _CrtSetReportHook2(
399              _In_ int _Mode,
400              _In_opt_ _CRT_REPORT_HOOK _PFnNewHook
401              );
402
403
404 _MRTIMP int __cdecl _CrtSetReportHookW2(
405              _In_ int _Mode,
406              _In_opt_ _CRT_REPORT_HOOKW _PFnNewHook
407              );
408 }
409 #endif
410
411 #if defined(_M_CEE_MIXED)
412 extern "C++"
413 {
414 _MRTIMP _CRT_REPORT_HOOK_M __cdecl _CrtSetReportHook(
415              _In_opt_ _CRT_REPORT_HOOK_M _PFnNewHook
416              );
417
418
419 _MRTIMP int __cdecl _CrtSetReportHook2(
420              _In_ int _Mode,
421              _In_opt_ _CRT_REPORT_HOOK_M _PFnNewHook
422              );
423
424
425 _MRTIMP int __cdecl _CrtSetReportHookW2(
426              _In_ int _Mode,
427              _In_opt_ _CRT_REPORT_HOOKW_M _PFnNewHook
428              );
429
430 /* 
431 This overload allows NULL to be passed unambiguously in the mixed case
432 */
433 _MRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
434              _In_ int _PFnNewHook
435              );
436 }
437 #endif
438
439
440 _CRTIMP int __cdecl _CrtSetReportMode(
441              _In_ int _ReportType,
442              _In_ int _ReportMode 
443              );
444
445 _CRTIMP _HFILE __cdecl _CrtSetReportFile(
446              _In_ int _ReportType,
447              _In_opt_ _HFILE _ReportFile 
448              );
449
450 _CRTIMP int __cdecl _CrtDbgReport(
451              _In_ int _ReportType,
452              _In_opt_z_ const char * _Filename,
453              _In_ int _Linenumber,
454              _In_opt_z_ const char * _ModuleName,
455              _In_opt_z_ const char * _Format,
456              ...);
457
458 _CRTIMP size_t __cdecl _CrtSetDebugFillThreshold(
459              _In_ size_t _NewDebugFillThreshold
460              );
461
462 #if !defined(_NATIVE_WCHAR_T_DEFINED) && defined(_M_CEE_PURE)
463 extern "C++"
464 #endif
465 _CRTIMP int __cdecl _CrtDbgReportW(
466              _In_ int _ReportType,
467              _In_opt_z_ const wchar_t * _Filename,
468              _In_ int _LineNumber,
469              _In_opt_z_ const wchar_t * _ModuleName,
470              _In_opt_z_ const wchar_t * _Format,
471              ...);
472
473 /* Asserts */
474 /* We use !! below to ensure that any overloaded operators used to evaluate expr do not end up at operator || */
475 #define _ASSERT_EXPR(expr, msg) \
476              (void) ((!!(expr)) || \
477                           (1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, msg)) || \
478                           (_CrtDbgBreak(), 0))
479
480 #ifndef _ASSERT
481 #define _ASSERT(expr)     _ASSERT_EXPR((expr), NULL)
482 #endif
483
484 #ifndef _ASSERTE
485 #define _ASSERTE(expr)  _ASSERT_EXPR((expr), _CRT_WIDE(#expr))
486 #endif
487
488 /*
489 We retain _ASSERT_BASE solely for backwards compatibility with those who used it even though they
490 should not have done so since it was not documented. 
491 */
492 #ifndef _ASSERT_BASE
493 #define _ASSERT_BASE _ASSERT_EXPR
494 #endif
495
496 /* Reports with no file/line info */
497
498 #if        _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE)
499 #define _RPT_BASE(args) \
500              (void) ((1 != _CrtDbgReport args) || \
501                           (_CrtDbgBreak(), 0))
502
503 #define _RPT_BASE_W(args) \
504              (void) ((1 != _CrtDbgReportW args) || \
505                           (_CrtDbgBreak(), 0))
506 #else
507 #define _RPT_BASE(args) \
508              do { if ((1 == _CrtDbgReport args)) \
509                           _CrtDbgBreak(); } while (0)
510
511 #define _RPT_BASE_W(args) \
512              do { if ((1 == _CrtDbgReportW args)) \
513                           _CrtDbgBreak(); } while (0)
514 #endif
515
516 #define _RPT0(rptno, msg) \
517              _RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
518
519 #define _RPTW0(rptno, msg) \
520              _RPT_BASE_W((rptno, NULL, 0, NULL, L"%s", msg))
521
522 #define _RPT1(rptno, msg, arg1) \
523              _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
524
525 #define _RPTW1(rptno, msg, arg1) \
526              _RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1))
527
528 #define _RPT2(rptno, msg, arg1, arg2) \
529              _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
530
531 #define _RPTW2(rptno, msg, arg1, arg2) \
532              _RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2))
533
534 #define _RPT3(rptno, msg, arg1, arg2, arg3) \
535              _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
536
537 #define _RPTW3(rptno, msg, arg1, arg2, arg3) \
538              _RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
539
540 #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
541              _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
542
543 #define _RPTW4(rptno, msg, arg1, arg2, arg3, arg4) \
544              _RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
545
546 #define _RPT5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
547              _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
548
549 #define _RPTW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
550              _RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
551
552 /* Reports with file/line info */
553
554 #define _RPTF0(rptno, msg) \
555              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
556
557 #define _RPTFW0(rptno, msg) \
558              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%s", msg))
559
560 #define _RPTF1(rptno, msg, arg1) \
561              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
562
563 #define _RPTFW1(rptno, msg, arg1) \
564              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1))
565
566 #define _RPTF2(rptno, msg, arg1, arg2) \
567              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
568
569 #define _RPTFW2(rptno, msg, arg1, arg2) \
570              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2))
571
572 #define _RPTF3(rptno, msg, arg1, arg2, arg3) \
573              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
574
575 #define _RPTFW3(rptno, msg, arg1, arg2, arg3) \
576              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3))
577
578 #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
579              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
580
581 #define _RPTFW4(rptno, msg, arg1, arg2, arg3, arg4) \
582              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
583
584 #define _RPTF5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
585              _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
586
587 #define _RPTFW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
588              _RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
589
590 #if        _MSC_VER >= 1300 && !defined(_CRT_PORTABLE)
591 #define _CrtDbgBreak() __debugbreak()
592 #elif     defined(_M_IX86) && !defined(_CRT_PORTABLE)
593 #define _CrtDbgBreak() __asm { int 3 }
594 #elif     defined(_M_IA64) && !defined(_CRT_PORTABLE)
595 void __break(int);
596 #pragma intrinsic (__break)
597 #define _CrtDbgBreak() __break(0x80016)
598 #else
599 _CRTIMP void __cdecl _CrtDbgBreak(
600              void
601              );
602 #endif
603
604  /****************************************************************************
605  *
606  * Heap routines
607  *
608  ***************************************************************************/
609
610 #ifdef  _CRTDBG_MAP_ALLOC
611
612 #define     malloc(s)                     _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
613 #define     calloc(c, s)                _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
614 #define     realloc(p, s)               _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
615 #define     _recalloc(p, c, s)      _recalloc_dbg(p, c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
616 #define     _expand(p, s)               _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
617 #define     free(p)                         _free_dbg(p, _NORMAL_BLOCK)
618 #define     _msize(p)                     _msize_dbg(p, _NORMAL_BLOCK)
619 #define     _aligned_msize(p, a, o)                               _aligned_msize_dbg(p, a, o)
620 #define     _aligned_malloc(s, a)                                   _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
621 #define     _aligned_realloc(p, s, a)                            _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
622 #define     _aligned_recalloc(p, c, s, a)                     _aligned_recalloc_dbg(p, c, s, a, __FILE__, __LINE__)
623 #define     _aligned_offset_malloc(s, a, o)                  _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
624 #define     _aligned_offset_realloc(p, s, a, o)           _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
625 #define     _aligned_offset_recalloc(p, c, s, a, o)     _aligned_offset_recalloc_dbg(p, c, s, a, o, __FILE__, __LINE__)
626 #define     _aligned_free(p)  _aligned_free_dbg(p)
627
628 #define     _malloca(s)             _malloca_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
629 #define     _freea(p)                _freea_dbg(p, _NORMAL_BLOCK)
630
631 #define     _strdup(s)               _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
632 #define     _wcsdup(s)               _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
633 #define     _mbsdup(s)               _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
634 #define     _tempnam(s1, s2)     _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
635 #define     _wtempnam(s1, s2)  _wtempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
636 #define     _fullpath(s1, s2, le)        _fullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
637 #define     _wfullpath(s1, s2, le)      _wfullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
638 #define     _getcwd(s, le)          _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
639 #define     _wgetcwd(s, le)        _wgetcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
640 #define     _getdcwd(d, s, le)  _getdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
641 #define     _wgetdcwd(d, s, le) _wgetdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
642 #define     _getdcwd_nolock(d, s, le)        _getdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
643 #define     _wgetdcwd_nolock(d, s, le)      _wgetdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
644 #define     _dupenv_s(ps1, size, s2)          _dupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
645 #define     _wdupenv_s(ps1, size, s2)        _wdupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
646
647 #if        !__STDC__
648 #define     strdup(s)                _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
649 #define     wcsdup(s)                _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
650 #define     tempnam(s1, s2)      _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
651 #define     getcwd(s, le)          _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
652 #endif
653
654
655 #endif  /* _CRTDBG_MAP_ALLOC */
656
657 #if !defined(_M_CEE_PURE)
658 _CRTIMP extern long _crtBreakAlloc;          /* Break on this allocation */
659 #endif /* !defined(_M_CEE_PURE) */
660
661 _CRTIMP long __cdecl _CrtSetBreakAlloc(
662              _In_ long _BreakAlloc 
663              );
664
665 /*
666  * Prototypes for malloc, free, realloc, etc are in malloc.h
667  */
668
669 _Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _malloc_dbg(
670              _In_ size_t _Size,
671              _In_ int _BlockType,
672              _In_opt_z_ const char * _Filename,
673              _In_ int _LineNumber
674              );
675
676 _Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP void * __cdecl _calloc_dbg(
677              _In_ size_t _Count,
678              _In_ size_t _Size,
679              _In_ int _BlockType,
680              _In_opt_z_ const char * _Filename,
681              _In_ int _LineNumber
682              );
683
684 _Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _realloc_dbg(
685              _In_opt_ void * _Memory,
686              _In_ size_t _NewSize,
687              _In_ int _BlockType,
688              _In_opt_z_ const char * _Filename,
689              _In_ int _LineNumber
690              );
691
692 _Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _recalloc_dbg
693 (
694              _In_opt_ void * _Memory,
695              _In_ size_t _NumOfElements,
696              _In_ size_t _SizeOfElements,
697              _In_ int _BlockType,
698              _In_opt_z_ const char * _Filename,
699              _In_ int _LineNumber
700 );
701
702 _Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _expand_dbg(
703              _Inout_opt_ void * _Memory,
704              _In_ size_t _NewSize,
705              _In_ int _BlockType,
706              _In_opt_z_ const char * _Filename,
707              _In_ int _LineNumber
708              );
709
710 _CRTIMP void __cdecl _free_dbg(
711              _Inout_opt_ void * _Memory,
712              _In_ int _BlockType
713              );
714
715 _CRTIMP size_t __cdecl _msize_dbg (
716              _In_ void * _Memory,
717              _In_ int _BlockType
718              );
719
720 _CRTIMP size_t __cdecl _aligned_msize_dbg (
721              _In_ void * _Memory,
722              _In_ size_t _Alignment,
723              _In_ size_t _Offset
724              );
725
726 _Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _aligned_malloc_dbg(
727              _In_ size_t _Size,
728              _In_ size_t _Alignment,
729              _In_opt_z_ const char * _Filename,
730              _In_ int _LineNumber
731              );
732
733 _Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _aligned_realloc_dbg(
734              _In_opt_ void * _Memory,
735              _In_ size_t _NewSize,
736              _In_ size_t _Alignment,
737              _In_opt_z_ const char * _Filename,
738              _In_ int _LineNumber
739              );
740
741 _Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _aligned_recalloc_dbg
742 (
743              _In_opt_ void * _Memory,
744              _In_ size_t _NumOfElements,
745              _In_ size_t _SizeOfElements,
746              _In_ size_t _Alignment,
747              _In_opt_z_ const char * _Filename,
748              _In_ int _LineNumber
749 );
750
751 _Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP void * __cdecl _aligned_offset_malloc_dbg(
752              _In_ size_t _Size,
753              _In_ size_t _Alignment,
754              _In_ size_t _Offset,
755              _In_opt_z_ const char * _Filename,
756              _In_ int _LineNumber
757              );
758
759 _Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void * __cdecl _aligned_offset_realloc_dbg(
760              _In_opt_ void * _Memory,
761              _In_ size_t _NewSize,
762              _In_ size_t _Alignment,
763              _In_ size_t _Offset,
764              _In_opt_z_ const char * _Filename,
765              _In_ int _LineNumber
766              );
767
768 _Check_return_ _Ret_opt_bytecap_x_(_NumOfElements*_SizeOfElements) _CRTIMP void * __cdecl _aligned_offset_recalloc_dbg
769 (
770              _In_opt_ void * _Memory,
771              _In_ size_t _NumOfElements,
772              _In_ size_t _SizeOfElements,
773              _In_ size_t _Alignment,
774              _In_ size_t _Offset,
775              _In_opt_z_ const char * _Filename,
Lines 776 ... 785 are skipped.
786              _In_opt_z_ const char * _Filename,
787              _In_ int _LineNumber
788              );
789
790 _Check_return_ _Ret_opt_z_ _CRTIMP wchar_t * __cdecl _wcsdup_dbg(
791              _In_opt_z_ const wchar_t * _Str,
792              _In_ int _BlockType,
793              _In_opt_z_ const char * _Filename,
794              _In_ int _LineNumber
795              );
796
797 _Check_return_ _Ret_opt_z_ _CRTIMP char * __cdecl _tempnam_dbg(
798              _In_opt_z_ const char * _DirName,
799              _In_opt_z_ const char * _FilePrefix,
800              _In_ int _BlockType,
801              _In_opt_z_ const char * _Filename,
802              _In_ int _LineNumber
803              );
804
805 _Check_return_ _Ret_opt_z_ _CRTIMP wchar_t * __cdecl _wtempnam_dbg(
806              _In_opt_z_ const wchar_t * _DirName,
807              _In_opt_z_ const wchar_t * _FilePrefix,
808              _In_ int _BlockType,
809              _In_opt_z_ const char * _Filename,
810              _In_ int _LineNumber
811              );
812
813 _Check_return_ _Ret_opt_z_ _CRTIMP char * __cdecl _fullpath_dbg(
814              _Out_opt_z_cap_(_SizeInBytes) char * _FullPath, 
815              _In_z_ const char * _Path, 
816              _In_ size_t _SizeInBytes,
817              _In_ int _BlockType,
818              _In_opt_z_ const char * _Filename,
819              _In_ int _LineNumber
820              );
821
822 _Check_return_ _Ret_opt_z_ _CRTIMP wchar_t * __cdecl _wfullpath_dbg(
823              _Out_opt_z_cap_(_SizeInWords) wchar_t * _FullPath, 
824              _In_z_ const wchar_t * _Path, 
825              _In_ size_t _SizeInWords,
826              _In_ int _BlockType,
827              _In_opt_z_ const char * _Filename,
828              _In_ int _LineNumber
829              );
830
831 _Check_return_ _Ret_opt_z_ _CRTIMP char * __cdecl _getcwd_dbg(
832              _Out_opt_z_cap_(_SizeInBytes) char * _DstBuf,
833              _In_ int _SizeInBytes,
834              _In_ int _BlockType,
835              _In_opt_z_ const char * _Filename,
836              _In_ int _LineNumber
837              );
838
839 _Check_return_ _Ret_opt_z_ _CRTIMP wchar_t * __cdecl _wgetcwd_dbg(
840              _Out_opt_z_cap_(_SizeInWords) wchar_t * _DstBuf,
841              _In_ int _SizeInWords,
842              _In_ int _BlockType,
843              _In_opt_z_ const char * _Filename,
844              _In_ int _LineNumber
845              );
846
847 _Check_return_ _Ret_opt_z_ _CRTIMP char * __cdecl _getdcwd_dbg(
848              _In_ int _Drive,
849              _Out_opt_z_cap_(_SizeInBytes) char * _DstBuf,
850              _In_ int _SizeInBytes,
851              _In_ int _BlockType,
852              _In_opt_z_ const char * _Filename,
853              _In_ int _LineNumber
854              );
855
856 _Check_return_ _Ret_opt_z_ _CRTIMP wchar_t * __cdecl _wgetdcwd_dbg(
857              _In_ int _Drive,
858              _Out_opt_z_cap_(_SizeInWords) wchar_t * _DstBuf,
859              _In_ int _SizeInWords,
860              _In_ int _BlockType,
861              _In_opt_z_ const char * _Filename,
862              _In_ int _LineNumber
863              );
864
865 _Check_return_ _Ret_opt_z_ char * __cdecl _getdcwd_lk_dbg(
866              _In_ int _Drive,
867              _Out_opt_z_cap_(_SizeInBytes) char * _DstBuf,
868              _In_ int _SizeInBytes,
869              _In_ int _BlockType,
870              _In_opt_z_ const char * _Filename,
871              _In_ int _LineNumber
872              );
873
874 _Check_return_ _Ret_opt_z_ wchar_t * __cdecl _wgetdcwd_lk_dbg(
875              _In_ int _Drive,
876              _Out_opt_z_cap_(_SizeInWords) wchar_t * _DstBuf,
877              _In_ int _SizeInWords,
878              _In_ int _BlockType,
879              _In_opt_z_ const char * _Filename,
880              _In_ int _LineNumber
881              );
882
883 _Check_return_wat_ _CRTIMP errno_t __cdecl _dupenv_s_dbg(
884              _Out_ _Deref_post_opt_z_cap_(*_PBufferSizeInBytes) char ** _PBuffer,
885              _Out_opt_ size_t * _PBufferSizeInBytes,
886              _In_z_ const char * _VarName,
887              _In_ int _BlockType,
888              _In_opt_z_ const char * _Filename,
889              _In_ int _LineNumber
890              );
891
892 _Check_return_wat_ _CRTIMP errno_t __cdecl _wdupenv_s_dbg(
893              _Out_ _Deref_post_opt_z_cap_(*_PBufferSizeInWords) wchar_t ** _PBuffer,
894              _Out_opt_ size_t * _PBufferSizeInWords,
895              _In_z_ const wchar_t * _VarName,
896              _In_ int _BlockType,
897              _In_opt_z_ const char * _Filename,
898              _In_ int _LineNumber
899              );
900
901 #define _malloca_dbg(s, t, f, l)      _malloc_dbg(s, t, f, l)
902 #define _freea_dbg(p, t)                    _free_dbg(p, t)
903
904 #if defined(__cplusplus) && defined(_CRTDBG_MAP_ALLOC)
905 namespace std
906 {
907     using ::_calloc_dbg; using ::_free_dbg; using ::_malloc_dbg; using ::_realloc_dbg;
908 }
909 #endif 
910
911  /****************************************************************************
912  *
913  * Client-defined allocation hook
914  *
915  ***************************************************************************/
916 #if !defined(_M_CEE_PURE)
917 _CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtGetAllocHook
918 (
919       void
920 );
921 #endif
922
923 /* _CrtSetAllocHook:
924  * For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
925  * For pure and native, we just need clrcall and cdecl, respectively.
926  */
927 #if !defined(_M_CEE_PURE)
928 _CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
929 (
930       _In_opt_ _CRT_ALLOC_HOOK _PfnNewHook
931 );
932 #else
933 extern "C++"
934 {
935 _MRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
936 (
937       _In_opt_ _CRT_ALLOC_HOOK _PfnNewHook 
938 );
939 }
940 #endif
941
942 #if defined (_M_CEE_MIXED)
943 extern "C++"
944 {
945 _MRTIMP _CRT_ALLOC_HOOK_M __cdecl _CrtSetAllocHook
946 (
947       _In_opt_ _CRT_ALLOC_HOOK_M _PfnNewHook 
948 );
949 }
950
951 /* If we have both versions, then we need an int overload to disambiguate for the NULL case */
952 extern "C++" 
953 {
954 _MRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
955 (
956       _In_ int _PfnNewHook
957 );
958 }
959 #endif
960
961
962  /****************************************************************************
963  *
964  * Memory management
965  *
966  ***************************************************************************/
967
968 /*
969  * Bitfield flag that controls CRT heap behavior
970  * Default setting is _CRTDBG_ALLOC_MEM_DF
971  */
972
973 #if !defined(_M_CEE_PURE)
974 _CRTIMP extern int _crtDbgFlag;
975 #endif /* !defined(_M_CEE_PURE) */
976
977 _CRTIMP int __cdecl _CrtCheckMemory(
978              void
979              );
980
981 _CRTIMP int __cdecl _CrtSetDbgFlag(
982              _In_ int _NewFlag
983              );
984
985 _CRTIMP void __cdecl _CrtDoForAllClientObjects(
986              _In_ void (__cdecl *_PFn)(void *, void *),
987              void * _Context
988              );
989
990 #if defined(_M_CEE)
991 extern "C++"
992 {
993 _MRTIMP void __cdecl _CrtDoForAllClientObjects(
994              _In_ void (__clrcall * _PFn)(void *, void *),
995              void * _Context
996              );
997 }
998 #endif
999
1000 _Check_return_ _CRTIMP int __cdecl _CrtIsValidPointer(
1001              _In_opt_ const void * _Ptr,
1002              _In_ unsigned int _Bytes,
1003              _In_ int _ReadWrite
1004              );
1005
1006 _Check_return_ _CRTIMP int __cdecl _CrtIsValidHeapPointer(
1007              _In_opt_ const void * _HeapPtr
1008              );
1009
1010 _CRTIMP int __cdecl _CrtIsMemoryBlock(
1011              _In_opt_ const void * _Memory,
1012              _In_ unsigned int _Bytes,
1013              _Out_opt_ long * _RequestNumber,
1014              _Out_opt_ char ** _Filename,
1015              _Out_opt_ int * _LineNumber
1016              );
1017
1018 _Check_return_ _CRTIMP int __cdecl _CrtReportBlockType(
1019              _In_opt_ const void * _Memory
1020              );
1021
1022
1023  /****************************************************************************
1024  *
1025  * Memory state
1026  *
1027  ***************************************************************************/
1028
1029 #if !defined(_M_CEE_PURE)
1030 _CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtGetDumpClient
1031 (
1032       void
1033 );
1034 #endif
1035
1036 /* _CrtSetDumpClient:
1037  * For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
1038  * For pure and native, we just need clrcall and cdecl, respectively.
1039  */
1040 #if !defined(_M_CEE_PURE)
1041 _CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
1042 (
1043       _In_opt_ _CRT_DUMP_CLIENT _PFnNewDump
1044 );
1045
1046 #else
1047 extern "C++" 
1048 {
1049 _MRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
1050 (
1051       _In_opt_ _CRT_DUMP_CLIENT _PFnNewDump
1052 );
1053 }
1054 #endif
1055
1056 #if defined (_M_CEE_MIXED)
1057 extern "C++" 
1058 {
1059 _MRTIMP _CRT_DUMP_CLIENT_M __cdecl _CrtSetDumpClient
1060 (
1061       _In_opt_ _CRT_DUMP_CLIENT_M _PFnNewDump
1062 );
1063
1064 /* If we have both versions, then we need an int overload to disambiguate for the NULL case */
1065 _MRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
1066 (
1067       _In_ int _PFnNewDump
1068 );
1069 }
1070 #endif
1071
1072 _CRTIMP _CRT_MANAGED_HEAP_DEPRECATE void __cdecl _CrtMemCheckpoint(
1073              _Out_ _CrtMemState * _State
1074              );
1075
1076 _CRTIMP _CRT_MANAGED_HEAP_DEPRECATE int __cdecl _CrtMemDifference(
1077              _Out_ _CrtMemState * _State,
1078              _In_ const _CrtMemState * _OldState,
1079              _In_ const _CrtMemState * _NewState
1080              );
1081
1082 _CRTIMP void __cdecl _CrtMemDumpAllObjectsSince(
1083              _In_opt_ const _CrtMemState * _State
1084              );
1085
1086 _CRTIMP void __cdecl _CrtMemDumpStatistics(
1087              _In_ const _CrtMemState * _State
1088              );
1089
1090 _CRTIMP int __cdecl _CrtDumpMemoryLeaks(
1091              void
1092              );
1093
1094 _CRTIMP int __cdecl _CrtSetCheckCount(
1095              _In_ int _CheckCount
1096              );
1097
1098 _CRTIMP int __cdecl _CrtGetCheckCount(
1099              void
1100              );
1101
1102 #endif  /* _DEBUG */
1103
1104 #ifdef  __cplusplus
1105 }
1106
1107 #ifndef _MFC_OVERRIDES_NEW
1108
1109 extern "C++" {
1110
1111 #ifndef _DEBUG
1112
1113  /****************************************************************************
1114  *
1115  * Debug OFF
1116  * Debug OFF
1117  * Debug OFF
1118  *
1119  ***************************************************************************/
1120
1121  
1122 #pragma warning(suppress: 4985)
1123 _Ret_bytecap_(_Size) void * __CRTDECL operator new[](size_t _Size);
1124
1125 #if !defined(_M_CEE_PURE)
1126 _Ret_bytecap_(_Size) void * __CRTDECL operator new(
1127              size_t _Size,
1128              int,
1129              const char *,
1130              int
1131              );
1132
1133 #pragma warning(suppress: 4985)
1134 _Ret_bytecap_(_Size) void * __CRTDECL operator new[](
1135              size_t _Size,
1136              int,
1137              const char *,
1138              int
1139              );
1140
1141 #if        _MSC_VER >= 1200
1142
1143
1144 void __CRTDECL operator delete[](void *);
1145
1146 inline void __CRTDECL operator delete(void * _P, int, const char *, int)
1147              { ::operator delete(_P); }
1148 inline void __CRTDECL operator delete[](void * _P, int, const char *, int)
1149              { ::operator delete[](_P); }
1150 #endif
1151 #endif
1152 #else /* _DEBUG */
1153
1154  /****************************************************************************
1155  *
1156  * Debug ON
1157  * Debug ON
1158  * Debug ON
1159  *
1160  ***************************************************************************/
1161  
1162 #pragma warning(suppress: 4985)
1163 _Ret_bytecap_(_Size) void * __CRTDECL operator new[](size_t _Size);
1164
1165 _Ret_bytecap_(_Size) void * __CRTDECL operator new(
1166              size_t _Size,
1167              int,
1168              const char *,
1169              int
1170              );
1171
1172 #pragma warning(suppress: 4985)
1173 _Ret_bytecap_(_Size) void * __CRTDECL operator new[](
1174              size_t _Size,
1175              int,
1176              const char *,
1177              int
1178              );
1179
1180 #if        _MSC_VER >= 1200
1181 void __CRTDECL operator delete[](void *);
1182
1183 inline void __CRTDECL operator delete(void * _P, int, const char *, int)
1184              { ::operator delete(_P); }
1185
1186 inline void __CRTDECL operator delete[](void * _P, int, const char *, int)
1187              { ::operator delete[](_P); }
1188 #endif
1189
1190 #if defined(_CRTDBG_MAP_ALLOC) && defined(_CRTDBG_MAP_ALLOC_NEW)
1191 /* We keep these inlines for back compatibility only;
1192  * the operator new defined in the debug libraries already calls _malloc_dbg,
1193  * thus enabling the debug heap allocation functionalities.
1194  *
1195  * These inlines do not add any information, due that __FILE__ is expanded
1196  * to "crtdbg.h", which is not very helpful to the user.
1197  * 
1198  * The user will need to define _CRTDBG_MAP_ALLOC_NEW in addition to
1199  * _CRTDBG_MAP_ALLOC to enable these inlines.
1200  */
1201
1202 _Ret_bytecap_(_Size) inline void * __CRTDECL operator new(size_t _Size)
1203              { return ::operator new(_Size, _NORMAL_BLOCK, __FILE__, __LINE__); }
1204
1205 _Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size)
1206              { return ::operator new[](_Size, _NORMAL_BLOCK, __FILE__, __LINE__); }
1207
1208 #endif  /* _CRTDBG_MAP_ALLOC && _CRTDBG_MAP_ALLOC_NEW */
1209
1210 #endif  /* _DEBUG */
1211
1212 }
1213
1214 #endif  /* _MFC_OVERRIDES_NEW */
1215
1216 #endif  /* __cplusplus */
1217
1218 #ifdef  _MSC_VER
1219 #pragma pack(pop)
1220 #endif  /* _MSC_VER */
1221
1222 #endif  /* _INC_CRTDBG */
1223