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