ReactOS  0.4.14-dev-49-gfb4591c
main.c File Reference
#include <dxg_int.h>
#include "dxg_driver.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI DriverEntry (IN PVOID Context1, IN PVOID Context2)
 
NTSTATUS APIENTRY DxDdStartupDxGraphics (ULONG SizeEngDrv, PDRVENABLEDATA pDxEngDrv, ULONG SizeDxgDrv, PDRVENABLEDATA pDxgDrv, PULONG DirectDrawContext, PEPROCESS Proc)
 
NTSTATUS APIENTRY DxDdCleanupDxGraphics (VOID)
 

Variables

LONG gcDummyPageRefCnt = 0
 
HSEMAPHORE ghsemDummyPage = NULL
 
VOIDgpDummyPage = NULL
 
PEPROCESS gpepSession = NULL
 
PLARGE_INTEGER gpLockShortDelay = NULL
 
DXENG_FUNCTIONS gpEngFuncs
 
const ULONG gcDxgFuncs = DXG_INDEX_DxDdIoctl + 1
 

Function Documentation

◆ DriverEntry()

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

Definition at line 26 of file main.c.

28 {
29  return 0;
30 }

◆ 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

◆ DxDdStartupDxGraphics()

NTSTATUS APIENTRY DxDdStartupDxGraphics ( ULONG  SizeEngDrv,
PDRVENABLEDATA  pDxEngDrv,
ULONG  SizeDxgDrv,
PDRVENABLEDATA  pDxgDrv,
PULONG  DirectDrawContext,
PEPROCESS  Proc 
)

Definition at line 34 of file main.c.

40 {
41 
42  PDRVFN drv_func;
43  PFN *peng_funcs;
44  UINT i;
45 
46  /* Test see if the data is vaild we got from win32k.sys */
47  if ((SizeEngDrv != sizeof(DRVENABLEDATA)) ||
48  (SizeDxgDrv != sizeof(DRVENABLEDATA)))
49  {
51  }
52 
53  /* rest static value */
54  gpDummyPage = NULL;
57 
58  /*
59  * Setup internal driver functions list we got from dxg driver functions list
60  */
61  pDxgDrv->iDriverVersion = 0x80000; /* Note 12/1-2004 : DirectX 8 ? */
62  pDxgDrv->c = gcDxgFuncs;
63  pDxgDrv->pdrvfn = gaDxgFuncs;
64 
65  /* check how many driver functions and fail if the value does not match */
66  if (pDxEngDrv->c != DXENG_INDEX_DxEngLoadImage + 1)
67  {
68  return STATUS_INTERNAL_ERROR;
69  }
70 
71  /*
72  * Check if all drv functions are sorted right
73  * and if it really are exported
74  */
75 
76  peng_funcs = (PFN*)&gpEngFuncs;
77 
78  for (i = 1; i < DXENG_INDEX_DxEngLoadImage + 1; i++)
79  {
80  drv_func = &pDxEngDrv->pdrvfn[i];
81 
82  if ((drv_func->iFunc != i) ||
83  (drv_func->pfn == NULL))
84  {
85  return STATUS_INTERNAL_ERROR;
86  }
87 
88  peng_funcs[i] = drv_func->pfn;
89  }
90 
91  /* Note 12/1-2004 : Why is this set to 0x618 */
92  *DirectDrawContext = 0x618;
93 
94  if (DdHmgCreate())
95  {
97 
98  if (ghsemDummyPage)
99  {
100  gpepSession = Proc;
101  return STATUS_SUCCESS;
102  }
103  }
104 
105  DdHmgDestroy();
106 
107  if (ghsemDummyPage)
108  {
110  ghsemDummyPage = 0;
111  }
112 
113  return STATUS_NO_MEMORY;
114 }
ULONG iFunc
Definition: winddi.h:530
const ULONG gcDxgFuncs
Definition: main.c:22
DRVFN gaDxgFuncs[]
Definition: dxg_driver.h:778
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
#define DXENG_INDEX_DxEngLoadImage
Definition: dxeng.h:48
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
PFN pfn
Definition: winddi.h:531
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:451
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
smooth NULL
Definition: ftsmooth.c:416
BOOL FASTCALL DdHmgCreate(VOID)
Definition: ddhmg.c:49
VOID * gpDummyPage
Definition: main.c:16
DRVFN * pdrvfn
Definition: winddi.h:544
PEPROCESS gpepSession
Definition: main.c:17
BOOLEAN(* PFN)(PARGS)
Definition: parse.h:47
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
ULONG iDriverVersion
Definition: winddi.h:542
unsigned int UINT
Definition: ndis.h:50
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2966
Definition: winddi.h:529

Variable Documentation

◆ gcDummyPageRefCnt

LONG gcDummyPageRefCnt = 0

Definition at line 14 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ gcDxgFuncs

const ULONG gcDxgFuncs = DXG_INDEX_DxDdIoctl + 1

Definition at line 22 of file main.c.

Referenced by DxDdStartupDxGraphics().

◆ ghsemDummyPage

HSEMAPHORE ghsemDummyPage = NULL

Definition at line 15 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ gpDummyPage

VOID* gpDummyPage = NULL

Definition at line 16 of file main.c.

Referenced by DxDdCleanupDxGraphics(), and DxDdStartupDxGraphics().

◆ gpEngFuncs

◆ gpepSession

PEPROCESS gpepSession = NULL

Definition at line 17 of file main.c.

Referenced by DxDdStartupDxGraphics().

◆ gpLockShortDelay

PLARGE_INTEGER gpLockShortDelay = NULL

Definition at line 18 of file main.c.

Referenced by DdHmgCreate().