ReactOS  0.4.13-dev-551-gf37fb1f
dxg_int.h File Reference
#include <ntifs.h>
#include <windef.h>
#include <winerror.h>
#include <wingdi.h>
#include <winddi.h>
#include <ddkernel.h>
#include <initguid.h>
#include <ddrawi.h>
#include <ntgdityp.h>
#include <psfuncs.h>
#include <drivers/directx/directxint.h>
#include <drivers/directx/dxg.h>
#include <drivers/directx/dxeng.h>
#include "tags.h"
Include dependency graph for dxg_int.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DD_BASEOBJECT
 
struct  _DD_ENTRY
 
struct  _EDD_SURFACE_LOCAL
 
struct  _DXENG_FUNCTIONS
 

Macros

#define WINBASEAPI
 
#define STARTF_USESIZE   2
 
#define STARTF_USEPOSITION   4
 
#define INTERNAL_CALL   NTAPI
 
#define NT_BUILD_ENVIRONMENT
 
#define DDHMG_HANDLE_LIMIT   0x200000
 
#define DDHMG_HTOI(DdHandle)   ((DWORD_PTR)DdHandle & (DDHMG_HANDLE_LIMIT-1))
 
#define CapOver_DisableAccel   0x1
 
#define CapOver_DisableD3DDDAccel   0x2
 
#define CapOver_DisableD3DAccel   0x4
 
#define CapOver_DisableOGL   0x8
 
#define CapOver_DisableEscapes   0x10
 
#define ObjType_DDLOCAL_TYPE   1
 
#define ObjType_DDSURFACE_TYPE   2
 
#define ObjType_DDCONTEXT_TYPE   3
 
#define ObjType_DDVIDEOPORT_TYPE   4
 
#define ObjType_DDMOTIONCOMP_TYPE   5
 

Typedefs

typedef PVOID PDC
 
typedef PVOID PW32THREAD
 
typedef struct _DD_BASEOBJECT DD_BASEOBJECT
 
typedef struct _DD_BASEOBJECTPDD_BASEOBJECT
 
typedef struct _DD_ENTRY DD_ENTRY
 
typedef struct _DD_ENTRYPDD_ENTRY
 
typedef struct _EDD_SURFACE_LOCAL EDD_SURFACE_LOCAL
 
typedef struct _EDD_SURFACE_LOCALPEDD_SURFACE_LOCAL
 
typedef BOOLEAN(APIENTRYPFN_DxEngNUIsTermSrv) (VOID)
 
typedef DWORD(APIENTRYPFN_DxEngScreenAccessCheck) (VOID)
 
typedef BOOLEAN(APIENTRYPFN_DxEngRedrawDesktop) (VOID)
 
typedef ULONG(APIENTRYPFN_DxEngDispUniq) (VOID)
 
typedef BOOLEAN(APIENTRYPFN_DxEngIncDispUniq) (VOID)
 
typedef ULONG(APIENTRYPFN_DxEngVisRgnUniq) (VOID)
 
typedef BOOLEAN(APIENTRYPFN_DxEngLockShareSem) (VOID)
 
typedef BOOLEAN(APIENTRYPFN_DxEngUnlockShareSem) (VOID)
 
typedef HDEV *(APIENTRYPFN_DxEngEnumerateHdev) (HDEV *)
 
typedef BOOLEAN(APIENTRYPFN_DxEngLockHdev) (HDEV)
 
typedef BOOLEAN(APIENTRYPFN_DxEngUnlockHdev) (HDEV)
 
typedef BOOLEAN(APIENTRYPFN_DxEngIsHdevLockedByCurrentThread) (HDEV)
 
typedef BOOLEAN(APIENTRYPFN_DxEngReferenceHdev) (HDEV)
 
typedef BOOLEAN(APIENTRYPFN_DxEngUnreferenceHdev) (HDEV)
 
typedef BOOL(APIENTRYPFN_DxEngGetDeviceGammaRamp) (HDEV, PGAMMARAMP)
 
typedef BOOLEAN(APIENTRYPFN_DxEngSetDeviceGammaRamp) (HDEV, PGAMMARAMP, BOOL)
 
typedef DWORD(APIENTRYPFN_DxEngSpTearDownSprites) (DWORD, DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSpUnTearDownSprites) (DWORD, DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSpSpritesVisible) (DWORD)
 
typedef DWORD_PTR(APIENTRYPFN_DxEngGetHdevData) (HDEV, DXEGSHDEVDATA)
 
typedef BOOLEAN(APIENTRYPFN_DxEngSetHdevData) (HDEV, DXEGSHDEVDATA, DWORD_PTR)
 
typedef HDC(APIENTRYPFN_DxEngCreateMemoryDC) (HDEV)
 
typedef HDC(APIENTRYPFN_DxEngGetDesktopDC) (ULONG, BOOL, BOOL)
 
typedef BOOLEAN(APIENTRYPFN_DxEngDeleteDC) (HDC, BOOL)
 
typedef BOOLEAN(APIENTRYPFN_DxEngCleanDC) (HDC hdc)
 
typedef BOOL(APIENTRYPFN_DxEngSetDCOwner) (HGDIOBJ, DWORD)
 
typedef PDC(APIENTRYPFN_DxEngLockDC) (HDC)
 
typedef BOOLEAN(APIENTRYPFN_DxEngUnlockDC) (PDC)
 
typedef BOOLEAN(APIENTRYPFN_DxEngSetDCState) (HDC, DWORD, DWORD)
 
typedef DWORD_PTR(APIENTRYPFN_DxEngGetDCState) (HDC, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSelectBitmap) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSetBitmapOwner) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngDeleteSurface) (DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngGetSurfaceData) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngAltLockSurface) (DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngUploadPaletteEntryToSurface) (DWORD, DWORD, DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngMarkSurfaceAsDirectDraw) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSelectPaletteToSurface) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSyncPaletteTableWithDevice) (DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngSetPaletteState) (DWORD, DWORD, DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngGetRedirectionBitmap) (DWORD)
 
typedef DWORD(APIENTRYPFN_DxEngLoadImage) (DWORD, DWORD)
 
typedef struct _DXENG_FUNCTIONS DXENG_FUNCTIONS
 
typedef struct _DXENG_FUNCTIONSPDXENG_FUNCTIONS
 

Functions

 DEFINE_GUID (GUID_NTCallbacks, 0x6fe9ecde, 0xdf89, 0x11d1, 0x9d, 0xb0, 0x00, 0x60, 0x08, 0x27, 0x71, 0xba)
 
 DEFINE_GUID (GUID_DDMoreCaps, 0x880baf30, 0xb030, 0x11d0, 0x8e, 0xa7, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b)
 
 DEFINE_GUID (GUID_NTPrivateDriverCaps, 0xfad16a23, 0x7b66, 0x11d2, 0x83, 0xd7, 0x00, 0xc0, 0x4f, 0x7c, 0xe5, 0x8c)
 
NTSTATUS NTAPI DriverEntry (IN PVOID Context1, IN PVOID Context2)
 
NTSTATUS NTAPI GsDriverEntry (IN PVOID Context1, IN PVOID Context2)
 
NTSTATUS APIENTRY DxDdCleanupDxGraphics (VOID)
 
BOOL NTAPI DxDdEnableDirectDraw (HANDLE hDev, BOOL arg2)
 
DWORD NTAPI DxDdCreateDirectDrawObject (HDC hDC)
 
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)
 
DWORD NTAPI DxDdGetDriverInfo (HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData)
 
BOOL NTAPI DxDdQueryDirectDrawObject (HANDLE DdHandle, DD_HALINFO *pDdHalInfo, DWORD *pCallBackFlags, LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, PDD_D3DBUFCALLBACKS pd3dBufCallbacks, LPDDSURFACEDESC pTextureFormats, DWORD *p8, VIDEOMEMORY *p9, DWORD *pdwNumFourCC, DWORD *pdwFourCC)
 
DWORD NTAPI DxDdReenableDirectDrawObject (HANDLE DdHandle, PVOID p2)
 
DWORD NTAPI DxDdCanCreateSurface (HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData)
 
DWORD NTAPI DxDdCanCreateD3DBuffer (HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData)
 
DWORD NTAPI DxDdCreateD3DBuffer (HANDLE hDirectDrawLocal, PEDD_SURFACE pDdSurfList, DDSURFACEDESC2 *a3, DD_SURFACE_GLOBAL *pDdSurfGlob, DD_SURFACE_LOCAL *pDdSurfLoc, DD_SURFACE_MORE *pDdSurfMore, DD_CREATESURFACEDATA *pDdCreateSurfaceData, PVOID Address)
 
DWORD NTAPI DxDdLock (HANDLE hSurface, PDD_LOCKDATA puLockData, HDC hdcClip)
 
DWORD NTAPI DxDdUnlock (HANDLE hSurface, PDD_UNLOCKDATA puUnlockData)
 
