remove seh on malloc

svn path=/trunk/; revision=27038
This commit is contained in:
Magnus Olsen 2007-06-07 10:33:04 +00:00
parent a0230af6f5
commit fdf97aa483
2 changed files with 24 additions and 50 deletions

View file

@ -41,31 +41,13 @@ VOID Cleanup(LPDIRECTDRAW7 iface);
#define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \
p = NULL; p = NULL;
*/ */
//#define DxHeapMemAlloc(p, m) { \
// p = malloc(m); \
// if (p != NULL) \
// { \
// ZeroMemory(p,m); \
// } \
// }
/* a stupied bug in GCC it crash when malloc return NULL */
#define DxHeapMemAlloc(p, m) { \ #define DxHeapMemAlloc(p, m) { \
_SEH_TRY \
{ \
p = malloc(m); \ p = malloc(m); \
if (p != NULL) \ if (p != NULL) \
{ \ { \
ZeroMemory(p,m); \ ZeroMemory(p,m); \
} \ } \
} \
_SEH_HANDLE \
{ \
p = NULL; \
} \
_SEH_END; \
} }
#define DxHeapMemFree(p) { \ #define DxHeapMemFree(p) { \
free(p); \ free(p); \
p = NULL; \ p = NULL; \

View file

@ -13,9 +13,6 @@
#include "d3dhal.h" #include "d3dhal.h"
#include "ddrawgdi.h" #include "ddrawgdi.h"
/* PSEH for SEH Support */
#include <pseh/pseh.h>
DDRAWI_DIRECTDRAW_GBL ddgbl; DDRAWI_DIRECTDRAW_GBL ddgbl;
DDRAWI_DDRAWSURFACE_GBL ddSurfGbl; DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
@ -37,8 +34,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
DX_STUB_str("1 me\n");
This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
#if 0 #if 0
@ -112,9 +107,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
LPDDRAWI_DIRECTDRAW_INT memThis; LPDDRAWI_DIRECTDRAW_INT memThis;
DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT)); DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
if (memThis != NULL)
{
This = memThis; This = memThis;
if (This == NULL) if (This == NULL)
{ {
@ -124,17 +116,9 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
DX_STUB_str("DDERR_OUTOFMEMORY"); DX_STUB_str("DDERR_OUTOFMEMORY");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
}
else
{
DX_STUB_str("DDERR_OUTOFMEMORY");
return DDERR_OUTOFMEMORY;
}
/* Fixme release memory alloc if we fail */ /* Fixme release memory alloc if we fail */
DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_INT)); DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_INT));
if (This->lpLcl == NULL) if (This->lpLcl == NULL)
{ {
DX_STUB_str("DDERR_OUTOFMEMORY"); DX_STUB_str("DDERR_OUTOFMEMORY");
@ -142,8 +126,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
#endif #endif
DX_STUB_str("6 me\n");
This->lpLcl->lpGbl = &ddgbl; This->lpLcl->lpGbl = &ddgbl;
*pIface = (LPDIRECTDRAW)This; *pIface = (LPDIRECTDRAW)This;
@ -491,24 +473,34 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
return DD_FALSE; return DD_FALSE;
} }
DX_STUB_str("Here\n");
/* Alloc mpFourCC */ /* Alloc mpFourCC */
if (This->lpLcl->lpGbl->lpdwFourCC != NULL) if (This->lpLcl->lpGbl->lpdwFourCC != NULL)
{ {
DxHeapMemFree(This->lpLcl->lpGbl->lpdwFourCC); DxHeapMemFree(This->lpLcl->lpGbl->lpdwFourCC);
} }
if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) // if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{ // {
DxHeapMemAlloc(mpFourCC, (sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes)) + sizeof(DWORD) ); //mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21);
/* DrFred uncomet line 499 see if u getting werid crash in
* u computer, run the ddraw_test around 3-4 times
*/
//DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21);
// mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));
/*
if (mpFourCC == NULL) if (mpFourCC == NULL)
{ {
DxHeapMemFree(ddgbl.lpDDCBtmp); DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call // FIXME Close DX fristcall and second call
return DD_FALSE; return DD_FALSE;
} }
*/
} // }
DX_STUB_str("Here\n"); DX_STUB_str("Here\n");