From 298cd5e0940c137502515c807f5358dfc1c0eb17 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Mon, 21 May 2007 18:49:28 +0000 Subject: [PATCH] Thx DrFred notice I did take wrong struct at alloc, I also comment up the code bit. svn path=/trunk/; revision=26857 --- reactos/dll/directx/ddraw/startup.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 5c4f64120e2..908cbc2ff50 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -60,7 +60,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, DX_STUB_str("DDERR_OUTOFMEMORY"); return DDERR_OUTOFMEMORY; } - This->lpLcl->lpGbl = &ddgbl; } else { @@ -68,6 +67,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, /* We got the DirectDraw interface alloc and we need create the link */ LPDDRAWI_DIRECTDRAW_INT newThis; + /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */ newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); if (newThis == NULL) { @@ -75,7 +75,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, return DDERR_OUTOFMEMORY; } - /* we need check the GUID lpGUID what type it is */ + /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */ if (pGUID != (LPGUID)DDCREATE_HARDWAREONLY) { if (pGUID !=NULL) @@ -85,23 +85,24 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, return DDERR_INVALIDDIRECTDRAWGUID; } } + + /* step 3 do the link the old interface are store in the new one */ newThis->lpLink = This; - newThis->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + /* step 4 we need create new local directdraw struct for the new linked interface */ + newThis->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_LCL)); if (newThis->lpLcl == NULL) { This = newThis; DX_STUB_str("DDERR_OUTOFMEMORY"); return DDERR_OUTOFMEMORY; } - RtlCopyMemory(newThis->lpLcl, This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL)); This = newThis; - - DX_STUB_str("here\n"); - } + This->lpLcl->lpGbl = &ddgbl; + *pIface = (LPDIRECTDRAW)This; /* Get right interface we whant */ @@ -111,8 +112,6 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, if (StartDirectDraw((LPDIRECTDRAW)This, pGUID, FALSE) == DD_OK); { - DX_STUB_str("here"); - /* RtlZeroMemory(&wnd_class, sizeof(wnd_class)); wnd_class.style = CS_HREDRAW | CS_VREDRAW;