00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #if _MSC_VER > 1000
00014 #pragma once
00015 #endif
00016
00017 #ifndef _INC_DBGINT
00018 #define _INC_DBGINT
00019
00020 #ifndef _CRTBLD
00021
00022
00023
00024
00025 #error ERROR: Use of C runtime library internal header file.
00026 #endif
00027
00028 #include <crtdbg.h>
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #ifndef _DEBUG
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifdef __cplusplus
00045
00046 #define _new_crt new
00047
00048 #endif
00049
00050 #define _malloc_crt malloc
00051 #define _calloc_crt calloc
00052 #define _realloc_crt realloc
00053 #define _expand_crt _expand
00054 #define _free_crt free
00055 #define _msize_crt _msize
00056
00057
00058 #define _malloc_base malloc
00059 #define _nh_malloc_base _nh_malloc
00060 #define _nh_malloc_dbg(s, n, t, f, l) _nh_malloc(s, n)
00061 #define _heap_alloc_base _heap_alloc
00062 #define _heap_alloc_dbg(s, t, f, l) _heap_alloc(s)
00063 #define _calloc_base calloc
00064 #define _realloc_base realloc
00065 #define _expand_base _expand
00066 #define _free_base free
00067 #define _msize_base _msize
00068 #define _aligned_malloc_base _aligned_malloc
00069 #define _aligned_realloc_base _aligned_realloc
00070 #define _aligned_offset_malloc_base _aligned_offset_malloc
00071 #define _aligned_offset_realloc_base _aligned_offset_realloc
00072 #define _aligned_free_base _aligned_free
00073
00074 #ifdef _MT
00075
00076 #define _calloc_dbg_lk(c, s, t, f, l) _calloc_lk(c, s)
00077 #define _realloc_dbg_lk(p, s, t, f, l) _realloc_lk(p, s)
00078 #define _free_base_lk _free_lk
00079 #define _free_dbg_lk(p, t) _free_lk(p)
00080
00081 #else
00082
00083 #define _calloc_dbg_lk(c, s, t, f, l) calloc(c, s)
00084 #define _realloc_dbg_lk(p, s, t, f, l) realloc(p, s)
00085 #define _free_base_lk free
00086 #define _free_dbg_lk(p, t) free(p)
00087
00088 #endif
00089
00090
00091 #else
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #define _THISFILE __FILE__
00103
00104 #ifdef __cplusplus
00105
00106 #define _new_crt new(_CRT_BLOCK, _THISFILE, __LINE__)
00107
00108 #endif
00109
00110 #define _malloc_crt(s) _malloc_dbg(s, _CRT_BLOCK, _THISFILE, __LINE__)
00111 #define _calloc_crt(c, s) _calloc_dbg(c, s, _CRT_BLOCK, _THISFILE, __LINE__)
00112 #define _realloc_crt(p, s) _realloc_dbg(p, s, _CRT_BLOCK, _THISFILE, __LINE__)
00113 #define _expand_crt(p, s) _expand_dbg(p, s, _CRT_BLOCK)
00114 #define _free_crt(p) _free_dbg(p, _CRT_BLOCK)
00115 #define _msize_crt(p) _msize_dbg(p, _CRT_BLOCK)
00116
00117
00118
00119
00120
00121 void * __cdecl _malloc_base(
00122 size_t
00123 );
00124
00125 void * __cdecl _nh_malloc_base (
00126 size_t,
00127 int
00128 );
00129
00130 void * __cdecl _nh_malloc_dbg (
00131 size_t,
00132 int,
00133 int,
00134 const char *,
00135 int
00136 );
00137
00138 void * __cdecl _heap_alloc_base(
00139 size_t
00140 );
00141
00142 void * __cdecl _heap_alloc_dbg(
00143 size_t,
00144 int,
00145 const char *,
00146 int
00147 );
00148
00149 void * __cdecl _calloc_base(
00150 size_t,
00151 size_t
00152 );
00153
00154 void * __cdecl _realloc_base(
00155 void *,
00156 size_t
00157 );
00158
00159 void * __cdecl _expand_base(
00160 void *,
00161 size_t
00162 );
00163
00164 void __cdecl _free_base(
00165 void *
00166 );
00167
00168 size_t __cdecl _msize_base (
00169 void *
00170 );
00171
00172 void __cdecl _aligned_free_base(
00173 void *
00174 );
00175
00176 void * __cdecl _aligned_malloc_base(
00177 size_t,
00178 size_t
00179 );
00180
00181 void * __cdecl _aligned_offset_malloc_base(
00182 size_t,
00183 size_t,
00184 size_t
00185 );
00186
00187 void * __cdecl _aligned_realloc_base(
00188 void *,
00189 size_t,
00190 size_t
00191 );
00192
00193 void * __cdecl _aligned_offset_realloc_base(
00194 void *,
00195 size_t,
00196 size_t,
00197 size_t
00198 );
00199
00200 #ifdef _MT
00201
00202
00203
00204
00205
00206
00207 void * __cdecl _calloc_dbg_lk(
00208 size_t,
00209 size_t,
00210 int,
00211 char *,
00212 int
00213 );
00214
00215
00216 void * __cdecl _realloc_dbg_lk(
00217 void *,
00218 size_t,
00219 int,
00220 const char *,
00221 int
00222 );
00223
00224
00225 void __cdecl _free_base_lk(
00226 void *
00227 );
00228
00229 void __cdecl _free_dbg_lk(
00230 void *,
00231 int
00232 );
00233
00234 #else
00235
00236 #define _calloc_dbg_lk _calloc_dbg
00237 #define _realloc_dbg_lk _realloc_dbg
00238 #define _free_base_lk _free_base
00239 #define _free_dbg_lk _free_dbg
00240
00241 #endif
00242
00243
00244
00245
00246
00247
00248
00249 #define nNoMansLandSize 4
00250
00251 typedef struct _CrtMemBlockHeader
00252 {
00253 struct _CrtMemBlockHeader * pBlockHeaderNext;
00254 struct _CrtMemBlockHeader * pBlockHeaderPrev;
00255 char * szFileName;
00256 int nLine;
00257 #ifdef _WIN64
00258
00259
00260
00261
00262 int nBlockUse;
00263 size_t nDataSize;
00264 #else
00265 size_t nDataSize;
00266 int nBlockUse;
00267 #endif
00268 long lRequest;
00269 unsigned char gap[nNoMansLandSize];
00270
00271
00272
00273
00274 } _CrtMemBlockHeader;
00275
00276 #define pbData(pblock) ((unsigned char *)((_CrtMemBlockHeader *)pblock + 1))
00277 #define pHdr(pbData) (((_CrtMemBlockHeader *)pbData)-1)
00278
00279
00280 _CRTIMP void __cdecl _CrtSetDbgBlockType(
00281 void *,
00282 int
00283 );
00284
00285 #define _BLOCK_TYPE_IS_VALID(use) (_BLOCK_TYPE(use) == _CLIENT_BLOCK || \
00286 (use) == _NORMAL_BLOCK || \
00287 _BLOCK_TYPE(use) == _CRT_BLOCK || \
00288 (use) == _IGNORE_BLOCK)
00289
00290 extern _CRT_ALLOC_HOOK _pfnAllocHook;
00291
00292 int __cdecl _CrtDefaultAllocHook(
00293 int,
00294 void *,
00295 size_t,
00296 int,
00297 long,
00298 const unsigned char *,
00299 int
00300 );
00301
00302 #endif
00303
00304 #ifdef __cplusplus
00305 }
00306 #endif
00307
00308 #endif