From eb55201ce5b21fab91524ada4a41ff3d39f1700a Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 22 Apr 2007 19:59:44 +0000 Subject: [PATCH] Fixing a crash, fixed so Setcoparative pass the test, still some werid bugs after I delete all code in ddraw. anyone whant debuging this u are wellcome svn path=/trunk/; revision=26468 --- reactos/dll/directx/ddraw/main/ddraw_main.c | 3 +++ reactos/dll/directx/ddraw/startup.c | 30 ++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/reactos/dll/directx/ddraw/main/ddraw_main.c b/reactos/dll/directx/ddraw/main/ddraw_main.c index 46c97dfd613..f62c046321b 100644 --- a/reactos/dll/directx/ddraw/main/ddraw_main.c +++ b/reactos/dll/directx/ddraw/main/ddraw_main.c @@ -34,10 +34,13 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface, else { *obj = NULL; + DX_STUB_str("E_NOINTERFACE"); return E_NOINTERFACE; } + Main_DirectDraw_AddRef(iface); + DX_STUB_str("DD_OK"); return DD_OK; } diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 5a2483f4902..d3ccff0bdbe 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -41,7 +41,10 @@ Create_DirectDraw (LPGUID pGUID, This = memThis; if (This == NULL) { - if (memThis != NULL) DxHeapMemFree(memThis); + if (memThis != NULL) + DxHeapMemFree(memThis); + + DX_STUB_str("DDERR_OUTOFMEMORY"); return DDERR_OUTOFMEMORY; } } @@ -51,13 +54,18 @@ Create_DirectDraw (LPGUID pGUID, LPDDRAWI_DIRECTDRAW_INT newThis; newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); if (newThis == NULL) + { + DX_STUB_str("DDERR_OUTOFMEMORY"); return DDERR_OUTOFMEMORY; + } + /* we need check the GUID lpGUID what type it is */ if (pGUID != (LPGUID)DDCREATE_HARDWAREONLY) { if (pGUID !=NULL) { This = newThis; + DX_STUB_str("DDERR_INVALIDDIRECTDRAWGUID"); return DDERR_INVALIDDIRECTDRAWGUID; } } @@ -68,15 +76,24 @@ Create_DirectDraw (LPGUID pGUID, /* Fixme release memory alloc if we fail */ This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); if (This->lpLcl == NULL) + { + DX_STUB_str("DDERR_OUTOFMEMORY"); return DDERR_OUTOFMEMORY; + } + This->lpLcl->lpGbl = &ddgbl; *pIface = (LPDIRECTDRAW)This; /* Get right interface we whant */ - if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface)) + if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) == DD_OK) { + DX_STUB_str("Got iface"); + 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; wnd_class.lpfnWndProc = DefWindowProcW; @@ -90,13 +107,17 @@ Create_DirectDraw (LPGUID pGUID, wnd_class.lpszClassName = classname; if(!RegisterClassW(&wnd_class)) { + DX_STUB_str("DDERR_GENERIC"); return DDERR_GENERIC; } + */ + DX_STUB_str("DD_OK"); return DD_OK; } } + DX_STUB_str("DDERR_INVALIDPARAMS"); return DDERR_INVALIDPARAMS; } @@ -123,6 +144,7 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable) */ + if (reenable == FALSE) { if (This->lpLink == NULL) @@ -141,6 +163,8 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable) } } + DX_STUB_str("here"); + if (reenable == FALSE) { if (lpGuid == NULL) @@ -248,7 +272,7 @@ StartDirectDraw(LPDIRECTDRAW* iface, LPGUID lpGuid, BOOL reenable) This->lpLcl->hDD = This->lpLcl->lpGbl->hDD; ddgbl.hDD = This->lpLcl->lpGbl->hDD; - + DX_STUB_str("DD_OK"); return DD_OK; }