fixing some smaller bugs found by the regress test

svn path=/trunk/; revision=26816
This commit is contained in:
Magnus Olsen 2007-05-16 22:58:25 +00:00
parent 1ddfd23075
commit b527796afa
3 changed files with 23 additions and 20 deletions

View file

@ -82,6 +82,8 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
desc.dwFlags = desc.dwFlags & DDSD_ALL; desc.dwFlags = desc.dwFlags & DDSD_ALL;
} }
/* more code will follow */
return DDERR_GENERIC; return DDERR_GENERIC;

View file

@ -40,11 +40,6 @@ DirectDrawCreate (LPGUID lpGUID,
*/ */
DX_WINDBG_trace(); DX_WINDBG_trace();
/* check the pointer if it vaild to read from */
if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) )
{
return DDERR_INVALIDPARAMS;
}
/* check see if pUnkOuter is null or not */ /* check see if pUnkOuter is null or not */
if (pUnkOuter) if (pUnkOuter)
@ -75,12 +70,6 @@ DirectDrawCreateEx(LPGUID lpGUID,
*/ */
DX_WINDBG_trace(); DX_WINDBG_trace();
/* check the pointer if it vaild to read from */
if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) )
{
return DDERR_INVALIDPARAMS;
}
/* check see if pUnkOuter is null or not */ /* check see if pUnkOuter is null or not */
if (pUnkOuter) if (pUnkOuter)
{ {

View file

@ -25,12 +25,21 @@ HRESULT WINAPI
Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
REFIID id, BOOL ex) REFIID id, BOOL ex)
{ {
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; LPDDRAWI_DIRECTDRAW_INT This;
DX_WINDBG_trace(); DX_WINDBG_trace();
if (This == NULL) if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) ||
(IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW))))
{ {
return DDERR_INVALIDPARAMS;
}
This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW)))
{
DX_STUB_str("1. no linking\n");
/* 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;
@ -47,6 +56,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
else else
{ {
DX_STUB_str("2.linking\n");
/* 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;
newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
@ -269,7 +279,7 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
This->lpLcl->hDD = This->lpLcl->lpGbl->hDD; This->lpLcl->hDD = This->lpLcl->lpGbl->hDD;
ddgbl.hDD = This->lpLcl->lpGbl->hDD; ddgbl.hDD = This->lpLcl->lpGbl->hDD;
DX_STUB_str("DD_OK"); DX_STUB_str("DD_OK\n");
return DD_OK; return DD_OK;
} }
@ -373,6 +383,8 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
if (reenable == FALSE) if (reenable == FALSE)
{
if (ddgbl.lpDDCBtmp == NULL)
{ {
ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
if ( ddgbl.lpDDCBtmp == NULL) if ( ddgbl.lpDDCBtmp == NULL)
@ -380,6 +392,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
return DD_FALSE; return DD_FALSE;
} }
} }
}
else else
{ {
RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS)); RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS));
@ -425,7 +438,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
/* Alloc mpFourCC */ /* Alloc mpFourCC */
mpFourCC = NULL; mpFourCC = NULL;
if (mHALInfo.ddCaps.dwNumFourCCCodes) if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{ {
mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes); mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes);
if (mpFourCC == NULL) if (mpFourCC == NULL)
@ -438,8 +451,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
/* Alloc mpTextures */ /* Alloc mpTextures */
mpTextures = NULL; mpTextures = NULL;
if (mD3dDriverData.dwNumTextureFormats > 0)
if (mD3dDriverData.dwNumTextureFormats)
{ {
mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats); mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats);
if (mpTextures == NULL) if (mpTextures == NULL)