Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

775 lines
22 KiB

  1. /***
  2. *crtdbg.h - Supports debugging features of the C runtime library.
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Support CRT debugging features.
  8. *
  9. * [Public]
  10. *
  11. *Revision History:
  12. * 08-16-94 CFW Module created.
  13. * 11-28-94 CFW Add DumpClient, more params for AllocHook.
  14. * 12-08-94 CFW Use non-win32 names.
  15. * 01-09-95 CFW Dump client needs size, add _CrtSetBreakAlloc,
  16. * use const state pointers.
  17. * 01-10-95 CFW dbgint.h merge.
  18. * 01-20-94 CFW Change unsigned chars to chars.
  19. * 01-24-94 CFW Cleanup: remove unneeded funcs, add _CrtSetDbgFlag.
  20. * 01-24-94 CFW _CrtDbgReport now returns 1 for debug.
  21. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  22. * 02-14-95 CFW Clean up Mac merge.
  23. * 02-17-95 CFW new() proto moved from dbgint.h.
  24. * 02-27-95 CFW Change debug break scheme.
  25. * 03-21-95 CFW Add _CRT_ASSERT & _delete_client, remove tracking.
  26. * 03-23-95 JWM Restored tracking.
  27. * 03-28-95 CFW Remove tracking, export _crtBreakAlloc.
  28. * 04-06-95 CFW Add malloc -> _malloc_dbg macros.
  29. * 04-10-95 CFW Define NULL.
  30. * 03-21-95 CFW Remove _delete_client.
  31. * 03-30-95 CFW Avoid _CRTDBG_xxx conflicts with MFC.
  32. * 05-11-95 CFW Move C++ code to its own section.
  33. * 05-12-95 CFW Use _CrtIsValidPointer & _CrtIsValidHeapPointer.
  34. * 06-08-95 CFW Add return value parameter to report hook.
  35. * 06-27-95 CFW Add win32s support for debug libs.
  36. * 07-25-95 CFW Add win32s support for user visible debug heap variables.
  37. * 09-01-95 GJF Moved a proto for new up slightly to avoid compiler
  38. * error C2660 (Olympus 1015).
  39. * 09-20-95 CFW Change _RPT0, _RPTF0 to support messages with '%' in them.
  40. * 12-14-95 JWM Add "#pragma once".
  41. * 01-23-97 GJF Cleaned out obsolete support for Win32s.
  42. * 04-21-97 JWM Added 4-parameter operator delete(), required by 6.0 compiler.
  43. * 04-29-97 JWM Made 4-parameter operator delete() #if _MSC_VER >= 1200.
  44. * 08-14-97 GJF Strip __p_* prototypes from release version. Also,
  45. * moved the constant and type definition out of the ifdef
  46. * _DEBUG so they are always defined.
  47. * 01-19-98 JWM At request of DeanM, made debug prototypes of new & delete
  48. * #ifndef _MFC_OVERRIDES_NEW
  49. * 05-22-98 JWM Added support for new[] & delete[], courtesy of KFrei's RTC work.
  50. * 06-08-98 JWM Minor cleanups.
  51. * 12-01-98 GJF More choices for calling _CrtCheckMemory than never or always.
  52. * 12-15-98 GJF Changes for 64-bit size_t.
  53. * 05-17-99 PML Remove all Macintosh support.
  54. * 08-30-99 PML Get rid of unprintable character in comment.
  55. * 10-06-99 PML Add _W64 modifier to types which are 32 bits in Win32,
  56. * 64 bits in Win64.
  57. * 11-02-99 PML Add extern "C++" around C++ definitions.
  58. * 11-08-99 PML Don't mark debug operator new _CRTIMP (vs7#16060).
  59. * 11-16-99 PML Forward-decl _CrtMemBlockHeader to work around vs7#63059
  60. * 01-04-00 GB Added support for debug version for _aligned routines
  61. * 02-25-00 PML _CrtDbgBreak should use __debugbreak if available.
  62. * 05-31-00 PML Add _CrtReportBlockType (VS7#55049).
  63. * 09-26-00 PML Fix _ASSERT*, _RPT* to compile /W4 clean (vs7#166894)
  64. * 12-10-00 PML Non-_DEBUG macro versions of _CrtSet* should not be
  65. * typed as void (vs7#166572).
  66. * 03-21-01 PML Add _CrtSetReportHook2 (vs7#124998)
  67. *
  68. ****/
  69. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  70. #pragma once
  71. #endif
  72. #ifndef _INC_CRTDBG
  73. #define _INC_CRTDBG
  74. #if !defined(_WIN32)
  75. #error ERROR: Only Win32 target supported!
  76. #endif
  77. #ifndef _CRTBLD
  78. /* This version of the header files is NOT for user programs.
  79. * It is intended for use when building the C runtimes ONLY.
  80. * The version intended for public use will not have this message.
  81. */
  82. #error ERROR: Use of C runtime library internal header file.
  83. #endif /* _CRTBLD */
  84. #ifdef __cplusplus
  85. extern "C" {
  86. #endif /* __cplusplus */
  87. /****************************************************************************
  88. *
  89. * Constants and types
  90. *
  91. ***************************************************************************/
  92. #if !defined(_W64)
  93. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  94. #define _W64 __w64
  95. #else
  96. #define _W64
  97. #endif
  98. #endif
  99. #ifndef _SIZE_T_DEFINED
  100. #ifdef _WIN64
  101. typedef unsigned __int64 size_t;
  102. #else
  103. typedef _W64 unsigned int size_t;
  104. #endif
  105. #define _SIZE_T_DEFINED
  106. #endif
  107. /* Define NULL pointer value */
  108. #ifndef NULL
  109. #ifdef __cplusplus
  110. #define NULL 0
  111. #else
  112. #define NULL ((void *)0)
  113. #endif
  114. #endif
  115. /****************************************************************************
  116. *
  117. * Debug Reporting
  118. *
  119. ***************************************************************************/
  120. typedef void *_HFILE; /* file handle pointer */
  121. #define _CRT_WARN 0
  122. #define _CRT_ERROR 1
  123. #define _CRT_ASSERT 2
  124. #define _CRT_ERRCNT 3
  125. #define _CRTDBG_MODE_FILE 0x1
  126. #define _CRTDBG_MODE_DEBUG 0x2
  127. #define _CRTDBG_MODE_WNDW 0x4
  128. #define _CRTDBG_REPORT_MODE -1
  129. #define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
  130. #define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
  131. #define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
  132. #define _CRTDBG_FILE_STDERR ((_HFILE)-5)
  133. #define _CRTDBG_REPORT_FILE ((_HFILE)-6)
  134. typedef int (__cdecl * _CRT_REPORT_HOOK)(int, char *, int *);
  135. #define _CRT_RPTHOOK_INSTALL 0
  136. #define _CRT_RPTHOOK_REMOVE 1
  137. /****************************************************************************
  138. *
  139. * Heap
  140. *
  141. ***************************************************************************/
  142. /****************************************************************************
  143. *
  144. * Client-defined allocation hook
  145. *
  146. ***************************************************************************/
  147. #define _HOOK_ALLOC 1
  148. #define _HOOK_REALLOC 2
  149. #define _HOOK_FREE 3
  150. typedef int (__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
  151. /****************************************************************************
  152. *
  153. * Memory management
  154. *
  155. ***************************************************************************/
  156. /*
  157. * Bit values for _crtDbgFlag flag:
  158. *
  159. * These bitflags control debug heap behavior.
  160. */
  161. #define _CRTDBG_ALLOC_MEM_DF 0x01 /* Turn on debug allocation */
  162. #define _CRTDBG_DELAY_FREE_MEM_DF 0x02 /* Don't actually free memory */
  163. #define _CRTDBG_CHECK_ALWAYS_DF 0x04 /* Check heap every alloc/dealloc */
  164. #define _CRTDBG_RESERVED_DF 0x08 /* Reserved - do not use */
  165. #define _CRTDBG_CHECK_CRT_DF 0x10 /* Leak check/diff CRT blocks */
  166. #define _CRTDBG_LEAK_CHECK_DF 0x20 /* Leak check at program exit */
  167. /*
  168. * Some bit values for _crtDbgFlag which correspond to frequencies for checking
  169. * the the heap.
  170. */
  171. #define _CRTDBG_CHECK_EVERY_16_DF 0x00100000 /* check heap every 16 heap ops */
  172. #define _CRTDBG_CHECK_EVERY_128_DF 0x00800000 /* check heap every 128 heap ops */
  173. #define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000 /* check heap every 1024 heap ops */
  174. #define _CRTDBG_CHECK_DEFAULT_DF _CRTDBG_CHECK_EVERY_1024_DF
  175. #define _CRTDBG_REPORT_FLAG -1 /* Query bitflag status */
  176. #define _BLOCK_TYPE(block) (block & 0xFFFF)
  177. #define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
  178. /****************************************************************************
  179. *
  180. * Memory state
  181. *
  182. ***************************************************************************/
  183. /* Memory block identification */
  184. #define _FREE_BLOCK 0
  185. #define _NORMAL_BLOCK 1
  186. #define _CRT_BLOCK 2
  187. #define _IGNORE_BLOCK 3
  188. #define _CLIENT_BLOCK 4
  189. #define _MAX_BLOCKS 5
  190. typedef void (__cdecl * _CRT_DUMP_CLIENT)(void *, size_t);
  191. struct _CrtMemBlockHeader;
  192. typedef struct _CrtMemState
  193. {
  194. struct _CrtMemBlockHeader * pBlockHeader;
  195. size_t lCounts[_MAX_BLOCKS];
  196. size_t lSizes[_MAX_BLOCKS];
  197. size_t lHighWaterCount;
  198. size_t lTotalCount;
  199. } _CrtMemState;
  200. /****************************************************************************
  201. *
  202. * Declarations, prototype and function-like macros
  203. *
  204. ***************************************************************************/
  205. #ifndef _DEBUG
  206. /****************************************************************************
  207. *
  208. * Debug OFF
  209. * Debug OFF
  210. * Debug OFF
  211. *
  212. ***************************************************************************/
  213. #define _ASSERT(expr) ((void)0)
  214. #define _ASSERTE(expr) ((void)0)
  215. #define _RPT0(rptno, msg)
  216. #define _RPT1(rptno, msg, arg1)
  217. #define _RPT2(rptno, msg, arg1, arg2)
  218. #define _RPT3(rptno, msg, arg1, arg2, arg3)
  219. #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4)
  220. #define _RPTF0(rptno, msg)
  221. #define _RPTF1(rptno, msg, arg1)
  222. #define _RPTF2(rptno, msg, arg1, arg2)
  223. #define _RPTF3(rptno, msg, arg1, arg2, arg3)
  224. #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
  225. #define _malloc_dbg(s, t, f, l) malloc(s)
  226. #define _calloc_dbg(c, s, t, f, l) calloc(c, s)
  227. #define _realloc_dbg(p, s, t, f, l) realloc(p, s)
  228. #define _expand_dbg(p, s, t, f, l) _expand(p, s)
  229. #define _free_dbg(p, t) free(p)
  230. #define _msize_dbg(p, t) _msize(p)
  231. #define _aligned_malloc_dbg(s, a, f, l) _aligned_malloc(s, a)
  232. #define _aligned_realloc_dbg(p, s, a, f, l) _aligned_realloc(p, s, a)
  233. #define _aligned_free_dbg(p) _aligned_free(p)
  234. #define _aligned_offset_malloc_dbg(s, a, o, f, l) _aligned_offset_malloc(s, a, o)
  235. #define _aligned_offset_realloc_dbg(p, s, a, o, f, l) _aligned_offset_realloc(p, s, a, o)
  236. #define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
  237. #define _CrtSetReportHook2(t, f) ((int)0)
  238. #define _CrtSetReportMode(t, f) ((int)0)
  239. #define _CrtSetReportFile(t, f) ((_HFILE)0)
  240. #define _CrtDbgBreak() ((void)0)
  241. #define _CrtSetBreakAlloc(a) ((long)0)
  242. #define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
  243. #define _CrtCheckMemory() ((int)1)
  244. #define _CrtSetDbgFlag(f) ((int)0)
  245. #define _CrtDoForAllClientObjects(f, c) ((void)0)
  246. #define _CrtIsValidPointer(p, n, r) ((int)1)
  247. #define _CrtIsValidHeapPointer(p) ((int)1)
  248. #define _CrtIsMemoryBlock(p, t, r, f, l) ((int)1)
  249. #define _CrtReportBlockType(p) ((int)-1)
  250. #define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
  251. #define _CrtMemCheckpoint(s) ((void)0)
  252. #define _CrtMemDifference(s1, s2, s3) ((int)0)
  253. #define _CrtMemDumpAllObjectsSince(s) ((void)0)
  254. #define _CrtMemDumpStatistics(s) ((void)0)
  255. #define _CrtDumpMemoryLeaks() ((int)0)
  256. #else /* _DEBUG */
  257. /****************************************************************************
  258. *
  259. * Debug ON
  260. * Debug ON
  261. * Debug ON
  262. *
  263. ***************************************************************************/
  264. /* Define _CRTIMP */
  265. #ifndef _CRTIMP
  266. #ifdef CRTDLL
  267. #define _CRTIMP __declspec(dllexport)
  268. #else /* ndef CRTDLL */
  269. #ifdef _DLL
  270. #define _CRTIMP __declspec(dllimport)
  271. #else /* ndef _DLL */
  272. #define _CRTIMP
  273. #endif /* _DLL */
  274. #endif /* CRTDLL */
  275. #endif /* _CRTIMP */
  276. /****************************************************************************
  277. *
  278. * Debug Reporting
  279. *
  280. ***************************************************************************/
  281. #ifndef _INTERNAL_IFSTRIP_
  282. #if defined(_DLL) && defined(_M_IX86)
  283. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  284. _CRTIMP long * __cdecl __p__crtAssertBusy(void);
  285. #endif
  286. #endif /* _INTERNAL_IFSTRIP_ */
  287. _CRTIMP extern long _crtAssertBusy;
  288. _CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
  289. _CRT_REPORT_HOOK
  290. );
  291. _CRTIMP int __cdecl _CrtSetReportHook2(
  292. int,
  293. _CRT_REPORT_HOOK
  294. );
  295. _CRTIMP int __cdecl _CrtSetReportMode(
  296. int,
  297. int
  298. );
  299. _CRTIMP _HFILE __cdecl _CrtSetReportFile(
  300. int,
  301. _HFILE
  302. );
  303. _CRTIMP int __cdecl _CrtDbgReport(
  304. int,
  305. const char *,
  306. int,
  307. const char *,
  308. const char *,
  309. ...);
  310. /* Asserts */
  311. #if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  312. #define _ASSERT_BASE(expr, msg) \
  313. (void) ((expr) || \
  314. (1 != _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg)) || \
  315. (_CrtDbgBreak(), 0))
  316. #else
  317. #define _ASSERT_BASE(expr, msg) \
  318. do { if (!(expr) && \
  319. (1 == _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg))) \
  320. _CrtDbgBreak(); } while (0)
  321. #endif
  322. #define _ASSERT(expr) _ASSERT_BASE((expr), NULL)
  323. #define _ASSERTE(expr) _ASSERT_BASE((expr), #expr)
  324. /* Reports with no file/line info */
  325. #if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  326. #define _RPT_BASE(args) \
  327. (void) ((1 != _CrtDbgReport args) || \
  328. (_CrtDbgBreak(), 0))
  329. #else
  330. #define _RPT_BASE(args) \
  331. do { if ((1 == _CrtDbgReport args)) \
  332. _CrtDbgBreak(); } while (0)
  333. #endif
  334. #define _RPT0(rptno, msg) \
  335. _RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
  336. #define _RPT1(rptno, msg, arg1) \
  337. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
  338. #define _RPT2(rptno, msg, arg1, arg2) \
  339. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
  340. #define _RPT3(rptno, msg, arg1, arg2, arg3) \
  341. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
  342. #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
  343. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
  344. /* Reports with file/line info */
  345. #define _RPTF0(rptno, msg) \
  346. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
  347. #define _RPTF1(rptno, msg, arg1) \
  348. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
  349. #define _RPTF2(rptno, msg, arg1, arg2) \
  350. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
  351. #define _RPTF3(rptno, msg, arg1, arg2, arg3) \
  352. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
  353. #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
  354. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
  355. #if _MSC_VER >= 1300 && !defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  356. #define _CrtDbgBreak() __debugbreak()
  357. #elif defined(_M_IX86) && !defined(_CRT_PORTABLE)
  358. #define _CrtDbgBreak() __asm { int 3 }
  359. #elif defined(_M_ALPHA) && !defined(_CRT_PORTABLE)
  360. void _BPT();
  361. #pragma intrinsic(_BPT)
  362. #define _CrtDbgBreak() _BPT()
  363. #elif defined(_M_IA64) && !defined(_CRT_PORTABLE)
  364. void __break(int);
  365. #pragma intrinsic (__break)
  366. #define _CrtDbgBreak() __break(0x80016)
  367. #else
  368. _CRTIMP void __cdecl _CrtDbgBreak(
  369. void
  370. );
  371. #endif
  372. /****************************************************************************
  373. *
  374. * Heap routines
  375. *
  376. ***************************************************************************/
  377. #ifdef _CRTDBG_MAP_ALLOC
  378. #define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
  379. #define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  380. #define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  381. #define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  382. #define free(p) _free_dbg(p, _NORMAL_BLOCK)
  383. #define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
  384. #define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
  385. #define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
  386. #define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
  387. #define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
  388. #define _aligned_free(p) _aligned_free_dbg(p)
  389. #endif /* _CRTDBG_MAP_ALLOC */
  390. #ifndef _INTERNAL_IFSTRIP_
  391. #if defined(_DLL) && defined(_M_IX86)
  392. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  393. _CRTIMP long * __cdecl __p__crtBreakAlloc(void);
  394. #endif
  395. #endif /* _INTERNAL_IFSTRIP_ */
  396. _CRTIMP extern long _crtBreakAlloc; /* Break on this allocation */
  397. _CRTIMP long __cdecl _CrtSetBreakAlloc(
  398. long
  399. );
  400. /*
  401. * Prototypes for malloc, free, realloc, etc are in malloc.h
  402. */
  403. _CRTIMP void * __cdecl _malloc_dbg(
  404. size_t,
  405. int,
  406. const char *,
  407. int
  408. );
  409. _CRTIMP void * __cdecl _calloc_dbg(
  410. size_t,
  411. size_t,
  412. int,
  413. const char *,
  414. int
  415. );
  416. _CRTIMP void * __cdecl _realloc_dbg(
  417. void *,
  418. size_t,
  419. int,
  420. const char *,
  421. int
  422. );
  423. _CRTIMP void * __cdecl _expand_dbg(
  424. void *,
  425. size_t,
  426. int,
  427. const char *,
  428. int
  429. );
  430. _CRTIMP void __cdecl _free_dbg(
  431. void *,
  432. int
  433. );
  434. _CRTIMP size_t __cdecl _msize_dbg (
  435. void *,
  436. int
  437. );
  438. _CRTIMP void * __cdecl _aligned_malloc_dbg(
  439. size_t,
  440. size_t,
  441. const char *,
  442. int
  443. );
  444. _CRTIMP void * __cdecl _aligned_realloc_dbg(
  445. void *,
  446. size_t,
  447. size_t,
  448. const char *,
  449. int
  450. );
  451. _CRTIMP void * __cdecl _aligned_offset_malloc_dbg(
  452. size_t,
  453. size_t,
  454. size_t,
  455. const char *,
  456. int
  457. );
  458. _CRTIMP void * __cdecl _aligned_offset_realloc_dbg(
  459. void *,
  460. size_t,
  461. size_t,
  462. size_t,
  463. const char *,
  464. int
  465. );
  466. _CRTIMP void __cdecl _aligned_free_dbg(
  467. void *
  468. );
  469. /****************************************************************************
  470. *
  471. * Client-defined allocation hook
  472. *
  473. ***************************************************************************/
  474. _CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook(
  475. _CRT_ALLOC_HOOK
  476. );
  477. /****************************************************************************
  478. *
  479. * Memory management
  480. *
  481. ***************************************************************************/
  482. /*
  483. * Bitfield flag that controls CRT heap behavior
  484. * Default setting is _CRTDBG_ALLOC_MEM_DF
  485. */
  486. #ifndef _INTERNAL_IFSTRIP_
  487. #if defined(_DLL) && defined(_M_IX86)
  488. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  489. _CRTIMP int * __cdecl __p__crtDbgFlag(void);
  490. #endif
  491. #endif /* _INTERNAL_IFSTRIP_ */
  492. _CRTIMP extern int _crtDbgFlag;
  493. _CRTIMP int __cdecl _CrtCheckMemory(
  494. void
  495. );
  496. _CRTIMP int __cdecl _CrtSetDbgFlag(
  497. int
  498. );
  499. _CRTIMP void __cdecl _CrtDoForAllClientObjects(
  500. void (*pfn)(void *, void *),
  501. void *
  502. );
  503. _CRTIMP int __cdecl _CrtIsValidPointer(
  504. const void *,
  505. unsigned int,
  506. int
  507. );
  508. _CRTIMP int __cdecl _CrtIsValidHeapPointer(
  509. const void *
  510. );
  511. _CRTIMP int __cdecl _CrtIsMemoryBlock(
  512. const void *,
  513. unsigned int,
  514. long *,
  515. char **,
  516. int *
  517. );
  518. _CRTIMP int __cdecl _CrtReportBlockType(
  519. const void *
  520. );
  521. /****************************************************************************
  522. *
  523. * Memory state
  524. *
  525. ***************************************************************************/
  526. _CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient(
  527. _CRT_DUMP_CLIENT
  528. );
  529. _CRTIMP void __cdecl _CrtMemCheckpoint(
  530. _CrtMemState *
  531. );
  532. _CRTIMP int __cdecl _CrtMemDifference(
  533. _CrtMemState *,
  534. const _CrtMemState *,
  535. const _CrtMemState *
  536. );
  537. _CRTIMP void __cdecl _CrtMemDumpAllObjectsSince(
  538. const _CrtMemState *
  539. );
  540. _CRTIMP void __cdecl _CrtMemDumpStatistics(
  541. const _CrtMemState *
  542. );
  543. _CRTIMP int __cdecl _CrtDumpMemoryLeaks(
  544. void
  545. );
  546. #endif /* _DEBUG */
  547. #ifdef __cplusplus
  548. }
  549. #ifndef _MFC_OVERRIDES_NEW
  550. extern "C++" {
  551. #pragma warning(disable: 4507) /* Ignore faulty warning */
  552. #ifndef _DEBUG
  553. /****************************************************************************
  554. *
  555. * Debug OFF
  556. * Debug OFF
  557. * Debug OFF
  558. *
  559. ***************************************************************************/
  560. void * __cdecl operator new[](size_t);
  561. inline void * __cdecl operator new(size_t s, int, const char *, int)
  562. { return ::operator new(s); }
  563. inline void* __cdecl operator new[](size_t s, int, const char *, int)
  564. { return ::operator new[](s); }
  565. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  566. void __cdecl operator delete[](void *);
  567. inline void __cdecl operator delete(void * _P, int, const char *, int)
  568. { ::operator delete(_P); }
  569. inline void __cdecl operator delete[](void * _P, int, const char *, int)
  570. { ::operator delete[](_P); }
  571. #endif
  572. #else /* _DEBUG */
  573. /****************************************************************************
  574. *
  575. * Debug ON
  576. * Debug ON
  577. * Debug ON
  578. *
  579. ***************************************************************************/
  580. void * __cdecl operator new[](size_t);
  581. void * __cdecl operator new(
  582. size_t,
  583. int,
  584. const char *,
  585. int
  586. );
  587. void * __cdecl operator new[](
  588. size_t,
  589. int,
  590. const char *,
  591. int
  592. );
  593. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  594. void __cdecl operator delete[](void *);
  595. inline void __cdecl operator delete(void * _P, int, const char *, int)
  596. { ::operator delete(_P); }
  597. inline void __cdecl operator delete[](void * _P, int, const char *, int)
  598. { ::operator delete[](_P); }
  599. #endif
  600. #ifdef _CRTDBG_MAP_ALLOC
  601. inline void * __cdecl operator new(size_t s)
  602. { return ::operator new(s, _NORMAL_BLOCK, __FILE__, __LINE__); }
  603. inline void* __cdecl operator new[](size_t s)
  604. { return ::operator new[](s, _NORMAL_BLOCK, __FILE__, __LINE__); }
  605. #endif /* _CRTDBG_MAP_ALLOC */
  606. #endif /* _DEBUG */
  607. }
  608. #endif /* _MFC_OVERRIDES_NEW */
  609. #endif /* __cplusplus */
  610. #endif /* _INC_CRTDBG */