From 073d96842d197f5ddda9a53e046caeeef2a5a04a Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 2 Dec 2006 23:04:11 +0000 Subject: [PATCH] bug fixed some more info getting same as ms ddraw when you execute DirectDrawCreateEx fixed some comment in main.c, Comment why memory does not being fill to zero in lest windows 2000 after you play with directdraw. svn path=/trunk/; revision=25021 --- reactos/dll/directx/ddraw/main.c | 20 ++++++++++++--- reactos/dll/directx/ddraw/startup.c | 40 ++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/reactos/dll/directx/ddraw/main.c b/reactos/dll/directx/ddraw/main.c index dbcbab0cc93..c744286829f 100644 --- a/reactos/dll/directx/ddraw/main.c +++ b/reactos/dll/directx/ddraw/main.c @@ -33,9 +33,14 @@ WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter) -{ +{ + /* + remove this when UML digram are in place + this api is finish and is working as it should + */ DX_WINDBG_trace(); + /* check the pointer if it vaild to read from */ if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) { return DDERR_INVALIDPARAMS; @@ -44,10 +49,11 @@ DirectDrawCreate (LPGUID lpGUID, /* check see if pUnkOuter is null or not */ if (pUnkOuter) { - /* we do not use same error code as MS, ms use CLASS_E_NOAGGREGATION */ - return CLASS_E_NOAGGREGATION; + /* we are using same error code as MS*/ + return CLASS_E_NOAGGREGATION; } + /* Create our DirectDraw interface */ return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw7, FALSE); } @@ -63,8 +69,13 @@ DirectDrawCreateEx(LPGUID lpGUID, REFIID id, LPUNKNOWN pUnkOuter) { + /* + remove this when UML digram are in place + this api is finish and is working as it should + */ DX_WINDBG_trace(); + /* check the pointer if it vaild to read from */ if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) { return DDERR_INVALIDPARAMS; @@ -73,7 +84,7 @@ DirectDrawCreateEx(LPGUID lpGUID, /* check see if pUnkOuter is null or not */ if (pUnkOuter) { - /* we do not use same error code as MS, ms use CLASS_E_NOAGGREGATION */ + /* we are using same error code as MS*/ return CLASS_E_NOAGGREGATION; } @@ -83,6 +94,7 @@ DirectDrawCreateEx(LPGUID lpGUID, return DDERR_INVALIDPARAMS; } + /* Create our DirectDraw interface */ return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE); } diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 27e5dd52393..79653bcd41f 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -942,9 +942,43 @@ Create_DirectDraw (LPGUID pGUID, return DDERR_OUTOFMEMORY; } - This->lpLcl->lpGbl = &ddgbl; - This->lpLcl->dwLocalRefCnt = 0; + + /* + We need manual fill this struct member we can not trust on + the heap zero the struct if you play to much with directdraw + in Windows 2000. This is a small workaround of one of directdraw + bugs + */ + + /* + FIXME + read dwAppHackFlags flag from the system register instead for hard code it + */ + This->lpLcl->dwAppHackFlags = 0; + This->lpLcl->dwErrorMode = 0; + This->lpLcl->dwHotTracking = 0; + This->lpLcl->dwIMEState = 0; This->lpLcl->dwLocalFlags = DDRAWILCL_DIRECTDRAW7; + This->lpLcl->dwLocalRefCnt = 0; + This->lpLcl->dwObsolete1 = 0; + This->lpLcl->dwPreferredMode = 0; + This->lpLcl->dwProcessId = 0; + This->lpLcl->dwUnused0 = 0; + This->lpLcl->hD3DInstance = NULL; + This->lpLcl->hDC = 0; + This->lpLcl->hDDVxd = 0; + This->lpLcl->hFocusWnd = 0; + This->lpLcl->hGammaCalibrator = 0; + This->lpLcl->hWnd = 0; + This->lpLcl->hWndPopup = 0; + This->lpLcl->lpCB = NULL; + This->lpLcl->lpDDCB = NULL; + This->lpLcl->lpDDMore = 0; + This->lpLcl->lpGammaCalibrator = 0; + This->lpLcl->lpGbl = &ddgbl; + This->lpLcl->lpPrimary = NULL; + This->lpLcl->pD3DIUnknown = NULL; + This->lpLcl->pUnkOuter = NULL; *pIface = (LPDIRECTDRAW)This; @@ -955,7 +989,7 @@ Create_DirectDraw (LPGUID pGUID, if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID) == DD_OK); { - + This->lpLcl->hDD = ddgbl.hDD; return DD_OK; }