ReactOS 0.4.15-dev-8127-g6338913
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#include <win32k.h>
12
13// #define NDEBUG
14#include <debug.h>
15
16/************************************************************************/
17/* HeapVidMemAllocAligned */
18/************************************************************************/
24 LPSURFACEALIGNMENT lpAlignment,
25 LPLONG lpNewPitch)
26{
28
29 if (pfnHeapVidMemAllocAligned == NULL)
30 {
31 DPRINT1("Warning: no pfnHeapVidMemAllocAligned\n");
32 return 0;
33 }
34
35 DPRINT("Calling dxg.sys pfnHeapVidMemAllocAligned\n");
36 return pfnHeapVidMemAllocAligned(lpVidMem, dwWidth, dwHeight, lpAlignment, lpNewPitch);
37}
38
39/************************************************************************/
40/* VidMemFree */
41/************************************************************************/
42VOID
46{
48
49 if (pfnVidMemFree == NULL)
50 {
51 DPRINT1("Warning: no pfnVidMemFree\n");
52 }
53 else
54 {
55 DPRINT("Calling dxg.sys pfnVidMemFree\n");
56 pfnVidMemFree(pvmh, ptr);
57 }
58}
59
60/************************************************************************/
61/* EngAllocPrivateUserMem */
62/************************************************************************/
65__drv_allocatesMem(PrivateUserMem)
69EngAllocPrivateUserMem(
73{
75
76 if (pfnEngAllocPrivateUserMem == NULL)
77 {
78 DPRINT1("Warning: no pfnEngAllocPrivateUserMem\n");
80 }
81
82 DPRINT("Calling dxg.sys pfnEngAllocPrivateUserMem\n");
83 return pfnEngAllocPrivateUserMem(psl, cjMemSize, ulTag);
84}
85
86/************************************************************************/
87/* EngFreePrivateUserMem */
88/************************************************************************/
89VOID
92 PVOID pv)
93{
95
96 if (pfnEngFreePrivateUserMem == NULL)
97 {
98 DPRINT1("Warning: no pfnEngFreePrivateUserMem\n");
99 }
100 else
101 {
102 DPRINT("Calling dxg.sys pfnEngFreePrivateUserMem\n");
103 pfnEngFreePrivateUserMem(psl, pv);
104 }
105}
106
107/*++
108* @name EngDxIoctl
109* @implemented
110*
111* The function EngDxIoctl is the ioctl call to different DirectX functions
112* in the driver dxg.sys
113*
114* @param ULONG ulIoctl
115* The ioctl code that we want call to
116*
117* @param PVOID pBuffer
118* Our in or out buffer with data to the ioctl code we are using
119*
120* @param ULONG ulBufferSize
121* The buffer size in bytes
122*
123* @return
124* Always returns DDERR_UNSUPPORTED
125*
126* @remarks.
127* dxg.sys EngDxIoctl call is redirected to dxg.sys
128* This function is no longer used in Windows NT 2000/XP/2003
129*
130*--*/
135 ULONG ulBufferSize)
136{
138 DWORD retVal = DDERR_UNSUPPORTED;
139
140 DPRINT("Calling dxg.sys pfnEngDxIoctl\n");
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*--*/
168{
170 PDD_SURFACE_LOCAL retVal = NULL;
171
172 DPRINT("Calling dxg.sys pfnEngLockDirectDrawSurface\n");
173 if (pfnEngLockDirectDrawSurface != NULL)
174 {
175 retVal = pfnEngLockDirectDrawSurface(hSurface);
176 }
177
178 return retVal;
179}
180
181/*++
182* @name EngUnlockDirectDrawSurface
183* @implemented
184*
185* The function EngUnlockDirectDrawSurface unlocks the DirectX surface
186
187* @param PDD_SURFACE_LOCAL pSurface
188* The Surface we want to unlock
189*
190* @return
191* This return TRUE for success, FALSE for failure
192*
193* @remarks.
194* None
195*
196*--*/
197BOOL
200{
202 BOOL retVal = FALSE;
203
204 DPRINT("Calling dxg.sys pfnEngUnlockDirectDrawSurface\n");
205 if (pfnEngUnlockDirectDrawSurface != NULL)
206 {
207 retVal = pfnEngUnlockDirectDrawSurface(pSurface);
208 }
209
210 return retVal;
211}
#define DPRINT1
Definition: precomp.h:8
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
ULONG_PTR FLATPTR
Definition: ddrawint.h:76
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
static const WCHAR dwWidth[]
Definition: provider.c:62
static const WCHAR dwHeight[]
Definition: provider.c:63
#define APIENTRY
Definition: api.h:79
#define __drv_allocatesMem(kind)
Definition: driverspecs.h:257
#define DXG_INDEX_DxDdFreePrivateUserMem
Definition: dxg.h:97
#define DXG_INDEX_DxDdIoctl
Definition: dxg.h:100
#define DXG_INDEX_DxDdHeapVidMemFree
Definition: dxg.h:95
#define DXG_INDEX_DxDdAllocPrivateUserMem
Definition: dxg.h:96
DWORD(NTAPI * PGD_ENGDXIOCTL)(ULONG, PVOID, ULONG)
Definition: dxg.h:214
#define DXG_INDEX_DxDdUnlockDirectDrawSurface
Definition: dxg.h:99
#define DXG_INDEX_DxDdHeapVidMemAllocAligned
Definition: dxg.h:94
#define DXG_INDEX_DxDdLockDirectDrawSurface
Definition: dxg.h:98
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PDD_SURFACE_LOCAL(APIENTRY * PGD_ENGLOCKDIRECTDRAWSURFACE)(HANDLE)
Definition: intddraw.h:107
BOOL(APIENTRY * PGD_ENGUNLOCKDIRECTDRAWSURFACE)(PDD_SURFACE_LOCAL)
Definition: intddraw.h:108
VOID(APIENTRY * PGD_ENGFREEPRIVATEUSERMEM)(PDD_SURFACE_LOCAL, PVOID)
Definition: intddraw.h:106
FLATPTR(APIENTRY * PGD_HEAPVIDMEMALLOCALIGNED)(LPVIDMEM, DWORD, DWORD, LPSURFACEALIGNMENT, LPLONG)
Definition: intddraw.h:103
VOID(APIENTRY * PGD_VIDMEMFREE)(LPVMEMHEAP, FLATPTR)
Definition: intddraw.h:104
PVOID(APIENTRY * PGD_ENGALLOCPRIVATEUSERMEM)(PDD_SURFACE_LOCAL, SIZE_T, ULONG)
Definition: intddraw.h:105
static PVOID ptr
Definition: dispmode.c:27
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _In_
Definition: ms_sal.h:308
#define _Ret_opt_bytecount_(size)
Definition: ms_sal.h:1252
PVOID pBuffer
FLATPTR APIENTRY HeapVidMemAllocAligned(LPVIDMEM lpVidMem, DWORD dwWidth, DWORD dwHeight, LPSURFACEALIGNMENT lpAlignment, LPLONG lpNewPitch)
Definition: eng.c:21
BOOL APIENTRY EngUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
Definition: eng.c:199
VOID APIENTRY VidMemFree(LPVMEMHEAP pvmh, FLATPTR ptr)
Definition: eng.c:44
VOID APIENTRY EngFreePrivateUserMem(PDD_SURFACE_LOCAL psl, PVOID pv)
Definition: eng.c:91
HRESULT APIENTRY EngDxIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize)
Definition: eng.c:133
PDD_SURFACE_LOCAL APIENTRY EngLockDirectDrawSurface(HANDLE hSurface)
Definition: eng.c:167
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127
#define DPRINT
Definition: sndvol32.h:73
int32_t * LPLONG
Definition: typedefs.h:58
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl+1]
Definition: ddraw.c:24
_In_ ULONG _In_ ULONG ulTag
Definition: winddi.h:3942
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
_Must_inspect_result_ _In_ ULONG cjMemSize
Definition: winddi.h:1381
#define ENGAPI
Definition: winddi.h:48