implement GDIEntry1 of 16, the code is bit untested, we can not test it until all are in place and win32k/ntdraw got some stub remove. when all GdiEntry1-16 we are compatble with ms directdraw1-7 interface in gdi32.dll
Modified: trunk/reactos/lib/gdi32/gdi32.xml
Added: trunk/reactos/lib/gdi32/include/ddentry.h
Modified: trunk/reactos/lib/gdi32/include/precomp.h
Added: trunk/reactos/lib/gdi32/misc/gdientry.c
Modified: trunk/reactos/lib/gdi32/misc/stubs.c

Modified: trunk/reactos/lib/gdi32/gdi32.xml
--- trunk/reactos/lib/gdi32/gdi32.xml	2005-07-28 18:34:01 UTC (rev 16833)
+++ trunk/reactos/lib/gdi32/gdi32.xml	2005-07-28 18:45:58 UTC (rev 16834)
@@ -17,6 +17,7 @@
 	</directory>
 	<directory name="misc">
 		<file>heap.c</file>
+            <file>gdientry.c</file>
 		<file>misc.c</file>
 		<file>stubs.c</file>
 		<file>stubsa.c</file>

Added: trunk/reactos/lib/gdi32/include/ddentry.h
--- trunk/reactos/lib/gdi32/include/ddentry.h	2005-07-28 18:34:01 UTC (rev 16833)
+++ trunk/reactos/lib/gdi32/include/ddentry.h	2005-07-28 18:45:58 UTC (rev 16834)
@@ -0,0 +1,324 @@
+
+#ifndef __D3D8THK_H
+#define __D3D8THK_H
+
+#include <ddk\ddrawint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+BOOL STDCALL NtGdiD3dContextCreate(
+    HANDLE hDirectDrawLocal,
+    HANDLE hSurfColor,
+    HANDLE hSurfZ,
+    PD3DNTHAL_CONTEXTCREATEDATA pdcci
+);
+
+DWORD STDCALL NtGdiD3dContextDestroy(      
+    PD3DNTHAL_CONTEXTDESTROYDATA pContextDestroyData
+);
+
+DWORD STDCALL NtGdiD3dContextDestroyAll(VOID);
+
+DWORD STDCALL NtGdiD3dDrawPrimitives2(      
+    HANDLE hCmdBuf,
+    HANDLE hVBuf,
+    PD3DNTHAL_DRAWPRIMITIVES2DATA pded,
+    FLATPTR *pfpVidMemCmd,
+    DWORD *pdwSizeCmd,
+    FLATPTR *pfpVidMemVtx,
+    DWORD *pdwSizeVtx
+);
+
+DWORD STDCALL NtGdiD3dValidateTextureStageState(      
+    PD3DNTHAL_VALIDATETEXTURESTAGESTATEDATA pData
+);
+
+DWORD STDCALL NtGdiDdAddAttachedSurface(      
+    HANDLE hSurface,
+    HANDLE hSurfaceAttached,
+    PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData
+);
+
+DWORD STDCALL NtGdiDdAlphaBlt(VOID);
+
+BOOL STDCALL NtGdiDdAttachSurface(      
+    HANDLE hSurfaceFrom,
+    HANDLE hSurfaceTo
+);
+
+DWORD STDCALL NtGdiDdBeginMoCompFrame(      
+    HANDLE hMoComp,
+    PDD_BEGINMOCOMPFRAMEDATA puBeginFrameData
+);
+
+DWORD STDCALL NtGdiDdBlt(      
+    HANDLE hSurfaceDest,
+    HANDLE hSurfaceSrc,
+    PDD_BLTDATA puBltData
+);
+
+DWORD STDCALL NtGdiDdCanCreateD3DBuffer(      
+    HANDLE hDirectDraw,
+    PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
+);
+
+DWORD STDCALL NtGdiDdCanCreateSurface(      
+    HANDLE hDirectDraw,
+    PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
+);
+
+DWORD STDCALL NtGdiDdColorControl(      
+    HANDLE hSurface,
+    PDD_COLORCONTROLDATA puColorControlData
+);
+
+DWORD STDCALL NtGdiDdCreateD3DBuffer(      
+    HANDLE hDirectDraw,
+    HANDLE *hSurface,
+    DDSURFACEDESC *puSurfaceDescription,
+    DD_SURFACE_GLOBAL *puSurfaceGlobalData,
+    DD_SURFACE_LOCAL *puSurfaceLocalData,
+    DD_SURFACE_MORE *puSurfaceMoreData,
+    PDD_CREATESURFACEDATA puCreateSurfaceData,
+    HANDLE *puhSurface
+);
+
+HANDLE STDCALL NtGdiDdCreateDirectDrawObject(      
+    HDC hdc
+);
+
+HANDLE STDCALL NtGdiDdCreateMoComp(      
+    HANDLE hDirectDraw,
+    PDD_CREATEMOCOMPDATA puCreateMoCompData
+);
+
+DWORD STDCALL NtGdiDdCreateSurface(      
+    HANDLE hDirectDraw,
+    HANDLE *hSurface,
+    DDSURFACEDESC *puSurfaceDescription,
+    DD_SURFACE_GLOBAL *puSurfaceGlobalData,
+    DD_SURFACE_LOCAL *puSurfaceLocalData,
+    DD_SURFACE_MORE *puSurfaceMoreData,
+    PDD_CREATESURFACEDATA puCreateSurfaceData,
+    HANDLE *puhSurface
+);
+
+DWORD STDCALL NtGdiDdCreateSurfaceEx(      
+    HANDLE hDirectDraw,
+    HANDLE hSurface,
+    DWORD dwSurfaceHandle
+);
+
+HANDLE STDCALL NtGdiDdCreateSurfaceObject(      
+    HANDLE hDirectDrawLocal,
+    HANDLE hSurface,
+    PDD_SURFACE_LOCAL puSurfaceLocal,
+    PDD_SURFACE_MORE puSurfaceMore,
+    PDD_SURFACE_GLOBAL puSurfaceGlobal,
+    BOOL bComplete
+);
+
+BOOL STDCALL NtGdiDdDeleteDirectDrawObject(      
+    HANDLE hDirectDrawLocal
+);
+
+BOOL STDCALL NtGdiDdDeleteSurfaceObject(      
+    HANDLE hSurface
+);
+
+DWORD STDCALL NtGdiDdDestroyD3DBuffer(      
+    HANDLE hSurface
+);
+
+DWORD STDCALL NtGdiDdDestroyMoComp(      
+    HANDLE hMoComp,
+    PDD_DESTROYMOCOMPDATA puBeginFrameData
+);
+
+DWORD STDCALL NtGdiDdDestroySurface(      
+    HANDLE hSurface,
+    BOOL bRealDestroy
+);
+
+DWORD STDCALL NtGdiDdEndMoCompFrame(      
+    HANDLE hMoComp,
+    PDD_ENDMOCOMPFRAMEDATA puEndFrameData
+);
+
+DWORD STDCALL NtGdiDdFlip(      
+    HANDLE hSurfaceCurrent,
+    HANDLE hSurfaceTarget,
+    HANDLE hSurfaceCurrentLeft,
+    HANDLE hSurfaceTargetLeft,
+    PDD_FLIPDATA puFlipData
+);
+
+DWORD STDCALL NtGdiDdFlipToGDISurface(      
+    HANDLE hDirectDraw,
+    PDD_FLIPTOGDISURFACEDATA puFlipToGDISurfaceData
+);
+
+DWORD STDCALL NtGdiDdGetAvailDriverMemory(      
+    HANDLE hDirectDraw,
+    PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData
+);
+
+DWORD STDCALL NtGdiDdGetBltStatus(      
+    HANDLE hSurface,
+    PDD_GETBLTSTATUSDATA puGetBltStatusData
+);
+
+HDC STDCALL NtGdiDdGetDC(      
+    HANDLE hSurface,
+    PALETTEENTRY *puColorTable
+);
+
+DWORD STDCALL NtGdiDdGetDriverInfo(      
+    HANDLE hDirectDraw,
+    PDD_GETDRIVERINFODATA puGetDriverInfoData
+);
+
+DWORD STDCALL NtGdiDdGetDriverState(      
+    PDD_GETDRIVERSTATEDATA pdata
+);
+
+DWORD STDCALL NtGdiDdGetDxHandle(      
+    HANDLE hDirectDraw,
+    HANDLE hSurface,
+    BOOL bRelease
+);
+
+DWORD STDCALL NtGdiDdGetFlipStatus(      
+    HANDLE hSurface,
+    PDD_GETFLIPSTATUSDATA puGetFlipStatusData
+);
+
+DWORD STDCALL NtGdiDdGetInternalMoCompInfo(      
+    HANDLE hDirectDraw,
+    PDD_GETINTERNALMOCOMPDATA puGetInternalData
+);
+
+DWORD STDCALL NtGdiDdGetMoCompBuffInfo(      
+    HANDLE hDirectDraw,
+    PDD_GETMOCOMPCOMPBUFFDATA puGetBuffData
+);
+
+DWORD STDCALL NtGdiDdGetMoCompFormats(      
+    HANDLE hDirectDraw,
+    PDD_GETMOCOMPFORMATSDATA puGetMoCompFormatsData
+);
+
+DWORD STDCALL NtGdiDdGetMoCompGuids(      
+    HANDLE hDirectDraw,
+    PDD_GETMOCOMPGUIDSDATA puGetMoCompGuidsData
+);
+
+DWORD STDCALL NtGdiDdGetScanLine(      
+    HANDLE hDirectDraw,
+    PDD_GETSCANLINEDATA puGetScanLineData
+);
+
+DWORD STDCALL NtGdiDdLock(      
+    HANDLE hSurface,
+    PDD_LOCKDATA puLockData,
+    HDC hdcClip
+);
+
+DWORD STDCALL NtGdiDdLockD3D(      
+    HANDLE hSurface,
+    PDD_LOCKDATA puLockData
+);
+
+BOOL STDCALL NtGdiDdQueryDirectDrawObject(      
+    HANDLE hDirectDrawLocal,
+    DD_HALINFO *pHalInfo,
+    DWORD *pCallBackFlags,
+    PD3DNTHAL_CALLBACKS puD3dCallbacks,
+    PD3DNTHAL_GLOBALDRIVERDATA puD3dDriverData,
+    PDD_D3DBUFCALLBACKS puD3dBufferCallbacks,
+    LPDDSURFACEDESC puD3dTextureFormats,
+    DWORD *puNumHeaps,
+    VIDEOMEMORY *puvmList,
+    DWORD *puNumFourCC,
+    DWORD *puFourCC
+);
+
+DWORD STDCALL NtGdiDdQueryMoCompStatus(      
+    HANDLE hMoComp,
+    PDD_QUERYMOCOMPSTATUSDATA puQueryMoCompStatusData
+);
+
+BOOL STDCALL NtGdiDdReenableDirectDrawObject(      
+    HANDLE hDirectDrawLocal,
+    BOOL *pubNewMode
+);
+
+BOOL STDCALL NtGdiDdReleaseDC(      
+    HANDLE hSurface
+);
+
+DWORD STDCALL NtGdiDdRenderMoComp(      
+    HANDLE hMoComp,
+    PDD_RENDERMOCOMPDATA puRenderMoCompData
+);
+
+BOOL STDCALL NtGdiDdResetVisrgn(      
+    HANDLE hSurface,
+    HWND hwnd
+);
+
+DWORD STDCALL NtGdiDdSetColorKey(      
+    HANDLE hSurface,
+    PDD_SETCOLORKEYDATA puSetColorKeyData
+);
+
+DWORD STDCALL NtGdiDdSetExclusiveMode(      
+    HANDLE hDirectDraw,
+    PDD_SETEXCLUSIVEMODEDATA puSetExclusiveModeData
+);
+
+BOOL STDCALL NtGdiDdSetGammaRamp(      
+    HANDLE hDirectDraw,
+    HDC hdc,
+    LPVOID lpGammaRamp
+);
+
+DWORD STDCALL NtGdiDdSetOverlayPosition(      
+    HANDLE hSurfaceSource,
+    HANDLE hSurfaceDestination,
+    PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData
+);
+
+VOID STDCALL NtGdiDdUnattachSurface(      
+    HANDLE hSurface,
+    HANDLE hSurfaceAttached
+);
+
+DWORD STDCALL NtGdiDdUnlock(      
+    HANDLE hSurface,
+    PDD_UNLOCKDATA puUnlockData
+);
+
+DWORD STDCALL NtGdiDdUnlockD3D(      
+    HANDLE hSurface,
+    PDD_UNLOCKDATA puUnlockData
+);
+
+DWORD STDCALL NtGdiDdUpdateOverlay(      
+    HANDLE hSurfaceDestination,
+    HANDLE hSurfaceSource,
+    PDD_UPDATEOVERLAYDATA puUpdateOverlayData
+);
+
+DWORD STDCALL NtGdiDdWaitForVerticalBlank(      
+    HANDLE hDirectDraw,
+    PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData
+);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif // __D3D8THK_H

