Leaked source code of windows server 2003
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.

772 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. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  68. *
  69. ****/
  70. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  71. #pragma once
  72. #endif
  73. #ifndef _INC_CRTDBG
  74. #define _INC_CRTDBG
  75. #if !defined(_WIN32)
  76. #error ERROR: Only Win32 target supported!
  77. #endif
  78. #ifndef _CRTBLD
  79. /* This version of the header files is NOT for user programs.
  80. * It is intended for use when building the C runtimes ONLY.
  81. * The version intended for public use will not have this message.
  82. */
  83. #error ERROR: Use of C runtime library internal header file.
  84. #endif /* _CRTBLD */
  85. #ifdef __cplusplus
  86. extern "C" {
  87. #endif /* __cplusplus */
  88. /****************************************************************************
  89. *
  90. * Constants and types
  91. *
  92. ***************************************************************************/
  93. #if !defined(_W64)
  94. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  95. #define _W64 __w64
  96. #else
  97. #define _W64
  98. #endif
  99. #endif
  100. #ifndef _SIZE_T_DEFINED
  101. #ifdef _WIN64
  102. typedef unsigned __int64 size_t;
  103. #else
  104. typedef _W64 unsigned int size_t;
  105. #endif
  106. #define _SIZE_T_DEFINED
  107. #endif
  108. /* Define NULL pointer value */
  109. #ifndef NULL
  110. #ifdef __cplusplus
  111. #define NULL 0
  112. #else
  113. #define NULL ((void *)0)
  114. #endif
  115. #endif
  116. /****************************************************************************
  117. *
  118. * Debug Reporting
  119. *
  120. ***************************************************************************/
  121. typedef void *_HFILE; /* file handle pointer */
  122. #define _CRT_WARN 0
  123. #define _CRT_ERROR 1
  124. #define _CRT_ASSERT 2
  125. #define _CRT_ERRCNT 3
  126. #define _CRTDBG_MODE_FILE 0x1
  127. #define _CRTDBG_MODE_DEBUG 0x2
  128. #define _CRTDBG_MODE_WNDW 0x4
  129. #define _CRTDBG_REPORT_MODE -1
  130. #define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
  131. #define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
  132. #define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
  133. #define _CRTDBG_FILE_STDERR ((_HFILE)-5)
  134. #define _CRTDBG_REPORT_FILE ((_HFILE)-6)
  135. typedef int (__cdecl * _CRT_REPORT_HOOK)(int, char *, int *);
  136. #define _CRT_RPTHOOK_INSTALL 0
  137. #define _CRT_RPTHOOK_REMOVE 1
  138. /****************************************************************************
  139. *
  140. * Heap
  141. *
  142. ***************************************************************************/
  143. /****************************************************************************
  144. *
  145. * Client-defined allocation hook
  146. *
  147. ***************************************************************************/
  148. #define _HOOK_ALLOC 1
  149. #define _HOOK_REALLOC 2
  150. #define _HOOK_FREE 3
  151. typedef int (__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
  152. /****************************************************************************
  153. *
  154. * Memory management
  155. *
  156. ***************************************************************************/
  157. /*
  158. * Bit values for _crtDbgFlag flag:
  159. *
  160. * These bitflags control debug heap behavior.
  161. */
  162. #define _CRTDBG_ALLOC_MEM_DF 0x01 /* Turn on debug allocation */
  163. #define _CRTDBG_DELAY_FREE_MEM_DF 0x02 /* Don't actually free memory */
  164. #define _CRTDBG_CHECK_ALWAYS_DF 0x04 /* Check heap every alloc/dealloc */
  165. #define _CRTDBG_RESERVED_DF 0x08 /* Reserved - do not use */
  166. #define _CRTDBG_CHECK_CRT_DF 0x10 /* Leak check/diff CRT blocks */
  167. #define _CRTDBG_LEAK_CHECK_DF 0x20 /* Leak check at program exit */
  168. /*
  169. * Some bit values for _crtDbgFlag which correspond to frequencies for checking
  170. * the the heap.
  171. */
  172. #define _CRTDBG_CHECK_EVERY_16_DF 0x00100000 /* check heap every 16 heap ops */
  173. #define _CRTDBG_CHECK_EVERY_128_DF 0x00800000 /* check heap every 128 heap ops */
  174. #define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000 /* check heap every 1024 heap ops */
  175. #define _CRTDBG_CHECK_DEFAULT_DF _CRTDBG_CHECK_EVERY_1024_DF
  176. #define _CRTDBG_REPORT_FLAG -1 /* Query bitflag status */
  177. #define _BLOCK_TYPE(block) (block & 0xFFFF)
  178. #define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
  179. /****************************************************************************
  180. *
  181. * Memory state
  182. *
  183. ***************************************************************************/
  184. /* Memory block identification */
  185. #define _FREE_BLOCK 0
  186. #define _NORMAL_BLOCK 1
  187. #define _CRT_BLOCK 2
  188. #define _IGNORE_BLOCK 3
  189. #define _CLIENT_BLOCK 4
  190. #define _MAX_BLOCKS 5
  191. typedef void (__cdecl * _CRT_DUMP_CLIENT)(void *, size_t);
  192. struct _CrtMemBlockHeader;
  193. typedef struct _CrtMemState
  194. {
  195. struct _CrtMemBlockHeader * pBlockHeader;
  196. size_t lCounts[_MAX_BLOCKS];
  197. size_t lSizes[_MAX_BLOCKS];
  198. size_t lHighWaterCount;
  199. size_t lTotalCount;
  200. } _CrtMemState;
  201. /****************************************************************************
  202. *
  203. * Declarations, prototype and function-like macros
  204. *
  205. ***************************************************************************/
  206. #ifndef _DEBUG
  207. /****************************************************************************
  208. *
  209. * Debug OFF
  210. * Debug OFF
  211. * Debug OFF
  212. *
  213. ***************************************************************************/
  214. #define _ASSERT(expr) ((void)0)
  215. #define _ASSERTE(expr) ((void)0)
  216. #define _RPT0(rptno, msg)
  217. #define _RPT1(rptno, msg, arg1)
  218. #define _RPT2(rptno, msg, arg1, arg2)
  219. #define _RPT3(rptno, msg, arg1, arg2, arg3)
  220. #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4)
  221. #define _RPTF0(rptno, msg)
  222. #define _RPTF1(rptno, msg, arg1)
  223. #define _RPTF2(rptno, msg, arg1, arg2)
  224. #define _RPTF3(rptno, msg, arg1, arg2, arg3)
  225. #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
  226. #define _malloc_dbg(s, t, f, l) malloc(s)
  227. #define _calloc_dbg(c, s, t, f, l) calloc(c, s)
  228. #define _realloc_dbg(p, s, t, f, l) realloc(p, s)
  229. #define _expand_dbg(p, s, t, f, l) _expand(p, s)
  230. #define _free_dbg(p, t) free(p)
  231. #define _msize_dbg(p, t) _msize(p)
  232. #define _aligned_malloc_dbg(s, a, f, l) _aligned_malloc(s, a)
  233. #define _aligned_realloc_dbg(p, s, a, f, l) _aligned_realloc(p, s, a)
  234. #define _aligned_free_dbg(p) _aligned_free(p)
  235. #define _aligned_offset_malloc_dbg(s, a, o, f, l) _aligned_offset_malloc(s, a, o)
  236. #define _aligned_offset_realloc_dbg(p, s, a, o, f, l) _aligned_offset_realloc(p, s, a, o)
  237. #define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
  238. #define _CrtSetReportHook2(t, f) ((int)0)
  239. #define _CrtSetReportMode(t, f) ((int)0)
  240. #define _CrtSetReportFile(t, f) ((_HFILE)0)
  241. #define _CrtDbgBreak() ((void)0)
  242. #define _CrtSetBreakAlloc(a) ((long)0)
  243. #define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
  244. #define _CrtCheckMemory() ((int)1)
  245. #define _CrtSetDbgFlag(f) ((int)0)
  246. #define _CrtDoForAllClientObjects(f, c) ((void)0)
  247. #define _CrtIsValidPointer(p, n, r) ((int)1)
  248. #define _CrtIsValidHeapPointer(p) ((int)1)
  249. #define _CrtIsMemoryBlock(p, t, r, f, l) ((int)1)
  250. #define _CrtReportBlockType(p) ((int)-1)
  251. #define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
  252. #define _CrtMemCheckpoint(s) ((void)0)
  253. #define _CrtMemDifference(s1, s2, s3) ((int)0)
  254. #define _CrtMemDumpAllObjectsSince(s) ((void)0)
  255. #define _CrtMemDumpStatistics(s) ((void)0)
  256. #define _CrtDumpMemoryLeaks() ((int)0)
  257. #else /* _DEBUG */
  258. /****************************************************************************
  259. *
  260. * Debug ON
  261. * Debug ON
  262. * Debug ON
  263. *
  264. ***************************************************************************/
  265. /* Define _CRTIMP */
  266. #ifndef _CRTIMP
  267. #ifdef CRTDLL
  268. #define _CRTIMP __declspec(dllexport)
  269. #else /* ndef CRTDLL */
  270. #ifdef _DLL
  271. #define _CRTIMP __declspec(dllimport)
  272. #else /* ndef _DLL */
  273. #define _CRTIMP
  274. #endif /* _DLL */
  275. #endif /* CRTDLL */
  276. #endif /* _CRTIMP */
  277. /****************************************************************************
  278. *
  279. * Debug Reporting
  280. *
  281. ***************************************************************************/
  282. #ifndef _INTERNAL_IFSTRIP_
  283. #if defined(_DLL) && defined(_M_IX86)
  284. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  285. _CRTIMP long * __cdecl __p__crtAssertBusy(void);
  286. #endif
  287. #endif /* _INTERNAL_IFSTRIP_ */
  288. _CRTIMP extern long _crtAssertBusy;
  289. _CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
  290. _CRT_REPORT_HOOK
  291. );
  292. _CRTIMP int __cdecl _CrtSetReportHook2(
  293. int,
  294. _CRT_REPORT_HOOK
  295. );
  296. _CRTIMP int __cdecl _CrtSetReportMode(
  297. int,
  298. int
  299. );
  300. _CRTIMP _HFILE __cdecl _CrtSetReportFile(
  301. int,
  302. _HFILE
  303. );
  304. _CRTIMP int __cdecl _CrtDbgReport(
  305. int,
  306. const char *,
  307. int,
  308. const char *,
  309. const char *,
  310. ...);
  311. /* Asserts */
  312. #if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  313. #define _ASSERT_BASE(expr, msg) \
  314. (void) ((expr) || \
  315. (1 != _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg)) || \
  316. (_CrtDbgBreak(), 0))
  317. #else
  318. #define _ASSERT_BASE(expr, msg) \
  319. do { if (!(expr) && \
  320. (1 == _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg))) \
  321. _CrtDbgBreak(); } while (0)
  322. #endif
  323. #define _ASSERT(expr) _ASSERT_BASE((expr), NULL)
  324. #define _ASSERTE(expr) _ASSERT_BASE((expr), #expr)
  325. /* Reports with no file/line info */
  326. #if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  327. #define _RPT_BASE(args) \
  328. (void) ((1 != _CrtDbgReport args) || \
  329. (_CrtDbgBreak(), 0))
  330. #else
  331. #define _RPT_BASE(args) \
  332. do { if ((1 == _CrtDbgReport args)) \
  333. _CrtDbgBreak(); } while (0)
  334. #endif
  335. #define _RPT0(rptno, msg) \
  336. _RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
  337. #define _RPT1(rptno, msg, arg1) \
  338. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
  339. #define _RPT2(rptno, msg, arg1, arg2) \
  340. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
  341. #define _RPT3(rptno, msg, arg1, arg2, arg3) \
  342. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
  343. #define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
  344. _RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
  345. /* Reports with file/line info */
  346. #define _RPTF0(rptno, msg) \
  347. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
  348. #define _RPTF1(rptno, msg, arg1) \
  349. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
  350. #define _RPTF2(rptno, msg, arg1, arg2) \
  351. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
  352. #define _RPTF3(rptno, msg, arg1, arg2, arg3) \
  353. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
  354. #define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
  355. _RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
  356. #if _MSC_VER >= 1300 && !defined(_CRT_PORTABLE) /*IFSTRIP=IGN*/
  357. #define _CrtDbgBreak() __debugbreak()
  358. #elif defined(_M_IX86) && !defined(_CRT_PORTABLE)
  359. #define _CrtDbgBreak() __asm { int 3 }
  360. #elif defined(_M_IA64) && !defined(_CRT_PORTABLE)
  361. void __break(int);
  362. #pragma intrinsic (__break)
  363. #define _CrtDbgBreak() __break(0x80016)
  364. #else
  365. _CRTIMP void __cdecl _CrtDbgBreak(
  366. void
  367. );
  368. #endif
  369. /****************************************************************************
  370. *
  371. * Heap routines
  372. *
  373. ***************************************************************************/
  374. #ifdef _CRTDBG_MAP_ALLOC
  375. #define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
  376. #define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  377. #define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  378. #define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
  379. #define free(p) _free_dbg(p, _NORMAL_BLOCK)
  380. #define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
  381. #define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
  382. #define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
  383. #define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
  384. #define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
  385. #define _aligned_free(p) _aligned_free_dbg(p)
  386. #endif /* _CRTDBG_MAP_ALLOC */
  387. #ifndef _INTERNAL_IFSTRIP_
  388. #if defined(_DLL) && defined(_M_IX86)
  389. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  390. _CRTIMP long * __cdecl __p__crtBreakAlloc(void);
  391. #endif
  392. #endif /* _INTERNAL_IFSTRIP_ */
  393. _CRTIMP extern long _crtBreakAlloc; /* Break on this allocation */
  394. _CRTIMP long __cdecl _CrtSetBreakAlloc(
  395. long
  396. );
  397. /*
  398. * Prototypes for malloc, free, realloc, etc are in malloc.h
  399. */
  400. _CRTIMP void * __cdecl _malloc_dbg(
  401. size_t,
  402. int,
  403. const char *,
  404. int
  405. );
  406. _CRTIMP void * __cdecl _calloc_dbg(
  407. size_t,
  408. size_t,
  409. int,
  410. const char *,
  411. int
  412. );
  413. _CRTIMP void * __cdecl _realloc_dbg(
  414. void *,
  415. size_t,
  416. int,
  417. const char *,
  418. int
  419. );
  420. _CRTIMP void * __cdecl _expand_dbg(
  421. void *,
  422. size_t,
  423. int,
  424. const char *,
  425. int
  426. );
  427. _CRTIMP void __cdecl _free_dbg(
  428. void *,
  429. int
  430. );
  431. _CRTIMP size_t __cdecl _msize_dbg (
  432. void *,
  433. int
  434. );
  435. _CRTIMP void * __cdecl _aligned_malloc_dbg(
  436. size_t,
  437. size_t,
  438. const char *,
  439. int
  440. );
  441. _CRTIMP void * __cdecl _aligned_realloc_dbg(
  442. void *,
  443. size_t,
  444. size_t,
  445. const char *,
  446. int
  447. );
  448. _CRTIMP void * __cdecl _aligned_offset_malloc_dbg(
  449. size_t,
  450. size_t,
  451. size_t,
  452. const char *,
  453. int
  454. );
  455. _CRTIMP void * __cdecl _aligned_offset_realloc_dbg(
  456. void *,
  457. size_t,
  458. size_t,
  459. size_t,
  460. const char *,
  461. int
  462. );
  463. _CRTIMP void __cdecl _aligned_free_dbg(
  464. void *
  465. );
  466. /****************************************************************************
  467. *
  468. * Client-defined allocation hook
  469. *
  470. ***************************************************************************/
  471. _CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook(
  472. _CRT_ALLOC_HOOK
  473. );
  474. /****************************************************************************
  475. *
  476. * Memory management
  477. *
  478. ***************************************************************************/
  479. /*
  480. * Bitfield flag that controls CRT heap behavior
  481. * Default setting is _CRTDBG_ALLOC_MEM_DF
  482. */
  483. #ifndef _INTERNAL_IFSTRIP_
  484. #if defined(_DLL) && defined(_M_IX86)
  485. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  486. _CRTIMP int * __cdecl __p__crtDbgFlag(void);
  487. #endif
  488. #endif /* _INTERNAL_IFSTRIP_ */
  489. _CRTIMP extern int _crtDbgFlag;
  490. _CRTIMP int __cdecl _CrtCheckMemory(
  491. void
  492. );
  493. _CRTIMP int __cdecl _CrtSetDbgFlag(
  494. int
  495. );
  496. _CRTIMP void __cdecl _CrtDoForAllClientObjects(
  497. void (*pfn)(void *, void *),
  498. void *
  499. );
  500. _CRTIMP int __cdecl _CrtIsValidPointer(
  501. const void *,
  502. unsigned int,
  503. int
  504. );
  505. _CRTIMP int __cdecl _CrtIsValidHeapPointer(
  506. const void *
  507. );
  508. _CRTIMP int __cdecl _CrtIsMemoryBlock(
  509. const void *,
  510. unsigned int,
  511. long *,
  512. char **,
  513. int *
  514. );
  515. _CRTIMP int __cdecl _CrtReportBlockType(
  516. const void *
  517. );
  518. /****************************************************************************
  519. *
  520. * Memory state
  521. *
  522. ***************************************************************************/
  523. _CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient(
  524. _CRT_DUMP_CLIENT
  525. );
  526. _CRTIMP void __cdecl _CrtMemCheckpoint(
  527. _CrtMemState *
  528. );
  529. _CRTIMP int __cdecl _CrtMemDifference(
  530. _CrtMemState *,
  531. const _CrtMemState *,
  532. const _CrtMemState *
  533. );
  534. _CRTIMP void __cdecl _CrtMemDumpAllObjectsSince(
  535. const _CrtMemState *
  536. );
  537. _CRTIMP void __cdecl _CrtMemDumpStatistics(
  538. const _CrtMemState *
  539. );
  540. _CRTIMP int __cdecl _CrtDumpMemoryLeaks(
  541. void
  542. );
  543. #endif /* _DEBUG */
  544. #ifdef __cplusplus
  545. }
  546. #ifndef _MFC_OVERRIDES_NEW
  547. extern "C++" {
  548. #pragma warning(disable: 4507) /* Ignore faulty warning */
  549. #ifndef _DEBUG
  550. /****************************************************************************
  551. *
  552. * Debug OFF
  553. * Debug OFF
  554. * Debug OFF
  555. *
  556. ***************************************************************************/
  557. void * __cdecl operator new[](size_t);
  558. inline void * __cdecl operator new(size_t s, int, const char *, int)
  559. { return ::operator new(s); }
  560. inline void* __cdecl operator new[](size_t s, int, const char *, int)
  561. { return ::operator new[](s); }
  562. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  563. void __cdecl operator delete[](void *);
  564. inline void __cdecl operator delete(void * _P, int, const char *, int)
  565. { ::operator delete(_P); }
  566. inline void __cdecl operator delete[](void * _P, int, const char *, int)
  567. { ::operator delete[](_P); }
  568. #endif
  569. #else /* _DEBUG */
  570. /****************************************************************************
  571. *
  572. * Debug ON
  573. * Debug ON
  574. * Debug ON
  575. *
  576. ***************************************************************************/
  577. void * __cdecl operator new[](size_t);
  578. void * __cdecl operator new(
  579. size_t,
  580. int,
  581. const char *,
  582. int
  583. );
  584. void * __cdecl operator new[](
  585. size_t,
  586. int,
  587. const char *,
  588. int
  589. );
  590. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  591. void __cdecl operator delete[](void *);
  592. inline void __cdecl operator delete(void * _P, int, const char *, int)
  593. { ::operator delete(_P); }
  594. inline void __cdecl operator delete[](void * _P, int, const char *, int)
  595. { ::operator delete[](_P); }
  596. #endif
  597. #ifdef _CRTDBG_MAP_ALLOC
  598. inline void * __cdecl operator new(size_t s)
  599. { return ::operator new(s, _NORMAL_BLOCK, __FILE__, __LINE__); }
  600. inline void* __cdecl operator new[](size_t s)
  601. { return ::operator new[](s, _NORMAL_BLOCK, __FILE__, __LINE__); }
  602. #endif /* _CRTDBG_MAP_ALLOC */
  603. #endif /* _DEBUG */
  604. }
  605. #endif /* _MFC_OVERRIDES_NEW */
  606. #endif /* __cplusplus */
  607. #endif /* _INC_CRTDBG */