From 5c4420fc4c618d16912d1443c1534aa6481cf5ae Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Tue, 18 May 2004 01:05:36 +0000 Subject: [PATCH] Implemented the debug version of operator new (C++). --- configure | 3 +- configure.ac | 1 + dlls/msvcrtd/Makefile.in | 4 +- dlls/msvcrtd/debug.c | 32 ++++++++++++++-- dlls/msvcrtd/msvcrtd.spec | 6 +-- dlls/msvcrtd/tests/.cvsignore | 3 ++ dlls/msvcrtd/tests/Makefile.in | 14 +++++++ dlls/msvcrtd/tests/debug.c | 70 ++++++++++++++++++++++++++++++++++ 8 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 dlls/msvcrtd/tests/.cvsignore create mode 100644 dlls/msvcrtd/tests/Makefile.in create mode 100644 dlls/msvcrtd/tests/debug.c diff --git a/configure b/configure index e7e2c3e1e7..e512212f76 100755 --- a/configure +++ b/configure @@ -20031,7 +20031,7 @@ MAKE_LIB_RULES=libs/Makelib.rules MAKE_PROG_RULES=programs/Makeprog.rules - ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" + ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" cat >confcache <<\_ACEOF @@ -20655,6 +20655,7 @@ do "dlls/msvcrt20/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvcrt20/Makefile" ;; "dlls/msvcrt40/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvcrt40/Makefile" ;; "dlls/msvcrtd/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvcrtd/Makefile" ;; + "dlls/msvcrtd/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvcrtd/tests/Makefile" ;; "dlls/msvidc32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvidc32/Makefile" ;; "dlls/msvideo/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msvideo/Makefile" ;; "dlls/mswsock/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mswsock/Makefile" ;; diff --git a/configure.ac b/configure.ac index 6899543a07..08b0254bf6 100644 --- a/configure.ac +++ b/configure.ac @@ -1580,6 +1580,7 @@ dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile +dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile diff --git a/dlls/msvcrtd/Makefile.in b/dlls/msvcrtd/Makefile.in index daef310cd4..c461807d6c 100644 --- a/dlls/msvcrtd/Makefile.in +++ b/dlls/msvcrtd/Makefile.in @@ -3,11 +3,13 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = msvcrtd.dll -IMPORTS = msvcrt +IMPORTS = msvcrt kernel32 C_SRCS = \ debug.c +SUBDIRS = tests + @MAKE_DLL_RULES@ ### Dependencies: diff --git a/dlls/msvcrtd/debug.c b/dlls/msvcrtd/debug.c index 0b09594b64..9e326d0d00 100644 --- a/dlls/msvcrtd/debug.c +++ b/dlls/msvcrtd/debug.c @@ -20,16 +20,39 @@ #include "wine/debug.h" +#include "winbase.h" + WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); int _crtAssertBusy = -1; int _crtBreakAlloc = -1; int _crtDbgFlag = 0; +extern int _callnewh(unsigned long); + +/********************************************************************* + * ??2@YAPAXIHPBDH@Z (MSVCRTD.@) + */ +void *MSVCRTD_operator_new_dbg( + unsigned long nSize, + int nBlockUse, + const char *szFileName, + int nLine) +{ + void *retval = HeapAlloc(GetProcessHeap(), 0, nSize); + + TRACE("(%lu, %d, '%s', %d) returning %p\n", nSize, nBlockUse, szFileName, nLine, retval); + + if (!retval) + _callnewh(nSize); + + return retval; +} + /********************************************************************* * _CrtSetDumpClient (MSVCRTD.@) */ -void *_CrtSetDumpClient() +void *_CrtSetDumpClient(void *dumpClient) { return NULL; } @@ -38,7 +61,7 @@ void *_CrtSetDumpClient() /********************************************************************* * _CrtSetReportHook (MSVCRTD.@) */ -void *_CrtSetReportHook() +void *_CrtSetReportHook(void *reportHook) { return NULL; } @@ -47,7 +70,7 @@ void *_CrtSetReportHook() /********************************************************************* * _CrtSetReportMode (MSVCRTD.@) */ -int _CrtSetReportMode() +int _CrtSetReportMode(int reportType, int reportMode) { return 0; } @@ -77,7 +100,8 @@ int _CrtSetDbgFlag(int new) /********************************************************************* * _CrtDbgReport (MSVCRTD.@) */ -int _CrtDbgReport() +int _CrtDbgReport(int reportType, const char *filename, int linenumber, + const char *moduleName, const char *format, ...) { return 0; } diff --git a/dlls/msvcrtd/msvcrtd.spec b/dlls/msvcrtd/msvcrtd.spec index 89874ace26..3e5c55e1e1 100644 --- a/dlls/msvcrtd/msvcrtd.spec +++ b/dlls/msvcrtd/msvcrtd.spec @@ -16,7 +16,7 @@ @ cdecl -i386 ??1exception@@UAE@XZ() msvcrt.??1exception@@UAE@XZ @ cdecl -i386 ??1type_info@@UAE@XZ() msvcrt.??1type_info@@UAE@XZ @ cdecl ??2@YAPAXI@Z(long) msvcrt.??2@YAPAXI@Z -@ cdecl ??2@YAPAXIHPBDH@Z(long) msvcrt.??2@YAPAXIHPBDH@Z +@ cdecl ??2@YAPAXIHPBDH@Z(long long str long) MSVCRTD_operator_new_dbg @ cdecl ??3@YAXPAX@Z(ptr) msvcrt.??3@YAXPAX@Z @ cdecl -i386 ??4__non_rtti_object@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4__non_rtti_object@@QAEAAV0@ABV0@@Z @ cdecl -i386 ??4bad_cast@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4bad_cast@@QAEAAV0@ABV0@@Z @@ -68,7 +68,7 @@ @ cdecl _CItanh() msvcrt._CItanh @ stub _CrtCheckMemory @ stub _CrtDbgBreak -@ cdecl _CrtDbgReport(long ptr long ptr ptr) +@ varargs _CrtDbgReport(long ptr long ptr ptr) @ stub _CrtDoForAllClientObjects @ cdecl _CrtDumpMemoryLeaks() @ stub _CrtIsMemoryBlock @@ -85,7 +85,7 @@ @ cdecl _CrtSetDumpClient(ptr) @ stub _CrtSetReportFile @ cdecl _CrtSetReportHook(ptr) -@ cdecl _CrtSetReportMode(long) +@ cdecl _CrtSetReportMode(long long) @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ cdecl -i386 -norelay _EH_prolog() msvcrt._EH_prolog @ cdecl _Getdays() msvcrt._Getdays diff --git a/dlls/msvcrtd/tests/.cvsignore b/dlls/msvcrtd/tests/.cvsignore new file mode 100644 index 0000000000..fb818cd092 --- /dev/null +++ b/dlls/msvcrtd/tests/.cvsignore @@ -0,0 +1,3 @@ +Makefile +debug.ok +testlist.c diff --git a/dlls/msvcrtd/tests/Makefile.in b/dlls/msvcrtd/tests/Makefile.in new file mode 100644 index 0000000000..43bb7a946c --- /dev/null +++ b/dlls/msvcrtd/tests/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = msvcrtd.dll +IMPORTS = msvcrtd +EXTRAINCL = -I$(TOPSRCDIR)/include/msvcrt + +CTESTS = \ + debug.c + +@MAKE_TEST_RULES@ + +### Dependencies: diff --git a/dlls/msvcrtd/tests/debug.c b/dlls/msvcrtd/tests/debug.c new file mode 100644 index 0000000000..d20d435719 --- /dev/null +++ b/dlls/msvcrtd/tests/debug.c @@ -0,0 +1,70 @@ +/* + * Unit test suite for debug functions. + * + * Copyright 2004 Patrik Stridvall + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "winnt.h" + +#include "wine/test.h" + +/**********************************************************************/ + +static void * (*pMSVCRTD_operator_new_dbg)(unsigned long, int, const char *, int) = NULL; + +/* Some exports are only available in later versions */ +#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hModule,y) +#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y) + +int init_functions(void) +{ + HMODULE hModule = LoadLibraryA("msvcrtd.dll"); + ok(hModule != NULL, "LoadLibraryA failed\n"); + + if (!hModule) + return FALSE; + + SET(pMSVCRTD_operator_new_dbg, "??2@YAPAXIHPBDH@Z"); + if (pMSVCRTD_operator_new_dbg == NULL) + return FALSE; + + return TRUE; +} + +/**********************************************************************/ + +void test_new(void) +{ + void *mem; + + mem = pMSVCRTD_operator_new_dbg(42, 0, __FILE__, __LINE__); + ok(mem != NULL, "memory not allocated\n"); +} + +/**********************************************************************/ + +START_TEST(debug) +{ + if (!init_functions()) + return; + + test_new(); +}