HANDLE NTAPI DxDdCreateSurfaceObject (HANDLE hDirectDrawLocal, HANDLE hSurface, PDD_SURFACE_LOCAL puSurfaceLocal, PDD_SURFACE_MORE puSurfaceMore, PDD_SURFACE_GLOBAL puSurfaceGlobal, BOOL bComplete)
 
BOOL FASTCALL VerifyObjectOwner (PDD_ENTRY pEntry)
 
BOOL FASTCALL DdHmgCreate (VOID)
 
BOOL FASTCALL DdHmgDestroy (VOID)
 
PVOID FASTCALL DdHmgLock (HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
 
HANDLE FASTCALL DdHmgAlloc (ULONG objSize, CHAR objType, BOOLEAN objLock)
 
PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject (PEDD_DIRECTDRAW_LOCAL peDdL, HANDLE hDirectDrawLocal, PDD_SURFACE_GLOBAL pDdSurfGlob, PDD_SURFACE_LOCAL pDdSurfLoc, PDD_SURFACE_MORE pDdSurfMore)
 

Variables

ULONG gcSizeDdHmgr
 
PDD_ENTRY gpentDdHmgr
 
ULONG gcMaxDdHmgr
 
PDD_ENTRY gpentDdHmgrLast
 
ULONG ghFreeDdHmgr
 
HSEMAPHORE ghsemHmgr
 
LONG gcDummyPageRefCnt
 
HSEMAPHORE ghsemDummyPage
 
VOIDgpDummyPage
 
PEPROCESS gpepSession
 
PLARGE_INTEGER gpLockShortDelay
 
DXENG_FUNCTIONS gpEngFuncs
 

Macro Definition Documentation

◆ CapOver_DisableAccel

#define CapOver_DisableAccel   0x1

Definition at line 50 of file dxg_int.h.

◆ CapOver_DisableD3DAccel

#define CapOver_DisableD3DAccel   0x4

Definition at line 52 of file dxg_int.h.

◆ CapOver_DisableD3DDDAccel

#define CapOver_DisableD3DDDAccel   0x2

Definition at line 51 of file dxg_int.h.

◆ CapOver_DisableEscapes

#define CapOver_DisableEscapes   0x10

Definition at line 54 of file dxg_int.h.

◆ CapOver_DisableOGL

#define CapOver_DisableOGL   0x8

Definition at line 53 of file dxg_int.h.

◆ DDHMG_HANDLE_LIMIT

#define DDHMG_HANDLE_LIMIT   0x200000

Definition at line 13 of file dxg_int.h.

◆ DDHMG_HTOI

#define DDHMG_HTOI (   DdHandle)    ((DWORD_PTR)DdHandle & (DDHMG_HANDLE_LIMIT-1))

Definition at line 14 of file dxg_int.h.

◆ INTERNAL_CALL

#define INTERNAL_CALL   NTAPI

Definition at line 10 of file dxg_int.h.

◆ NT_BUILD_ENVIRONMENT

#define NT_BUILD_ENVIRONMENT

Definition at line 11 of file dxg_int.h.

◆ ObjType_DDCONTEXT_TYPE

#define ObjType_DDCONTEXT_TYPE   3

Definition at line 58 of file dxg_int.h.

◆ ObjType_DDLOCAL_TYPE

#define ObjType_DDLOCAL_TYPE   1

Definition at line 56 of file dxg_int.h.

◆ ObjType_DDMOTIONCOMP_TYPE

#define ObjType_DDMOTIONCOMP_TYPE   5

Definition at line 60 of file dxg_int.h.

◆ ObjType_DDSURFACE_TYPE

#define ObjType_DDSURFACE_TYPE   2

Definition at line 57 of file dxg_int.h.

◆ ObjType_DDVIDEOPORT_TYPE

#define ObjType_DDVIDEOPORT_TYPE   4

Definition at line 59 of file dxg_int.h.

◆ STARTF_USEPOSITION

#define STARTF_USEPOSITION   4

Definition at line 9 of file dxg_int.h.

◆ STARTF_USESIZE

#define STARTF_USESIZE   2

Definition at line 8 of file dxg_int.h.

◆ WINBASEAPI

#define WINBASEAPI

Definition at line 7 of file dxg_int.h.

Typedef Documentation

◆ DD_BASEOBJECT

◆ DD_ENTRY

◆ DXENG_FUNCTIONS

◆ EDD_SURFACE_LOCAL

◆ PDC

typedef PVOID PDC

Definition at line 32 of file dxg_int.h.

◆ PDD_BASEOBJECT

◆ PDD_ENTRY

◆ PDXENG_FUNCTIONS

◆ PEDD_SURFACE_LOCAL

◆ PFN_DxEngAltLockSurface

typedef DWORD(APIENTRY* PFN_DxEngAltLockSurface) (DWORD)

Definition at line 115 of file dxg_int.h.

◆ PFN_DxEngCleanDC

typedef BOOLEAN(APIENTRY* PFN_DxEngCleanDC) (HDC hdc)

Definition at line 105 of file dxg_int.h.

◆ PFN_DxEngCreateMemoryDC

typedef HDC(APIENTRY* PFN_DxEngCreateMemoryDC) (HDEV)

Definition at line 102 of file dxg_int.h.

◆ PFN_DxEngDeleteDC

typedef BOOLEAN(APIENTRY* PFN_DxEngDeleteDC) (HDC, BOOL)

Definition at line 104 of file dxg_int.h.

◆ PFN_DxEngDeleteSurface

typedef DWORD(APIENTRY* PFN_DxEngDeleteSurface) (DWORD)

Definition at line 113 of file dxg_int.h.

◆ PFN_DxEngDispUniq

typedef ULONG(APIENTRY* PFN_DxEngDispUniq) (VOID)

Definition at line 84 of file dxg_int.h.

◆ PFN_DxEngEnumerateHdev

typedef HDEV*(APIENTRY* PFN_DxEngEnumerateHdev) (HDEV *)

Definition at line 89 of file dxg_int.h.

◆ PFN_DxEngGetDCState

typedef DWORD_PTR(APIENTRY* PFN_DxEngGetDCState) (HDC, DWORD)

Definition at line 110 of file dxg_int.h.

◆ PFN_DxEngGetDesktopDC

typedef HDC(APIENTRY* PFN_DxEngGetDesktopDC) (ULONG, BOOL, BOOL)

Definition at line 103 of file dxg_int.h.

◆ PFN_DxEngGetDeviceGammaRamp

typedef BOOL(APIENTRY* PFN_DxEngGetDeviceGammaRamp) (HDEV, PGAMMARAMP)

Definition at line 95 of file dxg_int.h.

◆ PFN_DxEngGetHdevData

typedef DWORD_PTR(APIENTRY* PFN_DxEngGetHdevData) (HDEV, DXEGSHDEVDATA)

Definition at line 100 of file dxg_int.h.

◆ PFN_DxEngGetRedirectionBitmap

typedef DWORD(APIENTRY* PFN_DxEngGetRedirectionBitmap) (DWORD)

Definition at line 121 of file dxg_int.h.

◆ PFN_DxEngGetSurfaceData

typedef DWORD(APIENTRY* PFN_DxEngGetSurfaceData) (DWORD, DWORD)

Definition at line 114 of file dxg_int.h.

◆ PFN_DxEngIncDispUniq

typedef BOOLEAN(APIENTRY* PFN_DxEngIncDispUniq) (VOID)

Definition at line 85 of file dxg_int.h.

◆ PFN_DxEngIsHdevLockedByCurrentThread

typedef BOOLEAN(APIENTRY* PFN_DxEngIsHdevLockedByCurrentThread) (HDEV)

Definition at line 92 of file dxg_int.h.

◆ PFN_DxEngLoadImage

typedef DWORD(APIENTRY* PFN_DxEngLoadImage) (DWORD, DWORD)

Definition at line 122 of file dxg_int.h.

◆ PFN_DxEngLockDC

typedef PDC(APIENTRY* PFN_DxEngLockDC) (HDC)

Definition at line 107 of file dxg_int.h.

◆ PFN_DxEngLockHdev

typedef BOOLEAN(APIENTRY* PFN_DxEngLockHdev) (HDEV)

Definition at line 90 of file dxg_int.h.

◆ PFN_DxEngLockShareSem

typedef BOOLEAN(APIENTRY* PFN_DxEngLockShareSem) (VOID)

Definition at line 87 of file dxg_int.h.

◆ PFN_DxEngMarkSurfaceAsDirectDraw

typedef DWORD(APIENTRY* PFN_DxEngMarkSurfaceAsDirectDraw) (DWORD, DWORD)

Definition at line 117 of file dxg_int.h.

◆ PFN_DxEngNUIsTermSrv

typedef BOOLEAN(APIENTRY* PFN_DxEngNUIsTermSrv) (VOID)

Definition at line 81 of file dxg_int.h.

◆ PFN_DxEngRedrawDesktop

typedef BOOLEAN(APIENTRY* PFN_DxEngRedrawDesktop) (VOID)

Definition at line 83 of file dxg_int.h.

◆ PFN_DxEngReferenceHdev

typedef BOOLEAN(APIENTRY* PFN_DxEngReferenceHdev) (HDEV)

Definition at line 93 of file dxg_int.h.

◆ PFN_DxEngScreenAccessCheck

typedef DWORD(APIENTRY* PFN_DxEngScreenAccessCheck) (VOID)

Definition at line 82 of file dxg_int.h.

◆ PFN_DxEngSelectBitmap

typedef DWORD(APIENTRY* PFN_DxEngSelectBitmap) (DWORD, DWORD)

Definition at line 111 of file dxg_int.h.

◆ PFN_DxEngSelectPaletteToSurface

typedef DWORD(APIENTRY* PFN_DxEngSelectPaletteToSurface) (DWORD, DWORD)

Definition at line 118 of file dxg_int.h.

◆ PFN_DxEngSetBitmapOwner

typedef DWORD(APIENTRY* PFN_DxEngSetBitmapOwner) (DWORD, DWORD)

Definition at line 112 of file dxg_int.h.

◆ PFN_DxEngSetDCOwner

typedef BOOL(APIENTRY* PFN_DxEngSetDCOwner) (HGDIOBJ, DWORD)

Definition at line 106 of file dxg_int.h.

◆ PFN_DxEngSetDCState

typedef BOOLEAN(APIENTRY* PFN_DxEngSetDCState) (HDC, DWORD, DWORD)

Definition at line 109 of file dxg_int.h.

◆ PFN_DxEngSetDeviceGammaRamp

typedef BOOLEAN(APIENTRY* PFN_DxEngSetDeviceGammaRamp) (HDEV, PGAMMARAMP, BOOL)

Definition at line 96 of file dxg_int.h.

◆ PFN_DxEngSetHdevData

typedef BOOLEAN(APIENTRY* PFN_DxEngSetHdevData) (HDEV, DXEGSHDEVDATA, DWORD_PTR)

Definition at line 101 of file dxg_int.h.

◆ PFN_DxEngSetPaletteState

typedef DWORD(APIENTRY* PFN_DxEngSetPaletteState) (DWORD, DWORD, DWORD)

Definition at line 120 of file dxg_int.h.

◆ PFN_DxEngSpSpritesVisible

typedef DWORD(APIENTRY* PFN_DxEngSpSpritesVisible) (DWORD)

Definition at line 99 of file dxg_int.h.

◆ PFN_DxEngSpTearDownSprites

typedef DWORD(APIENTRY* PFN_DxEngSpTearDownSprites) (DWORD, DWORD, DWORD)

Definition at line 97 of file dxg_int.h.

◆ PFN_DxEngSpUnTearDownSprites

typedef DWORD(APIENTRY* PFN_DxEngSpUnTearDownSprites) (DWORD, DWORD, DWORD)

Definition at line 98 of file dxg_int.h.

◆ PFN_DxEngSyncPaletteTableWithDevice

typedef DWORD(APIENTRY* PFN_DxEngSyncPaletteTableWithDevice) (DWORD, DWORD)

Definition at line 119 of file dxg_int.h.

◆ PFN_DxEngUnlockDC

typedef BOOLEAN(APIENTRY* PFN_DxEngUnlockDC) (PDC)

Definition at line 108 of file dxg_int.h.

◆ PFN_DxEngUnlockHdev

typedef BOOLEAN(APIENTRY* PFN_DxEngUnlockHdev) (HDEV)

Definition at line 91 of file dxg_int.h.

◆ PFN_DxEngUnlockShareSem

typedef BOOLEAN(APIENTRY* PFN_DxEngUnlockShareSem) (VOID)

Definition at line 88 of file dxg_int.h.

◆ PFN_DxEngUnreferenceHdev

typedef BOOLEAN(APIENTRY* PFN_DxEngUnreferenceHdev) (HDEV)

Definition at line 94 of file dxg_int.h.

◆ PFN_DxEngUploadPaletteEntryToSurface

typedef DWORD(APIENTRY* PFN_DxEngUploadPaletteEntryToSurface) (DWORD, DWORD, DWORD, DWORD)

Definition at line 116 of file dxg_int.h.

◆ PFN_DxEngVisRgnUniq

typedef ULONG(APIENTRY* PFN_DxEngVisRgnUniq) (VOID)

Definition at line 86 of file dxg_int.h.

◆ PW32THREAD

typedef PVOID PW32THREAD

Definition at line 33 of file dxg_int.h.

Function Documentation

◆ DdHmgAlloc()

HANDLE FASTCALL DdHmgAlloc ( ULONG  objSize,
CHAR  objType,
BOOLEAN  objLock 
)

Definition at line 340 of file ddhmg.c.

341 {
342  PVOID pObject = NULL;
343  HANDLE DdHandle = NULL;
344  PDD_ENTRY pEntry = NULL;
345  DWORD Index;
346 
347  pObject = DdAllocateObject(objSize, objType, TRUE);
348  if (!pObject)
349  return 0;
350 
352 
353  /* Get next free handle */
354  DdHandle = DdGetFreeHandle(objType);
355 
356  if (DdHandle)
357  {
358  Index = DDHMG_HTOI(DdHandle);
359 
360  pEntry = (PDD_ENTRY)((PBYTE)gpentDdHmgr + (sizeof(DD_ENTRY) * Index));
361 
362  pEntry->pobj = pObject;
363  pEntry->Objt = objType;
364 
365  pEntry->Pid = (HANDLE)(((ULONG_PTR)PsGetCurrentProcessId() & 0xFFFFFFFC) | ((ULONG_PTR)(pEntry->Pid) & 1));
366 
367  if (objLock)
368  {
370  pEntry->pobj->Tid = KeGetCurrentThread();
371  }
372  pEntry->pobj->hHmgr = DdHandle;
373 
375 
376  /* Return handle if object not locked */
377  if (!objLock)
378  return DdHandle;
379 
380  return (HANDLE)pEntry;
381  }
382 
384  DdFreeObject(pObject);
385  return 0;
386 }
PW32THREAD Tid
Definition: dxg_int.h:41
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
Definition: dxg_int.h:62
#define TRUE
Definition: types.h:120
#define DDHMG_HTOI(DdHandle)
Definition: dxg_int.h:14
UCHAR Objt
Definition: dxg_int.h:71
VOID FASTCALL DdFreeObject(PVOID pObject)
Definition: ddhmg.c:235
PDD_ENTRY gpentDdHmgr
Definition: ddhmg.c:16
USHORT cExclusiveLock
Definition: dxg_int.h:39
uint32_t ULONG_PTR
Definition: typedefs.h:63
PDD_BASEOBJECT pobj
Definition: dxg_int.h:66
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
HSEMAPHORE ghsemHmgr
Definition: ddhmg.c:23
PVOID FASTCALL DdAllocateObject(ULONG objSize, UCHAR objType, BOOLEAN objZeroMemory)
Definition: ddhmg.c:203
static const UCHAR Index[8]
Definition: usbohci.c:18
PVOID HANDLE
Definition: typedefs.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _DD_ENTRY DD_ENTRY
#define InterlockedIncrement
Definition: armddk.h:53
HGDIOBJ hHmgr
Definition: dxg_int.h:37
HANDLE Pid
Definition: dxg_int.h:69
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
HANDLE FASTCALL DdGetFreeHandle(UCHAR objType)
Definition: ddhmg.c:259
struct _DD_ENTRY * PDD_ENTRY
#define KeGetCurrentThread
Definition: hal.h:44
BYTE * PBYTE
Definition: pedump.c:66

Referenced by intDdCreateDirectDrawLocal(), and intDdCreateNewSurfaceObject().

◆ DdHmgCreate()

BOOL FASTCALL DdHmgCreate ( VOID  )

Definition at line 49 of file ddhmg.c.

50 {
52  ghFreeDdHmgr = 0;
53  gcMaxDdHmgr = 1;
54 
55  if (gpentDdHmgr)
56  {
58 
59  if (ghsemHmgr)
60  {
62 
63  if (gpLockShortDelay)
64  {
66  return TRUE;
67  }
68 
70  ghsemHmgr = NULL;
71  }
72 
74  gpentDdHmgr = NULL;
75  }
76 
77  return FALSE;
78 }
Definition: dxg_int.h:62
#define TRUE
Definition: types.h:120
PDD_ENTRY gpentDdHmgr
Definition: ddhmg.c:16
#define EngFreeMem
Definition: polytest.cpp:56
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106
#define FL_NONPAGED_MEMORY
Definition: winddi.h:1359
smooth NULL
Definition: ftsmooth.c:416
HSEMAPHORE ghsemHmgr
Definition: ddhmg.c:23
ULONG gcMaxDdHmgr
Definition: ddhmg.c:18
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
ULONG ghFreeDdHmgr
Definition: ddhmg.c:22
#define TAG_GINI
Definition: tags.h:2
#define TAG_THDD
Definition: tags.h:1
ULONG gcSizeDdHmgr
Definition: ddhmg.c:15
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
PLARGE_INTEGER gpLockShortDelay
Definition: main.c:18

Referenced by DxDdStartupDxGraphics().

◆ DdHmgDestroy()

BOOL FASTCALL DdHmgDestroy ( VOID  )

Definition at line 95 of file ddhmg.c.

96 {
97  gcMaxDdHmgr = 0;
98  gcSizeDdHmgr = 0;
99  ghFreeDdHmgr = 0;
101 
102  if (gpentDdHmgr)
103  {
105  gpentDdHmgr = NULL;
106  }
107 
108  if (ghsemHmgr)
109  {
111  ghsemHmgr = NULL;
112  }
113 
114  return TRUE;
115 }
PDD_ENTRY gpentDdHmgrLast
Definition: ddhmg.c:19
#define TRUE
Definition: types.h:120
PDD_ENTRY gpentDdHmgr
Definition: ddhmg.c:16
#define EngFreeMem
Definition: polytest.cpp:56
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106
smooth NULL
Definition: ftsmooth.c:416
HSEMAPHORE ghsemHmgr
Definition: ddhmg.c:23
ULONG gcMaxDdHmgr
Definition: ddhmg.c:18
ULONG ghFreeDdHmgr
Definition: ddhmg.c:22
ULONG gcSizeDdHmgr
Definition: ddhmg.c:15

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ DdHmgLock()

PVOID FASTCALL DdHmgLock ( HANDLE  DdHandle,
UCHAR  ObjectType,
BOOLEAN  LockOwned 
)

Definition at line 147 of file ddhmg.c.

148 {
149  DWORD Index = DDHMG_HTOI(DdHandle);
150 
151  PDD_ENTRY pEntry = NULL;
152  PVOID Object = NULL;
153 
154  if ( !LockOwned )
155  {
157  }
158 
159  if ( Index < gcMaxDdHmgr )
160  {
161  pEntry = (PDD_ENTRY)((PBYTE)gpentDdHmgr + (sizeof(DD_ENTRY) * Index));
162 
163  if ( VerifyObjectOwner(pEntry) )
164  {
165  if ( ( pEntry->Objt == ObjectType ) &&
166  ( pEntry->FullUnique == (((ULONG_PTR)DdHandle >> 21) & 0x7FF) ) &&
167  ( !pEntry->pobj->cExclusiveLock ) )
168  {
170  pEntry->pobj->Tid = KeGetCurrentThread();
171  Object = pEntry->pobj;
172  }
173  }
174  }
175 
176  if ( !LockOwned )
177  {
179  }
180 
181  return Object;
182 }
PW32THREAD Tid
Definition: dxg_int.h:41
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
ObjectType
Definition: metafile.c:80
Definition: dxg_int.h:62
#define DDHMG_HTOI(DdHandle)
Definition: dxg_int.h:14
UCHAR Objt
Definition: dxg_int.h:71
PDD_ENTRY gpentDdHmgr
Definition: ddhmg.c:16
USHORT cExclusiveLock
Definition: dxg_int.h:39
PDD_BASEOBJECT pobj
Definition: dxg_int.h:66
BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry)
Definition: ddhmg.c:27
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
HSEMAPHORE ghsemHmgr
Definition: ddhmg.c:23
USHORT FullUnique
Definition: dxg_int.h:70
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG gcMaxDdHmgr
Definition: ddhmg.c:18
struct _DD_ENTRY DD_ENTRY
static IUnknown Object
Definition: main.c:512
#define InterlockedIncrement
Definition: armddk.h:53
#define ULONG_PTR
Definition: config.h:101
struct _DD_ENTRY * PDD_ENTRY
#define KeGetCurrentThread
Definition: hal.h:44
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DxDdCanCreateD3DBuffer(), DxDdCanCreateSurface(), DxDdCreateSurfaceObject(), DxDdGetDriverInfo(), DxDdLock(), DxDdLockDirectDrawSurface(), DxDdQueryDirectDrawObject(), DxDdReenableDirectDrawObject(), intDdCreateNewSurfaceObject(), and intDdCreateSurfaceOrBuffer().

