From 898809f6cb87857ac3a3f2d3261e36c0b98d7955 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 30 Nov 2006 22:58:48 +0000 Subject: [PATCH] fixed crash in stub of createsurface svn path=/trunk/; revision=25009 --- reactos/dll/directx/ddraw/main/ddraw_main.c | 24 ++++++--------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/reactos/dll/directx/ddraw/main/ddraw_main.c b/reactos/dll/directx/ddraw/main/ddraw_main.c index 0acb3686d5a..9c5c9e5e012 100644 --- a/reactos/dll/directx/ddraw/main/ddraw_main.c +++ b/reactos/dll/directx/ddraw/main/ddraw_main.c @@ -198,24 +198,16 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; LPDDRAWI_DDRAWSURFACE_INT That; - - - DX_WINDBG_trace(); - if (pUnkOuter!=NULL) { return CLASS_E_NOAGGREGATION; } - DX_STUB_str("ok pUnkOuter == NULL"); - if (sizeof(DDSURFACEDESC2)!=pDDSD->dwSize && sizeof(DDSURFACEDESC)!=pDDSD->dwSize) { return DDERR_UNSUPPORTED; } - DX_STUB_str("ok pDDSD->dwSize ok"); - That = (LPDDRAWI_DDRAWSURFACE_INT)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_INT)); if (That == NULL) @@ -223,22 +215,18 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE return E_OUTOFMEMORY; } - DX_STUB_str("That got memory"); + That->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_LCL)); + + if (That == NULL) + { + return E_OUTOFMEMORY; + } - That->lpVtbl = &DirectDrawSurface7_Vtable; - - DX_STUB_str("That->lpVtbl ok"); - *ppSurf = (LPDIRECTDRAWSURFACE7)That; - DX_STUB_str("*ppSurf ok"); - That->lpLcl->lpGbl = &ddSurfGbl; - DX_STUB_str("ddSurfGbl ok"); - That->lpLcl->lpGbl->lpDD = &ddgbl; - DX_STUB_str("crash one line below : why ? to tried figout lpDD ok"); Main_DDrawSurface_AddRef((LPDIRECTDRAWSURFACE7)That);