Modified: trunk/reactos/lib/gdi32/include/precomp.h
--- trunk/reactos/lib/gdi32/include/precomp.h	2005-07-28 18:34:01 UTC (rev 16833)
+++ trunk/reactos/lib/gdi32/include/precomp.h	2005-07-28 18:45:58 UTC (rev 16834)
@@ -18,10 +18,15 @@
 #include <prntfont.h>
 #include <ddrawgdi.h>
 #include <ndk/ntndk.h>
+#include <tchar.h>
 
 /* Win32K External Headers */
 #include <win32k/kapi.h>
 
+/* directdraw syscall */
+#include <ddentry.h>
+
+
 #define NtUserGetDCBrushColor(hbr) \
   (COLORREF)NtUserCallTwoParam((DWORD)(hbr), OBJ_BRUSH, TWOPARAM_ROUTINE_GETDCCOLOR)
 

Added: trunk/reactos/lib/gdi32/misc/gdientry.c
--- trunk/reactos/lib/gdi32/misc/gdientry.c	2005-07-28 18:34:01 UTC (rev 16833)
+++ trunk/reactos/lib/gdi32/misc/gdientry.c	2005-07-28 18:45:58 UTC (rev 16834)
@@ -0,0 +1,89 @@
+/*
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/*
+ * $Id:
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS GDI32
+ * PURPOSE:          Gdi DirectX inteface
+ * FILE:             lib/gdi32/misc/gdientry.c
+ * PROGRAMER:        Magnus Olsen (magnus@greatlord.com)
+ * REVISION HISTORY: 
+ * NOTES:            
+ */
+
+
+#include "precomp.h"
+static LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobalInternal;
+
+
+/*
+ * @implemented
+ *
+ * GDIEntry 1 
+ */
+BOOL STDCALL DdCreateDirectDrawObject( 
+LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal,
+HDC hdc)
+{  
+  HDC newHdc;
+  /* check see if HDC is NULL or not  
+     if it null we need create the DC */
+
+  if (hdc != NULL) 
+  {
+    pDirectDrawGlobal->hDD = (ULONG_PTR)NtGdiDdCreateDirectDrawObject(hdc); 
+    
+    /* if hDD ==NULL */
+    if (!pDirectDrawGlobal->hDD) 
+    {
+      return FALSE;
+    }
+    return TRUE;
+  }
+
+  /* The hdc was not null we need check see if we alread 
+     have create a directdraw handler */
+
+  /* if hDD !=NULL */
+  if (pDirectDrawGlobalInternal->hDD)
+  {
+    /* we have create a directdraw handler already */
+
+    pDirectDrawGlobal->hDD = pDirectDrawGlobalInternal->hDD;
+    return TRUE;
+  }
+
+  /* Now we create the DC */
+  newHdc = CreateDC(L"DISPLAY\0", NULL, NULL, NULL);
+
+  /* we are checking if we got a hdc or not */
+  if ((ULONG_PTR)newHdc != pDirectDrawGlobalInternal->hDD)
+  {
+    pDirectDrawGlobalInternal->hDD = (ULONG_PTR) NtGdiDdCreateDirectDrawObject(newHdc);
+    NtGdiDeleteDC(newHdc);
+  }
+
+   pDirectDrawGlobal->hDD = pDirectDrawGlobalInternal->hDD;
+
+  /* test see if we got a handler */
+  if (!pDirectDrawGlobalInternal->hDD)
+  {       
+    return FALSE;
+  }
+
+  return TRUE;
+}

Modified: trunk/reactos/lib/gdi32/misc/stubs.c
--- trunk/reactos/lib/gdi32/misc/stubs.c	2005-07-28 18:34:01 UTC (rev 16833)
+++ trunk/reactos/lib/gdi32/misc/stubs.c	2005-07-28 18:45:58 UTC (rev 16834)
@@ -3862,18 +3862,6 @@
 	return 0;
 }
 
-/*
- * @unimplemented
- */
-BOOL STDCALL DdCreateDirectDrawObject( 
-LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal,
-HDC hdc
-)
-{
-	UNIMPLEMENTED;
-	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-	return 0;
-}
 
 /*
  * @unimplemented