mirror of
https://github.com/reactos/reactos.git
synced 2025-08-11 13:15:39 +00:00
Create a branch for network fixes.
svn path=/branches/aicom-network-fixes/; revision=34994
This commit is contained in:
parent
0e213bbc00
commit
c501d8112c
18148 changed files with 0 additions and 860488 deletions
184
drivers/directx/dxg/ddhmg.c
Normal file
184
drivers/directx/dxg/ddhmg.c
Normal file
|
@ -0,0 +1,184 @@
|
|||
|
||||
|
||||
/*
|
||||
* 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 <dxg_int.h>
|
||||
|
||||
/* 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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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;
|
||||
}
|
9
drivers/directx/dxg/dxg.def
Normal file
9
drivers/directx/dxg/dxg.def
Normal file
|
@ -0,0 +1,9 @@
|
|||
; $Id: videoprt.def 27062 2007-06-07 21:13:06Z greatlrd $
|
||||
;
|
||||
; dxg.def - export definition file for ReactOS
|
||||
;
|
||||
EXPORTS
|
||||
DriverEntry@8
|
||||
DxDdCleanupDxGraphics@0
|
||||
DxDdStartupDxGraphics@24
|
||||
|
17
drivers/directx/dxg/dxg.rbuild
Normal file
17
drivers/directx/dxg/dxg.rbuild
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
||||
<module name="dxg" type="kernelmodedriver" installbase="system32/drivers" installname="dxg.sys">
|
||||
<importlibrary definition="dxg.def" />
|
||||
<include base="dxg">.</include>
|
||||
<include base="dxg">include</include>
|
||||
<include base="ReactOS">subsystems/win32/win32k/include</include>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="WINVER">0x600</define>
|
||||
<library>dxgthk</library>
|
||||
<library>ntoskrnl</library>
|
||||
<file>main.c</file>
|
||||
<file>ddhmg.c</file>
|
||||
<file>eng.c</file>
|
||||
<file>historic.c</file>
|
||||
<file>dxg.rc</file>
|
||||
</module>
|
7
drivers/directx/dxg/dxg.rc
Normal file
7
drivers/directx/dxg/dxg.rc
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $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 <reactos/version.rc>
|
98
drivers/directx/dxg/dxg_driver.h
Normal file
98
drivers/directx/dxg/dxg_driver.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
|
||||
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}
|
||||
|
||||
};
|
111
drivers/directx/dxg/dxg_int.h
Normal file
111
drivers/directx/dxg/dxg_int.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
|
||||
/* DDK/NDK/SDK Headers */
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddmou.h>
|
||||
#include <ddk/ntifs.h>
|
||||
#include <ddk/tvout.h>
|
||||
#include <ndk/ntndk.h>
|
||||
|
||||
/* Win32 Headers */
|
||||
#define WINBASEAPI
|
||||
#define STARTF_USESIZE 2
|
||||
#define STARTF_USEPOSITION 4
|
||||
#define INTERNAL_CALL NTAPI
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winerror.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <winuser.h>
|
||||
#include <prntfont.h>
|
||||
#include <dde.h>
|
||||
#include <wincon.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntusrtyp.h>
|
||||
#include <win32k/ntuser.h>
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
#include <win32.h>
|
||||
#include <gdiobj.h>
|
||||
#include <dc.h>
|
||||
|
||||
#include <drivers/directx/directxint.h>
|
||||
|
||||
#include <drivers/directx/dxg.h>
|
||||
#include <drivers/directx/dxeng.h>
|
||||
|
||||
#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 DriverEntry(IN PVOID Context1, IN PVOID Context2);
|
||||
NTSTATUS GsDriverEntry(IN PVOID Context1, IN PVOID Context2);
|
||||
NTSTATUS DxDdCleanupDxGraphics();
|
||||
|
||||
/* 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 STDCALL DxDxgGenericThunk(ULONG_PTR ulIndex, ULONG_PTR ulHandle, SIZE_T *pdwSizeOfPtr1, PVOID pvPtr1, SIZE_T *pdwSizeOfPtr2, PVOID pvPtr2);
|
||||
DWORD STDCALL DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize);
|
||||
PDD_SURFACE_LOCAL STDCALL DxDdLockDirectDrawSurface(HANDLE hDdSurface);
|
||||
BOOL STDCALL DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface);
|
||||
|
||||
/* Internal functions */
|
||||
BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry);
|
||||
BOOL FASTCALL DdHmgCreate();
|
||||
BOOL FASTCALL DdHmgDestroy();
|
||||
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]
|
||||
|
54
drivers/directx/dxg/eng.c
Normal file
54
drivers/directx/dxg/eng.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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 <dxg_int.h>
|
||||
|
||||
|
||||
PDD_SURFACE_LOCAL
|
||||
STDCALL
|
||||
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
|
||||
STDCALL
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
88
drivers/directx/dxg/historic.c
Normal file
88
drivers/directx/dxg/historic.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
|
||||
/*
|
||||
* 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 <dxg_int.h>
|
||||
|
||||
/*++
|
||||
* @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
|
||||
STDCALL
|
||||
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
|
||||
STDCALL
|
||||
DxDdIoctl(ULONG ulIoctl,
|
||||
PVOID pBuffer,
|
||||
ULONG ulBufferSize)
|
||||
{
|
||||
return DDERR_UNSUPPORTED;
|
||||
}
|
||||
|
145
drivers/directx/dxg/main.c
Normal file
145
drivers/directx/dxg/main.c
Normal file
|
@ -0,0 +1,145 @@
|
|||
|
||||
/*
|
||||
* 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 <dxg_int.h>
|
||||
#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
|
||||
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;
|
||||
INT 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
|
||||
DxDdCleanupDxGraphics()
|
||||
{
|
||||
DdHmgDestroy();
|
||||
|
||||
if (ghsemDummyPage != 0 )
|
||||
{
|
||||
if (gpDummyPage != 0 )
|
||||
{
|
||||
ExFreePoolWithTag(gpDummyPage,0);
|
||||
gpDummyPage = NULL;
|
||||
gcDummyPageRefCnt = 0;
|
||||
}
|
||||
EngDeleteSemaphore(ghsemDummyPage);
|
||||
ghsemDummyPage = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
8
drivers/directx/dxg/tags.h
Normal file
8
drivers/directx/dxg/tags.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
|
||||
#define TAG_THDD TAG('t', 'h', 'd', 'd')
|
||||
#define TAG_GINI TAG('G', 'i', 'n', 'i')
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue