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); \
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) { \
_SEH_TRY \
{ \
p = malloc(m); \
if (p != NULL) \
{ \
ZeroMemory(p,m); \
} \
} \
_SEH_HANDLE \
{ \
p = NULL; \
} \
_SEH_END; \
p = malloc(m); \
if (p != NULL) \
{ \
ZeroMemory(p,m); \
} \
}
#define DxHeapMemFree(p) { \
free(p); \
p = NULL; \

View file

@ -13,9 +13,6 @@
#include "d3dhal.h"
#include "ddrawgdi.h"
/* PSEH for SEH Support */
#include <pseh/pseh.h>
DDRAWI_DIRECTDRAW_GBL ddgbl;
DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
@ -37,8 +34,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
return DDERR_INVALIDPARAMS;
}
DX_STUB_str("1 me\n");
This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
#if 0
@ -112,29 +107,18 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
LPDDRAWI_DIRECTDRAW_INT memThis;
DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
if (memThis != NULL)
This = memThis;
if (This == NULL)
{
This = memThis;
if (This == NULL)
{
if (memThis != NULL)
DxHeapMemFree(memThis);
if (memThis != NULL)
DxHeapMemFree(memThis);
DX_STUB_str("DDERR_OUTOFMEMORY");
return DDERR_OUTOFMEMORY;
}
}
else
{
DX_STUB_str("DDERR_OUTOFMEMORY");
return DDERR_OUTOFMEMORY;
}
/* Fixme release memory alloc if we fail */
DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_INT));
if (This->lpLcl == NULL)
{
DX_STUB_str("DDERR_OUTOFMEMORY");
@ -142,8 +126,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
}
#endif
DX_STUB_str("6 me\n");
This->lpLcl->lpGbl = &ddgbl;
*pIface = (LPDIRECTDRAW)This;
@ -490,6 +472,10 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
// FIXME Close DX fristcall and second call
return DD_FALSE;
}
DX_STUB_str("Here\n");
/* Alloc mpFourCC */
if (This->lpLcl->lpGbl->lpdwFourCC != NULL)
@ -497,18 +483,24 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
DxHeapMemFree(This->lpLcl->lpGbl->lpdwFourCC);
}
if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{
DxHeapMemAlloc(mpFourCC, (sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes)) + sizeof(DWORD) );
// if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
// {
//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)
{
DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call
return DD_FALSE;
}
}
*/
// }
DX_STUB_str("Here\n");