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));
Author: greatlrd
Date: Sat Dec 2 11:30:16 2006
New Revision: 25013
URL: http://svn.reactos.org/svn/reactos?rev=25013&view=rev
Log:
Adding two new debuger macro and debocument each debug macro I am using in windows and why you should use one of them
with time the debug macro will be compelete remove.
Modified:
trunk/reactos/dll/directx/ddraw/ddraw.rbuild
trunk/reactos/dll/directx/ddraw/rosdraw.h
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/ddraw.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/ddraw.rb…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/ddraw.rbuild (original)
+++ trunk/reactos/dll/directx/ddraw/ddraw.rbuild Sat Dec 2 11:30:16 2006
@@ -15,6 +15,7 @@
<library>ole32</library>
<library>user32</library>
<library>advapi32</library>
+ <library>msvcrt</library>
<file>ddraw.rc</file>
<file>main.c</file>
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Sat Dec 2 11:30:16 2006
@@ -596,6 +596,45 @@
/*********** Macros ***********/
+/*
+ use this macro to close
+ down the debuger text complete
+ no debuging at all, it will
+ crash ms debuger in VS
+*/
+
+//#define DX_WINDBG_trace()
+//#define DX_STUB
+//#define DX_STUB_DD_OK return DD_OK;
+//#define DX_STUB_str(x)
+//#define DX_WINDBG_trace_res
+
+
+/*
+ Use this macro if you want deboug in visual studio or
+ if you have a program to look at the _INT struct from
+ ReactOS ddraw.dll or ms ddraw.dll, so you can see what
+ value ms are being setup.
+
+ This macro will create allot warings and can not be help when you compile
+*/
+
+
+//#define DX_WINDBG_trace()
+//#define DX_STUB
+//#define DX_STUB_DD_OK return DD_OK;
+//#define DX_STUB_str(x) printf("%s",x);
+//#define DX_WINDBG_trace_res
+
+/*
+ use this if want doing a trace from a program
+ like a game and ReactOS ddraw.dll in windows
+ so you can figout what going wrong and what
+ api are being call or if it hel or is it hal
+
+ This marco does not create warings when you compile
+*/
+
#define DX_STUB \
{ \
static BOOL firstcall = TRUE; \
@@ -630,10 +669,6 @@
OutputDebugStringA(buffer); \
}
-
-//#define DX_WINDBG_trace()
-
-
#define DX_WINDBG_trace() \
static BOOL firstcallx = TRUE; \
if (firstcallx) \
@@ -644,7 +679,6 @@
firstcallx = TRUE; \
}
-
#define DX_WINDBG_trace_res(width,height,bpp) \
static BOOL firstcallxx = TRUE; \
if (firstcallxx) \
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 11:30:16 2006
@@ -40,7 +40,7 @@
{
DX_STUB_str("Out of memmory");
return DD_FALSE;
- }
+ }
This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp;
@@ -158,9 +158,13 @@
This->lpLcl->dwProcessId = GetCurrentProcessId();
-
- hal_ret = StartDirectDrawHal(iface);
- hel_ret = StartDirectDrawHel(iface);
+
+
+ hel_ret = StartDirectDrawHel(iface);
+ hal_ret = StartDirectDrawHal(iface);
+
+
+
if ((hal_ret!=DD_OK) && (hel_ret!=DD_OK))
{
DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT");
@@ -641,6 +645,8 @@
DeleteDC((HDC)This->lpLcl->hDC);
return DD_FALSE;
}
+
+ return DD_OK;
// Do not relase HDC it have been map in kernel mode
// DeleteDC(hdc);
@@ -901,7 +907,7 @@
{
return DDERR_INVALIDPARAMS;
}
-
+
if (StartDirectDraw((LPDIRECTDRAW*)This, pGUID) == DD_OK);
{