From c5832b0f71a7e1750d1dcdc996d82c5c65676728 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 2 Jun 2007 13:26:33 +0000 Subject: [PATCH] protect DirectDrawCreateEx with seh no more crash svn path=/trunk/; revision=26965 --- reactos/dll/directx/ddraw/main.c | 34 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/reactos/dll/directx/ddraw/main.c b/reactos/dll/directx/ddraw/main.c index 5da56f9f4c0..4cf9bf25a30 100644 --- a/reactos/dll/directx/ddraw/main.c +++ b/reactos/dll/directx/ddraw/main.c @@ -12,6 +12,9 @@ #include "rosdraw.h" +/* PSEH for SEH Support */ +#include + CRITICAL_SECTION ddcs; // This function is exported by the dll @@ -55,27 +58,38 @@ DirectDrawCreateEx(LPGUID lpGUID, REFIID id, LPUNKNOWN pUnkOuter) { + HRESULT retVal = DDERR_GENERIC; /* remove this when UML digram are in place this api is finish and is working as it should */ DX_WINDBG_trace(); - /* check see if pUnkOuter is null or not */ - if (pUnkOuter) + _SEH_TRY { - /* we are using same error code as MS*/ - return CLASS_E_NOAGGREGATION; - } + /* check see if pUnkOuter is null or not */ + if (pUnkOuter) + { + /* we are using same error code as MS*/ + return CLASS_E_NOAGGREGATION; + } - /* Is it a DirectDraw 7 Request or not */ - if (!IsEqualGUID(id, &IID_IDirectDraw7)) + /* Is it a DirectDraw 7 Request or not */ + if (!IsEqualGUID(id, &IID_IDirectDraw7)) + { + return DDERR_INVALIDPARAMS; + } + + retVal = Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); + + /* Create our DirectDraw interface */ + } + _SEH_HANDLE { - return DDERR_INVALIDPARAMS; } + _SEH_END; - /* Create our DirectDraw interface */ - return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); + return retVal; } /*