Author: greatlrd
Date: Sat Jun 16 23:38:20 2007
New Revision: 27208
URL:
http://svn.reactos.org/svn/reactos?rev=27208&view=rev
Log:
fixing couple of bugs in Main_DirectDraw_QueryInterface
1. adding create linking when u req a new directdraw interface from old one.
This Type of linking is exacly same lcl pointer as the linked interface,
it mean we shall not create new lcl but use the current we got.
waring still bugs in DirectDraw_QueryInterface
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Sat Jun 16 23:38:20 2007
@@ -39,44 +39,79 @@
*/
if (IsEqualGUID(&IID_IDirectDraw7, id))
{
- /* FIXME linking */
-
- /* DirectDraw7 Vtable */
- This->lpVtbl = &DirectDraw7_Vtable;
- This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags +
DDRAWILCL_DIRECTDRAW7;
- *obj = &This->lpVtbl;
- Main_DirectDraw_AddRef(iface);
+ LPDDRAWI_DIRECTDRAW_INT newThis;
+ DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
+
+ if (newThis == NULL)
+ {
+ retVal = DDERR_OUTOFMEMORY;
+ }
+ else
+ {
+ /* DirectDraw7 Vtable */
+ newThis->lpVtbl = &DirectDraw7_Vtable;
+ newThis->lpLcl = This->lpLcl;
+ newThis->dwIntRefCnt = 1;
+ newThis->lpLink = This;
+ *obj = &newThis->lpVtbl;
+ }
}
else if (IsEqualGUID(&IID_IDirectDraw4, id))
{
- /* FIXME linking */
-
- /* DirectDraw4 Vtable */
- This->lpVtbl = &DirectDraw4_Vtable;
- This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags;
- *obj = &This->lpVtbl;
- Main_DirectDraw_AddRef(iface);
+ LPDDRAWI_DIRECTDRAW_INT newThis;
+ DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
+
+ if (newThis == NULL)
+ {
+ retVal = DDERR_OUTOFMEMORY;
+ }
+ else
+ {
+ /* DirectDraw4 Vtable */
+ newThis->lpVtbl = &DirectDraw4_Vtable;
+ newThis->lpLcl = This->lpLcl;
+ newThis->dwIntRefCnt = 1;
+ newThis->lpLink = This;
+ *obj = &newThis->lpVtbl;
+ }
}
else if (IsEqualGUID(&IID_IDirectDraw2, id))
{
- /* FIXME linking */
-
-
- /* DirectDraw4 Vtable */
- This->lpVtbl = &DirectDraw2_Vtable;
- This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags;
- *obj = &This->lpVtbl;
- Main_DirectDraw_AddRef(iface);
+ LPDDRAWI_DIRECTDRAW_INT newThis;
+ DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
+
+ if (newThis == NULL)
+ {
+ retVal = DDERR_OUTOFMEMORY;
+ }
+ else
+ {
+ /* DirectDraw4 Vtable */
+ newThis->lpVtbl = &DirectDraw2_Vtable;
+ newThis->lpLcl = This->lpLcl;
+ newThis->dwIntRefCnt = 1;
+ newThis->lpLink = This;
+ *obj = &newThis->lpVtbl;
+ }
}
else if (IsEqualGUID(&IID_IDirectDraw, id))
{
- /* FIXME linking */
-
- /* DirectDraw4 Vtable */
- This->lpVtbl = &DirectDraw_Vtable;
- This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags;
- *obj = &This->lpVtbl;
- Main_DirectDraw_AddRef(iface);
+ LPDDRAWI_DIRECTDRAW_INT newThis;
+ DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
+
+ if (newThis == NULL)
+ {
+ retVal = DDERR_OUTOFMEMORY;
+ }
+ else
+ {
+ /* DirectDraw4 Vtable */
+ newThis->lpVtbl = &DirectDraw_Vtable;
+ newThis->lpLcl = This->lpLcl;
+ newThis->dwIntRefCnt = 1;
+ newThis->lpLink = This;
+ *obj = &newThis->lpVtbl;
+ }
}
else
{