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