small code cleanup
[reactos.git] / reactos / dll / directx / ddraw / startup.c
1 /* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/ddraw/ddraw.c
6 * PURPOSE: DirectDraw Library
7 * PROGRAMMER: Magnus Olsen (greatlrd)
8 *
9 */
10
11 #include "rosdraw.h"
12 #include "ddrawgdi.h"
13
14 DDRAWI_DIRECTDRAW_GBL ddgbl;
15 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
16
17 WCHAR classname[128];
18 WNDCLASSW wnd_class;
19
20
21 HRESULT WINAPI
22 Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
23 REFIID id, BOOL ex)
24 {
25 LPDDRAWI_DIRECTDRAW_INT This;
26
27 DX_WINDBG_trace();
28
29 if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) ||
30 (IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW))))
31 {
32 return DDERR_INVALIDPARAMS;
33 }
34
35 This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
36
37 /* fixme linking too second link when we shall not doing it */
38 if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW)))
39 {
40 DX_STUB_str("1. no linking\n");
41
42 /* We do not have a DirectDraw interface, we need alloc it*/
43 LPDDRAWI_DIRECTDRAW_INT memThis;
44
45 DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
46 if (memThis == NULL)
47 {
48 return DDERR_OUTOFMEMORY;
49 }
50
51 This = memThis;
52
53 /* Fixme release memory alloc if we fail */
54
55 DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
56 if (This->lpLcl == NULL)
57 {
58 return DDERR_OUTOFMEMORY;
59 }
60 }
61 else
62 {
63 DX_STUB_str("2.linking\n");
64 /* We got the DirectDraw interface alloc and we need create the link */
65 LPDDRAWI_DIRECTDRAW_INT newThis;
66
67 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
68 DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
69 if (newThis == NULL)
70 {
71 return DDERR_OUTOFMEMORY;
72 }
73
74 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
75 if ((pGUID) && (pGUID != (LPGUID)DDCREATE_HARDWAREONLY))
76 {
77 if (pGUID !=NULL)
78 {
79 This = newThis;
80 return DDERR_INVALIDDIRECTDRAWGUID;
81 }
82 }
83
84 /* step 3 do the link the old interface are store in the new one */
85 newThis->lpLink = This;
86
87 /* step 4 we need create new local directdraw struct for the new linked interface */
88 DxHeapMemAlloc(newThis->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
89 if (newThis->lpLcl == NULL)
90 {
91 This = newThis;
92 return DDERR_OUTOFMEMORY;
93 }
94
95 This = newThis;
96 }
97
98 This->lpLcl->lpGbl = &ddgbl;
99
100 *pIface = (LPDIRECTDRAW)This;
101
102 /* Get right interface we whant */
103 if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) == DD_OK)
104 {
105 DX_STUB_str("Got iface\n");
106
107 if (StartDirectDraw((LPDIRECTDRAW)This, pGUID, FALSE) == DD_OK);
108 {
109 /*
110 RtlZeroMemory(&wnd_class, sizeof(wnd_class));
111 wnd_class.style = CS_HREDRAW | CS_VREDRAW;
112 wnd_class.lpfnWndProc = DefWindowProcW;
113 wnd_class.cbClsExtra = 0;
114 wnd_class.cbWndExtra = 0;
115 wnd_class.hInstance = GetModuleHandleW(0);
116 wnd_class.hIcon = 0;
117 wnd_class.hCursor = 0;
118 wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
119 wnd_class.lpszMenuName = NULL;
120 wnd_class.lpszClassName = classname;
121 if(!RegisterClassW(&wnd_class))
122 {
123 DX_STUB_str("DDERR_GENERIC");
124 return DDERR_GENERIC;
125 }
126 */
127 This->lpLcl->hDD = ddgbl.hDD;
128 return DD_OK;
129 }
130 }
131
132 return DDERR_INVALIDPARAMS;
133 }
134
135
136 HRESULT WINAPI
137 StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
138 {
139 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
140 DWORD hal_ret = DD_FALSE;
141 DWORD hel_ret = DD_FALSE;
142 DWORD devicetypes = 0;
143 DWORD dwFlags = 0;
144
145 DX_WINDBG_trace();
146
147 /*
148 * ddgbl.dwPDevice is not longer in use in windows 2000 and higher
149 * I am using it for device type
150 * devicetypes = 1 : both hal and hel are enable
151 * devicetypes = 2 : both hal are enable
152 * devicetypes = 3 : both hel are enable
153 * devicetypes = 4 :loading a guid drv from the register
154 */
155
156 if (reenable == FALSE)
157 {
158 if ((!IsBadReadPtr(This->lpLink,sizeof(LPDIRECTDRAW))) && (This->lpLink == NULL))
159 {
160 RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
161 This->lpLcl->lpGbl->dwRefCnt++;
162 if (ddgbl.lpDDCBtmp == NULL)
163 {
164 // LPDDHAL_CALLBACKS
165 DxHeapMemAlloc( ddgbl.lpDDCBtmp , sizeof(DDHAL_CALLBACKS));
166 if (ddgbl.lpDDCBtmp == NULL)
167 {
168 DX_STUB_str("Out of memmory\n");
169 return DD_FALSE;
170 }
171 }
172 }
173 }
174
175 DX_STUB_str("here\n");
176
177 if (reenable == FALSE)
178 {
179 if (lpGuid == NULL)
180 {
181 DX_STUB_str("lpGuid == NULL\n");
182 devicetypes= 1;
183
184 /* Create HDC for default, hal and hel driver */
185 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
186 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
187
188 /* cObsolete is undoc in msdn it being use in CreateDCA */
189 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
190 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
191 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
192
193
194 }
195 else if (lpGuid == (LPGUID) DDCREATE_HARDWAREONLY)
196 {
197 devicetypes = 2;
198 /* Create HDC for default, hal driver */
199 This->lpLcl->hWnd =(ULONG_PTR) GetActiveWindow();
200 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
201
202 /* cObsolete is undoc in msdn it being use in CreateDCA */
203 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
204 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
205 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
206 }
207 else if (lpGuid == (LPGUID) DDCREATE_EMULATIONONLY)
208 {
209 devicetypes = 3;
210
211 /* Create HDC for default, hal and hel driver */
212 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
213 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
214
215 /* cObsolete is undoc in msdn it being use in CreateDCA */
216 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
217 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
218
219 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
220 }
221 else
222 {
223 /* FIXME : need getting driver from the GUID that have been pass in from
224 * the register. we do not support that yet
225 */
226 devicetypes = 4;
227 This->lpLcl->hDC = (ULONG_PTR) NULL ;
228 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
229 }
230
231 if ( (HDC)This->lpLcl->hDC == NULL)
232 {
233 DX_STUB_str("DDERR_OUTOFMEMORY\n");
234 return DDERR_OUTOFMEMORY ;
235 }
236 }
237
238 This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp;
239
240 /* Startup HEL and HAL */
241 This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp;
242 This->lpLcl->dwProcessId = GetCurrentProcessId();
243
244 switch (devicetypes)
245 {
246 case 2:
247 hal_ret = StartDirectDrawHal(iface, reenable);
248 This->lpLcl->lpDDCB->HELDD.dwFlags = 0;
249 break;
250
251 case 3:
252 hel_ret = StartDirectDrawHel(iface, reenable);
253 This->lpLcl->lpDDCB->HALDD.dwFlags = 0;
254 break;
255
256 default:
257 hal_ret = StartDirectDrawHal(iface, reenable);
258 hel_ret = StartDirectDrawHel(iface, reenable);
259 }
260
261 DX_STUB_str("return\n");
262
263 if (hal_ret!=DD_OK)
264 {
265 if (hel_ret!=DD_OK)
266 {
267 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
268 return DDERR_NODIRECTDRAWSUPPORT;
269 }
270 dwFlags |= DDRAWI_NOHARDWARE;
271 }
272
273 if (hel_ret!=DD_OK)
274 {
275 dwFlags |= DDRAWI_NOEMULATION;
276
277 }
278 else
279 {
280 dwFlags |= DDRAWI_EMULATIONINITIALIZED;
281 }
282
283 /* Fill some basic info for Surface */
284 This->lpLcl->lpGbl->dwFlags = dwFlags | DDRAWI_ATTACHEDTODESKTOP;
285 This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp;
286 This->lpLcl->hDD = ddgbl.hDD;
287
288 DX_STUB_str("DD_OK\n");
289 return DD_OK;
290 }
291
292 HRESULT WINAPI
293 StartDirectDrawHel(LPDIRECTDRAW iface, BOOL reenable)
294 {
295 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
296
297 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CanCreateSurface = HelDdCanCreateSurface;
298 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreateSurface = HelDdCreateSurface;
299 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreatePalette = HelDdCreatePalette;
300 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.DestroyDriver = HelDdDestroyDriver;
301 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.FlipToGDISurface = HelDdFlipToGDISurface;
302 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.GetScanLine = HelDdGetScanLine;
303 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetColorKey = HelDdSetColorKey;
304 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetExclusiveMode = HelDdSetExclusiveMode;
305 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetMode = HelDdSetMode;
306 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.WaitForVerticalBlank = HelDdWaitForVerticalBlank;
307
308 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE |
309 DDHAL_CB32_CREATESURFACE |
310 DDHAL_CB32_CREATEPALETTE |
311 DDHAL_CB32_DESTROYDRIVER |
312 DDHAL_CB32_FLIPTOGDISURFACE |
313 DDHAL_CB32_GETSCANLINE |
314 DDHAL_CB32_SETCOLORKEY |
315 DDHAL_CB32_SETEXCLUSIVEMODE |
316 DDHAL_CB32_SETMODE |
317 DDHAL_CB32_WAITFORVERTICALBLANK ;
318
319 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.dwSize = sizeof(This->lpLcl->lpDDCB->HELDD);
320
321 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.AddAttachedSurface = HelDdSurfAddAttachedSurface;
322 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Blt = HelDdSurfBlt;
323 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.DestroySurface = HelDdSurfDestroySurface;
324 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Flip = HelDdSurfFlip;
325 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.GetBltStatus = HelDdSurfGetBltStatus;
326 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.GetFlipStatus = HelDdSurfGetFlipStatus;
327 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Lock = HelDdSurfLock;
328 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.reserved4 = HelDdSurfreserved4;
329 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetClipList = HelDdSurfSetClipList;
330 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetColorKey = HelDdSurfSetColorKey;
331 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetOverlayPosition = HelDdSurfSetOverlayPosition;
332 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetPalette = HelDdSurfSetPalette;
333 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Unlock = HelDdSurfUnlock;
334 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.UpdateOverlay = HelDdSurfUpdateOverlay;
335 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.dwFlags = DDHAL_SURFCB32_ADDATTACHEDSURFACE |
336 DDHAL_SURFCB32_BLT |
337 DDHAL_SURFCB32_DESTROYSURFACE |
338 DDHAL_SURFCB32_FLIP |
339 DDHAL_SURFCB32_GETBLTSTATUS |
340 DDHAL_SURFCB32_GETFLIPSTATUS |
341 DDHAL_SURFCB32_LOCK |
342 DDHAL_SURFCB32_RESERVED4 |
343 DDHAL_SURFCB32_SETCLIPLIST |
344 DDHAL_SURFCB32_SETCOLORKEY |
345 DDHAL_SURFCB32_SETOVERLAYPOSITION |
346 DDHAL_SURFCB32_SETPALETTE |
347 DDHAL_SURFCB32_UNLOCK |
348 DDHAL_SURFCB32_UPDATEOVERLAY;
349
350 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDSurface);
351
352 /*
353 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
354 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
355 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
356 */
357
358 /*
359 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
360 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
361 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
362 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
363 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
364 */
365
366 return DD_OK;
367 }
368
369
370 HRESULT WINAPI
371 StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
372 {
373 LPDWORD mpFourCC = NULL;
374 DDHALINFO mHALInfo;
375 BOOL newmode = FALSE;
376 LPDDSURFACEDESC mpTextures;
377 D3DHAL_CALLBACKS mD3dCallbacks;
378 D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
379 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
380 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
381
382 DX_WINDBG_trace();
383
384 RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
385 RtlZeroMemory(&mD3dCallbacks, sizeof(D3DHAL_CALLBACKS));
386 RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA));
387 RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS));
388
389 if (reenable == FALSE)
390 {
391 if (ddgbl.lpDDCBtmp == NULL)
392 {
393 DxHeapMemAlloc(ddgbl.lpDDCBtmp, sizeof(DDHAL_CALLBACKS));
394 if ( ddgbl.lpDDCBtmp == NULL)
395 {
396 return DD_FALSE;
397 }
398 }
399 }
400 else
401 {
402 RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS));
403 }
404
405 /*
406 * Startup DX HAL step one of three
407 */
408 if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC))
409 {
410 DxHeapMemFree(ddgbl.lpDDCBtmp);
411 return DD_FALSE;
412 }
413
414 /* Some card disable the dx after it have been created so
415 * we are force reanble it
416 */
417 if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode))
418 {
419 DxHeapMemFree(ddgbl.lpDDCBtmp);
420 return DD_FALSE;
421 }
422
423 if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
424 &mHALInfo,
425 &ddgbl.lpDDCBtmp->HALDD,
426 &ddgbl.lpDDCBtmp->HALDDSurface,
427 &ddgbl.lpDDCBtmp->HALDDPalette,
428 &mD3dCallbacks,
429 &mD3dDriverData,
430 &mD3dBufferCallbacks,
431 NULL,
432 mpFourCC,
433 NULL))
434 {
435 DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
436 DxHeapMemFree(ddgbl.lpDDCBtmp);
437 // FIXME Close DX fristcall and second call
438 return DD_FALSE;
439 }
440
441 DX_STUB_str("Trying alloc FourCCC \n");
442
443 /* Alloc mpFourCC */
444 if (This->lpLcl->lpGbl->lpdwFourCC != NULL)
445 {
446 DxHeapMemFree(This->lpLcl->lpGbl->lpdwFourCC);
447 }
448
449 if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
450 {
451
452 DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));
453
454 if (mpFourCC == NULL)
455 {
456 DxHeapMemFree(ddgbl.lpDDCBtmp);
457 // FIXME Close DX fristcall and second call
458 return DD_FALSE;
459 }
460 }
461
462 DX_STUB_str("End Trying alloc FourCCC\n");
463
464
465
466
467
468 /* Alloc mpTextures */
469 #if 0
470 DX_STUB_str("1 Here\n");
471
472 if (This->lpLcl->lpGbl->texture != NULL)
473 {
474 DxHeapMemFree(This->lpLcl->lpGbl->texture;
475 }
476
477 mpTextures = NULL;
478 if (mD3dDriverData.dwNumTextureFormats > 0)
479 {
480 mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats);
481 if (mpTextures == NULL)
482 {
483 DxHeapMemFree(mpFourCC);
484 DxHeapMemFree(ddgbl.lpDDCBtmp);
485 // FIXME Close DX fristcall and second call
486 }
487 }
488
489 DX_STUB_str("2 Here\n");
490
491 #else
492 mpTextures = NULL;
493 #endif
494
495
496 /* Get all basic data from the driver */
497 if (!DdQueryDirectDrawObject(
498 This->lpLcl->lpGbl,
499 &mHALInfo,
500 &ddgbl.lpDDCBtmp->HALDD,
501 &ddgbl.lpDDCBtmp->HALDDSurface,
502 &ddgbl.lpDDCBtmp->HALDDPalette,
503 &mD3dCallbacks,
504 &mD3dDriverData,
505 &ddgbl.lpDDCBtmp->HALDDExeBuf,
506 (DDSURFACEDESC*)mpTextures,
507 mpFourCC,
508 NULL))
509 {
510 DxHeapMemFree(mpFourCC);
511 DxHeapMemFree(mpTextures);
512 DxHeapMemFree(ddgbl.lpDDCBtmp);
513 // FIXME Close DX fristcall and second call
514 return DD_FALSE;
515 }
516
517 memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
518
519
520 memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
521
522 This->lpLcl->lpGbl->dwNumFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
523 This->lpLcl->lpGbl->lpdwFourCC = mpFourCC;
524 This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency;
525 This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex;
526 This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
527 This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
528
529 DX_STUB_str("Here\n");
530
531 /* FIXME convert mpTextures to DDHALMODEINFO */
532 // DxHeapMemFree( mpTextures);
533
534 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
535 DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 };
536 DdGetDriverInfo.dwSize = sizeof (DDHAL_GETDRIVERINFODATA);
537 DdGetDriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
538
539 DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->HALDDMiscellaneous;
540
541 DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS);
542
543 if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.ddRVal != DD_OK)
544 {
545 DxHeapMemFree(mpFourCC);
546 DxHeapMemFree(mpTextures);
547 DxHeapMemFree(ddgbl.lpDDCBtmp);
548 // FIXME Close DX fristcall and second call
549 return DD_FALSE;
550 }
551
552 return DD_OK;
553 }