Fixed one weird crash, please type make draw_clean 3 times so it gurated be clean in u tree, now build the ddraw,

tested compile with -O and no crash have been show 

svn path=/trunk/; revision=27044
This commit is contained in:
Magnus Olsen 2007-06-07 12:20:13 +00:00
parent d4c1add2a8
commit 259286f6fc
2 changed files with 43 additions and 38 deletions

View file

@ -27,6 +27,8 @@ Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
_SEH_TRY _SEH_TRY
{ {
DX_STUB_str("here\n");
if(!pCallback) if(!pCallback)
{ {
ret = DDERR_INVALIDPARAMS; ret = DDERR_INVALIDPARAMS;
@ -34,11 +36,15 @@ Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
else else
{ {
DX_STUB_str("here\n");
DevMode.dmSize = sizeof(DEVMODE); DevMode.dmSize = sizeof(DEVMODE);
DevMode.dmDriverExtra = 0; DevMode.dmDriverExtra = 0;
while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE) while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE)
{ {
DX_STUB_str("here\n");
DDSURFACEDESC2 SurfaceDesc; DDSURFACEDESC2 SurfaceDesc;
iMode++; iMode++;
@ -71,6 +77,7 @@ Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
if(pDDSD) if(pDDSD)
{ {
DX_STUB_str("here\n");
if(pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwHeight != SurfaceDesc.dwHeight) if(pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwHeight != SurfaceDesc.dwHeight)
continue; continue;
@ -97,6 +104,9 @@ Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
{ {
} }
_SEH_END; _SEH_END;
DX_STUB_str("here\n");
return ret; return ret;
} }

View file

@ -32,9 +32,10 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
DX_STUB_str("here\n");
This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
#if 0
/* fixme linking too second link when we shall not doing it */ /* fixme linking too second link when we shall not doing it */
if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW))) if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW)))
{ {
@ -42,24 +43,32 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
/* We do not have a DirectDraw interface, we need alloc it*/ /* We do not have a DirectDraw interface, we need alloc it*/
LPDDRAWI_DIRECTDRAW_INT memThis; LPDDRAWI_DIRECTDRAW_INT memThis;
memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); DX_STUB_str("here\n");
This = memThis;
if (This == NULL)
{
if (memThis != NULL)
DxHeapMemFree(memThis);
DX_STUB_str("DDERR_OUTOFMEMORY"); DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
DX_STUB_str("here\n")
if (memThis == NULL)
{
DX_STUB_str("DDERR_OUTOFMEMORY\n");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
This = memThis;
DX_STUB_str("here\n");
/* Fixme release memory alloc if we fail */ /* Fixme release memory alloc if we fail */
This->lpLcl = DxHeapMemAlloc(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\n");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
DX_STUB_str("here\n");
} }
else else
{ {
@ -67,14 +76,18 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
/* We got the DirectDraw interface alloc and we need create the link */ /* We got the DirectDraw interface alloc and we need create the link */
LPDDRAWI_DIRECTDRAW_INT newThis; LPDDRAWI_DIRECTDRAW_INT newThis;
DX_STUB_str("here\n");
/* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */ /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
if (newThis == NULL) if (newThis == NULL)
{ {
DX_STUB_str("DDERR_OUTOFMEMORY\n"); DX_STUB_str("DDERR_OUTOFMEMORY\n");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
DX_STUB_str("here\n");
/* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */ /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
if ((pGUID) && (pGUID != (LPGUID)DDCREATE_HARDWAREONLY)) if ((pGUID) && (pGUID != (LPGUID)DDCREATE_HARDWAREONLY))
{ {
@ -86,43 +99,25 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
} }
DX_STUB_str("here\n");
/* step 3 do the link the old interface are store in the new one */ /* step 3 do the link the old interface are store in the new one */
newThis->lpLink = This; newThis->lpLink = This;
/* step 4 we need create new local directdraw struct for the new linked interface */ /* step 4 we need create new local directdraw struct for the new linked interface */
newThis->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_LCL)); DxHeapMemAlloc(newThis->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
if (newThis->lpLcl == NULL) if (newThis->lpLcl == NULL)
{ {
This = newThis; This = newThis;
DX_STUB_str("DDERR_OUTOFMEMORY"); DX_STUB_str("DDERR_OUTOFMEMORY\n");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
DX_STUB_str("here\n");
This = newThis; This = newThis;
} }
#else
/* FIXME HACK linking does not working we need figout why */
LPDDRAWI_DIRECTDRAW_INT memThis;
DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
This = memThis;
if (This == NULL)
{
if (memThis != NULL)
DxHeapMemFree(memThis);
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");
return DDERR_OUTOFMEMORY;
}
#endif
This->lpLcl->lpGbl = &ddgbl; This->lpLcl->lpGbl = &ddgbl;
@ -131,7 +126,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
/* Get right interface we whant */ /* Get right interface we whant */
if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) == DD_OK) if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) == DD_OK)
{ {
DX_STUB_str("Got iface"); DX_STUB_str("Got iface\n");
if (StartDirectDraw((LPDIRECTDRAW)This, pGUID, FALSE) == DD_OK); if (StartDirectDraw((LPDIRECTDRAW)This, pGUID, FALSE) == DD_OK);
{ {
@ -154,12 +149,12 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
*/ */
DX_STUB_str("DD_OK"); DX_STUB_str("DD_OK\n");
return DD_OK; return DD_OK;
} }
} }
DX_STUB_str("DDERR_INVALIDPARAMS"); DX_STUB_str("DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }