Author: mbosma
Date: Mon Jun 18 18:58:44 2007
New Revision: 27224
URL:
http://svn.reactos.org/svn/reactos?rev=27224&view=rev
Log:
- Some formatting fixes
- Some checks and fixed return values
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Mon Jun 18 18:58:44 2007
@@ -489,7 +489,7 @@
}
_SEH_HANDLE
{
- ret = DDERR_GENERIC;
+ ret = DDERR_INVALIDPARAMS;
}
_SEH_END;
// LeaveCriticalSection(&ddcs);
@@ -502,24 +502,22 @@
Main_DirectDraw_CreateSurface4(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
{
- HRESULT ret;
+ HRESULT ret;
DX_WINDBG_trace();
// EnterCriticalSection(&ddcs);
_SEH_TRY
{
ret = Internal_CreateSurface( (LPDDRAWI_DIRECTDRAW_INT)iface,pDDSD,
ppSurf,pUnkOuter);
}
- _SEH_HANDLE
- {
- ret = DDERR_GENERIC;
+ _SEH_HANDLE
+ {
+ ret = DDERR_INVALIDPARAMS;
}
_SEH_END;
// LeaveCriticalSection(&ddcs);
return ret;
}
-
-
/* 5 of 31 DirectDraw7_Vtable api are working simluare to windows */
/* 8 of 31 DirectDraw7_Vtable api are under devloping / testing */
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 Mon Jun 18 18:58:44 2007
@@ -41,8 +41,33 @@
DWORD num_of_surf=1;
DWORD count;
-
/* Fixme adding vaidlate of income param */
+ if(pDDraw->lpLcl->dwLocalFlags == 0x20000)
+ {
+ return DDERR_NOCOOPERATIVELEVELSET;
+ }
+
+ if(pUnkOuter)
+ {
+ return CLASS_E_NOAGGREGATION;
+ }
+
+ if(!pDDSD->dwFlags & DDSD_CAPS)
+ {
+ return DDERR_INVALIDPARAMS;
+ }
+
+ if(!(pDDSD->dwFlags & DDSD_HEIGHT) && !(pDDSD->dwFlags &
DDSD_HEIGHT)
+ && !(pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
+ {
+ return DDERR_INVALIDPARAMS;
+ }
+
+ else if(pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwFlags &
DDSD_HEIGHT
+ && pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
+ {
+ return DDERR_INVALIDPARAMS;
+ }
/* FIXME count our how many surface we need */
@@ -74,9 +99,6 @@
DxHeapMemFree(slist_int);
return DDERR_OUTOFMEMORY;
}
-
-
-
for( count=0; count < num_of_surf; count++ )
{
@@ -156,13 +178,9 @@
ThisSurfLcl->dwProcessId = GetCurrentProcessId();
-
-
-
/* FIXME the lpLnk */
/* FIXME the ref counter */
}
-
/* Fixme call on DdCanCreate then on DdCreateSurface createsurface data here */
@@ -180,11 +198,11 @@
return DDERR_NOTINITIALIZED;
}
- if (mDdCanCreateSurface.ddRVal != DD_OK)
- {
+ if (mDdCanCreateSurface.ddRVal != DD_OK)
+ {
DX_STUB_str("mDdCanCreateSurface fail");
return DDERR_NOTINITIALIZED;
- }
+ }
mDdCreateSurface.lpDD = pDDraw->lpLcl->lpGbl;
mDdCreateSurface.CreateSurface =
pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.CreateSurface;
@@ -195,12 +213,12 @@
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) ==
DDHAL_DRIVER_NOTHANDLED)
{
- return DDERR_NOTINITIALIZED;
+ return DDERR_NOTINITIALIZED;
}
if (mDdCreateSurface.ddRVal != DD_OK)
{
- return mDdCreateSurface.ddRVal;
+ return mDdCreateSurface.ddRVal;
}
*ppSurf = &slist_int[0]->lpVtbl;
@@ -233,7 +251,7 @@
return DDERR_OUTOFMEMORY;
}
- // That->lpLcl->lpSurfMore->slist = lpLcl;
+ // That->lpLcl->lpSurfMore->slist = lpLcl;
That->lpVtbl = &DirectDrawSurface7_Vtable;
That->lpLcl->lpSurfMore->dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
@@ -263,38 +281,38 @@
mDdCreateSurface.lpDDSurfaceDesc = (LPDDSURFACEDESC) pDDSD;
mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
-
- That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps;
-
- This->lpLcl->lpPrimary = That;
- if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (mDdCanCreateSurface.ddRVal != DD_OK)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
-
- if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) ==
DDHAL_DRIVER_NOTHANDLED)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (mDdCreateSurface.ddRVal != DD_OK)
- {
- return mDdCreateSurface.ddRVal;
- }
-
- That->lpLcl->lpSurfMore->slist = mDdCreateSurface.lplpSList ;
-
- That->lpLink = This->lpLcl->lpGbl->dsList;
- This->lpLcl->lpGbl->dsList = That;
-
- return DD_OK;
+
+ That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps;
+
+ This->lpLcl->lpPrimary = That;
+ if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
+ {
+ return DDERR_NOTINITIALIZED;
+ }
+
+ if (mDdCanCreateSurface.ddRVal != DD_OK)
+ {
+ return DDERR_NOTINITIALIZED;
+ }
+
+ mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
+
+ if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) ==
DDHAL_DRIVER_NOTHANDLED)
+ {
+ return DDERR_NOTINITIALIZED;
+ }
+
+ if (mDdCreateSurface.ddRVal != DD_OK)
+ {
+ return mDdCreateSurface.ddRVal;
+ }
+
+ That->lpLcl->lpSurfMore->slist = mDdCreateSurface.lplpSList ;
+
+ That->lpLink = This->lpLcl->lpGbl->dsList;
+ This->lpLcl->lpGbl->dsList = That;
+
+ return DD_OK;
}
HRESULT
@@ -398,7 +416,6 @@
LPDDRAWI_DDRAWSURFACE_INT *That,
LPDDSURFACEDESC2 pDDSD)
{
-
DDSURFACEDESC mddsdOverlay;
DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal;
DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6];
@@ -487,21 +504,21 @@
{
j = (i + 1) % cSurfaces;
-
+
/*if (!mHALInfo.lpDDSurfaceCallbacks->AddAttachedSurface(mpOverlayLocals[i],
mpOverlayLocals[j]))
- {
+ {
// derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d)
failed", this, i, j);
return DD_FALSE;
}*/
- if (!DdAttachSurface(mpOverlayLocals[i], mpOverlayLocals[j]))
- {
+ if (!DdAttachSurface(mpOverlayLocals[i], mpOverlayLocals[j]))
+ {
// derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d, %d)
failed", this, i, j);
//printf("Fail to DdAttachSurface (%d:%d)\n", i, j);
DX_STUB_str("DdAttachSurface fail");
return DD_FALSE;
}
-
+
}
// DDHAL_CREATESURFACEDATA mDdCreateSurface;
@@ -513,14 +530,14 @@
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
{
- DX_STUB_str("mDdCreateSurface DDHAL_DRIVER_NOTHANDLED fail");
- return DDERR_NOTINITIALIZED;
+ DX_STUB_str("mDdCreateSurface DDHAL_DRIVER_NOTHANDLED fail");
+ return DDERR_NOTINITIALIZED;
}
if (mDdCreateSurface.ddRVal != DD_OK)
{
- DX_STUB_str("mDdCreateSurface fail");
+ DX_STUB_str("mDdCreateSurface fail");
return mDdCreateSurface.ddRVal;
}
@@ -540,20 +557,17 @@
mDdUpdateOverlay.rSrc.right = 50;
mDdUpdateOverlay.rSrc.bottom = 50;
-
-
-
if ( mDdUpdateOverlay.UpdateOverlay(&mDdUpdateOverlay) == DDHAL_DRIVER_NOTHANDLED)
{
- DX_STUB_str("UpdateOverlay fail");
- return DDERR_NOTINITIALIZED;
+ DX_STUB_str("UpdateOverlay fail");
+ return DDERR_NOTINITIALIZED;
}
if (mDdUpdateOverlay.ddRVal != DD_OK)
{
DX_STUB_str("mDdUpdateOverlay fail");
- //printf("Fail to mDdUpdateOverlay mDdUpdateOverlay.ddRVal =
%d:%s\n",(int)mDdUpdateOverlay.ddRVal,DDErrorString(mDdUpdateOverlay.ddRVal));
+ //printf("Fail to mDdUpdateOverlay mDdUpdateOverlay.ddRVal =
%d:%s\n",(int)mDdUpdateOverlay.ddRVal,DDErrorString(mDdUpdateOverlay.ddRVal));
return mDdUpdateOverlay.ddRVal;
}