imm32: Simplify the helper functions to retrieve the thread data.
[wine.git] / dlls / msvcrtd / debug.c
blobb8496526ae2199dd351572548c5f768e6090a5bb
1 /*
2 * msvcrtd.dll debugging code
4 * Copyright (C) 2003 Adam Gundy
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/debug.h"
23 #include "winbase.h"
25 #define _DEBUG
26 #include "crtdbg.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
30 int _crtAssertBusy = -1;
31 int _crtBreakAlloc = -1;
32 int _crtDbgFlag = 0;
34 #ifdef _WIN64
35 typedef unsigned __int64 MSVCRT_size_t;
36 #else
37 typedef unsigned long MSVCRT_size_t;
38 #endif
40 extern int _callnewh(MSVCRT_size_t);
42 /*********************************************************************
43 * ??2@YAPAXIHPBDH@Z (MSVCRTD.@)
45 void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse,
46 const char *szFileName, int nLine)
48 void *retval = NULL;
50 TRACE("(%lu, %d, '%s', %d)\n", nSize, nBlockUse, szFileName, nLine);
52 switch(_BLOCK_TYPE(nBlockUse))
54 case _NORMAL_BLOCK:
55 break;
56 case _CLIENT_BLOCK:
57 FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n");
58 return NULL;
59 case _FREE_BLOCK:
60 FIXME("Native code throws an exception here\n");
61 return NULL;
62 case _CRT_BLOCK:
63 case _IGNORE_BLOCK:
64 ERR("Not allowed nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
65 return NULL;
66 default:
67 ERR("Unknown nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
68 return NULL;
71 retval = HeapAlloc(GetProcessHeap(), 0, nSize);
73 if (!retval)
74 _callnewh(nSize);
76 return retval;
79 /*********************************************************************
80 * _CrtSetDumpClient (MSVCRTD.@)
82 void * CDECL _CrtSetDumpClient(void *dumpClient)
84 return NULL;
88 /*********************************************************************
89 * _CrtSetReportHook (MSVCRTD.@)
91 void * CDECL _CrtSetReportHook(void *reportHook)
93 return NULL;
97 /*********************************************************************
98 * _CrtSetReportMode (MSVCRTD.@)
100 int CDECL _CrtSetReportMode(int reportType, int reportMode)
102 return 0;
106 /*********************************************************************
107 * _CrtSetBreakAlloc (MSVCRTD.@)
109 int CDECL _CrtSetBreakAlloc(int new)
111 int old = _crtBreakAlloc;
112 _crtBreakAlloc = new;
113 return old;
116 /*********************************************************************
117 * _CrtSetDbgFlag (MSVCRTD.@)
119 int CDECL _CrtSetDbgFlag(int new)
121 int old = _crtDbgFlag;
122 _crtDbgFlag = new;
123 return old;
127 /*********************************************************************
128 * _CrtDbgReport (MSVCRTD.@)
130 int CDECL _CrtDbgReport(int reportType, const char *filename, int linenumber,
131 const char *moduleName, const char *format, ...)
133 return 0;
136 /*********************************************************************
137 * _CrtDumpMemoryLeaks (MSVCRTD.@)
139 int CDECL _CrtDumpMemoryLeaks(void)
141 return 0;
144 /*********************************************************************
145 * _CrtCheckMemory (MSVCRTD.@)
147 int CDECL _CrtCheckMemory(void)
149 /* Note: maybe we could call here our heap validating functions ? */
150 return TRUE;
154 /*********************************************************************
155 * __p__crtAssertBusy (MSVCRTD.@)
157 int * CDECL __p__crtAssertBusy(void)
159 return &_crtAssertBusy;
162 /*********************************************************************
163 * __p__crtBreakAlloc (MSVCRTD.@)
165 int * CDECL __p__crtBreakAlloc(void)
167 return &_crtBreakAlloc;
170 /*********************************************************************
171 * __p__crtDbgFlag (MSVCRTD.@)
173 int * CDECL __p__crtDbgFlag(void)
175 return &_crtDbgFlag;