2003-04-04 19:37:57 +00:00
|
|
|
/*
|
|
|
|
* msvcrtd.dll debugging code
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Adam Gundy
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-04-04 19:37:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2004-05-18 01:05:36 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
|
2005-07-21 10:34:08 +00:00
|
|
|
#define _DEBUG
|
|
|
|
#include "crtdbg.h"
|
|
|
|
|
2003-04-04 19:37:57 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
|
|
|
|
2004-01-13 05:37:47 +00:00
|
|
|
int _crtAssertBusy = -1;
|
|
|
|
int _crtBreakAlloc = -1;
|
|
|
|
int _crtDbgFlag = 0;
|
|
|
|
|
2004-05-18 01:05:36 +00:00
|
|
|
extern int _callnewh(unsigned long);
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* ??2@YAPAXIHPBDH@Z (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
void * CDECL MSVCRTD_operator_new_dbg(
|
2004-05-18 01:05:36 +00:00
|
|
|
unsigned long nSize,
|
|
|
|
int nBlockUse,
|
|
|
|
const char *szFileName,
|
|
|
|
int nLine)
|
|
|
|
{
|
2005-07-21 10:34:08 +00:00
|
|
|
void *retval = NULL;
|
2004-05-18 01:05:36 +00:00
|
|
|
|
|
|
|
TRACE("(%lu, %d, '%s', %d) returning %p\n", nSize, nBlockUse, szFileName, nLine, retval);
|
|
|
|
|
2005-07-21 10:34:08 +00:00
|
|
|
switch(_BLOCK_TYPE(nBlockUse))
|
|
|
|
{
|
|
|
|
case _NORMAL_BLOCK:
|
|
|
|
break;
|
|
|
|
case _CLIENT_BLOCK:
|
|
|
|
FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n");
|
|
|
|
return NULL;
|
|
|
|
case _FREE_BLOCK:
|
|
|
|
FIXME("Native code throws an exception here\n");
|
|
|
|
case _CRT_BLOCK:
|
|
|
|
case _IGNORE_BLOCK:
|
|
|
|
ERR("Not allowed nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
|
|
|
|
return NULL;
|
|
|
|
default:
|
|
|
|
ERR("Unknown nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = HeapAlloc(GetProcessHeap(), 0, nSize);
|
|
|
|
|
2004-05-18 01:05:36 +00:00
|
|
|
if (!retval)
|
|
|
|
_callnewh(nSize);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-04-04 19:37:57 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* _CrtSetDumpClient (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
void * CDECL _CrtSetDumpClient(void *dumpClient)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CrtSetReportHook (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
void * CDECL _CrtSetReportHook(void *reportHook)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CrtSetReportMode (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtSetReportMode(int reportType, int reportMode)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-13 05:37:47 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* _CrtSetBreakAlloc (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtSetBreakAlloc(int new)
|
2004-01-13 05:37:47 +00:00
|
|
|
{
|
|
|
|
int old = _crtBreakAlloc;
|
|
|
|
_crtBreakAlloc = new;
|
|
|
|
return old;
|
|
|
|
}
|
|
|
|
|
2003-04-04 19:37:57 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* _CrtSetDbgFlag (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtSetDbgFlag(int new)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
2004-01-13 05:37:47 +00:00
|
|
|
int old = _crtDbgFlag;
|
|
|
|
_crtDbgFlag = new;
|
|
|
|
return old;
|
2003-04-04 19:37:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CrtDbgReport (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtDbgReport(int reportType, const char *filename, int linenumber,
|
|
|
|
const char *moduleName, const char *format, ...)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CrtDumpMemoryLeaks (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtDumpMemoryLeaks(void)
|
2003-04-04 19:37:57 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2004-01-13 05:37:47 +00:00
|
|
|
|
2004-06-14 17:57:06 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* _CrtCheckMemory (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int CDECL _CrtCheckMemory(void)
|
2004-06-14 17:57:06 +00:00
|
|
|
{
|
|
|
|
/* Note: maybe we could call here our heap validating functions ? */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-13 05:37:47 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* __p__crtAssertBusy (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int * CDECL __p__crtAssertBusy(void)
|
2004-01-13 05:37:47 +00:00
|
|
|
{
|
|
|
|
return &_crtAssertBusy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __p__crtBreakAlloc (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int * CDECL __p__crtBreakAlloc(void)
|
2004-01-13 05:37:47 +00:00
|
|
|
{
|
|
|
|
return &_crtBreakAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __p__crtDbgFlag (MSVCRTD.@)
|
|
|
|
*/
|
2006-06-12 19:35:40 +00:00
|
|
|
int * CDECL __p__crtDbgFlag(void)
|
2004-01-13 05:37:47 +00:00
|
|
|
{
|
|
|
|
return &_crtDbgFlag;
|
|
|
|
}
|