crtdbg.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the mingw-w64 runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  5. */
  6. #include <crtdefs.h>
  7. #ifndef _INC_CRTDBG
  8. #define _INC_CRTDBG
  9. #pragma pack(push,_CRT_PACKING)
  10. #ifndef NULL
  11. #ifdef __cplusplus
  12. #ifndef _WIN64
  13. #define NULL 0
  14. #else
  15. #define NULL 0LL
  16. #endif /* W64 */
  17. #else
  18. #define NULL ((void *)0)
  19. #endif
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. typedef void *_HFILE;
  25. #define _CRT_WARN 0
  26. #define _CRT_ERROR 1
  27. #define _CRT_ASSERT 2
  28. #define _CRT_ERRCNT 3
  29. #define _CRTDBG_MODE_FILE 0x1
  30. #define _CRTDBG_MODE_DEBUG 0x2
  31. #define _CRTDBG_MODE_WNDW 0x4
  32. #define _CRTDBG_REPORT_MODE -1
  33. #define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
  34. #define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
  35. #define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
  36. #define _CRTDBG_FILE_STDERR ((_HFILE)-5)
  37. #define _CRTDBG_REPORT_FILE ((_HFILE)-6)
  38. typedef int (__cdecl *_CRT_REPORT_HOOK)(int,char *,int *);
  39. typedef int (__cdecl *_CRT_REPORT_HOOKW)(int,wchar_t *,int *);
  40. #define _CRT_RPTHOOK_INSTALL 0
  41. #define _CRT_RPTHOOK_REMOVE 1
  42. #define _HOOK_ALLOC 1
  43. #define _HOOK_REALLOC 2
  44. #define _HOOK_FREE 3
  45. typedef int (__cdecl *_CRT_ALLOC_HOOK)(int,void *,size_t,int,long,const unsigned char *,int);
  46. #define _CRTDBG_ALLOC_MEM_DF 0x01
  47. #define _CRTDBG_DELAY_FREE_MEM_DF 0x02
  48. #define _CRTDBG_CHECK_ALWAYS_DF 0x04
  49. #define _CRTDBG_RESERVED_DF 0x08
  50. #define _CRTDBG_CHECK_CRT_DF 0x10
  51. #define _CRTDBG_LEAK_CHECK_DF 0x20
  52. #define _CRTDBG_CHECK_EVERY_16_DF 0x00100000
  53. #define _CRTDBG_CHECK_EVERY_128_DF 0x00800000
  54. #define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000
  55. #define _CRTDBG_CHECK_DEFAULT_DF 0
  56. #define _CRTDBG_REPORT_FLAG -1
  57. #define _BLOCK_TYPE(block) (block & 0xFFFF)
  58. #define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
  59. #define _FREE_BLOCK 0
  60. #define _NORMAL_BLOCK 1
  61. #define _CRT_BLOCK 2
  62. #define _IGNORE_BLOCK 3
  63. #define _CLIENT_BLOCK 4
  64. #define _MAX_BLOCKS 5
  65. typedef void (__cdecl *_CRT_DUMP_CLIENT)(void *,size_t);
  66. struct _CrtMemBlockHeader;
  67. typedef struct _CrtMemState {
  68. struct _CrtMemBlockHeader *pBlockHeader;
  69. size_t lCounts[_MAX_BLOCKS];
  70. size_t lSizes[_MAX_BLOCKS];
  71. size_t lHighWaterCount;
  72. size_t lTotalCount;
  73. } _CrtMemState;
  74. #ifndef _STATIC_ASSERT
  75. #if defined(_MSC_VER)
  76. #define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)]
  77. #else
  78. #define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1])
  79. #endif
  80. #endif
  81. #ifndef _ASSERT
  82. #define _ASSERT(expr) ((void)0)
  83. #endif
  84. #ifndef _ASSERTE
  85. #define _ASSERTE(expr) ((void)0)
  86. #endif
  87. #ifndef _ASSERT_EXPR
  88. #define _ASSERT_EXPR(expr,expr_str) ((void)0)
  89. #endif
  90. #ifndef _ASSERT_BASE
  91. #define _ASSERT_BASE _ASSERT_EXPR
  92. #endif
  93. #define _RPT0(rptno,msg)
  94. #define _RPTW0(rptno,msg)
  95. #define _RPT1(rptno,msg,arg1)
  96. #define _RPTW1(rptno,msg,arg1)
  97. #define _RPT2(rptno,msg,arg1,arg2)
  98. #define _RPTW2(rptno,msg,arg1,arg2)
  99. #define _RPT3(rptno,msg,arg1,arg2,arg3)
  100. #define _RPTW3(rptno,msg,arg1,arg2,arg3)
  101. #define _RPT4(rptno,msg,arg1,arg2,arg3,arg4)
  102. #define _RPTW4(rptno,msg,arg1,arg2,arg3,arg4)
  103. #define _RPTF0(rptno,msg)
  104. #define _RPTFW0(rptno,msg)
  105. #define _RPTF1(rptno,msg,arg1)
  106. #define _RPTFW1(rptno,msg,arg1)
  107. #define _RPTF2(rptno,msg,arg1,arg2)
  108. #define _RPTFW2(rptno,msg,arg1,arg2)
  109. #define _RPTF3(rptno,msg,arg1,arg2,arg3)
  110. #define _RPTFW3(rptno,msg,arg1,arg2,arg3)
  111. #define _RPTF4(rptno,msg,arg1,arg2,arg3,arg4)
  112. #define _RPTFW4(rptno,msg,arg1,arg2,arg3,arg4)
  113. #define _malloc_dbg(s,t,f,l) malloc(s)
  114. #define _calloc_dbg(c,s,t,f,l) calloc(c,s)
  115. #define _realloc_dbg(p,s,t,f,l) realloc(p,s)
  116. #define _expand_dbg(p,s,t,f,l) _expand(p,s)
  117. #define _free_dbg(p,t) free(p)
  118. #define _msize_dbg(p,t) _msize(p)
  119. #define _aligned_malloc_dbg(s,a,f,l) _aligned_malloc(s,a)
  120. #define _aligned_realloc_dbg(p,s,a,f,l) _aligned_realloc(p,s,a)
  121. #define _aligned_free_dbg(p) _aligned_free(p)
  122. #define _aligned_offset_malloc_dbg(s,a,o,f,l) _aligned_offset_malloc(s,a,o)
  123. #define _aligned_offset_realloc_dbg(p,s,a,o,f,l) _aligned_offset_realloc(p,s,a,o)
  124. #if __MSVCRT_VERSION__ >= 0x900
  125. #define _recalloc_dbg(p,c,s,t,f,l) _recalloc(p,c,s)
  126. #define _aligned_recalloc_dbg(p,c,s,a,f,l) _aligned_realloc(p,c,s,a)
  127. #define _aligned_offset_recalloc_dbg(p,c,s,a,o,f,l) _aligned_offset_recalloc(p,c,s,a,o)
  128. #endif
  129. #define _malloca_dbg(s,t,f,l) _malloca(s)
  130. #define _freea_dbg(p,t) _freea(p)
  131. #define _strdup_dbg(s,t,f,l) _strdup(s)
  132. #define _wcsdup_dbg(s,t,f,l) _wcsdup(s)
  133. #define _mbsdup_dbg(s,t,f,l) _mbsdup(s)
  134. #define _tempnam_dbg(s1,s2,t,f,l) _tempnam(s1,s2)
  135. #define _wtempnam_dbg(s1,s2,t,f,l) _wtempnam(s1,s2)
  136. #define _fullpath_dbg(s1,s2,le,t,f,l) _fullpath(s1,s2,le)
  137. #define _wfullpath_dbg(s1,s2,le,t,f,l) _wfullpath(s1,s2,le)
  138. #define _getcwd_dbg(s,le,t,f,l) _getcwd(s,le)
  139. #define _wgetcwd_dbg(s,le,t,f,l) _wgetcwd(s,le)
  140. #define _getdcwd_dbg(d,s,le,t,f,l) _getdcwd(d,s,le)
  141. #define _wgetdcwd_dbg(d,s,le,t,f,l) _wgetdcwd(d,s,le)
  142. #if __MSVCRT_VERSION__ >= 0x800
  143. #define _getdcwd_lk_dbg(d,s,le,t,f,l) _getdcwd_nolock(d,s,le)
  144. #define _wgetdcwd_lk_dbg(d,s,le,t,f,l) _wgetdcwd_nolock(d,s,le)
  145. #endif
  146. #define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
  147. #define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0)
  148. #define _CrtSetReportHook2(t,f) ((int)0)
  149. #define _CrtSetReportHookW2(t,f) ((int)0)
  150. #define _CrtSetReportMode(t,f) ((int)0)
  151. #define _CrtSetReportFile(t,f) ((_HFILE)0)
  152. #define _CrtDbgBreak() ((void)0)
  153. #define _CrtSetBreakAlloc(a) ((long)0)
  154. #define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
  155. #define _CrtGetAllocHook() ((_CRT_ALLOC_HOOK)0)
  156. #define _CrtCheckMemory() ((int)1)
  157. #define _CrtSetDbgFlag(f) ((int)0)
  158. #define _CrtDoForAllClientObjects(f,c) ((void)0)
  159. #define _CrtIsValidPointer(p,n,r) ((int)1)
  160. #define _CrtIsValidHeapPointer(p) ((int)1)
  161. #define _CrtIsMemoryBlock(p,t,r,f,l) ((int)1)
  162. #define _CrtReportBlockType(p) ((int)-1)
  163. #define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
  164. #define _CrtGetDumpClient() ((_CRT_DUMP_CLIENT)0)
  165. #define _CrtMemCheckpoint(s) ((void)0)
  166. #define _CrtMemDifference(s1,s2,s3) ((int)0)
  167. #define _CrtMemDumpAllObjectsSince(s) ((void)0)
  168. #define _CrtMemDumpStatistics(s) ((void)0)
  169. #define _CrtDumpMemoryLeaks() ((int)0)
  170. #define _CrtSetDebugFillThreshold(t) ((size_t)0)
  171. #define _CrtSetCheckCount(f) ((int)0)
  172. #define _CrtGetCheckCount() ((int)0)
  173. #ifdef __cplusplus
  174. }
  175. /*
  176. void *__cdecl operator new[](size_t _Size);
  177. inline void *__cdecl operator new(size_t _Size,int,const char *,int) { return ::operator new(_Size); }
  178. inline void *__cdecl operator new[](size_t _Size,int,const char *,int) { return ::operator new[](_Size); }
  179. void __cdecl operator delete[](void *);
  180. inline void __cdecl operator delete(void *_P,int,const char *,int) { ::operator delete(_P); }
  181. inline void __cdecl operator delete[](void *_P,int,const char *,int) { ::operator delete[](_P); }
  182. */
  183. #endif
  184. #pragma pack(pop)
  185. #include <sec_api/crtdbg_s.h>
  186. #endif