◆ DEFINE_GUID() [1/3]

DEFINE_GUID ( GUID_NTCallbacks  ,
0x6fe9ecde  ,
0xdf89  ,
0x11d1  ,
0x9d  ,
0xb0  ,
0x00  ,
0x60  ,
0x08  ,
0x27  ,
0x71  ,
0xba   
)

◆ DEFINE_GUID() [2/3]

DEFINE_GUID ( GUID_DDMoreCaps  ,
0x880baf30  ,
0xb030  ,
0x11d0  ,
0x8e  ,
0xa7  ,
0x00  ,
0x60  ,
0x97  ,
0x97  ,
0xea  ,
0x5b   
)

◆ DEFINE_GUID() [3/3]

DEFINE_GUID ( GUID_NTPrivateDriverCaps  ,
0xfad16a23  ,
0x7b66  ,
0x11d2  ,
0x83  ,
0xd7  ,
0x00  ,
0xc0  ,
0x4f  ,
0x7c  ,
0xe5  ,
0x8c   
)

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PVOID  Context1,
IN PVOID  Context2 
)

Definition at line 6177 of file atapi.c.

6198 {
6199  HW_INITIALIZATION_DATA hwInitializationData;
6200  ULONG adapterCount;
6201  ULONG i;
6202  ULONG statusToReturn, newStatus;
6203 
6204  DebugPrint((1,"\n\nATAPI IDE MiniPort Driver\n"));
6205 
6206  statusToReturn = 0xffffffff;
6207 
6208  //
6209  // Zero out structure.
6210  //
6211 
6212  AtapiZeroMemory(((PUCHAR)&hwInitializationData), sizeof(HW_INITIALIZATION_DATA));
6213 
6214  //
6215  // Set size of hwInitializationData.
6216  //
6217 
6218  hwInitializationData.HwInitializationDataSize =
6219  sizeof(HW_INITIALIZATION_DATA);
6220 
6221  //
6222  // Set entry points.
6223  //
6224 
6225  hwInitializationData.HwInitialize = AtapiHwInitialize;
6226  hwInitializationData.HwResetBus = AtapiResetController;
6227  hwInitializationData.HwStartIo = AtapiStartIo;
6228  hwInitializationData.HwInterrupt = AtapiInterrupt;
6229 
6230  //
6231  // Specify size of extensions.
6232  //
6233 
6234  hwInitializationData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
6235  hwInitializationData.SpecificLuExtensionSize = sizeof(HW_LU_EXTENSION);
6236 
6237  //
6238  // Indicate PIO device.
6239  //
6240 
6241  hwInitializationData.MapBuffers = TRUE;
6242 
6243  //
6244  // Native Mode Devices
6245  //
6246  for (i=0; i <NUM_NATIVE_MODE_ADAPTERS; i++) {
6247  hwInitializationData.HwFindAdapter = AtapiFindNativeModeController;
6248  hwInitializationData.NumberOfAccessRanges = 4;
6249  hwInitializationData.AdapterInterfaceType = PCIBus;
6250 
6251  hwInitializationData.VendorId = NativeModeAdapters[i].VendorId;
6252  hwInitializationData.VendorIdLength = (USHORT) NativeModeAdapters[i].VendorIdLength;
6253  hwInitializationData.DeviceId = NativeModeAdapters[i].DeviceId;
6254  hwInitializationData.DeviceIdLength = (USHORT) NativeModeAdapters[i].DeviceIdLength;
6255 
6256  newStatus = ScsiPortInitialize(DriverObject,
6257  Argument2,
6258  &hwInitializationData,
6259  (PVOID)(ULONG_PTR)i);
6260  if (newStatus < statusToReturn)
6261  statusToReturn = newStatus;
6262  }
6263 
6264  hwInitializationData.VendorId = 0;
6265  hwInitializationData.VendorIdLength = 0;
6266  hwInitializationData.DeviceId = 0;
6267  hwInitializationData.DeviceIdLength = 0;
6268 
6269  //
6270  // The adapter count is used by the find adapter routine to track how
6271  // which adapter addresses have been tested.
6272  //
6273 
6274  adapterCount = 0;
6275 
6276  hwInitializationData.HwFindAdapter = AtapiFindPCIController;
6277  hwInitializationData.NumberOfAccessRanges = 4;
6278  hwInitializationData.AdapterInterfaceType = Isa;
6279 
6280  newStatus = ScsiPortInitialize(DriverObject,
6281  Argument2,
6282  &hwInitializationData,
6283  &adapterCount);
6284  if (newStatus < statusToReturn)
6285  statusToReturn = newStatus;
6286 
6287  //
6288  // Indicate 2 access ranges and reset FindAdapter.
6289  //
6290 
6291  hwInitializationData.NumberOfAccessRanges = 2;
6292  hwInitializationData.HwFindAdapter = AtapiFindController;
6293 
6294  //
6295  // Indicate ISA bustype.
6296  //
6297 
6298  hwInitializationData.AdapterInterfaceType = Isa;
6299 
6300  //
6301  // Call initialization for ISA bustype.
6302  //
6303 
6304  newStatus = ScsiPortInitialize(DriverObject,
6305  Argument2,
6306  &hwInitializationData,
6307  &adapterCount);
6308  if (newStatus < statusToReturn)
6309  statusToReturn = newStatus;
6310 
6311  //
6312  // Set up for MCA
6313  //
6314 
6315  hwInitializationData.AdapterInterfaceType = MicroChannel;
6316  adapterCount = 0;
6317 
6318  newStatus = ScsiPortInitialize(DriverObject,
6319  Argument2,
6320  &hwInitializationData,
6321  &adapterCount);
6322  if (newStatus < statusToReturn)
6323  statusToReturn = newStatus;
6324 
6325  return statusToReturn;
6326 
6327 } // end DriverEntry()
#define TRUE
Definition: types.h:120
NATIVE_MODE_CONTROLLER_INFORMATION const NativeModeAdapters[]
Definition: atapi.h:319
BOOLEAN NTAPI AtapiResetController(IN PVOID HwDeviceExtension, IN ULONG PathId)
Definition: atapi.c:733
BOOLEAN NTAPI AtapiStartIo(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
Definition: atapi.c:5811
unsigned char * PUCHAR
Definition: retypes.h:3
struct _HW_INITIALIZATION_DATA HW_INITIALIZATION_DATA
#define NUM_NATIVE_MODE_ADAPTERS
Definition: atapi.h:322
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG NTAPI AtapiFindNativeModeController(IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
Definition: atapi.c:2712
struct _HW_LU_EXTENSION HW_LU_EXTENSION
ULONG NTAPI AtapiFindController(IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
Definition: atapi.c:2106
ULONG NTAPI ScsiPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN PHW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext OPTIONAL)
Definition: scsiport.c:1089
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
_In_ PVOID Argument2
Definition: classpnp.h:680
VOID NTAPI AtapiZeroMemory(IN PUCHAR Buffer, IN ULONG Count)
Definition: atapi.c:6381
ULONG NTAPI AtapiFindPCIController(IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
Definition: atapi.c:3014
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
BOOLEAN NTAPI AtapiHwInitialize(IN PVOID HwDeviceExtension)
Definition: atapi.c:1282
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI AtapiInterrupt(IN PVOID HwDeviceExtension)
Definition: atapi.c:3484

◆ DxDdCanCreateD3DBuffer()

DWORD NTAPI DxDdCanCreateD3DBuffer ( HANDLE  DdHandle,
PDD_CANCREATESURFACEDATA  SurfaceData 
)

Definition at line 14 of file d3d.c.

17 {
21 
23  if (!peDdL)
24  return RetVal;
25 
26  peDdGl = peDdL->peDirectDrawGlobal2;
27  gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
28 
29  // assign out DirectDrawGlobal to SurfaceData
30  SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
31 
33  RetVal = peDdGl->d3dBufCallbacks.CanCreateD3DBuffer(SurfaceData);
34 
37 
38  return RetVal;
39 }
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
PDD_CANCREATESURFACE CanCreateD3DBuffer
Definition: ddrawint.h:1032
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
USHORT cExclusiveLock
Definition: dxg_int.h:39
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:456
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_D3DBUFCALLBACKS d3dBufCallbacks
Definition: directxint.h:165
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138

◆ DxDdCanCreateSurface()

DWORD NTAPI DxDdCanCreateSurface ( HANDLE  DdHandle,
PDD_CANCREATESURFACEDATA  SurfaceData 
)

Definition at line 13 of file dd.c.

16 {
20 
22  if (!peDdL)
23  return RetVal;
24 
25  peDdGl = peDdL->peDirectDrawGlobal2;
26  gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
27 
28  // assign out DirectDrawGlobal to SurfaceData
29  SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
30 
32  {
33  RetVal = peDdGl->ddCallbacks.CanCreateSurface(SurfaceData);
34  }
35 
38 
39  return RetVal;
40 }
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
USHORT cExclusiveLock
Definition: dxg_int.h:39
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
#define DDHAL_CB32_CANCREATESURFACE
Definition: ddrawi.h:658
PDD_CANCREATESURFACE CanCreateSurface
Definition: ddrawint.h:505
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:456
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
DWORD dwFlags
Definition: ddrawint.h:499
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138

◆ DxDdCleanupDxGraphics()

NTSTATUS APIENTRY DxDdCleanupDxGraphics ( VOID  )

Definition at line 118 of file main.c.

119 {
120  DdHmgDestroy();
121 
122  if (ghsemDummyPage != 0 )
123  {
124  if (gpDummyPage != 0 )
125  {
127  gpDummyPage = NULL;
128  gcDummyPageRefCnt = 0;
129  }
131  ghsemDummyPage = 0;
132  }
133 
134  return 0;
135 }
HSEMAPHORE ghsemDummyPage
Definition: main.c:15
LONG gcDummyPageRefCnt
Definition: main.c:14
BOOL FASTCALL DdHmgDestroy(VOID)
Definition: ddhmg.c:95
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106
smooth NULL
Definition: ftsmooth.c:416
VOID * gpDummyPage
Definition: main.c:16
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ DxDdCreateD3DBuffer()

DWORD NTAPI DxDdCreateD3DBuffer ( HANDLE  hDirectDrawLocal,
PEDD_SURFACE  pDdSurfList,
DDSURFACEDESC2 a3,
DD_SURFACE_GLOBAL pDdSurfGlob,
DD_SURFACE_LOCAL pDdSurfLoc,
DD_SURFACE_MORE pDdSurfMore,
DD_CREATESURFACEDATA pDdCreateSurfaceData,
PVOID  Address 
)

Definition at line 114 of file d3d.c.

123 {
124  return intDdCreateSurfaceOrBuffer(hDirectDrawLocal, pDdSurfList, a3, pDdSurfGlob, pDdSurfLoc, pDdSurfMore, pDdCreateSurfaceData, Address);
125 }
static const struct update_accum a3
Definition: msg.c:600
static WCHAR Address[46]
Definition: ping.c:68
DWORD FASTCALL intDdCreateSurfaceOrBuffer(HANDLE hDirectDrawLocal, PEDD_SURFACE pDdSurfList, DDSURFACEDESC2 *a3, DD_SURFACE_GLOBAL *pDdSurfGlob, DD_SURFACE_LOCAL *pDdSurfLoc, DD_SURFACE_MORE *pDdSurfMore, DD_CREATESURFACEDATA *pDdCreateSurfaceData, PVOID Address)
Definition: d3d.c:43

◆ DxDdCreateDirectDrawObject()

DWORD NTAPI DxDdCreateDirectDrawObject ( HDC  hDC)

Definition at line 258 of file ddraw.c.

260 {
261  PDC pDC = NULL;
262  HDEV hDev = NULL;
263  DWORD_PTR retVal = 0;
264 
265  pDC = gpEngFuncs.DxEngLockDC(hDC);
266  if (!pDC)
267  return 0;
268 
269  // get driver hDev from DC
270  hDev = (HDEV)gpEngFuncs.DxEngGetDCState(hDC, 3);
271  if (!hDev) {
273  return 0;
274  }
275 
276  // is this primary display?
278  {
280  return 0;
281  }
282 
284 
285  // create object only for 8BPP and more
287  retVal = (DWORD_PTR)intDdCreateDirectDrawLocal(hDev);
288 
291  return retVal;
292 }
PFN_DxEngLockDC DxEngLockDC
Definition: dxg_int.h:154
PVOID FASTCALL intDdCreateDirectDrawLocal(HDEV hDev)
Definition: ddraw.c:210
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
smooth NULL
Definition: ftsmooth.c:416
PFN_DxEngGetDCState DxEngGetDCState
Definition: dxg_int.h:157
Definition: polytest.cpp:40
uint32_t DWORD_PTR
Definition: typedefs.h:63
static HDC hDC
Definition: 3dtext.c:33
Definition: xlate.c:10
PFN_DxEngGetHdevData DxEngGetHdevData
Definition: dxg_int.h:147
PFN_DxEngUnlockDC DxEngUnlockDC
Definition: dxg_int.h:155
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138

◆ DxDdCreateSurfaceObject()

HANDLE NTAPI DxDdCreateSurfaceObject ( HANDLE  hDirectDrawLocal,
HANDLE  hSurface,
PDD_SURFACE_LOCAL  puSurfaceLocal,
PDD_SURFACE_MORE  puSurfaceMore,
PDD_SURFACE_GLOBAL  puSurfaceGlobal,
BOOL  bComplete 
)

Definition at line 647 of file ddraw.c.

653 {
654  HANDLE RetVal = FALSE;
655  PEDD_DIRECTDRAW_LOCAL peDdL = NULL;
656  PEDD_SURFACE pDdSurface = NULL;
657 
658  peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(hDirectDrawLocal, ObjType_DDLOCAL_TYPE, FALSE);
659 
660  if (!peDdL)
661  return RetVal;
662 
663  pDdSurface = intDdCreateNewSurfaceObject(peDdL, hSurface, puSurfaceGlobal, puSurfaceLocal, puSurfaceMore);
664  if (!pDdSurface)
665  {
667  return RetVal;
668  }
669 
670  RetVal = pDdSurface->pobj.hHmgr;
671 
674 
675  return RetVal;
676 }
USHORT cExclusiveLock
Definition: dxg_int.h:39
PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject(PEDD_DIRECTDRAW_LOCAL peDdL, HANDLE hDirectDrawLocal, PDD_SURFACE_GLOBAL pDdSurfGlob, PDD_SURFACE_LOCAL pDdSurfLoc, PDD_SURFACE_MORE pDdSurfMore)
Definition: ddraw.c:588
smooth NULL
Definition: ftsmooth.c:416
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
HGDIOBJ hHmgr
Definition: dxg_int.h:37
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
DD_BASEOBJECT pobj
Definition: directxint.h:46

◆ DxDdEnableDirectDraw()

BOOL NTAPI DxDdEnableDirectDraw ( HANDLE  hDev,
BOOL  arg2 
)

Definition at line 504 of file ddraw.c.

505 {
506  PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL;
507 
509  {
511  peDdGl->hDev = hDev;
512  peDdGl->bSuspended = FALSE;
514  intDdEnableDriver(peDdGl);
515  return TRUE;
516  }
517 
518  return FALSE;
519 }
#define TRUE
Definition: types.h:120
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
VOID intDdEnableDriver(PEDD_DIRECTDRAW_GLOBAL peDdGl)
Definition: ddraw.c:131
struct _EDD_DIRECTDRAW_GLOBAL * PEDD_DIRECTDRAW_GLOBAL
PFN_DxEngGetHdevData DxEngGetHdevData
Definition: dxg_int.h:147

◆ DxDdGetDriverInfo()

DWORD NTAPI DxDdGetDriverInfo ( HANDLE  DdHandle,
PDD_GETDRIVERINFODATA  drvInfoData 
)

Definition at line 309 of file ddraw.c.

310 {
311  PEDD_DIRECTDRAW_LOCAL peDdL;
312  PEDD_DIRECTDRAW_GLOBAL peDdGl;
313  PVOID pInfo = NULL;
314  DWORD dwInfoSize = 0;
315  BYTE callbackStruct[1024];
316  DWORD RetVal = FALSE;
317 
319  if (!peDdL)
320  return RetVal;
321 
322  peDdGl = peDdL->peDirectDrawGlobal2;
323 
324  // check VideoPort related callbacks
326  {
327  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCallbacks))
328  {
329  dwInfoSize = sizeof(DD_VIDEOPORTCALLBACKS);
330  pInfo = (VOID*)&peDdGl->ddVideoPortCallback;
331  }
332  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCaps))
333  {
334  pInfo = (VOID*)peDdGl->lpDDVideoPortCaps;
335  dwInfoSize = 72 * peDdGl->ddHalInfo.ddCaps.dwMaxVideoPorts;
336  }
337  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_D3DCallbacks3))
338  {
339  dwInfoSize = sizeof(D3DNTHAL_CALLBACKS3);
340  pInfo = (VOID*)&peDdGl->d3dNtHalCallbacks3;
341  }
342  }
343 
344  // check ColorControl related callbacks
346  {
347  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_ColorControlCallbacks))
348  {
349  dwInfoSize = sizeof(DD_COLORCONTROLCALLBACKS);
350  pInfo = (VOID*)&peDdGl->ddColorControlCallbacks;
351  }
352  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_NTCallbacks))
353  {
354  dwInfoSize = sizeof(DD_NTCALLBACKS);
355  pInfo = (VOID*)&peDdGl->ddNtCallbacks;
356  }
357  }
358 
359  // check Miscellaneous callbacks
361  {
362  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MiscellaneousCallbacks))
363  {
364  dwInfoSize = sizeof(DD_MISCELLANEOUSCALLBACKS);
365  pInfo = (VOID*)&peDdGl->ddMiscellanousCallbacks;
366  }
367  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreCaps))
368  {
369  dwInfoSize = sizeof(DD_MORECAPS);
370  pInfo = &peDdGl->ddMoreCaps;
371  }
372  }
373 
374  if (peDdGl->dwCallbackFlags & EDDDGBL_MISC2CALLBACKS &&
375  InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_Miscellaneous2Callbacks))
376  {
377  dwInfoSize = sizeof(DD_MISCELLANEOUS2CALLBACKS);
378  pInfo = (VOID*)&peDdGl->ddMiscellanous2Callbacks;
379  }
380 
382  InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MotionCompCallbacks))
383  {
384  dwInfoSize = sizeof(DD_MOTIONCOMPCALLBACKS);
385  pInfo = (VOID*)&peDdGl->ddMotionCompCallbacks;
386  }
387 
388  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_KernelCaps) )
389  {
390  dwInfoSize = sizeof(DD_KERNELCALLBACKS);
391  pInfo = &peDdGl->ddKernelCaps;
392  }
393 
394  if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreSurfaceCaps))
395  {
396  dwInfoSize = sizeof(DDMORESURFACECAPS);
397  pInfo = &peDdGl->ddMoreSurfaceCaps;
398  }
399 
400  if (dwInfoSize && pInfo)
401  {
402  gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
403  intDdGetDriverInfo(peDdGl, drvInfoData->guidInfo, &callbackStruct, dwInfoSize, &dwInfoSize);
405  memcpy(drvInfoData->lpvData, callbackStruct, dwInfoSize);
406  }
407 
409 
410  return TRUE;
411 }
#define TRUE
Definition: types.h:120
#define EDDDGBL_COLORCONTROLCALLBACKS
Definition: directxint.h:109
#define EDDDGBL_MOTIONCOMPCALLBACKS
Definition: directxint.h:110
DDNTCORECAPS ddCaps
Definition: ddrawint.h:1126
DD_MORECAPS ddMoreCaps
Definition: directxint.h:158
struct DD_MOTIONCOMPCALLBACKS DD_MOTIONCOMPCALLBACKS
USHORT cExclusiveLock
Definition: dxg_int.h:39
DD_MOTIONCOMPCALLBACKS ddMotionCompCallbacks
Definition: directxint.h:174
struct _DD_MISCELLANEOUSCALLBACKS DD_MISCELLANEOUSCALLBACKS
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
DD_COLORCONTROLCALLBACKS ddColorControlCallbacks
Definition: directxint.h:171
#define EDDDGBL_MISC2CALLBACKS
Definition: directxint.h:111
LPDDVIDEOPORTCAPS lpDDVideoPortCaps
Definition: directxint.h:123
DD_MISCELLANEOUS2CALLBACKS ddMiscellanous2Callbacks
Definition: directxint.h:169
DD_MISCELLANEOUSCALLBACKS ddMiscellanousCallbacks
Definition: directxint.h:168
smooth NULL
Definition: ftsmooth.c:416
struct DD_KERNELCALLBACKS DD_KERNELCALLBACKS
DDMORESURFACECAPS ddMoreSurfaceCaps
Definition: directxint.h:175
DD_VIDEOPORTCALLBACKS ddVideoPortCallback
Definition: directxint.h:167
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
struct DD_VIDEOPORTCALLBACKS DD_VIDEOPORTCALLBACKS
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define EDDDGBL_MISCCALLBACKS
Definition: directxint.h:107
struct _DD_MISCELLANEOUS2CALLBACKS DD_MISCELLANEOUS2CALLBACKS
struct _DD_MORECAPS DD_MORECAPS
#define InterlockedDecrement
Definition: armddk.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
DWORD dwMaxVideoPorts
Definition: ddrawint.h:1110
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_NTCALLBACKS ddNtCallbacks
Definition: directxint.h:170
#define EDDDGBL_VIDEOPORTCALLBACKS
Definition: directxint.h:108
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
struct _DD_NTCALLBACKS DD_NTCALLBACKS
BOOL intDdGetDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct, ULONG callbackSize, ULONG *returnSize)
Definition: ddraw.c:42
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
struct _DD_COLORCONTROLCALLBACKS DD_COLORCONTROLCALLBACKS
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138
struct _D3DNTHAL_CALLBACKS3 D3DNTHAL_CALLBACKS3
D3DNTHAL_CALLBACKS3 d3dNtHalCallbacks3
Definition: directxint.h:173
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:137
struct _DDMORESURFACECAPS DDMORESURFACECAPS
DDKERNELCAPS ddKernelCaps
Definition: directxint.h:157

◆ DxDdIoctl()

DWORD NTAPI DxDdIoctl ( ULONG  ulIoctl,
PVOID  pBuffer,
ULONG  ulBufferSize 
)

Definition at line 82 of file historic.c.

85 {
86  return DDERR_UNSUPPORTED;
87 }
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127

◆ DxDdLock()

DWORD NTAPI DxDdLock ( HANDLE  hSurface,
PDD_LOCKDATA  puLockData,
HDC  hdcClip 
)

Definition at line 36 of file ddsurf.c.

39 {
43  DD_MAPMEMORYDATA mapMemoryData;
44 
46  peDdL = pSurface->peDirectDrawLocal;
47  peDdGl = peDdL->peDirectDrawGlobal2;
48 
49  // Map memory if it's not already mapped and driver function is provided
50  if (!peDdL->isMemoryMapped && (peDdGl->ddCallbacks.dwFlags & DDHAL_CB32_MAPMEMORY))
51  {
52  mapMemoryData.bMap = 1;
53  mapMemoryData.hProcess = (HANDLE)-1;
54  mapMemoryData.fpProcess = 0;
55  mapMemoryData.lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
56 
57  peDdGl->ddCallbacks.MapMemory(&mapMemoryData);
58 
59  if (!mapMemoryData.ddRVal)
60  {
61  peDdL->isMemoryMapped = 1;
62  peDdL->fpProcess2 = mapMemoryData.fpProcess;
63  }
64  }
65 
66  if (pSurface)
67  {
68  InterlockedExchangeAdd((LONG*)&pSurface->pobj.cExclusiveLock, 0xFFFFFFFF);
69  }
70 
71  puLockData->ddRVal = DD_OK;
72 
73  return DDHAL_DRIVER_HANDLED;
74 }
#define TRUE
Definition: types.h:120
#define DDHAL_CB32_MAPMEMORY
Definition: ddrawint.h:519
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:57
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:483
HRESULT ddRVal
Definition: ddrawint.h:487
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DD_OK
Definition: ddraw.h:186
long LONG
Definition: pedump.c:60
#define InterlockedExchangeAdd
Definition: interlocked.h:181
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
PVOID HANDLE
Definition: typedefs.h:71
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
FLATPTR fpProcess
Definition: ddrawint.h:486
DWORD dwFlags
Definition: ddrawint.h:499
HRESULT ddRVal
Definition: ddrawint.h:248
struct _EDD_SURFACE * PEDD_SURFACE
PDD_MAPMEMORY MapMemory
Definition: ddrawint.h:508

◆ DxDdLockDirectDrawSurface()

PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface ( HANDLE  hDdSurface)

Definition at line 15 of file eng.c.

16 {
17  PEDD_SURFACE pEDDSurface = NULL;
18  PDD_SURFACE_LOCAL pSurfacelcl = NULL;
19 
20  pEDDSurface = DdHmgLock(hDdSurface, ObjType_DDSURFACE_TYPE, FALSE);
21  if (pEDDSurface != NULL)
22  {
23  pSurfacelcl = &pEDDSurface->ddsSurfaceLocal;
24  }
25 
26  return pSurfacelcl;
27 }
DD_SURFACE_LOCAL ddsSurfaceLocal
Definition: directxint.h:51
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:57
smooth NULL
Definition: ftsmooth.c:416
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147

◆ DxDdQueryDirectDrawObject()

BOOL NTAPI DxDdQueryDirectDrawObject ( HANDLE  DdHandle,
DD_HALINFO pDdHalInfo,
DWORD pCallBackFlags,
LPD3DNTHAL_CALLBACKS  pd3dNtHalCallbacks,
LPD3DNTHAL_GLOBALDRIVERDATA  pd3dNtGlobalDriverData,
PDD_D3DBUFCALLBACKS  pd3dBufCallbacks,
LPDDSURFACEDESC  pTextureFormats,
DWORD p8,
VIDEOMEMORY p9,
DWORD pdwNumFourCC,
DWORD pdwFourCC 
)

Definition at line 424 of file ddraw.c.

436 {
437  PEDD_DIRECTDRAW_LOCAL peDdL;
438  PEDD_DIRECTDRAW_GLOBAL peDdGl;
439  BOOL RetVal = FALSE;
440 
441  if (!DdHandle)
442  return RetVal;
443 
444  if (!pDdHalInfo)
445  return RetVal;
446 
448  return RetVal;
449 
451  if (peDdL)
452  {
453  peDdGl = peDdL->peDirectDrawGlobal2;
454  gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
455 
456  memcpy(pDdHalInfo, &peDdGl->ddHalInfo, sizeof(DD_HALINFO));
457 
458  if (pCallBackFlags)
459  {
460  *(DWORD*)pCallBackFlags = peDdGl->ddCallbacks.dwFlags;
461  *(DWORD*)((ULONG_PTR)pCallBackFlags + 4) = peDdGl->ddSurfaceCallbacks.dwFlags;
462  *(DWORD*)((ULONG_PTR)pCallBackFlags + 8) = peDdGl->ddPaletteCallbacks.dwFlags;
463  }
464 
465  if (pd3dNtHalCallbacks)
466  memcpy(pd3dNtHalCallbacks, &peDdGl->d3dNtHalCallbacks, sizeof(peDdGl->d3dNtHalCallbacks));
467 
468  if (pd3dNtGlobalDriverData)
469  memcpy(pd3dNtGlobalDriverData, &peDdGl->d3dNtGlobalDriverData, sizeof(peDdGl->d3dNtGlobalDriverData));
470 
471  if (pd3dBufCallbacks)
472  memcpy(pd3dBufCallbacks, &peDdGl->d3dBufCallbacks, sizeof(peDdGl->d3dBufCallbacks));
473 
474  if (pTextureFormats)
476 
477  if (pdwNumFourCC)
478  *pdwNumFourCC = peDdGl->dwNumFourCC;
479 
480  if (pdwFourCC)
481  memcpy(pdwFourCC, &peDdGl->pdwFourCC, 4 * peDdGl->dwNumFourCC);
482 
483  RetVal = TRUE;
484 
486 
488  }
489 
490  return RetVal;
491 }
#define TRUE
Definition: types.h:120
USHORT cExclusiveLock
Definition: dxg_int.h:39
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
D3DNTHAL_CALLBACKS d3dNtHalCallbacks
Definition: directxint.h:164
uint32_t ULONG_PTR
Definition: typedefs.h:63
DD_PALETTECALLBACKS ddPaletteCallbacks
Definition: directxint.h:162
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
LPDDSURFACEDESC lpTextureFormats
Definition: d3dnthal.h:132
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
_Out_ DD_HALINFO _Out_ DWORD _Out_ VIDEOMEMORY _Out_ DWORD _Out_ DWORD * pdwFourCC
Definition: winddi.h:4226
DD_D3DBUFCALLBACKS d3dBufCallbacks
Definition: directxint.h:165
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
PFN_DxEngScreenAccessCheck DxEngScreenAccessCheck
Definition: dxg_int.h:129
DD_SURFACECALLBACKS ddSurfaceCallbacks
Definition: directxint.h:161
DWORD dwFlags
Definition: ddrawint.h:499
#define ULONG_PTR
Definition: config.h:101
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138
D3DNTHAL_GLOBALDRIVERDATA d3dNtGlobalDriverData
Definition: directxint.h:163

