ReactOS  0.4.14-dev-1007-g90d795b
eng.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * PURPOSE: Native DirectDraw implementation
5  * FILE: win32ss/reactx/ntddraw/eng.c
6  * PROGRAMER: Magnus olsen (magnus@greatlord.com)
7  * REVISION HISTORY:
8  * 19/1-2006 Magnus Olsen
9  */
10 
11 
12 #include <win32k.h>
13 #include <debug.h>
14 
15 /************************************************************************/
16 /* HeapVidMemAllocAligned */
17 /************************************************************************/
18 FLATPTR
21  DWORD dwWidth,
23  LPSURFACEALIGNMENT lpAlignment,
24  LPLONG lpNewPitch)
25 {
27 
28  if (pfnHeapVidMemAllocAligned == NULL)
29  {
30  DPRINT1("Warning: no pfnHeapVidMemAllocAligned\n");
31  return 0;
32  }
33 
34  DPRINT1("Calling dxg.sys pfnHeapVidMemAllocAligned\n");
35  return pfnHeapVidMemAllocAligned(lpVidMem, dwWidth, dwHeight, lpAlignment, lpNewPitch);
36 }
37 
38 /************************************************************************/
39 /* VidMemFree */
40 /************************************************************************/
41 VOID
44  FLATPTR ptr)
45 {
47 
48  if (pfnVidMemFree == NULL)
49  {
50  DPRINT1("Warning: no pfnVidMemFree\n");
51  }
52  else
53  {
54  DPRINT1("Calling dxg.sys pfnVidMemFree\n");
55  pfnVidMemFree(pvmh, ptr);
56  }
57 }
58 
59 /************************************************************************/
60 /* EngAllocPrivateUserMem */
61 /************************************************************************/
64 __drv_allocatesMem(PrivateUserMem)
65 ENGAPI
66 PVOID
68 EngAllocPrivateUserMem(
72 {
74 
75  if (pfnEngAllocPrivateUserMem == NULL)
76  {
77  DPRINT1("Warning: no pfnEngAllocPrivateUserMem\n");
79  }
80 
81  DPRINT1("Calling dxg.sys pfnEngAllocPrivateUserMem\n");
82  return pfnEngAllocPrivateUserMem(psl, cjMemSize, ulTag);
83 }
84 
85 /************************************************************************/
86 /* EngFreePrivateUserMem */
87 /************************************************************************/
88 VOID
91  PVOID pv)
92 {
94 
95  if (pfnEngFreePrivateUserMem == NULL)
96  {
97  DPRINT1("Warning: no pfnEngFreePrivateUserMem\n");
98  }
99  else
100  {
101  DPRINT1("Calling dxg.sys pfnEngFreePrivateUserMem\n");
102  pfnEngFreePrivateUserMem(psl, pv);
103  }
104 }
105 
106 /*++
107 * @name EngDxIoctl
108 * @implemented
109 *
110 * The function EngDxIoctl is the ioctl call to different DirectX functions
111 * in the driver dxg.sys
112 *
113 * @param ULONG ulIoctl
114 * The ioctl code that we want call to
115 *
116 * @param PVOID pBuffer
117 * Our in or out buffer with data to the ioctl code we are using
118 *
119 * @param ULONG ulBufferSize
120 * The buffer size in bytes
121 *
122 * @return
123 * Always returns DDERR_UNSUPPORTED
124 *
125 * @remarks.
126 * dxg.sys EngDxIoctl call is redirected to dxg.sys
127 * This function is no longer used in Windows NT 2000/XP/2003
128 *
129 *--*/
130 HRESULT
131 APIENTRY
133  PVOID pBuffer,
134  ULONG ulBufferSize)
135 {
137  DWORD retVal = DDERR_UNSUPPORTED;
138 
139  DPRINT1("Calling dxg.sys pfnEngDxIoctl\n");
140 
141  if (pfnEngDxIoctl != NULL)
142  {
143  retVal = pfnEngDxIoctl(ulIoctl, pBuffer, ulBufferSize);
144  }
145 
146  return retVal;
147 }
148 
149 /*++
150 * @name EngLockDirectDrawSurface
151 * @implemented
152 *
153 * The function EngUnlockDirectDrawSurface locks the DirectX surface.
154 
155 * @param HANDLE hSurface
156 * The handle of a surface
157 *
158 * @return
159 * This return a vaild or NULL pointer to a PDD_SURFACE_LOCAL object
160 *
161 * @remarks.
162 * None
163 *
164 *--*/
166 APIENTRY
168 {
170  PDD_SURFACE_LOCAL retVal = NULL;
171 
172  DPRINT1("Calling dxg.sys pfnEngLockDirectDrawSurface\n");
173 
174  if (pfnEngLockDirectDrawSurface != NULL)
175  {
176  retVal = pfnEngLockDirectDrawSurface(hSurface);
177  }
178 
179  return retVal;
180 }
181 
182 
183 /*++
184 * @name EngUnlockDirectDrawSurface
185 * @implemented
186 *
187 * The function EngUnlockDirectDrawSurface unlocks the DirectX surface
188 
189 * @param PDD_SURFACE_LOCAL pSurface
190 * The Surface we want to unlock
191 *
192 * @return
193 * This return TRUE for success, FALSE for failure
194 *
195 * @remarks.
196 * None
197 *
198 *--*/
199 BOOL
200 APIENTRY
202 {
204  BOOL retVal = FALSE;
205 
206  DPRINT1("Calling dxg.sys pfnEngUnlockDirectDrawSurface\n");
207 
208  if (pfnEngUnlockDirectDrawSurface != NULL)
209  {
210  retVal = pfnEngUnlockDirectDrawSurface(pSurface);
211  }
212 
213  return retVal;
214 }
215 
#define _Must_inspect_result_
Definition: no_sal2.h:314
VOID APIENTRY EngFreePrivateUserMem(PDD_SURFACE_LOCAL psl, PVOID pv)
Definition: eng.c:90
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127
BOOL APIENTRY EngUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
Definition: eng.c:201
#define ENGAPI
Definition: winddi.h:48
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
VOID(APIENTRY * PGD_VIDMEMFREE)(LPVMEMHEAP, FLATPTR)
Definition: intddraw.h:105
VOID(APIENTRY * PGD_ENGFREEPRIVATEUSERMEM)(PDD_SURFACE_LOCAL, PVOID)
Definition: intddraw.h:107
HRESULT APIENTRY EngDxIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize)
Definition: eng.c:132
_Must_inspect_result_ _In_ ULONG cjMemSize
Definition: winddi.h:1381
PVOID(APIENTRY * PGD_ENGALLOCPRIVATEUSERMEM)(PDD_SURFACE_LOCAL, SIZE_T, ULONG)
Definition: intddraw.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DXG_INDEX_DxDdHeapVidMemFree
Definition: dxg.h:95
_Must_inspect_result_ _Ret_opt_bytecount_(cjMemSize)
Definition: eng.c:63
static PVOID ptr
Definition: dispmode.c:27
FLATPTR APIENTRY HeapVidMemAllocAligned(LPVIDMEM lpVidMem, DWORD dwWidth, DWORD dwHeight, LPSURFACEALIGNMENT lpAlignment, LPLONG lpNewPitch)
Definition: eng.c:20
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
VOID APIENTRY VidMemFree(LPVMEMHEAP pvmh, FLATPTR ptr)
Definition: eng.c:43
static const WCHAR dwHeight[]
Definition: provider.c:63
#define __drv_allocatesMem(kind)
Definition: driverspecs.h:239
#define DXG_INDEX_DxDdAllocPrivateUserMem
Definition: dxg.h:96
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
#define DXG_INDEX_DxDdLockDirectDrawSurface
Definition: dxg.h:98
ULONG_PTR FLATPTR
Definition: ddrawint.h:76
LONG HRESULT
Definition: typedefs.h:78
#define DXG_INDEX_DxDdHeapVidMemAllocAligned
Definition: dxg.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL(APIENTRY * PGD_ENGUNLOCKDIRECTDRAWSURFACE)(PDD_SURFACE_LOCAL)
Definition: intddraw.h:109
#define DXG_INDEX_DxDdFreePrivateUserMem
Definition: dxg.h:97
DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl+1]
Definition: ddraw.c:23
PDD_SURFACE_LOCAL(APIENTRY * PGD_ENGLOCKDIRECTDRAWSURFACE)(HANDLE)
Definition: intddraw.h:108
#define _In_
Definition: no_sal2.h:204
_In_ ULONG _In_ ULONG ulTag
Definition: winddi.h:3941
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#define DXG_INDEX_DxDdIoctl
Definition: dxg.h:100
int32_t * LPLONG
Definition: typedefs.h:57
FLATPTR(APIENTRY * PGD_HEAPVIDMEMALLOCALIGNED)(LPVIDMEM, DWORD, DWORD, LPSURFACEALIGNMENT, LPLONG)
Definition: intddraw.h:104
#define DPRINT1
Definition: precomp.h:8
DWORD(NTAPI * PGD_ENGDXIOCTL)(ULONG, PVOID, ULONG)
Definition: dxg.h:214
#define DXG_INDEX_DxDdUnlockDirectDrawSurface
Definition: dxg.h:99
unsigned int ULONG
Definition: retypes.h:1
PDD_SURFACE_LOCAL APIENTRY EngLockDirectDrawSurface(HANDLE hSurface)
Definition: eng.c:167
static const WCHAR dwWidth[]
Definition: provider.c:62
#define APIENTRY
Definition: api.h:79