Author: greatlrd Date: Sat Jun 2 17:26:33 2007 New Revision: 26965
URL: http://svn.reactos.org/svn/reactos?rev=26965&view=rev Log: protect DirectDrawCreateEx with seh no more crash
Modified: trunk/reactos/dll/directx/ddraw/main.c
Modified: trunk/reactos/dll/directx/ddraw/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?re... ============================================================================== --- trunk/reactos/dll/directx/ddraw/main.c (original) +++ trunk/reactos/dll/directx/ddraw/main.c Sat Jun 2 17:26:33 2007 @@ -12,6 +12,9 @@
#include "rosdraw.h"
+/* PSEH for SEH Support */ +#include <pseh/pseh.h> + CRITICAL_SECTION ddcs;
// This function is exported by the dll @@ -55,27 +58,38 @@ 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) - { - /* 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)) - { - return DDERR_INVALIDPARAMS; - } - - /* Create our DirectDraw interface */ - return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); + _SEH_TRY + { + /* 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)) + { + return DDERR_INVALIDPARAMS; + } + + retVal = Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); + + /* Create our DirectDraw interface */ + } + _SEH_HANDLE + { + } + _SEH_END; + + return retVal; }
/*