Index: boot/bootdata/packages/reactos.dff =================================================================== --- boot/bootdata/packages/reactos.dff (revision 43196) +++ boot/bootdata/packages/reactos.dff (working copy) @@ -153,7 +153,7 @@ dll\directx\dplayx\dplayx.dll 1 dll\directx\dsound\dsound.dll 1 dll\directx\dxdiagn\dxdiagn.dll 1 -dll\directx\wine\ddraw\ddraw.dll 1 +dll\directx\ddraw\ddraw.dll 1 dll\directx\d3d8thk\d3d8thk.dll 1 dll\directx\devenum\devenum.dll 1 dll\directx\ksproxy\ksproxy.ax 1 @@ -478,7 +478,6 @@ drivers\bus\isapnp\isapnp.sys 2 drivers\directx\dxapi\dxapi.sys 2 -drivers\directx\dxg\dxg.sys 2 drivers\directx\dxgthk\dxgthk.sys 2 drivers\filesystems\fs_rec\fs_rec.sys 2 @@ -659,6 +658,7 @@ subsystems\win32\csrss\win32csr\win32csr.dll 1 subsystems\ntvdm\ntvdm.exe 1 subsystems\win32\win32k\win32k.sys 1 +subsystems\win32\win32k\dxg\dxg.sys 2 ; Optional/proprietary files modules\optional\kvmnet.inf 6 optional Index: drivers/directx/directory.rbuild =================================================================== --- drivers/directx/directory.rbuild (revision 43196) +++ drivers/directx/directory.rbuild (working copy) @@ -4,9 +4,6 @@ - - - Index: drivers/directx/dxg/ddhmg.c =================================================================== --- drivers/directx/dxg/ddhmg.c (revision 43196) +++ drivers/directx/dxg/ddhmg.c (working copy) @@ -1,182 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Native driver for dxg implementation - * FILE: drivers/directx/dxg/ddhmg.c - * PROGRAMER: Magnus olsen (magnus@greatlord.com) - * REVISION HISTORY: - * 30/12-2007 Magnus Olsen - */ - -#include - -/* The DdHmgr manger stuff */ -ULONG gcSizeDdHmgr = 64 * sizeof(DD_ENTRY); -PDD_ENTRY gpentDdHmgr = NULL; - -ULONG gcMaxDdHmgr = 0; -PDD_ENTRY gpentDdHmgrLast = NULL; - -HANDLE ghFreeDdHmgr = 0; -HSEMAPHORE ghsemHmgr = NULL; - -BOOL -FASTCALL -VerifyObjectOwner(PDD_ENTRY pEntry) -{ - DWORD Pid = (DWORD) PsGetCurrentProcessId() & 0xFFFFFFFC; - DWORD check = pEntry->ObjectOwner.ulObj & 0xFFFFFFFE; - return ( (check == Pid) || (!check)); -} - -/*++ -* @name DdHmgCreate -* @implemented -* -* The function DdHmgCreate is used internally in dxg.sys -* It creates all DX kernel objects that are need it for creation of DX objects. -* -* @return -* Return FALSE for failure and TRUE for success in creating the DX object -* -* @remarks. -* Only used internally in dxg.sys -*--*/ -BOOL -FASTCALL -DdHmgCreate(VOID) -{ - gpentDdHmgr = EngAllocMem(FL_ZERO_MEMORY, gcSizeDdHmgr, TAG_THDD); - ghFreeDdHmgr = 0; - gcMaxDdHmgr = 1; - - if (gpentDdHmgr) - { - ghsemHmgr = EngCreateSemaphore(); - - if (ghsemHmgr) - { - gpLockShortDelay = EngAllocMem(FL_ZERO_MEMORY | FL_NONPAGED_MEMORY, sizeof(LARGE_INTEGER), TAG_GINI); - - if (gpLockShortDelay) - { - gpLockShortDelay->HighPart = -1; - return TRUE; - } - - EngDeleteSemaphore(ghsemHmgr); - ghsemHmgr = NULL; - } - - EngFreeMem(gpentDdHmgr); - gpentDdHmgr = NULL; - } - - return FALSE; -} - -/*++ -* @name DdHmgDestroy -* @implemented -* -* The function DdHmgDestroy is used internally in dxg.sys -* It destroys all DX kernel objects -* -* @return -* Always returns true, as a failure here would result in a BSOD. -* -* @remarks. -* Only used internally in dxg.sys -*--*/ -BOOL -FASTCALL -DdHmgDestroy(VOID) -{ - gcMaxDdHmgr = 0; - gcSizeDdHmgr = 0; - ghFreeDdHmgr = 0; - gpentDdHmgrLast = NULL; - - if (gpentDdHmgr) - { - EngFreeMem(gpentDdHmgr); - gpentDdHmgr = NULL; - } - - if (ghsemHmgr) - { - EngDeleteSemaphore(ghsemHmgr); - ghsemHmgr = NULL; - } - - return TRUE; -} - -/*++ -* @name DdHmgLock -* @implemented -* -* The function DdHmgLock is used internally in dxg.sys -* It locks a DX kernel object -* -* @param HANDLE DdHandle -* The handle we want locked -* -* @param UCHAR ObjectType -* The type of the object we expected the handle to contain -* value 0 is for ? -* value 1 is for EDD_DIRECTDRAW_LOCAL -* value 2 is for EDD_SURFACE -* value 3 is for ? -* value 4 is for EDD_VIDEOPORT -* value 5 is for EDD_MOTIONCOMP - -* @param BOOLEAN LockOwned -* If it needs to call EngAcquireSemaphore or not -* -* @return -* Returns an EDD_* object, or NULL if it fails -* -* @remarks. -* Only used internally in dxg.sys -*--*/ -PVOID -FASTCALL -DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned) -{ - - DWORD Index = (DWORD)DdHandle & 0x1FFFFF; - PDD_ENTRY pEntry = NULL; - PVOID Object = NULL; - - if ( !LockOwned ) - { - EngAcquireSemaphore(ghsemHmgr); - } - - if ( Index < gcMaxDdHmgr ) - { - pEntry = (PDD_ENTRY)((PBYTE)gpentDdHmgr + (sizeof(DD_ENTRY) * Index)); - if ( VerifyObjectOwner(pEntry) ) - { - /* FIXME - if ( (pEntry->Objt == ObjectType ) && - (pEntry->FullUnique == (((DWORD)DdHandle >> 21) & 0x7FF) ) && - (pEntry->pobj->cExclusiveLock == 0) && - (pEntry->pobj->Tid == PsGetCurrentThread())) - { - InterlockedIncrement(&pEntry->pobj->cExclusiveLock); - pEntry->pobj->Tid = PsGetCurrentThread(); - Object = pEntry->pobj; - } - */ - } - } - - if ( !LockOwned ) - { - EngDeleteSemaphore(ghsemHmgr); - } - - return Object; -} Index: drivers/directx/dxg/dxg.rbuild =================================================================== --- drivers/directx/dxg/dxg.rbuild (revision 43196) +++ drivers/directx/dxg/dxg.rbuild (working copy) @@ -1,14 +0,0 @@ - - - - - . - include - dxgthk - ntoskrnl - main.c - ddhmg.c - eng.c - historic.c - dxg.rc - Index: drivers/directx/dxg/dxg.rc =================================================================== --- drivers/directx/dxg/dxg.rc (revision 43196) +++ drivers/directx/dxg/dxg.rc (working copy) @@ -1,7 +0,0 @@ -/* $Id: vbemp.rc 21844 2006-05-07 19:34:23Z ion $ */ - -#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "DXG DirectX interface Device Driver\0" -#define REACTOS_STR_INTERNAL_NAME "dxg\0" -#define REACTOS_STR_ORIGINAL_FILENAME "dxg.sys\0" -#include Index: drivers/directx/dxg/dxg.spec =================================================================== --- drivers/directx/dxg/dxg.spec (revision 43196) +++ drivers/directx/dxg/dxg.spec (working copy) @@ -1,3 +0,0 @@ -@ stdcall DriverEntry(ptr ptr) -@ stdcall DxDdCleanupDxGraphics() -@ stdcall DxDdStartupDxGraphics(long ptr long ptr ptr ptr) Index: drivers/directx/dxg/dxg_driver.h =================================================================== --- drivers/directx/dxg/dxg_driver.h (revision 43196) +++ drivers/directx/dxg/dxg_driver.h (working copy) @@ -1,98 +0,0 @@ - - -DRVFN gaDxgFuncs [] = -{ - {DXG_INDEX_DxDxgGenericThunk, (PFN)DxDxgGenericThunk}, - //{DXG_INDEX_DxD3dContextCreate, (PFN)DxD3dContextCreate}, - //{DXG_INDEX_DxD3dContextDestroy, (PFN)DxD3dContextDestroy}, - //{DXG_INDEX_DxD3dContextDestroyAll, (PFN)DxD3dContextDestroyAll}, - //{DXG_INDEX_DxD3dValidateTextureStageState, (PFN)DxD3dValidateTextureStageState}, - //{DXG_INDEX_DxD3dDrawPrimitives2, (PFN)DxD3dDrawPrimitives2}, - //{DXG_INDEX_DxDdGetDriverState, (PFN)DxDdGetDriverState}, - //{DXG_INDEX_DxDdAddAttachedSurface, (PFN)DxDdAddAttachedSurface}, - //{DXG_INDEX_DxDdAlphaBlt, (PFN)DxDdAlphaBlt}, - //{DXG_INDEX_DxDdAttachSurface, (PFN)DxDdAttachSurface}, - //{DXG_INDEX_DxDdBeginMoCompFrame, (PFN)DxDdBeginMoCompFrame}, - //{DXG_INDEX_DxDdBlt, (PFN)DxDdBlt}, - //{DXG_INDEX_DxDdCanCreateSurface, (PFN)DxDdCanCreateSurface}, - //{DXG_INDEX_DxDdCanCreateD3DBuffer, (PFN)DxDdCanCreateD3DBuffer}, - //{DXG_INDEX_DxDdColorControl, (PFN)DxDdColorControl}, - //{DXG_INDEX_DxDdCreateDirectDrawObject, (PFN)DxDdCreateDirectDrawObject}, - //{DXG_INDEX_DxDdCreateSurface, (PFN)DxDdCreateD3DBuffer}, - //{DXG_INDEX_DxDdCreateD3DBuffer, (PFN)DxDdCreateD3DBuffer}, - //{DXG_INDEX_DxDdCreateMoComp, (PFN)DxDdCreateMoComp}, - //{DXG_INDEX_DxDdCreateSurfaceObject, (PFN)DxDdCreateSurfaceObject}, - //{DXG_INDEX_DxDdDeleteDirectDrawObject, (PFN)DxDdDeleteDirectDrawObject}, - //{DXG_INDEX_DxDdDeleteSurfaceObject, (PFN)DxDdDeleteSurfaceObject}, - //{DXG_INDEX_DxDdDestroyMoComp, (PFN)DxDdDestroyMoComp}, - //{DXG_INDEX_DxDdDestroySurface, (PFN)DxDdDestroySurface}, - //{DXG_INDEX_DxDdDestroyD3DBuffer, (PFN)DxDdDestroyD3DBuffer}, - //{DXG_INDEX_DxDdEndMoCompFrame, (PFN)DxDdEndMoCompFrame}, - //{DXG_INDEX_DxDdFlip, (PFN)DxDdFlip}, - //{DXG_INDEX_DxDdFlipToGDISurface, (PFN)DxDdFlipToGDISurface}, - //{DXG_INDEX_DxDdGetAvailDriverMemory, (PFN)DxDdGetAvailDriverMemory}, - //{DXG_INDEX_DxDdGetBltStatus, (PFN)DxDdGetBltStatus}, - //{DXG_INDEX_DxDdGetDC, (PFN)DxDdGetDC}, - //{DXG_INDEX_DxDdGetDriverInfo, (PFN)DxDdGetDriverInfo}, - //{DXG_INDEX_DxDdGetDxHandle, (PFN)DxDdGetDxHandle}, - //{DXG_INDEX_DxDdGetFlipStatus, (PFN)DxDdGetFlipStatus}, - //{DXG_INDEX_DxDdGetInternalMoCompInfo, (PFN)DxDdGetInternalMoCompInfo}, - //{DXG_INDEX_DxDdGetMoCompBuffInfo, (PFN)DxDdGetMoCompBuffInfo}, - //{DXG_INDEX_DxDdGetMoCompGuids, (PFN)DxDdGetMoCompGuids}, - //{DXG_INDEX_DxDdGetMoCompFormats, (PFN)DxDdGetMoCompFormats}, - //{DXG_INDEX_DxDdGetScanLine, (PFN)DxDdGetScanLine}, - //{DXG_INDEX_DxDdLock, (PFN)DxDdLock}, - //{DXG_INDEX_DxDdLockD3D, (PFN)DxDdLockD3D}, - //{DXG_INDEX_DxDdQueryDirectDrawObject, (PFN)DxDdQueryDirectDrawObject}, - //{DXG_INDEX_DxDdQueryMoCompStatus, (PFN)DxDdQueryMoCompStatus}, - //{DXG_INDEX_DxDdReenableDirectDrawObject, (PFN)DxDdReenableDirectDrawObject}, - //{DXG_INDEX_DxDdReleaseDC, (PFN)DxDdReleaseDC}, - //{DXG_INDEX_DxDdRenderMoComp, (PFN)DxDdRenderMoComp}, - //{DXG_INDEX_DxDdResetVisrgn, (PFN)DxDdResetVisrgn}, - //{DXG_INDEX_DxDdSetColorKey, (PFN)DxDdSetColorKey}, - //{DXG_INDEX_DxDdSetExclusiveMode, (PFN)DxDdSetExclusiveMode}, - //{DXG_INDEX_DxDdSetGammaRamp, (PFN)DxDdSetGammaRamp}, - //{DXG_INDEX_DxDdCreateSurfaceEx, (PFN)DxDdCreateSurfaceEx}, - //{DXG_INDEX_DxDdSetOverlayPosition, (PFN)DxDdSetOverlayPosition}, - //{DXG_INDEX_DxDdUnattachSurface, (PFN)DxDdUnattachSurface}, - //{DXG_INDEX_DxDdUnlock, (PFN)DxDdUnlock}, - //{DXG_INDEX_DxDdUnlockD3D2, (PFN)DxDdUnlockD3D}, - //{DXG_INDEX_DxDdUpdateOverlay, (PFN)DxDdUpdateOverlay}, - //{DXG_INDEX_DxDdWaitForVerticalBlank, (PFN)DxDdWaitForVerticalBlank}, - //{DXG_INDEX_DxDvpCanCreateVideoPort, (PFN)DxDvpCanCreateVideoPort}, - //{DXG_INDEX_DxDvpColorControl, (PFN)DxDvpColorControl}, - //{DXG_INDEX_DxDvpCreateVideoPort, (PFN)DxDvpCreateVideoPort}, - //{DXG_INDEX_DxDvpDestroyVideoPort, (PFN)DxDvpDestroyVideoPort}, - //{DXG_INDEX_DxDvpFlipVideoPort, (PFN)DxDvpFlipVideoPort}, - //{DXG_INDEX_DxDvpGetVideoPortBandwidth, (PFN)DxDvpGetVideoPortBandwidth}, - //{DXG_INDEX_DxDvpGetVideoPortField, (PFN)DxDvpGetVideoPortField}, - //{DXG_INDEX_DxDvpGetVideoPortFlipStatus, (PFN)DxDvpGetVideoPortFlipStatus}, - //{DXG_INDEX_DxDvpGetVideoPortInputFormats, (PFN)DxDvpGetVideoPortInputFormats}, - //{DXG_INDEX_DxDvpGetVideoPortLine, (PFN)DxDvpGetVideoPortLine}, - //{DXG_INDEX_DxDvpGetVideoPortOutputFormats, (PFN)DxDvpGetVideoPortOutputFormats}, - //{DXG_INDEX_DxDvpGetVideoPortConnectInfo, (PFN)DxDvpGetVideoPortConnectInfo}, - //{DXG_INDEX_DxDvpGetVideoSignalStatus, (PFN)DxDvpGetVideoSignalStatus}, - //{DXG_INDEX_DxDvpUpdateVideoPort, (PFN)DxDvpUpdateVideoPort}, - //{DXG_INDEX_DxDvpWaitForVideoPortSync, (PFN)DxDvpWaitForVideoPortSync}, - //{DXG_INDEX_DxDvpAcquireNotification, (PFN)DxDvpAcquireNotification}, - //{DXG_INDEX_DxDvpReleaseNotification, (PFN)DxDvpReleaseNotification}, - //{DXG_INDEX_DxDdHeapVidMemAllocAligned, (PFN)DxDdHeapVidMemAllocAligned}, - //{DXG_INDEX_DxDdHeapVidMemFree, (PFN)DxDdHeapVidMemFree}, - //{DXG_INDEX_DxDdEnableDirectDraw, (PFN)DxDdEnableDirectDraw}, - //{DXG_INDEX_DxDdDisableDirectDraw, (PFN)DxDdDisableDirectDraw}, - //{DXG_INDEX_DxDdSuspendDirectDraw, (PFN)DxDdSuspendDirectDraw}, - //{DXG_INDEX_DxDdResumeDirectDraw, (PFN)DxDdResumeDirectDraw}, - //{DXG_INDEX_DxDdDynamicModeChange, (PFN)DxDdDynamicModeChange}, - //{DXG_INDEX_DxDdCloseProcess, (PFN)DxDdCloseProcess}, - //{DXG_INDEX_DxDdGetDirectDrawBound, (PFN)DxDdGetDirectDrawBound}, - //{DXG_INDEX_DxDdEnableDirectDrawRedirection, (PFN)DxDdEnableDirectDrawRedirection}, - //{DXG_INDEX_DxDdAllocPrivateUserMem, (PFN)DxDdAllocPrivateUserMem}, - //{DXG_INDEX_DxDdFreePrivateUserMem, (PFN)DxDdFreePrivateUserMem}, - {DXG_INDEX_DxDdLockDirectDrawSurface, (PFN)DxDdLockDirectDrawSurface}, - {DXG_INDEX_DxDdUnlockDirectDrawSurface, (PFN)DxDdUnlockDirectDrawSurface}, - //{DXG_INDEX_DxDdSetAccelLevel, (PFN)DxDdSetAccelLevel}, - //{DXG_INDEX_DxDdGetSurfaceLock, (PFN)DxDdGetSurfaceLock}, - //{DXG_INDEX_DxDdEnumLockedSurfaceRect, (PFN)DxDdEnumLockedSurfaceRect}, - {DXG_INDEX_DxDdIoctl, (PFN)DxDdIoctl} - -}; Index: drivers/directx/dxg/dxg_int.h =================================================================== --- drivers/directx/dxg/dxg_int.h (revision 43196) +++ drivers/directx/dxg/dxg_int.h (working copy) @@ -1,112 +0,0 @@ -/* DDK/NDK/SDK Headers */ -#include -#include -#include -#include -#include - -/* Win32 Headers */ -#define WINBASEAPI -#define STARTF_USESIZE 2 -#define STARTF_USEPOSITION 4 -#define INTERNAL_CALL NTAPI -#define NT_BUILD_ENVIRONMENT - -#include -#include -#include -#include -#include -#include -#include - -/* DXG treats this as opaque */ -typedef PVOID PDC; -typedef PVOID PW32THREAD; - -typedef struct _DD_BASEOBJECT -{ - HGDIOBJ hHmgr; - ULONG ulShareCount; - USHORT cExclusiveLock; - USHORT BaseFlags; - PW32THREAD Tid; -} DD_BASEOBJECT, *PDD_BASEOBJECT; - -#include -#include -#include - -#include "tags.h" - -#define ObjType_DDSURFACE_TYPE 2 -#define ObjType_DDVIDEOPORT_TYPE 4 -#define ObjType_DDMOTIONCOMP_TYPE 5 - - typedef struct _DD_ENTRY -{ - union - { - PDD_BASEOBJECT pobj; - HANDLE hFree; - }; - union - { - ULONG ulObj; - struct - { - USHORT Count; - USHORT Lock; - HANDLE Pid; - }; - } ObjectOwner; - USHORT FullUnique; - UCHAR Objt; - UCHAR Flags; - PVOID pUser; -} DD_ENTRY, *PDD_ENTRY; - -typedef struct _EDD_SURFACE_LOCAL -{ - DD_BASEOBJECT Object; - DD_SURFACE_LOCAL Surfacelcl; -} EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL; - -/* exported functions */ -NTSTATUS NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2); -NTSTATUS NTAPI GsDriverEntry(IN PVOID Context1, IN PVOID Context2); -NTSTATUS APIENTRY DxDdCleanupDxGraphics(VOID); - -/* Global pointers */ -extern ULONG gcSizeDdHmgr; -extern PDD_ENTRY gpentDdHmgr; -extern ULONG gcMaxDdHmgr; -extern PDD_ENTRY gpentDdHmgrLast; -extern HANDLE ghFreeDdHmgr; -extern HSEMAPHORE ghsemHmgr; -extern LONG gcDummyPageRefCnt; -extern HSEMAPHORE ghsemDummyPage; -extern VOID *gpDummyPage; -extern PEPROCESS gpepSession; -extern PLARGE_INTEGER gpLockShortDelay; - -/* Driver list export functions */ -DWORD NTAPI DxDxgGenericThunk(ULONG_PTR ulIndex, ULONG_PTR ulHandle, SIZE_T *pdwSizeOfPtr1, PVOID pvPtr1, SIZE_T *pdwSizeOfPtr2, PVOID pvPtr2); -DWORD NTAPI DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize); -PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface); -BOOL NTAPI DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface); - -/* Internal functions */ -BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry); -BOOL FASTCALL DdHmgCreate(VOID); -BOOL FASTCALL DdHmgDestroy(VOID); -PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned); - -/* define stuff */ -#define drvDxEngLockDC gpEngFuncs[DXENG_INDEX_DxEngLockDC] -#define drvDxEngGetDCState gpEngFuncs[DXENG_INDEX_DxEngGetDCState] -#define drvDxEngGetHdevData gpEngFuncs[DXENG_INDEX_DxEngGetHdevData] -#define drvDxEngUnlockDC gpEngFuncs[DXENG_INDEX_DxEngUnlockDC] -#define drvDxEngUnlockHdev gpEngFuncs[DXENG_INDEX_DxEngUnlockHdev] -#define drvDxEngLockHdev gpEngFuncs[DXENG_INDEX_DxEngLockHdev] - Index: drivers/directx/dxg/eng.c =================================================================== --- drivers/directx/dxg/eng.c (revision 43196) +++ drivers/directx/dxg/eng.c (working copy) @@ -1,54 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Native driver for dxg implementation - * FILE: drivers/directx/dxg/main.c - * PROGRAMER: Magnus olsen (magnus@greatlord.com) - * REVISION HISTORY: - * 30/12-2007 Magnus Olsen - */ - - -#include - - -PDD_SURFACE_LOCAL -NTAPI -DxDdLockDirectDrawSurface(HANDLE hDdSurface) -{ - PEDD_SURFACE pEDDSurface = NULL; - PDD_SURFACE_LOCAL pSurfacelcl = NULL; - - pEDDSurface = DdHmgLock(hDdSurface, ObjType_DDSURFACE_TYPE, FALSE); - if (pEDDSurface != NULL) - { - pSurfacelcl = &pEDDSurface->ddsSurfaceLocal; - } - - return pSurfacelcl; -} - -BOOL -NTAPI -DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface) -{ - BOOL retVal = FALSE; - PEDD_SURFACE pEDDSurface = NULL; - - if (pSurface) - { - pEDDSurface = (PEDD_SURFACE)( ((PBYTE)pSurface) - sizeof(DD_BASEOBJECT)); - // InterlockedDecrement(&pEDDSurface->pobj.cExclusiveLock); - retVal = TRUE; - } - - return retVal; -} - - - - - - - - Index: drivers/directx/dxg/historic.c =================================================================== --- drivers/directx/dxg/historic.c (revision 43196) +++ drivers/directx/dxg/historic.c (working copy) @@ -1,88 +0,0 @@ - -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Native driver for dxg implementation - * FILE: drivers/directx/dxg/main.c - * PROGRAMER: Magnus olsen (magnus@greatlord.com) - * REVISION HISTORY: - * 15/10-2007 Magnus Olsen - */ - -#include - -/*++ -* @name DxDxgGenericThunk -* @implemented -* -* The function DxDxgGenericThunk redirects DirectX calls to other functions. -* -* @param ULONG_PTR ulIndex -* The functions we want redirct -* -* @param ULONG_PTR ulHandle -* Unknown -* -* @param SIZE_T *pdwSizeOfPtr1 -* Unknown -* -* @param PVOID pvPtr1 -* Unknown -* -* @param SIZE_T *pdwSizeOfPtr2 -* Unknown -* -* @param PVOID pvPtr2 -* Unknown -* -* @return -* Always returns DDHAL_DRIVER_NOTHANDLED -* -* @remarks. -* This function is no longer used in Windows NT 2000/XP/2003 -* -*--*/ -DWORD -NTAPI -DxDxgGenericThunk(ULONG_PTR ulIndex, - ULONG_PTR ulHandle, - SIZE_T *pdwSizeOfPtr1, - PVOID pvPtr1, - SIZE_T *pdwSizeOfPtr2, - PVOID pvPtr2) -{ - return DDHAL_DRIVER_NOTHANDLED; -} - - -/*++ -* @name DxDdIoctl -* @implemented -* -* The function DxDdIoctl is the ioctl call to diffent DirectX functions -* -* @param ULONG ulIoctl -* The ioctl code that we want call to -* -* @param PVOID pBuffer -* Our in or out buffer with data to the ioctl code we are using -* -* @param ULONG ulBufferSize -* The buffer size in bytes -* -* @return -* Always returns DDERR_UNSUPPORTED -* -* @remarks. -* This function is no longer used in Windows NT 2000/XP/2003 -* -*--*/ -DWORD -NTAPI -DxDdIoctl(ULONG ulIoctl, - PVOID pBuffer, - ULONG ulBufferSize) -{ - return DDERR_UNSUPPORTED; -} - Index: drivers/directx/dxg/main.c =================================================================== --- drivers/directx/dxg/main.c (revision 43196) +++ drivers/directx/dxg/main.c (working copy) @@ -1,138 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Native driver for dxg implementation - * FILE: drivers/directx/dxg/main.c - * PROGRAMER: Magnus olsen (magnus@greatlord.com) - * REVISION HISTORY: - * 15/10-2007 Magnus Olsen - */ - - -#include -#include "dxg_driver.h" - -LONG gcDummyPageRefCnt = 0; -HSEMAPHORE ghsemDummyPage = NULL; -VOID *gpDummyPage = NULL; -PEPROCESS gpepSession = NULL; -PLARGE_INTEGER gpLockShortDelay = NULL; - - -PDRVFN gpEngFuncs; -const ULONG gcDxgFuncs = DXG_INDEX_DxDdIoctl + 1; - - - -NTSTATUS NTAPI -DriverEntry(IN PVOID Context1, - IN PVOID Context2) -{ - return 0; -} - -NTSTATUS -APIENTRY -DxDdStartupDxGraphics (ULONG SizeEngDrv, - PDRVENABLEDATA pDxEngDrv, - ULONG SizeDxgDrv, - PDRVENABLEDATA pDxgDrv, - PULONG DirectDrawContext, - PEPROCESS Proc ) -{ - - PDRVFN drv_func; - UINT i; - - /* Test see if the data is vaild we got from win32k.sys */ - if ((SizeEngDrv != sizeof(DRVENABLEDATA)) || - (SizeDxgDrv != sizeof(DRVENABLEDATA))) - { - return STATUS_BUFFER_TOO_SMALL; - } - - /* rest static value */ - gpDummyPage = NULL; - gcDummyPageRefCnt = 0; - ghsemDummyPage = NULL; - - /* - * Setup internal driver functions list we got from dxg driver functions list - */ - pDxgDrv->iDriverVersion = 0x80000; /* Note 12/1-2004 : DirectX 8 ? */ - pDxgDrv->c = gcDxgFuncs; - pDxgDrv->pdrvfn = gaDxgFuncs; - - /* check how many driver functions and fail if the value does not match */ - if (pDxEngDrv->c != DXENG_INDEX_DxEngLoadImage + 1) - { - return STATUS_INTERNAL_ERROR; - } - - /* - * Check if all drv functions are sorted right - * and if it really are exported - */ - - for (i=1 ; i < DXENG_INDEX_DxEngLoadImage + 1; i++) - { - drv_func = &pDxEngDrv->pdrvfn[i]; - - if ((drv_func->iFunc != i) || - (drv_func->pfn == NULL)) - { - return STATUS_INTERNAL_ERROR; - } - } - - gpEngFuncs = pDxEngDrv->pdrvfn; - - /* Note 12/1-2004 : Why is this set to 0x618 */ - *DirectDrawContext = 0x618; - - if (DdHmgCreate()) - { - ghsemDummyPage = EngCreateSemaphore(); - - if (ghsemDummyPage) - { - gpepSession = Proc; - return STATUS_SUCCESS; - } - } - - DdHmgDestroy(); - - if (ghsemDummyPage) - { - EngDeleteSemaphore(ghsemDummyPage); - ghsemDummyPage = 0; - } - - return STATUS_NO_MEMORY; -} - - - - -NTSTATUS -APIENTRY -DxDdCleanupDxGraphics(VOID) -{ - DdHmgDestroy(); - - if (ghsemDummyPage != 0 ) - { - if (gpDummyPage != 0 ) - { - ExFreePoolWithTag(gpDummyPage,0); - gpDummyPage = NULL; - gcDummyPageRefCnt = 0; - } - EngDeleteSemaphore(ghsemDummyPage); - ghsemDummyPage = 0; - } - - return 0; -} - Index: drivers/directx/dxg/tags.h =================================================================== --- drivers/directx/dxg/tags.h (revision 43196) +++ drivers/directx/dxg/tags.h (working copy) @@ -1,8 +0,0 @@ - - - -#define TAG_THDD 'ddht' -#define TAG_GINI 'iniG' - - - Index: include/reactos/win32k/ntgdityp.h =================================================================== --- include/reactos/win32k/ntgdityp.h (revision 43196) +++ include/reactos/win32k/ntgdityp.h (working copy) @@ -731,4 +731,16 @@ ASSERT_PFN(Notify); ASSERT_PFN(SynchronizeSurface); +/* Every GDI Object must have this standard type of header. + * It's for thread locking. */ +typedef struct _BASEOBJECT +{ + HGDIOBJ hHmgr; + ULONG ulShareCount; + USHORT cExclusiveLock; + USHORT BaseFlags; + struct _THREADINFO *Tid; +} BASEOBJECT, *POBJ; + + #endif Index: subsystems/win32/win32k/dxg/dxg_int.h =================================================================== --- subsystems/win32/win32k/dxg/dxg_int.h (revision 43196) +++ subsystems/win32/win32k/dxg/dxg_int.h (working copy) @@ -37,6 +37,9 @@ #include #include +#include +#include "../include/pdevobj.h" + #include "tags.h" #define ObjType_DDSURFACE_TYPE 2 @@ -95,6 +98,7 @@ DWORD NTAPI DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize); PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface); BOOL NTAPI DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface); +BOOL NTAPI DxDdEnableDirectDraw(PPDEVOBJ ppdevobj, BOOL unknown); /* Internal functions */ BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry); Index: subsystems/win32/win32k/dxg/eng.c =================================================================== --- subsystems/win32/win32k/dxg/eng.c (revision 43196) +++ subsystems/win32/win32k/dxg/eng.c (working copy) @@ -9,9 +9,12 @@ */ -#include +#include "dxg_int.h" +#define NDEBUG +#include + PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface) @@ -46,9 +49,73 @@ } +BOOL +NTAPI +DxDdEnableDirectDraw(PPDEVOBJ ppdevobj, BOOL unknown) +{ + PEDD_DIRECTDRAW_GLOBAL pEDDgpl = ppdevobj->pEDDgpl ; + PFN_DrvEnableDirectDraw pEnableDirectDraw = NULL ; + PFN_DrvGetDirectDrawInfo pGetDirectDrawInfo = NULL ; + PFN_DrvDisableDirectDraw pDisableDirectDraw = NULL ; + /*Some Checks*/ + if(!pEDDgpl->ddCallbacks.dwSize < sizeof(DD_CALLBACKS)) + return FALSE ; + if(!pEDDgpl->ddSurfaceCallbacks.dwSize < sizeof(DD_SURFACECALLBACKS)) + return FALSE ; + if(!pEDDgpl->ddPaletteCallbacks.dwSize < sizeof(DD_PALETTECALLBACKS)) + return FALSE ; + if(!pEDDgpl->ddHalInfo.dwSize < sizeof(DD_HALINFO)) + return FALSE ; + /*Initialize callbacks*/ + pEnableDirectDraw = ppdevobj->DriverFunctions.EnableDirectDraw ; + pDisableDirectDraw = ppdevobj->DriverFunctions.DisableDirectDraw ; + if(!pEnableDirectDraw || !pDisableDirectDraw) + { + /*This should really not happen*/ + DPRINT1("No EnableDirectDraw or DisableDirectDraw callbacks... OUCH!\n") ; + return FALSE ; + } + if(!pEnableDirectDraw(ppdevobj->dhpdev, + &pEDDgpl->ddCallbacks, + &pEDDgpl->ddSurfaceCallbacks, + &pEDDgpl->ddPaletteCallbacks)) + { + DPRINT1("Driver's EnableDirectDraw FAILED!!!\n") ; + return FALSE ; + } + pGetDirectDrawInfo = ppdevobj->DriverFunctions.GetDirectDrawInfo ; + /* Retrieve information */ + if(!pGetDirectDrawInfo || !pGetDirectDrawInfo(ppdevobj->dhpdev, + &pEDDgpl->ddHalInfo, + &pEDDgpl->dwNumHeaps, + NULL, + &pEDDgpl->dwNumFourCC, + NULL)) + { + DPRINT1("Wrong call to GetDirectDrawInfo?\n") ; + pDisableDirectDraw(ppdevobj->dhpdev) ; + return FALSE ; + } + pEDDgpl->pvmList = ExAllocatePoolWithTag(PagedPool, pEDDgpl->dwNumHeaps*sizeof(VIDEOMEMORY), TAG_EDDGBL) ; + pEDDgpl->pdwFourCC = ExAllocatePoolWithTag(PagedPool, pEDDgpl->dwNumFourCC*sizeof(DWORD), TAG_EDDGBL) ; + if(!pEDDgpl->pvmList || !pEDDgpl->pdwFourCC) { + DPRINT1("Failed to allocate memory!!\n"); + pDisableDirectDraw(ppdevobj->dhpdev) ; + return FALSE ; + } - - - + if(!pGetDirectDrawInfo(ppdevobj->dhpdev, + &pEDDgpl->ddHalInfo, + &pEDDgpl->dwNumHeaps, + pEDDgpl->pvmList, + &pEDDgpl->dwNumFourCC, + pEDDgpl->pdwFourCC)) + { + DPRINT1("Uh? Second call to GetDirectDrawInfo failed...\n") ; + pDisableDirectDraw(ppdevobj->dhpdev) ; + return FALSE ; + } + return TRUE; +} Index: subsystems/win32/win32k/dxg/main.c =================================================================== --- subsystems/win32/win32k/dxg/main.c (revision 43196) +++ subsystems/win32/win32k/dxg/main.c (working copy) @@ -10,8 +10,107 @@ #include -#include "dxg_driver.h" + + +DRVFN gaDxgFuncs [] = +{ + {DXG_INDEX_DxDxgGenericThunk, (PFN)DxDxgGenericThunk}, + {DXG_INDEX_DxD3dContextCreate, (PFN)NULL}, + {DXG_INDEX_DxD3dContextDestroy, (PFN)NULL}, + {DXG_INDEX_DxD3dContextDestroyAll, (PFN)NULL}, + {DXG_INDEX_DxD3dValidateTextureStageState, (PFN)NULL}, + {DXG_INDEX_DxD3dDrawPrimitives2, (PFN)NULL}, + {DXG_INDEX_DxDdGetDriverState, (PFN)NULL}, + {DXG_INDEX_DxDdAddAttachedSurface, (PFN)NULL}, + {DXG_INDEX_DxDdAlphaBlt, (PFN)NULL}, + {DXG_INDEX_DxDdAttachSurface, (PFN)NULL}, + {DXG_INDEX_DxDdBeginMoCompFrame, (PFN)NULL}, + {DXG_INDEX_DxDdBlt, (PFN)NULL}, + {DXG_INDEX_DxDdCanCreateSurface, (PFN)NULL}, + {DXG_INDEX_DxDdCanCreateD3DBuffer, (PFN)NULL}, + {DXG_INDEX_DxDdColorControl, (PFN)NULL}, + {DXG_INDEX_DxDdCreateDirectDrawObject, (PFN)NULL}, + {DXG_INDEX_DxDdCreateSurface, (PFN)NULL}, + {DXG_INDEX_DxDdCreateD3DBuffer, (PFN)NULL}, + {DXG_INDEX_DxDdCreateMoComp, (PFN)NULL}, + {DXG_INDEX_DxDdCreateSurfaceObject, (PFN)NULL}, + {DXG_INDEX_DxDdDeleteDirectDrawObject, (PFN)NULL}, + {DXG_INDEX_DxDdDeleteSurfaceObject, (PFN)NULL}, + {DXG_INDEX_DxDdDestroyMoComp, (PFN)NULL}, + {DXG_INDEX_DxDdDestroySurface, (PFN)NULL}, + {DXG_INDEX_DxDdDestroyD3DBuffer, (PFN)NULL}, + {DXG_INDEX_DxDdEndMoCompFrame, (PFN)NULL}, + {DXG_INDEX_DxDdFlip, (PFN)NULL}, + {DXG_INDEX_DxDdFlipToGDISurface, (PFN)NULL}, + {DXG_INDEX_DxDdGetAvailDriverMemory, (PFN)NULL}, + {DXG_INDEX_DxDdGetBltStatus, (PFN)NULL}, + {DXG_INDEX_DxDdGetDC, (PFN)NULL}, + {DXG_INDEX_DxDdGetDriverInfo, (PFN)NULL}, + {DXG_INDEX_DxDdGetDxHandle, (PFN)NULL}, + {DXG_INDEX_DxDdGetFlipStatus, (PFN)NULL}, + {DXG_INDEX_DxDdGetInternalMoCompInfo, (PFN)NULL}, + {DXG_INDEX_DxDdGetMoCompBuffInfo, (PFN)NULL}, + {DXG_INDEX_DxDdGetMoCompGuids, (PFN)NULL}, + {DXG_INDEX_DxDdGetMoCompFormats, (PFN)NULL}, + {DXG_INDEX_DxDdGetScanLine, (PFN)NULL}, + {DXG_INDEX_DxDdLock, (PFN)NULL}, + {DXG_INDEX_DxDdLockD3D, (PFN)NULL}, + {DXG_INDEX_DxDdQueryDirectDrawObject, (PFN)NULL}, + {DXG_INDEX_DxDdQueryMoCompStatus, (PFN)NULL}, + {DXG_INDEX_DxDdReenableDirectDrawObject, (PFN)NULL}, + {DXG_INDEX_DxDdReleaseDC, (PFN)NULL}, + {DXG_INDEX_DxDdRenderMoComp, (PFN)NULL}, + {DXG_INDEX_DxDdResetVisrgn, (PFN)NULL}, + {DXG_INDEX_DxDdSetColorKey, (PFN)NULL}, + {DXG_INDEX_DxDdSetExclusiveMode, (PFN)NULL}, + {DXG_INDEX_DxDdSetGammaRamp, (PFN)NULL}, + {DXG_INDEX_DxDdCreateSurfaceEx, (PFN)NULL}, + {DXG_INDEX_DxDdSetOverlayPosition, (PFN)NULL}, + {DXG_INDEX_DxDdUnattachSurface, (PFN)NULL}, + {DXG_INDEX_DxDdUnlock, (PFN)NULL}, + {DXG_INDEX_DxDdUnlockD3D, (PFN)NULL}, + {DXG_INDEX_DxDdUpdateOverlay, (PFN)NULL}, + {DXG_INDEX_DxDdWaitForVerticalBlank, (PFN)NULL}, + {DXG_INDEX_DxDvpCanCreateVideoPort, (PFN)NULL}, + {DXG_INDEX_DxDvpColorControl, (PFN)NULL}, + {DXG_INDEX_DxDvpCreateVideoPort, (PFN)NULL}, + {DXG_INDEX_DxDvpDestroyVideoPort, (PFN)NULL}, + {DXG_INDEX_DxDvpFlipVideoPort, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortBandwidth, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortField, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortFlipStatus, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortInputFormats, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortLine, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortOutputFormats, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoPortConnectInfo, (PFN)NULL}, + {DXG_INDEX_DxDvpGetVideoSignalStatus, (PFN)NULL}, + {DXG_INDEX_DxDvpUpdateVideoPort, (PFN)NULL}, + {DXG_INDEX_DxDvpWaitForVideoPortSync, (PFN)NULL}, + {DXG_INDEX_DxDvpAcquireNotification, (PFN)NULL}, + {DXG_INDEX_DxDvpReleaseNotification, (PFN)NULL}, + {DXG_INDEX_DxDdHeapVidMemAllocAligned, (PFN)NULL}, + {DXG_INDEX_DxDdHeapVidMemFree, (PFN)NULL}, + {DXG_INDEX_DxDdEnableDirectDraw, (PFN)DxDdEnableDirectDraw}, + {DXG_INDEX_DxDdDisableDirectDraw, (PFN)NULL}, + {DXG_INDEX_DxDdSuspendDirectDraw, (PFN)NULL}, + {DXG_INDEX_DxDdResumeDirectDraw, (PFN)NULL}, + {DXG_INDEX_DxDdDynamicModeChange, (PFN)NULL}, + {DXG_INDEX_DxDdCloseProcess, (PFN)NULL}, + {DXG_INDEX_DxDdGetDirectDrawBound, (PFN)NULL}, + {DXG_INDEX_DxDdEnableDirectDrawRedirection, (PFN)NULL}, + {DXG_INDEX_DxDdAllocPrivateUserMem, (PFN)NULL}, + {DXG_INDEX_DxDdFreePrivateUserMem, (PFN)NULL}, + {DXG_INDEX_DxDdLockDirectDrawSurface, (PFN)DxDdLockDirectDrawSurface}, + {DXG_INDEX_DxDdUnlockDirectDrawSurface, (PFN)DxDdUnlockDirectDrawSurface}, + {DXG_INDEX_DxDdSetAccelLevel, (PFN)NULL}, + {DXG_INDEX_DxDdGetSurfaceLock, (PFN)NULL}, + {DXG_INDEX_DxDdEnumLockedSurfaceRect, (PFN)NULL}, + {DXG_INDEX_DxDdIoctl, (PFN)DxDdIoctl} + +}; + + LONG gcDummyPageRefCnt = 0; HSEMAPHORE ghsemDummyPage = NULL; VOID *gpDummyPage = NULL; Index: subsystems/win32/win32k/dxg/tags.h =================================================================== --- subsystems/win32/win32k/dxg/tags.h (revision 43196) +++ subsystems/win32/win32k/dxg/tags.h (working copy) @@ -1,6 +1,6 @@ - +#define TAG_EDDGBL 'GDDE' #define TAG_THDD 'ddht' #define TAG_GINI 'iniG' Index: subsystems/win32/win32k/include/gdiobj.h =================================================================== --- subsystems/win32/win32k/include/gdiobj.h (revision 43196) +++ subsystems/win32/win32k/include/gdiobj.h (working copy) @@ -36,17 +36,6 @@ typedef BOOL (INTERNAL_CALL *GDICLEANUPPROC)(PVOID ObjectBody); -/* Every GDI Object must have this standard type of header. - * It's for thread locking. */ -typedef struct _BASEOBJECT -{ - HGDIOBJ hHmgr; - ULONG ulShareCount; - USHORT cExclusiveLock; - USHORT BaseFlags; - PTHREADINFO Tid; -} BASEOBJECT, *POBJ; - typedef struct _CLIENTOBJ { BASEOBJECT BaseObject; @@ -87,7 +76,7 @@ BOOL FASTCALL IntGdiSetDCOwnerEx( HDC, DWORD, BOOL); /*! - * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked. + * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked. * You should unlock the object * as soon as you don't need to have access to it's data. Index: subsystems/win32/win32k/include/pdevobj.h =================================================================== --- subsystems/win32/win32k/include/pdevobj.h (revision 43196) +++ subsystems/win32/win32k/include/pdevobj.h (working copy) @@ -30,9 +30,9 @@ SIZEL Size; POINTL HotSpot; XLATEOBJ *XlateObject; - SURFACE *psurfColor; - SURFACE *psurfMask; - SURFACE *psurfSave; + struct _SURFACE *psurfColor; + struct _SURFACE *psurfMask; + struct _SURFACE *psurfSave; int ShowPointer; /* counter negtive do not show the mouse postive show the mouse */ /* public pointer information */ Index: subsystems/win32/win32k/ntddraw/ddraw.c =================================================================== --- subsystems/win32/win32k/ntddraw/ddraw.c (revision 43196) +++ subsystems/win32/win32k/ntddraw/ddraw.c (working copy) @@ -76,6 +76,7 @@ pDev->pEDDgpl->ddCallbacks.dwSize = sizeof(DD_CALLBACKS); pDev->pEDDgpl->ddSurfaceCallbacks.dwSize = sizeof(DD_SURFACECALLBACKS); pDev->pEDDgpl->ddPaletteCallbacks.dwSize = sizeof(DD_PALETTECALLBACKS); + pDev->pEDDgpl->ddHalInfo.dwSize = sizeof(DD_HALINFO) ; pfnDdEnableDirectDraw = (PGD_DXDDENABLEDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdEnableDirectDraw].pfn; if (pfnDdEnableDirectDraw == NULL) Index: subsystems/win32/win32k/win32k.rbuild =================================================================== --- subsystems/win32/win32k/win32k.rbuild (revision 43196) +++ subsystems/win32/win32k/win32k.rbuild (working copy) @@ -212,4 +212,7 @@ dxguid win32k.rc + + +