From ac282bf4e419825bdf9e3daa9ab761e747cbdae6 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 2 Jun 2007 15:09:52 +0000 Subject: [PATCH] commited bugfix if we got if (my) dxallocfree and so on, also fixed the alloc macro it always zero the memory buffer svn path=/trunk/; revision=26968 --- reactos/dll/directx/ddraw/rosdraw.h | 14 +++++++++++--- reactos/dll/directx/ddraw/startup.c | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index da0964b67c2..40742f6c612 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -41,9 +41,17 @@ VOID Cleanup(LPDIRECTDRAW7 iface); #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ p = NULL; */ -#define DxHeapMemAlloc(p, m) p = malloc(m) -#define DxHeapMemFree(p) free(p); \ - p = NULL; +#define DxHeapMemAlloc(p, m) { \ + p = malloc(m); \ + if (p != NULL) \ + { \ + ZeroMemory(p,m); \ + } \ + } +#define DxHeapMemFree(p) { \ + free(p); \ + p = NULL; \ + } /******** Main Object ********/ diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 6ce852b89c9..0306ffb3213 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -486,8 +486,8 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) /* Alloc mpFourCC */ - //if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) - { + // if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) + // { //mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21); // DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21); @@ -500,7 +500,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) return DD_FALSE; } */ - } + // } DX_STUB_str("Here\n"); @@ -553,7 +553,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) { char buffer[2048]; - sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes); + sprintf ( buffer, "3 test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes); OutputDebugStringA(buffer); }