Author: greatlrd
Date: Sat Dec 2 16:37:55 2006
New Revision: 25016
URL:
http://svn.reactos.org/svn/reactos?rev=25016&view=rev
Log:
fixed partly linking with other directdraw interface, but we still overwrite some member
and crash it, when we doing a link.
Modified:
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Sat Dec 2 16:37:55 2006
@@ -879,20 +879,37 @@
LPDIRECTDRAW* pIface,
REFIID id,
BOOL ex)
-{
- LPDDRAWI_DIRECTDRAW_INT This;
-
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
+
DX_WINDBG_trace();
if (!IsEqualGUID(&IID_IDirectDraw7, id))
{
return DDERR_INVALIDDIRECTDRAWGUID;
}
-
- This = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
- if (This == NULL)
- {
- return DDERR_OUTOFMEMORY;
+
+
+ if (This == NULL)
+ {
+ /* We do not have any DirectDraw interface alloc */
+ This = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+ if (This == NULL)
+ {
+ return DDERR_OUTOFMEMORY;
+ }
+ }
+ else
+ {
+ /* We got the DirectDraw interface alloc and we need create the link */
+ LPDDRAWI_DIRECTDRAW_INT newThis;
+ newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+ if (newThis == NULL)
+ {
+ return DDERR_OUTOFMEMORY;
+ }
+ newThis->lpLink = This;
+ This = newThis;
}
This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));