ReactOS 0.4.16-dev-122-g325d74c
debug.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "crtdbg.h"
#include "wine/test.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Macros

#define SETNOFAIL(x, y)   x = (void*)GetProcAddress(hModule,y)
 
#define SET(x, y)   do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
 

Functions

static void *__cdeclpMSVCRTD_operator_new_dbg (size_t, int, const char *, int)
 
static void *__cdeclpMSVCRTD_operator_delete (void *)
 
static BOOL init_functions (void)
 
static void test_new (void)
 
 START_TEST (debug)
 

Macro Definition Documentation

◆ SET

#define SET (   x,
  y 
)    do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)

Definition at line 38 of file debug.c.

◆ SETNOFAIL

#define SETNOFAIL (   x,
  y 
)    x = (void*)GetProcAddress(hModule,y)

Definition at line 37 of file debug.c.

Function Documentation

◆ init_functions()

static BOOL init_functions ( void  )
static

Definition at line 40 of file debug.c.

41{
42 HMODULE hModule = LoadLibraryA("msvcrtd.dll");
43
44 if (!hModule) {
45 trace("LoadLibraryA failed to load msvcrtd.dll with GLE=%d\n", GetLastError());
46 return FALSE;
47 }
48
49 if (sizeof(void *) > sizeof(int)) /* 64-bit has a different mangled name */
50 {
51 SET(pMSVCRTD_operator_new_dbg, "??2@YAPEAX_KHPEBDH@Z");
52 SET(pMSVCRTD_operator_delete, "??3@YAXPEAX@Z");
53 }
54 else
55 {
56 SET(pMSVCRTD_operator_new_dbg, "??2@YAPAXIHPBDH@Z");
57 SET(pMSVCRTD_operator_delete, "??3@YAXPAX@Z");
58 }
59
61 return FALSE;
62
63 return TRUE;
64}
#define trace
Definition: atltest.h:70
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HMODULE hModule
Definition: animate.c:44
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void *__cdecl * pMSVCRTD_operator_new_dbg(size_t, int, const char *, int)
static void *__cdecl * pMSVCRTD_operator_delete(void *)
#define SET(x, y)
Definition: debug.c:38
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ pMSVCRTD_operator_delete()

static void *__cdecl * pMSVCRTD_operator_delete ( void )
static

Referenced by init_functions(), and test_new().

◆ pMSVCRTD_operator_new_dbg()

static void *__cdecl * pMSVCRTD_operator_new_dbg ( size_t  ,
int  ,
const char ,
int   
)
static

Referenced by init_functions(), and test_new().

◆ START_TEST()

START_TEST ( debug  )

Definition at line 83 of file debug.c.

84{
85 if (!init_functions())
86 return;
87
88 test_new();
89}
static void test_new(void)
Definition: debug.c:68
static BOOL init_functions(void)
Definition: debug.c:40

◆ test_new()

static void test_new ( void  )
static

Definition at line 68 of file debug.c.

69{
70 void *mem;
71
72 mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__);
73 ok(mem != NULL, "memory not allocated\n");
75
76 mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__);
77 ok(mem != NULL, "memory not allocated\n");
79}
#define ok(value,...)
Definition: atltest.h:57
#define _NORMAL_BLOCK
Definition: crtdbg.h:66
#define _CRT_BLOCK
Definition: crtdbg.h:67
Definition: mem.c:156

Referenced by START_TEST().