2004-05-18 03:05:36 +02:00
|
|
|
/*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-05-18 03:05:36 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnt.h"
|
|
|
|
|
2005-07-21 12:34:08 +02:00
|
|
|
#include "crtdbg.h"
|
|
|
|
|
2004-05-18 03:05:36 +02:00
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
2009-06-16 13:29:38 +02:00
|
|
|
static void * (__cdecl *pMSVCRTD_operator_new_dbg)(size_t, int, const char *, int) = NULL;
|
2004-05-18 03:05:36 +02:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static int init_functions(void)
|
2004-05-18 03:05:36 +02:00
|
|
|
{
|
|
|
|
HMODULE hModule = LoadLibraryA("msvcrtd.dll");
|
|
|
|
|
2005-08-12 12:33:50 +02:00
|
|
|
if (!hModule) {
|
2006-09-29 01:19:00 +02:00
|
|
|
trace("LoadLibraryA failed to load msvcrtd.dll with GLE=%d\n", GetLastError());
|
2004-05-18 03:05:36 +02:00
|
|
|
return FALSE;
|
2005-08-12 12:33:50 +02:00
|
|
|
}
|
2004-05-18 03:05:36 +02:00
|
|
|
|
|
|
|
SET(pMSVCRTD_operator_new_dbg, "??2@YAPAXIHPBDH@Z");
|
|
|
|
if (pMSVCRTD_operator_new_dbg == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void test_new(void)
|
2004-05-18 03:05:36 +02:00
|
|
|
{
|
|
|
|
void *mem;
|
|
|
|
|
2005-07-21 12:34:08 +02:00
|
|
|
mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__);
|
2004-05-18 03:05:36 +02:00
|
|
|
ok(mem != NULL, "memory not allocated\n");
|
2010-01-22 11:33:30 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, mem);
|
2004-05-18 03:05:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
START_TEST(debug)
|
|
|
|
{
|
|
|
|
if (!init_functions())
|
|
|
|
return;
|
|
|
|
|
|
|
|
test_new();
|
|
|
|
}
|