Author: greatlrd
Date: Sun Jul 16 16:03:41 2006
New Revision: 23073
URL:
http://svn.reactos.org/svn/reactos?rev=23073&view=rev
Log:
Clean up NtGdiDdCreateDirectDrawObject and confirm it working.
1. Fix create hdc when it is NULL that is need to get ms windows xp d3dx.dll working in
ReactOS, if some want try it.
Modified:
trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sun Jul 16 16:03:41 2006
@@ -12,11 +12,14 @@
#define NDEBUG
#include <debug.h>
+GDIDEVICE IntGetPrimarySurface(VOID);
/* swtich this off to get rid of all dx debug msg */
#define DX_DEBUG
#define DdHandleTable GdiHandleTable
+
+
/************************************************************************/
@@ -55,9 +58,8 @@
BOOL success;
HANDLE hDirectDraw;
PDD_DIRECTDRAW pDirectDraw;
-#ifdef DX_DEBUG
+
DPRINT1("NtGdiDdCreateDirectDrawObject\n");
-#endif
RtlZeroMemory(&callbacks, sizeof(DD_CALLBACKS));
callbacks.dwSize = sizeof(DD_CALLBACKS);
@@ -70,29 +72,30 @@
/* we need create it, if in that case */
if (hdc == NULL)
{
+ DPRINT1("FIXME hdc is NULL \n");
return NULL;
}
pDC = DC_LockDc(hdc);
if (!pDC)
+ {
return NULL;
-
- if (!pDC->DriverFunctions.EnableDirectDraw)
- {
- // Driver doesn't support DirectDraw
+ }
+
+ if (pDC->DriverFunctions.EnableDirectDraw == NULL)
+ {
+ /* Driver doesn't support DirectDraw */
DC_UnlockDc(pDC);
return NULL;
}
success = pDC->DriverFunctions.EnableDirectDraw(
- pDC->PDev, &callbacks, &surface_callbacks, &palette_callbacks);
+ pDC->PDev, &callbacks, &surface_callbacks, &palette_callbacks);
if (!success)
{
-#ifdef DX_DEBUG
DPRINT1("DirectDraw creation failed\n");
-#endif
- // DirectDraw creation failed
+ /* DirectDraw creation failed */
DC_UnlockDc(pDC);
return NULL;
}
@@ -101,9 +104,6 @@
if (!hDirectDraw)
{
/* No more memmory */
-#ifdef DX_DEBUG
- DPRINT1("No more memmory\n");
-#endif
DC_UnlockDc(pDC);
return NULL;
}
@@ -112,14 +112,10 @@
if (!pDirectDraw)
{
/* invalid handle */
-#ifdef DX_DEBUG
- DPRINT1("invalid handle\n");
-#endif
DC_UnlockDc(pDC);
return NULL;
}
-
pDirectDraw->Global.dhpdev = pDC->PDev;
pDirectDraw->Local.lpGbl = &pDirectDraw->Global;
@@ -128,16 +124,17 @@
/* DD_CALLBACKS setup */
RtlMoveMemory(&pDirectDraw->DD, &callbacks, sizeof(DD_CALLBACKS));
-
- /* DD_SURFACECALLBACKS setup*/
+
+ /* DD_SURFACECALLBACKS setup*/
RtlMoveMemory(&pDirectDraw->Surf, &surface_callbacks,
sizeof(DD_SURFACECALLBACKS));
-
+
/* DD_PALETTECALLBACKS setup*/
- RtlMoveMemory(&pDirectDraw->Pal, &surface_callbacks,
sizeof(DD_PALETTECALLBACKS));
-
+ RtlMoveMemory(&pDirectDraw->Pal, &palette_callbacks,
sizeof(DD_PALETTECALLBACKS));
+
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
DC_UnlockDc(pDC);
+ DPRINT1("DirectDraw return handler\n");
return hDirectDraw;
}