DXGL r394 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r393‎ | r394 | r395 >
Date:16:14, 2 July 2013
Author:admin
Status:new
Tags:
Comment:
Add flags validation on IDirectDraw7::EnumSurfaces, SetCooperativeLevel, and WaitForVerticalBlank.
Add flags validation on IDirectDraw7::Flip
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -902,6 +902,7 @@
903903 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
904904 if(!lpDDSD2) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
905905 if(!lpEnumSurfacesCallback) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 906+ if(dwFlags & 0xFFFFFFE0) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
906907 FIXME("IDirectDraw::EnumSurfaces: stub\n");
907908 TRACE_EXIT(23,DDERR_GENERIC);
908909 ERR(DDERR_GENERIC);
@@ -1182,6 +1183,8 @@
11831184 {
11841185 TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
11851186 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 1187+ if(hWnd && !IsWindow(hWnd)) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 1188+ if(dwFlags & 0xFFFFE020) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
11861189 this->hWnd = hWnd;
11871190 winstyle = GetWindowLongPtrA(hWnd,GWL_STYLE);
11881191 winstyleex = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
@@ -1535,6 +1538,8 @@
15361539 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
15371540 if(dwFlags & DDWAITVB_BLOCKBEGINEVENT)
15381541 TRACE_RET(HRESULT,23,DDERR_UNSUPPORTED);
 1542+ if(dwFlags & 0xFFFFFFFA) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 1543+ if(dwFlags == 5) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
15391544 if(!lastsync) lastsync = true;
15401545 else primary->RenderScreen(primary->texture,primary,1);
15411546 TRACE_EXIT(23,DD_OK);
Index: ddraw/glDirectDrawSurface.cpp
@@ -41,6 +41,7 @@
4242 glDirectDrawSurface7::glDirectDrawSurface7(LPDIRECTDRAW7 lpDD7, LPDDSURFACEDESC2 lpDDSurfaceDesc2, HRESULT *error, bool copysurface, glDirectDrawPalette *palettein)
4343 {
4444 TRACE_ENTER(6,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,error,21,copysurface,14,palettein);
 45+ overlay = false;
4546 hasstencil = false;
4647 dirty = 2;
4748 handle = 0;
@@ -704,6 +705,9 @@
705706 {
706707 TRACE_ENTER(3,14,this,14,lpDDSurfaceTargetOverride,9,dwFlags);
707708 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 709+ if(dwFlags & 0xF8FFFFC0) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 710+ if(locked) TRACE_RET(HRESULT,23,DDERR_SURFACEBUSY);
 711+ if(!overlay && ((dwFlags & DDFLIP_ODD) || (dwFlags & DDFLIP_EVEN))) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
708712 DWORD i;
709713 glDirectDrawSurface7 *tmp;
710714 if(dwFlags & DDFLIP_NOVSYNC) swapinterval=0;
Index: ddraw/glDirectDrawSurface.h
@@ -149,6 +149,7 @@
150150 int pagelocked;
151151 GLint magfilter,minfilter;
152152 glDirect3DDevice7 *device;
 153+ bool overlay;
153154 };
154155
155156 // Legacy DDRAW Interfaces