Author: greatlrd
Date: Thu May 17 02:58:25 2007
New Revision: 26816
URL:
http://svn.reactos.org/svn/reactos?rev=26816&view=rev
Log:
fixing some smaller bugs found by the regress test
Modified:
trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
trunk/reactos/dll/directx/ddraw/main.c
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/createsurface.c (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/createsurface.c Thu May 17 02:58:25 2007
@@ -81,6 +81,8 @@
desc.dwFlags = desc.dwFlags & DDSD_ALL;
}
+
+ /* more code will follow */
Modified: trunk/reactos/dll/directx/ddraw/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?r…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main.c Thu May 17 02:58:25 2007
@@ -40,11 +40,6 @@
*/
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 */
if (pUnkOuter)
@@ -74,12 +69,6 @@
this api is finish and is working as it should
*/
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 */
if (pUnkOuter)
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Thu May 17 02:58:25 2007
@@ -25,12 +25,21 @@
Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
REFIID id, BOOL ex)
{
- LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
+ LPDDRAWI_DIRECTDRAW_INT This;
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*/
LPDDRAWI_DIRECTDRAW_INT memThis;
@@ -47,6 +56,7 @@
}
else
{
+ DX_STUB_str("2.linking\n");
/* We got the DirectDraw interface alloc and we need create the link */
LPDDRAWI_DIRECTDRAW_INT newThis;
newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
@@ -269,7 +279,7 @@
This->lpLcl->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;
}
@@ -374,10 +384,13 @@
if (reenable == FALSE)
{
- ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
- if ( ddgbl.lpDDCBtmp == NULL)
- {
- return DD_FALSE;
+ if (ddgbl.lpDDCBtmp == NULL)
+ {
+ ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS));
+ if ( ddgbl.lpDDCBtmp == NULL)
+ {
+ return DD_FALSE;
+ }
}
}
else
@@ -425,7 +438,7 @@
/* Alloc mpFourCC */
mpFourCC = NULL;
- if (mHALInfo.ddCaps.dwNumFourCCCodes)
+ if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
{
mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) *
mHALInfo.ddCaps.dwNumFourCCCodes);
if (mpFourCC == NULL)
@@ -438,8 +451,7 @@
/* Alloc mpTextures */
mpTextures = NULL;
-
- if (mD3dDriverData.dwNumTextureFormats)
+ if (mD3dDriverData.dwNumTextureFormats > 0)
{
mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) *
mD3dDriverData.dwNumTextureFormats);
if (mpTextures == NULL)