1 
2 
3 #include "../rosdraw.h"
4 
5 
6 
7 HRESULT WINAPI
8 Thunk_DDrawSurface3_QueryInterface(LPDIRECTDRAWSURFACE3 iface, REFIID iid,
9 				       LPVOID *ppObj)
10 {
11 	DX_WINDBG_trace();
12 
13 	return Main_DDrawSurface_QueryInterface((LPDIRECTDRAWSURFACE7) iface,  iid, ppObj);
14 }
15 
16 ULONG WINAPI
17 Thunk_DDrawSurface3_AddRef(LPDIRECTDRAWSURFACE3 iface)
18 {
19 	DX_WINDBG_trace();
20 
21     return Main_DDrawSurface_AddRef((LPDIRECTDRAWSURFACE7) iface);
22 }
23 
24 ULONG WINAPI
25 Thunk_DDrawSurface3_Release(LPDIRECTDRAWSURFACE3 iface)
26 {
27 	DX_WINDBG_trace();
28 
29     return Main_DDrawSurface_Release((LPDIRECTDRAWSURFACE7) iface);
30 }
31 
32 HRESULT WINAPI
33 Thunk_DDrawSurface3_AddAttachedSurface(LPDIRECTDRAWSURFACE3 iface, LPDIRECTDRAWSURFACE3 pAttach)
34 {
35 	DX_WINDBG_trace();
36 
37     return Main_DDrawSurface_AddAttachedSurface((LPDIRECTDRAWSURFACE7) iface, (LPDIRECTDRAWSURFACE7) pAttach);
38 }
39 
40 HRESULT WINAPI
41 Thunk_DDrawSurface3_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 iface, LPRECT pRect)
42 {
43 	DX_WINDBG_trace();
44 
45     return Main_DDrawSurface_AddOverlayDirtyRect((LPDIRECTDRAWSURFACE7) iface, pRect);
46 }
47 
48 HRESULT WINAPI
49 Thunk_DDrawSurface3_Blt(LPDIRECTDRAWSURFACE3 iface, LPRECT rdst,
50 			    LPDIRECTDRAWSURFACE3 src, LPRECT rsrc,
51 			    DWORD dwFlags, LPDDBLTFX pFX)
52 {
53     DX_WINDBG_trace();
54 
55 	return Main_DDrawSurface_Blt((LPDIRECTDRAWSURFACE7) iface, rdst,(LPDIRECTDRAWSURFACE7) src, rsrc, dwFlags, pFX);
56 }
57 
58 HRESULT WINAPI
59 Thunk_DDrawSurface3_BltBatch(LPDIRECTDRAWSURFACE3 iface, LPDDBLTBATCH pBatch, DWORD dwCount, DWORD dwFlags)
60 {
61 	DX_WINDBG_trace();
62 
63 	return Main_DDrawSurface_BltBatch((LPDIRECTDRAWSURFACE7) iface, pBatch, dwCount, dwFlags);
64 }
65 
66 HRESULT WINAPI
67 Thunk_DDrawSurface3_BltFast(LPDIRECTDRAWSURFACE3 iface, DWORD dstx, DWORD dsty,
68 							LPDIRECTDRAWSURFACE3 src, LPRECT rsrc, DWORD dwTrans)
69 {
70 	DX_WINDBG_trace();
71 
72    	return Main_DDrawSurface_BltFast((LPDIRECTDRAWSURFACE7) iface, dstx, dsty,
73 		                             (LPDIRECTDRAWSURFACE7)src, rsrc, dwTrans);
74 }
75 
76 HRESULT WINAPI
77 Thunk_DDrawSurface3_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags, LPDIRECTDRAWSURFACE3 pAttached)
78 {
79 	DX_WINDBG_trace();
80 
81     return Main_DDrawSurface_DeleteAttachedSurface((LPDIRECTDRAWSURFACE7) iface, dwFlags,
82 		                                           (LPDIRECTDRAWSURFACE7) pAttached);
83 }
84 
85 
86 
87 HRESULT WINAPI
88 Thunk_DDrawSurface3_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 iface,
89 					     LPVOID context,
90 					     LPDDENUMSURFACESCALLBACK cb)
91 {
92     DX_WINDBG_trace();
93 
94     return Main_DDrawSurface_EnumAttachedSurfaces((LPDIRECTDRAWSURFACE7) iface,
95 		                                           context, (LPDDENUMSURFACESCALLBACK7)cb);
96 }
97 
98 HRESULT WINAPI
99 Thunk_DDrawSurface3_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 iface,
100 					   DWORD dwFlags, LPVOID context,
101 					   LPDDENUMSURFACESCALLBACK cb)
102 {
103     DX_WINDBG_trace();
104 
105 	return Main_DDrawSurface_EnumOverlayZOrders( (LPDIRECTDRAWSURFACE7) iface, dwFlags, context,
106 		                                         (LPDDENUMSURFACESCALLBACK7) cb);
107 }
108 
109 HRESULT WINAPI
110 Thunk_DDrawSurface3_Flip(LPDIRECTDRAWSURFACE3 iface,
111 			     LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags)
112 {
113 	DX_WINDBG_trace();
114 
115 	return Main_DDrawSurface_Flip( (LPDIRECTDRAWSURFACE7)iface, (LPDIRECTDRAWSURFACE7) lpDDSurfaceTargetOverride,
116 		                            dwFlags);
117 }
118 
119 HRESULT WINAPI
120 Thunk_DDrawSurface3_GetAttachedSurface(LPDIRECTDRAWSURFACE3 iface,
121 					   LPDDSCAPS pCaps,
122 					   LPDIRECTDRAWSURFACE3* ppAttached)
123 {
124     DDSCAPS2 caps;
125 	HRESULT hr = DDERR_GENERIC;
126 
127 	DX_WINDBG_trace();
128 
129 	ZeroMemory(&caps,sizeof(DDSCAPS2));
130 
131 	if (pCaps != NULL)
132 	{
133         caps.dwCaps  = pCaps->dwCaps;
134 
135 	    hr = Main_DDrawSurface_GetAttachedSurface( (LPDIRECTDRAWSURFACE7) iface,
136 		                                       &caps, (LPDIRECTDRAWSURFACE7 *) ppAttached);
137 	    pCaps->dwCaps = caps.dwCaps;
138 	}
139 	else
140 	{
141 		hr = Main_DDrawSurface_GetAttachedSurface( (LPDIRECTDRAWSURFACE7) iface,
142 		                                       NULL, (LPDIRECTDRAWSURFACE7 *) ppAttached);
143 	}
144 
145     return hr;
146 }
147 
148 HRESULT WINAPI
149 Thunk_DDrawSurface3_GetBltStatus(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags)
150 {
151     DX_WINDBG_trace();
152 
153 	return Main_DDrawSurface_GetBltStatus((LPDIRECTDRAWSURFACE7) iface, dwFlags);
154 }
155 
156 HRESULT WINAPI
157 Thunk_DDrawSurface3_GetCaps(LPDIRECTDRAWSURFACE3 iface, LPDDSCAPS pCaps)
158 {
159     DDSCAPS2 caps;
160     HRESULT hr = DDERR_GENERIC;
161 
162 	DX_WINDBG_trace();
163 
164 	ZeroMemory(&caps,sizeof(DDSCAPS2));
165 
166 	if (pCaps != NULL)
167 	{
168         hr = Main_DDrawSurface_GetCaps((LPDIRECTDRAWSURFACE7) iface, &caps);
169         pCaps->dwCaps = caps.dwCaps;
170 	}
171 	else
172 	{
173 		hr = Main_DDrawSurface_GetCaps((LPDIRECTDRAWSURFACE7) iface, NULL);
174 	}
175 
176     return hr;
177 }
178 
179 HRESULT WINAPI
180 Thunk_DDrawSurface3_GetClipper(LPDIRECTDRAWSURFACE3 iface,
181 				   LPDIRECTDRAWCLIPPER* ppClipper)
182 {
183 	DX_WINDBG_trace();
184 
185 	return Main_DDrawSurface_GetClipper((LPDIRECTDRAWSURFACE7) iface, ppClipper);
186 }
187 
188 HRESULT WINAPI
189 Thunk_DDrawSurface3_GetColorKey(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags,
190 				    LPDDCOLORKEY pCKey)
191 {
192 	DX_WINDBG_trace();
193 
194 	return Main_DDrawSurface_GetColorKey( (LPDIRECTDRAWSURFACE7) iface, dwFlags, pCKey);
195 }
196 
197 HRESULT WINAPI
198 Thunk_DDrawSurface3_GetDC(LPDIRECTDRAWSURFACE3 iface, HDC* phDC)
199 {
200 	DX_WINDBG_trace();
201 
202 	return Main_DDrawSurface_GetDC((LPDIRECTDRAWSURFACE7) iface, phDC);
203 }
204 
205 HRESULT WINAPI
206 Thunk_DDrawSurface3_GetFlipStatus(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags)
207 {
208 	DX_WINDBG_trace();
209 
210     return Main_DDrawSurface_GetFlipStatus((LPDIRECTDRAWSURFACE7) iface, dwFlags);
211 }
212 
213 HRESULT WINAPI
214 Thunk_DDrawSurface3_GetOverlayPosition(LPDIRECTDRAWSURFACE3 iface, LPLONG pX, LPLONG pY)
215 {
216 	DX_WINDBG_trace();
217 
218     return Main_DDrawSurface_GetOverlayPosition((LPDIRECTDRAWSURFACE7) iface,  pX, pY);
219 }
220 
221 HRESULT WINAPI
222 Thunk_DDrawSurface3_GetPalette(LPDIRECTDRAWSURFACE3 iface,
223 				   LPDIRECTDRAWPALETTE* ppPalette)
224 {
225 	DX_WINDBG_trace();
226 
227 	return Main_DDrawSurface_GetPalette((LPDIRECTDRAWSURFACE7) iface, ppPalette);
228 }
229 
230 HRESULT WINAPI
231 Thunk_DDrawSurface3_GetPixelFormat(LPDIRECTDRAWSURFACE3 iface,
232 				       LPDDPIXELFORMAT pDDPixelFormat)
233 {
234 	DX_WINDBG_trace();
235 
236     return Main_DDrawSurface_GetPixelFormat((LPDIRECTDRAWSURFACE7) iface, pDDPixelFormat);
237 }
238 
239 HRESULT WINAPI
240 Thunk_DDrawSurface3_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 iface,
241 				       LPDDSURFACEDESC pDDSD)
242 {
243     HRESULT retValue = DDERR_GENERIC;
244 
245     DX_WINDBG_trace();
246 
247 	if (pDDSD != NULL)
248 	{
249 	   DDSURFACEDESC2 pDDSD2;
250 	   ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
251 	   memcpy(&pDDSD2, pDDSD, sizeof(DDSURFACEDESC));
252 	   pDDSD2.dwSize = sizeof(DDSURFACEDESC2);
253 	   retValue = Main_DDrawSurface_GetSurfaceDesc((LPDIRECTDRAWSURFACE7) iface, &pDDSD2);
254        memcpy(pDDSD, &pDDSD2, sizeof(DDSURFACEDESC));
255 	   pDDSD->dwSize = sizeof(DDSURFACEDESC);
256 	}
257 	else
258 	{
259 		retValue = Main_DDrawSurface_GetSurfaceDesc((LPDIRECTDRAWSURFACE7) iface, NULL);
260 	}
261 
262     return retValue;
263 }
264 
265 HRESULT WINAPI
266 Thunk_DDrawSurface3_Initialize(LPDIRECTDRAWSURFACE3 iface, LPDIRECTDRAW pDD,
267 				   LPDDSURFACEDESC pDDSD)
268 {
269 	HRESULT retValue = DDERR_GENERIC;
270 	DDSURFACEDESC2 pDDSD2;
271 
272 	DX_WINDBG_trace();
273 
274 	ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
275 
276 	if (pDDSD != NULL)
277 	{
278 	   DDSURFACEDESC2 pDDSD2;
279 	   ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
280 	   memcpy(&pDDSD2, pDDSD, sizeof(DDSURFACEDESC));
281 	   pDDSD2.dwSize = sizeof(DDSURFACEDESC2);
282 	   retValue = Main_DDrawSurface_Initialize((LPDIRECTDRAWSURFACE7) iface, pDD, &pDDSD2);
283        memcpy(pDDSD, &pDDSD2, sizeof(DDSURFACEDESC));
284 	   pDDSD->dwSize = sizeof(DDSURFACEDESC);
285 	}
286 	else
287 	{
288 		retValue = Main_DDrawSurface_Initialize ((LPDIRECTDRAWSURFACE7) iface, pDD, NULL);
289 
290 	}
291 
292     return retValue;
293 }
294 
295 HRESULT WINAPI
296 Thunk_DDrawSurface3_IsLost(LPDIRECTDRAWSURFACE3 iface)
297 {
298 	DX_WINDBG_trace();
299 
300     return Main_DDrawSurface_IsLost((LPDIRECTDRAWSURFACE7) iface);
301 }
302 
303 HRESULT WINAPI
304 Thunk_DDrawSurface3_Lock(LPDIRECTDRAWSURFACE3 iface, LPRECT pRect,
305 			     LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE events)
306 {
307 
308 	HRESULT retValue = DDERR_GENERIC;
309 	DDSURFACEDESC2 pDDSD2;
310 
311 	DX_WINDBG_trace();
312 
313 	ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
314 
315 	if (pDDSD != NULL)
316 	{
317 	   DDSURFACEDESC2 pDDSD2;
318 	   ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
319 	   memcpy(&pDDSD2, pDDSD, sizeof(DDSURFACEDESC));
320 	   pDDSD2.dwSize = sizeof(DDSURFACEDESC2);
321 	   retValue = Main_DDrawSurface_Lock ( (LPDIRECTDRAWSURFACE7) iface, pRect, &pDDSD2, dwFlags, events);
322        memcpy(pDDSD, &pDDSD2, sizeof(DDSURFACEDESC));
323 	   pDDSD->dwSize = sizeof(DDSURFACEDESC);
324 	}
325 	else
326 	{
327 		retValue = Main_DDrawSurface_Lock ( (LPDIRECTDRAWSURFACE7) iface, pRect, NULL, dwFlags, events);
328 	}
329 
330     return retValue;
331 
332 }
333 
334 HRESULT WINAPI
335 Thunk_DDrawSurface3_ReleaseDC(LPDIRECTDRAWSURFACE3 iface, HDC hDC)
336 {
337 	DX_WINDBG_trace();
338 
339 	return Main_DDrawSurface_ReleaseDC((LPDIRECTDRAWSURFACE7) iface, hDC);
340 }
341 
342 HRESULT WINAPI
343 Thunk_DDrawSurface3_Restore(LPDIRECTDRAWSURFACE3 iface)
344 {
345 	DX_WINDBG_trace();
346 
347     return Main_DDrawSurface_Restore((LPDIRECTDRAWSURFACE7) iface);
348 }
349 
350 HRESULT WINAPI
351 Thunk_DDrawSurface3_SetClipper(LPDIRECTDRAWSURFACE3 iface, LPDIRECTDRAWCLIPPER pDDClipper)
352 {
353 	DX_WINDBG_trace();
354 
355     return Main_DDrawSurface_SetClipper ((LPDIRECTDRAWSURFACE7) iface, pDDClipper);
356 }
357 
358 HRESULT WINAPI
359 Thunk_DDrawSurface3_SetColorKey(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags,
360 				    LPDDCOLORKEY pCKey)
361 {
362 	DX_WINDBG_trace();
363 
364     return Main_DDrawSurface_SetColorKey ((LPDIRECTDRAWSURFACE7) iface, dwFlags, pCKey);
365 }
366 
367 HRESULT WINAPI
368 Thunk_DDrawSurface3_SetOverlayPosition(LPDIRECTDRAWSURFACE3 iface, LONG X,LONG Y)
369 {
370 	DX_WINDBG_trace();
371 
372     return Main_DDrawSurface_SetOverlayPosition ((LPDIRECTDRAWSURFACE7) iface, X, Y);
373 }
374 
375 HRESULT WINAPI
376 Thunk_DDrawSurface3_SetPalette(LPDIRECTDRAWSURFACE3 iface,
377 				   LPDIRECTDRAWPALETTE pPalette)
378 {
379 	DX_WINDBG_trace();
380 
381 	return Main_DDrawSurface_SetPalette ((LPDIRECTDRAWSURFACE7) iface, pPalette);
382 }
383 
384 /*
385 HRESULT WINAPI
386 Thunk_DDrawSurface3_Unlock(LPDIRECTDRAWSURFACE3 iface, LPRECT pRect)
387 {
388 	DX_WINDBG_trace();
389 
390 	return Main_DDrawSurface_Unlock ((LPDIRECTDRAWSURFACE7) iface, pRect);
391 } */
392 
393 HRESULT WINAPI
394 Thunk_DDrawSurface3_Unlock(LPVOID iface, LPVOID pRect)
395 {
396 	DX_WINDBG_trace();
397 	DX_STUB;
398 }
399 
400 HRESULT WINAPI
401 Thunk_DDrawSurface3_UpdateOverlay(LPDIRECTDRAWSURFACE3 iface, LPRECT pSrcRect, LPDIRECTDRAWSURFACE3 pDstSurface,
402 				                  LPRECT pDstRect, DWORD dwFlags, LPDDOVERLAYFX pFX)
403 {
404 
405 	DX_WINDBG_trace();
406 
407 	return Main_DDrawSurface_UpdateOverlay ( (LPDIRECTDRAWSURFACE7) iface, pSrcRect,
408 		                                     (LPDIRECTDRAWSURFACE7) pDstSurface, pDstRect, dwFlags, pFX);
409 }
410 
411 HRESULT WINAPI
412 Thunk_DDrawSurface3_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags)
413 {
414 	DX_WINDBG_trace();
415 
416     return Main_DDrawSurface_UpdateOverlayDisplay((LPDIRECTDRAWSURFACE7) iface, dwFlags);
417 }
418 
419 HRESULT WINAPI
420 Thunk_DDrawSurface3_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 iface,
421 					    DWORD dwFlags,
422 					    LPDIRECTDRAWSURFACE3 pSurfReference)
423 {
424 	DX_WINDBG_trace();
425     return Main_DDrawSurface_UpdateOverlayZOrder((LPDIRECTDRAWSURFACE7) iface, dwFlags,
426 						                         (LPDIRECTDRAWSURFACE7) pSurfReference);
427 }
428 
429 HRESULT WINAPI
430 Thunk_DDrawSurface3_GetDDInterface(LPDIRECTDRAWSURFACE3 iface, LPVOID* ppDD)
431 {
432 	DX_WINDBG_trace();
433 
434     return Main_DDrawSurface_GetDDInterface((LPDIRECTDRAWSURFACE7) iface, ppDD);
435 }
436 
437 HRESULT WINAPI
438 Thunk_DDrawSurface3_PageLock(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags)
439 {
440 	DX_WINDBG_trace();
441 
442     return Main_DDrawSurface_PageLock((LPDIRECTDRAWSURFACE7) iface, dwFlags);
443 }
444 
445 HRESULT WINAPI
446 Thunk_DDrawSurface3_PageUnlock(LPDIRECTDRAWSURFACE3 iface, DWORD dwFlags)
447 {
448 	DX_WINDBG_trace();
449 
450     return Main_DDrawSurface_PageUnlock((LPDIRECTDRAWSURFACE7) iface, dwFlags);
451 }
452 
453 HRESULT WINAPI
454 Thunk_DDrawSurface3_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 iface,
455 				       LPDDSURFACEDESC pDDSD, DWORD dwFlags)
456 {
457 	HRESULT retValue = DDERR_GENERIC;
458 
459     DX_WINDBG_trace();
460 
461 	if (pDDSD != NULL)
462 	{
463 	   DDSURFACEDESC2 pDDSD2;
464 	   ZeroMemory(&pDDSD2,sizeof(DDSURFACEDESC2));
465 	   memcpy(&pDDSD2, pDDSD, sizeof(DDSURFACEDESC));
466 	   pDDSD2.dwSize = sizeof(DDSURFACEDESC2);
467 	   retValue = Main_DDrawSurface_SetSurfaceDesc((LPDIRECTDRAWSURFACE7) iface, &pDDSD2, dwFlags);
468        memcpy(pDDSD, &pDDSD2, sizeof(DDSURFACEDESC));
469 	   pDDSD->dwSize = sizeof(DDSURFACEDESC);
470 	}
471 	else
472 	{
473 		retValue = Main_DDrawSurface_SetSurfaceDesc((LPDIRECTDRAWSURFACE7) iface, NULL, dwFlags);
474 	}
475 
476 
477     return retValue;
478 }
479 
480 IDirectDrawSurface3Vtbl DirectDrawSurface3_VTable =
481 {
482     Thunk_DDrawSurface3_QueryInterface,
483     Thunk_DDrawSurface3_AddRef,
484     Thunk_DDrawSurface3_Release,
485     Thunk_DDrawSurface3_AddAttachedSurface,
486     Thunk_DDrawSurface3_AddOverlayDirtyRect,
487     Thunk_DDrawSurface3_Blt,
488     Thunk_DDrawSurface3_BltBatch,
489     Thunk_DDrawSurface3_BltFast,
490     Thunk_DDrawSurface3_DeleteAttachedSurface,
491     Thunk_DDrawSurface3_EnumAttachedSurfaces,
492     Thunk_DDrawSurface3_EnumOverlayZOrders,
493     Thunk_DDrawSurface3_Flip,
494     Thunk_DDrawSurface3_GetAttachedSurface,
495     Thunk_DDrawSurface3_GetBltStatus,
496     Thunk_DDrawSurface3_GetCaps,
497     Thunk_DDrawSurface3_GetClipper,
498     Thunk_DDrawSurface3_GetColorKey,
499     Thunk_DDrawSurface3_GetDC,
500     Thunk_DDrawSurface3_GetFlipStatus,
501     Thunk_DDrawSurface3_GetOverlayPosition,
502     Thunk_DDrawSurface3_GetPalette,
503     Thunk_DDrawSurface3_GetPixelFormat,
504     Thunk_DDrawSurface3_GetSurfaceDesc,
505     Thunk_DDrawSurface3_Initialize,
506     Thunk_DDrawSurface3_IsLost,
507     Thunk_DDrawSurface3_Lock,
508     Thunk_DDrawSurface3_ReleaseDC,
509     Thunk_DDrawSurface3_Restore,
510     Thunk_DDrawSurface3_SetClipper,
511     Thunk_DDrawSurface3_SetColorKey,
512     Thunk_DDrawSurface3_SetOverlayPosition,
513     Thunk_DDrawSurface3_SetPalette,
514     Thunk_DDrawSurface3_Unlock,
515     Thunk_DDrawSurface3_UpdateOverlay,
516     Thunk_DDrawSurface3_UpdateOverlayDisplay,
517     Thunk_DDrawSurface3_UpdateOverlayZOrder,
518     Thunk_DDrawSurface3_GetDDInterface,
519     Thunk_DDrawSurface3_PageLock,
520     Thunk_DDrawSurface3_PageUnlock,
521     Thunk_DDrawSurface3_SetSurfaceDesc
522 };
523