◆ DxDdReenableDirectDrawObject()

DWORD NTAPI DxDdReenableDirectDrawObject ( HANDLE  DdHandle,
PVOID  p2 
)

Definition at line 541 of file ddraw.c.

544 {
545  PEDD_DIRECTDRAW_LOCAL peDdL;
546  PEDD_DIRECTDRAW_GLOBAL peDdGl;
547  HDC hDC;
548  DWORD RetVal = FALSE;
549 
551 
552  if (!peDdL)
553  return RetVal;
554 
555  peDdGl = peDdL->peDirectDrawGlobal2;
556 
558 
560  gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
561 
562  if (peDdGl->fl & 1 &&
563  gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 &&
568  {
569  // reset acceleration and suspend flags
570  peDdGl->fl &= 0xFFFFFFFD;
571  peDdGl->bSuspended = 0;
573 
574  RetVal = TRUE;
575  // FIXME AGP Stuff
576  }
577 
580 
582 
583  return RetVal;
584 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
USHORT cExclusiveLock
Definition: dxg_int.h:39
PFN_DxEngUnlockShareSem DxEngUnlockShareSem
Definition: dxg_int.h:135
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
PFN_DxEngGetDesktopDC DxEngGetDesktopDC
Definition: dxg_int.h:150
void * PVOID
Definition: retypes.h:9
PFN_DxEngGetDCState DxEngGetDCState
Definition: dxg_int.h:157
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
static HDC hDC
Definition: 3dtext.c:33
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
Definition: xlate.c:10
PFN_DxEngGetHdevData DxEngGetHdevData
Definition: dxg_int.h:147
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138
PFN_DxEngLockShareSem DxEngLockShareSem
Definition: dxg_int.h:134

◆ DxDdUnlock()

DWORD NTAPI DxDdUnlock ( HANDLE  hSurface,
PDD_UNLOCKDATA  puUnlockData 
)

Definition at line 96 of file ddsurf.c.

98 {
99  puUnlockData->ddRVal = DD_OK;
100 
101  return DDHAL_DRIVER_HANDLED;
102 }
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DD_OK
Definition: ddraw.h:186
HRESULT ddRVal
Definition: ddrawint.h:258

◆ DxDdUnlockDirectDrawSurface()

BOOL NTAPI DxDdUnlockDirectDrawSurface ( PDD_SURFACE_LOCAL  pSurface)

Definition at line 31 of file eng.c.

32 {
33  BOOL retVal = FALSE;
34  //PEDD_SURFACE pEDDSurface = NULL;
35 
36  if (pSurface)
37  {
38  // pEDDSurface = (PEDD_SURFACE)( ((PBYTE)pSurface) - sizeof(DD_BASEOBJECT));
39  // InterlockedDecrement(&pEDDSurface->pobj.cExclusiveLock);
40  retVal = TRUE;
41  }
42 
43  return retVal;
44 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

◆ DxDxgGenericThunk()

DWORD NTAPI DxDxgGenericThunk ( ULONG_PTR  ulIndex,
ULONG_PTR  ulHandle,
SIZE_T pdwSizeOfPtr1,
PVOID  pvPtr1,
SIZE_T pdwSizeOfPtr2,
PVOID  pvPtr2 
)

Definition at line 47 of file historic.c.

53 {
55 }
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320

◆ GsDriverEntry()

NTSTATUS NTAPI GsDriverEntry ( IN PVOID  Context1,
IN PVOID  Context2 
)

◆ intDdCreateNewSurfaceObject()

PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject ( PEDD_DIRECTDRAW_LOCAL  peDdL,
HANDLE  hDirectDrawLocal,
PDD_SURFACE_GLOBAL  pDdSurfGlob,
PDD_SURFACE_LOCAL  pDdSurfLoc,
PDD_SURFACE_MORE  pDdSurfMore 
)

Definition at line 588 of file ddraw.c.

589 {
591 
592  // first check if we can assign it from current ddHandle
593  if (hDirectDrawLocal)
594  {
596  // check if surface is locked and belongs to correct DirectDrawLocal
597  if ((pSurface)&&((pSurface->peDirectDrawLocal != peDdL)||(!pSurface->hSecure)))
598  {
600  return NULL;
601  }
602  }
603 
604  // if surface not found from ddHandle or ddHandle not provided
605  if (!pSurface)
606  {
607  // create new surface object
609  if (pSurface)
610  {
611  pSurface->ddsSurfaceLocal.lpGbl = &pSurface->ddsSurfaceGlobal;
612  pSurface->ddsSurfaceLocal.lpSurfMore = &pSurface->ddsSurfaceMore;
613  pSurface->ddsSurfaceInt.lpLcl = &pSurface->ddsSurfaceLocal;
614  pSurface->peDirectDrawLocal = peDdL;
615  pSurface->peDirectDrawGlobalNext = peDdL->peDirectDrawGlobal2;
616  pSurface->ldev = gpEngFuncs.DxEngGetHdevData(pSurface->peDirectDrawGlobalNext->hDev, DxEGShDevData_ldev);
617  pSurface->gdev = gpEngFuncs.DxEngGetHdevData(pSurface->peDirectDrawGlobalNext->hDev, DxEGShDevData_GDev);
618  pSurface->hSecure = (VOID*)1;
619  }
620  }
621 
622  if (pSurface)
623  {
624  pSurface->ddsSurfaceGlobal.fpVidMem = pDdSurfGlob->fpVidMem;
625  pSurface->ddsSurfaceGlobal.lPitch = pDdSurfGlob->lPitch;
626  pSurface->ddsSurfaceGlobal.wWidth = pDdSurfGlob->wWidth;
627  pSurface->ddsSurfaceGlobal.wHeight = pDdSurfGlob->wHeight;
628  pSurface->wWidth = pDdSurfGlob->wWidth;
629  pSurface->wHeight = pDdSurfGlob->wHeight;
630  memcpy(&pSurface->ddsSurfaceGlobal.ddpfSurface, &pDdSurfGlob->ddpfSurface, sizeof(pSurface->ddsSurfaceGlobal.ddpfSurface));
631  pSurface->ddsSurfaceLocal.ddsCaps.dwCaps = pDdSurfLoc->ddsCaps.dwCaps;
632  pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps2 = pDdSurfMore->ddsCapsEx.dwCaps2;
633  pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps3 = pDdSurfMore->ddsCapsEx.dwCaps3;
634  pSurface->ddsSurfaceMore.ddsCapsEx.dwCaps4 = pDdSurfMore->ddsCapsEx.dwCaps4;
635  pSurface->ddsSurfaceMore.dwSurfaceHandle = pDdSurfMore->dwSurfaceHandle;
636  pSurface->hSecure = (VOID*)1;
637 
638  peDdL->peSurface_DdList = pSurface;
639  peDdL->hSurface = (ULONG_PTR)pSurface->pobj.hHmgr;
640  }
641 
642  return pSurface;
643 }
#define TRUE
Definition: types.h:120
DWORD dwSurfaceHandle
Definition: ddrawint.h:166
DDSCAPSEX ddsCapsEx
Definition: ddrawint.h:165
DWORD dwCaps
Definition: ddraw.h:727
DDSCAPS ddsCaps
Definition: ddrawint.h:174
DWORD dwCaps3
Definition: ddraw.h:1060
USHORT cExclusiveLock
Definition: dxg_int.h:39
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
#define ObjType_DDSURFACE_TYPE
Definition: dxg_int.h:57
DWORD dwCaps4
Definition: ddraw.h:1063
smooth NULL
Definition: ftsmooth.c:416
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
DWORD dwCaps2
Definition: ddraw.h:1059
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
struct _EDD_SURFACE * peSurface_DdList
Definition: directxint.h:19
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define InterlockedDecrement
Definition: armddk.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DDPIXELFORMAT ddpfSurface
Definition: ddrawint.h:156
PFN_DxEngGetHdevData DxEngGetHdevData
Definition: dxg_int.h:147
HANDLE FASTCALL DdHmgAlloc(ULONG objSize, CHAR objType, BOOLEAN objLock)
Definition: ddhmg.c:340
FLATPTR fpVidMem
Definition: ddrawint.h:146
#define ULONG_PTR
Definition: config.h:101
struct _EDD_SURFACE * PEDD_SURFACE

Referenced by DxDdCreateSurfaceObject(), and intDdCreateSurfaceOrBuffer().

◆ VerifyObjectOwner()

BOOL FASTCALL VerifyObjectOwner ( PDD_ENTRY  pEntry)

Definition at line 27 of file ddhmg.c.

28 {
29  DWORD Pid = (DWORD)(DWORD_PTR)PsGetCurrentProcessId() & 0xFFFFFFFC;
30  DWORD check = (DWORD_PTR)pEntry->Pid & 0xFFFFFFFE;
31  return ( (check == Pid) || (!check));
32 }
return
Definition: dirsup.c:529
#define DWORD_PTR
Definition: treelist.c:76
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95
void check(CONTEXT *pContext)
Definition: NtContinue.c:61
uint32_t DWORD_PTR
Definition: typedefs.h:63
HANDLE Pid
Definition: dxg_int.h:69
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123

Referenced by DdHmgLock().

Variable Documentation

◆ gcDummyPageRefCnt

LONG gcDummyPageRefCnt

Definition at line 14 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ gcMaxDdHmgr

ULONG gcMaxDdHmgr

Definition at line 18 of file ddhmg.c.

Referenced by DdGetFreeHandle(), DdHmgCreate(), DdHmgDestroy(), and DdHmgLock().

◆ gcSizeDdHmgr

ULONG gcSizeDdHmgr

Definition at line 15 of file ddhmg.c.

Referenced by DdGetFreeHandle(), DdHmgCreate(), and DdHmgDestroy().

◆ ghFreeDdHmgr

ULONG ghFreeDdHmgr

Definition at line 22 of file ddhmg.c.

Referenced by DdGetFreeHandle(), DdHmgCreate(), DdHmgDestroy(), and DdHmgFree().

◆ ghsemDummyPage

HSEMAPHORE ghsemDummyPage

Definition at line 15 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ ghsemHmgr

HSEMAPHORE ghsemHmgr

Definition at line 23 of file ddhmg.c.

Referenced by DdHmgAlloc(), DdHmgCreate(), DdHmgDestroy(), DdHmgFree(), and DdHmgLock().

◆ gpDummyPage

VOID* gpDummyPage

Definition at line 16 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ gpEngFuncs

◆ gpentDdHmgr

PDD_ENTRY gpentDdHmgr

Definition at line 16 of file ddhmg.c.

Referenced by DdGetFreeHandle(), DdHmgAlloc(), DdHmgCreate(), DdHmgDestroy(), DdHmgFree(), and DdHmgLock().

◆ gpentDdHmgrLast

PDD_ENTRY gpentDdHmgrLast

Definition at line 19 of file ddhmg.c.

Referenced by DdGetFreeHandle(), and DdHmgDestroy().

◆ gpepSession

PEPROCESS gpepSession

Definition at line 17 of file main.c.

Referenced by DxDdStartupDxGraphics().

◆ gpLockShortDelay

PLARGE_INTEGER gpLockShortDelay

Definition at line 18 of file main.c.

Referenced by DdHmgCreate().