Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

694 lines
20 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddraw16.c
  6. * Content: 16-bit DirectDraw entry points
  7. * This is only used for 16-bit display drivers on Win95
  8. *@@BEGIN_MSINTERNAL
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 20-jan-95 craige initial implementation
  13. * 13-feb-95 craige allow 32-bit callbacks
  14. * 14-may-95 craige removed obsolete junk
  15. * 19-jun-95 craige more cleanup; added DDHAL_StreamingNotify
  16. * 02-jul-95 craige comment out streaming notify stuff
  17. * 07-jul-95 craige validate pdevice
  18. * 20-jul-95 craige internal reorg to prevent thunking during modeset
  19. * 05-sep-95 craige bug 814: added DD16_IsWin95MiniDriver
  20. * 02-mar-96 colinmc Repulsive hack to keep interim drivers working
  21. * 16-apr-96 colinmc Bug 17921: remove interim driver support
  22. * 06-oct-96 colinmc Bug 4207: Invalid LocalFree in video port stuff
  23. * 15-oct-96 colinmc Bug 4353: Failure to initialize VideoPort fields
  24. * in convert
  25. * 09-nov-96 colinmc Fixed problem with old and new drivers not working
  26. * with DirectDraw
  27. *@@END_MSINTERNAL
  28. *
  29. ***************************************************************************/
  30. #include "ddraw16.h"
  31. typedef struct DRIVERINFO
  32. {
  33. struct DRIVERINFO FAR *link;
  34. DDHALINFO ddHalInfo;
  35. DDHAL_DDCALLBACKS tmpDDCallbacks;
  36. DDHAL_DDSURFACECALLBACKS tmpDDSurfaceCallbacks;
  37. DDHAL_DDPALETTECALLBACKS tmpDDPaletteCallbacks;
  38. DDHAL_DDVIDEOPORTCALLBACKS tmpDDVideoPortCallbacks;
  39. DDHAL_DDCOLORCONTROLCALLBACKS tmpDDColorControlCallbacks;
  40. DWORD dwEvent;
  41. } DRIVERINFO, FAR *LPDRIVERINFO;
  42. extern __cdecl SetWin32Event( DWORD );
  43. void convertV1DDHALINFO( LPDDHALINFO_V1 lpddOld, LPDDHALINFO lpddNew );
  44. BOOL bInOurSetMode;
  45. LPDRIVERINFO lpDriverInfo;
  46. /*
  47. * freeDriverInfo
  48. */
  49. void freeDriverInfo( LPDRIVERINFO pgi )
  50. {
  51. if( pgi->ddHalInfo.lpdwFourCC != NULL )
  52. {
  53. LocalFreeSecondary( OFFSETOF(pgi->ddHalInfo.lpdwFourCC ) );
  54. pgi->ddHalInfo.lpdwFourCC = NULL;
  55. }
  56. if( pgi->ddHalInfo.lpModeInfo != NULL )
  57. {
  58. LocalFreeSecondary( OFFSETOF( pgi->ddHalInfo.lpModeInfo ) );
  59. pgi->ddHalInfo.lpModeInfo = NULL;
  60. }
  61. if( pgi->ddHalInfo.vmiData.pvmList != NULL )
  62. {
  63. LocalFreeSecondary( OFFSETOF( pgi->ddHalInfo.vmiData.pvmList ) );
  64. pgi->ddHalInfo.vmiData.pvmList = NULL;
  65. }
  66. } /* freeDriverInfo */
  67. /*
  68. * DDHAL_SetInfo
  69. *
  70. * Create a Driver object. Called by the display driver
  71. */
  72. BOOL DDAPI DDHAL_SetInfo(
  73. LPDDHALINFO lpDrvDDHALInfo,
  74. BOOL reset )
  75. {
  76. LPDDHAL_DDCALLBACKS drvcb;
  77. LPDDHAL_DDSURFACECALLBACKS surfcb;
  78. LPDDHAL_DDPALETTECALLBACKS palcb;
  79. DWORD bit;
  80. LPVOID cbrtn;
  81. LPVOID ptr;
  82. int numcb;
  83. int i;
  84. UINT size;
  85. LPDRIVERINFO pgi;
  86. static char szPath[ MAX_PATH ];
  87. LPDDHALINFO lpDDHALInfo;
  88. DDHALINFO ddNew;
  89. if( !VALIDEX_DDHALINFO_PTR( lpDrvDDHALInfo ) )
  90. {
  91. #ifdef DEBUG
  92. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid DDHALINFO provided" );
  93. DPF( 0, "lpDDHalInfo = %08lx", lpDrvDDHALInfo );
  94. if( !IsBadWritePtr( lpDrvDDHALInfo, 1 ) )
  95. {
  96. DPF( 0, "lpDDHalInfo->dwSize = %ld (%ld expected)",
  97. lpDrvDDHALInfo->dwSize, (DWORD)sizeof( DDHALINFO ) );
  98. }
  99. #endif
  100. return FALSE;
  101. }
  102. DPF(5, "lpDrvDDHALInfo->dwSize = %ld", lpDrvDDHALInfo->dwSize);
  103. /*
  104. * Check to see if the driver gave us an old DDHALINFO
  105. */
  106. if( lpDrvDDHALInfo->dwSize == DDHALINFOSIZE_V1 )
  107. {
  108. /*
  109. * We actually changed the ordering of some fields from V1
  110. * to V2 so we need to do some conversion to get it into
  111. * shape.
  112. */
  113. convertV1DDHALINFO((LPDDHALINFO_V1)lpDrvDDHALInfo, &ddNew);
  114. // use the reformatted ddhalinfo
  115. lpDDHALInfo = &ddNew;
  116. }
  117. else if( lpDrvDDHALInfo->dwSize < sizeof(DDHALINFO) )
  118. {
  119. /*
  120. * Its a newer version than V1 but not as new as this
  121. * version of DirectDraw. No ordering changes have taken
  122. * place but the HAL info is too small. We need to ensure
  123. * that the all the new fields are zeroed.
  124. *
  125. * NOTE: Validation above should have taken care of the
  126. * error case where the size is less than the size of the
  127. * V1 HAL info.
  128. */
  129. _fmemset(&ddNew, 0, sizeof(ddNew));
  130. _fmemcpy(&ddNew, lpDrvDDHALInfo, (size_t)lpDrvDDHALInfo->dwSize);
  131. lpDDHALInfo = &ddNew;
  132. }
  133. else
  134. {
  135. // the driver gave us a current ddhalinfo, use it.
  136. lpDDHALInfo = lpDrvDDHALInfo;
  137. }
  138. /*
  139. * check for hInstance
  140. */
  141. if( lpDDHALInfo->hInstance == 0 )
  142. {
  143. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:lpDDHalInfo->hInstance is NULL " );
  144. return FALSE;
  145. }
  146. /*
  147. * validate 16-bit driver callbacks
  148. */
  149. drvcb = lpDDHALInfo->lpDDCallbacks;
  150. if( !VALIDEX_PTR_PTR( drvcb ) )
  151. {
  152. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid driver callback ptr" );
  153. return FALSE;
  154. }
  155. DPF(5, "lpDDCallbacks->dwSize = %ld", drvcb->dwSize);
  156. if( !VALIDEX_DDCALLBACKSSIZE( drvcb ) )
  157. {
  158. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid size field in lpDDCallbacks" );
  159. return FALSE;
  160. }
  161. numcb =(int) (drvcb->dwSize-2*sizeof( DWORD ))/ sizeof( LPVOID );
  162. bit = 1;
  163. for( i=0;i<numcb;i++ )
  164. {
  165. if( !(drvcb->dwFlags & bit) )
  166. {
  167. cbrtn = (LPVOID) ((DWORD FAR *) &drvcb->DestroyDriver)[i];
  168. if( cbrtn != NULL )
  169. {
  170. if( !VALIDEX_CODE_PTR( cbrtn ) )
  171. {
  172. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid 16-bit callback in lpDDCallbacks" );
  173. return FALSE;
  174. }
  175. }
  176. }
  177. bit <<= 1;
  178. }
  179. /*
  180. * validate 16-bit surface callbacks
  181. */
  182. surfcb = lpDDHALInfo->lpDDSurfaceCallbacks;
  183. if( !VALIDEX_PTR_PTR( surfcb ) )
  184. {
  185. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid surface callback ptr" );
  186. return FALSE;
  187. }
  188. DPF(5, "lpDDSurfaceCallbacks->dwSize = %ld", surfcb->dwSize);
  189. if( !VALIDEX_DDSURFACECALLBACKSSIZE( surfcb ) )
  190. {
  191. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid size field in lpDDSurfaceCallbacks" );
  192. return FALSE;
  193. }
  194. numcb =(int)(surfcb->dwSize-2*sizeof( DWORD ))/ sizeof( LPVOID );
  195. bit = 1;
  196. for( i=0;i<numcb;i++ )
  197. {
  198. if( !(surfcb->dwFlags & bit) )
  199. {
  200. cbrtn = (LPVOID) ((DWORD FAR *) &surfcb->DestroySurface)[i];
  201. if( cbrtn != NULL )
  202. {
  203. if( !VALIDEX_CODE_PTR( cbrtn ) )
  204. {
  205. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid 16-bit callback in lpSurfaceCallbacks" );
  206. return FALSE;
  207. }
  208. }
  209. }
  210. bit <<= 1;
  211. }
  212. /*
  213. * validate 16-bit palette callbacks
  214. */
  215. palcb = lpDDHALInfo->lpDDPaletteCallbacks;
  216. if( !VALIDEX_PTR_PTR( palcb ) )
  217. {
  218. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid palette callback ptr" );
  219. return FALSE;
  220. }
  221. DPF(5, "lpDDPaletteCallbacks->dwSize = %ld", palcb->dwSize);
  222. if( !VALIDEX_DDPALETTECALLBACKSSIZE( palcb ) )
  223. {
  224. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid size field in lpPaletteCallbacks" );
  225. return FALSE;
  226. }
  227. numcb =(int)(palcb->dwSize-2*sizeof( DWORD ))/ sizeof( LPVOID );
  228. bit = 1;
  229. for( i=0;i<numcb;i++ )
  230. {
  231. if( !(palcb->dwFlags & bit) )
  232. {
  233. cbrtn = (LPVOID) ((DWORD FAR *) &palcb->DestroyPalette)[i];
  234. if( cbrtn != NULL )
  235. {
  236. if( !VALIDEX_CODE_PTR( cbrtn ) )
  237. {
  238. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid 16-bit callback in lpPaletteCallbacks" );
  239. return FALSE;
  240. }
  241. }
  242. }
  243. bit <<= 1;
  244. }
  245. /*
  246. * check pdevice
  247. */
  248. if( lpDDHALInfo->lpPDevice != NULL )
  249. {
  250. if( !VALIDEX_PTR( lpDDHALInfo->lpPDevice, sizeof( DIBENGINE ) ) )
  251. {
  252. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Invalid PDEVICE ptr" );
  253. return FALSE;
  254. }
  255. }
  256. /*
  257. * see if we have a driver info struct already
  258. */
  259. pgi = lpDriverInfo;
  260. while( pgi != NULL )
  261. {
  262. if( pgi->ddHalInfo.hInstance == lpDDHALInfo->hInstance )
  263. {
  264. break;
  265. }
  266. pgi = pgi->link;
  267. }
  268. if( pgi == NULL )
  269. {
  270. pgi = (LPVOID) (void NEAR *)LocalAlloc( LPTR, sizeof( DRIVERINFO ) );
  271. if( OFFSETOF( pgi ) == NULL )
  272. {
  273. DPF( 0, "Out of memory!" );
  274. return FALSE;
  275. }
  276. pgi->link = lpDriverInfo;
  277. lpDriverInfo = pgi;
  278. }
  279. DPF( 5, "hInstance = %08lx (%08lx)", pgi->ddHalInfo.hInstance, lpDDHALInfo->hInstance );
  280. /*
  281. * duplicate the hal info
  282. */
  283. freeDriverInfo( pgi );
  284. _fmemcpy( &pgi->ddHalInfo, lpDDHALInfo, sizeof( DDHALINFO ) );
  285. if( lpDDHALInfo->lpDDCallbacks != NULL )
  286. {
  287. _fmemcpy( &pgi->tmpDDCallbacks, lpDDHALInfo->lpDDCallbacks, sizeof( pgi->tmpDDCallbacks ) );
  288. pgi->ddHalInfo.lpDDCallbacks = &pgi->tmpDDCallbacks;
  289. }
  290. if( lpDDHALInfo->lpDDSurfaceCallbacks != NULL )
  291. {
  292. _fmemcpy( &pgi->tmpDDSurfaceCallbacks, lpDDHALInfo->lpDDSurfaceCallbacks, sizeof( pgi->tmpDDSurfaceCallbacks ) );
  293. pgi->ddHalInfo.lpDDSurfaceCallbacks = &pgi->tmpDDSurfaceCallbacks;
  294. }
  295. if( lpDDHALInfo->lpDDPaletteCallbacks != NULL )
  296. {
  297. _fmemcpy( &pgi->tmpDDPaletteCallbacks, lpDDHALInfo->lpDDPaletteCallbacks, sizeof( pgi->tmpDDPaletteCallbacks ) );
  298. pgi->ddHalInfo.lpDDPaletteCallbacks = &pgi->tmpDDPaletteCallbacks;
  299. }
  300. if( lpDDHALInfo->lpdwFourCC != NULL )
  301. {
  302. size = (UINT) lpDDHALInfo->ddCaps.dwNumFourCCCodes * sizeof( DWORD );
  303. if( size != 0 )
  304. {
  305. ptr = (LPVOID) LocalAllocSecondary( LPTR, size );
  306. }
  307. else
  308. {
  309. ptr = NULL;
  310. }
  311. pgi->ddHalInfo.lpdwFourCC = ptr;
  312. if( ptr != NULL )
  313. {
  314. _fmemcpy( pgi->ddHalInfo.lpdwFourCC, lpDDHALInfo->lpdwFourCC, size );
  315. }
  316. }
  317. if( lpDDHALInfo->lpModeInfo != NULL )
  318. {
  319. size = (UINT) lpDDHALInfo->dwNumModes * sizeof( DDHALMODEINFO );
  320. if( size != 0 )
  321. {
  322. ptr = (LPVOID) LocalAllocSecondary( LPTR, size );
  323. }
  324. else
  325. {
  326. ptr = NULL;
  327. }
  328. pgi->ddHalInfo.lpModeInfo = ptr;
  329. if( ptr != NULL )
  330. {
  331. _fmemcpy( pgi->ddHalInfo.lpModeInfo, lpDDHALInfo->lpModeInfo, size );
  332. }
  333. }
  334. if( lpDDHALInfo->vmiData.pvmList != NULL )
  335. {
  336. size = (UINT) lpDDHALInfo->vmiData.dwNumHeaps * sizeof( VIDMEM );
  337. if( size != 0 )
  338. {
  339. ptr = (LPVOID) LocalAllocSecondary( LPTR, size );
  340. }
  341. else
  342. {
  343. ptr = NULL;
  344. }
  345. pgi->ddHalInfo.vmiData.pvmList = ptr;
  346. if( ptr != NULL )
  347. {
  348. _fmemcpy( pgi->ddHalInfo.vmiData.pvmList, lpDDHALInfo->vmiData.pvmList, size );
  349. }
  350. }
  351. /*
  352. * get the driver version info
  353. */
  354. pgi->ddHalInfo.ddCaps.dwReserved1 = 0;
  355. pgi->ddHalInfo.ddCaps.dwReserved2 = 0;
  356. if( GetModuleFileName( (HINSTANCE) lpDDHALInfo->hInstance, szPath, sizeof( szPath ) ) )
  357. {
  358. int size;
  359. DWORD dumbdword;
  360. size = (int) GetFileVersionInfoSize( szPath, (LPDWORD) &dumbdword );
  361. if( size != 0 )
  362. {
  363. LPVOID vinfo;
  364. vinfo = (LPVOID) (void NEAR *) LocalAlloc( LPTR, size );
  365. if( OFFSETOF( vinfo ) != NULL )
  366. {
  367. if( GetFileVersionInfo( szPath, 0, size, vinfo ) )
  368. {
  369. VS_FIXEDFILEINFO FAR *ver=NULL;
  370. int cb;
  371. if( VerQueryValue(vinfo, "\\", &(LPVOID)ver, &cb) )
  372. {
  373. if( ver != NULL )
  374. {
  375. pgi->ddHalInfo.ddCaps.dwReserved1 = ver->dwFileVersionLS;
  376. pgi->ddHalInfo.ddCaps.dwReserved2 = ver->dwFileVersionMS;
  377. }
  378. }
  379. }
  380. LocalFree( OFFSETOF( vinfo ) );
  381. }
  382. }
  383. }
  384. if( !bInOurSetMode && reset )
  385. {
  386. DPF( 4, "************************* EXTERNAL MODE SET ************************" );
  387. if( pgi->dwEvent != NULL )
  388. {
  389. SetWin32Event( pgi->dwEvent );
  390. }
  391. }
  392. return TRUE;
  393. } /* DDHAL_SetInfo */
  394. /*
  395. * DDHAL_VidMemAlloc
  396. */
  397. FLATPTR DDAPI DDHAL_VidMemAlloc(
  398. LPDDRAWI_DIRECTDRAW_GBL lpDD,
  399. int heap,
  400. DWORD dwWidth,
  401. DWORD dwHeight )
  402. {
  403. extern FLATPTR DDAPI DDHAL32_VidMemAlloc( LPDDRAWI_DIRECTDRAW_GBL this, int heap, DWORD dwWidth, DWORD dwHeight );
  404. if( lpDD != NULL )
  405. {
  406. return DDHAL32_VidMemAlloc( lpDD, heap, dwWidth,dwHeight );
  407. }
  408. else
  409. {
  410. return 0;
  411. }
  412. } /* DDHAL_VidMemAlloc */
  413. /*
  414. * DDHAL_VidMemFree
  415. */
  416. void DDAPI DDHAL_VidMemFree(
  417. LPDDRAWI_DIRECTDRAW_GBL lpDD,
  418. int heap,
  419. FLATPTR fpMem )
  420. {
  421. extern void DDAPI DDHAL32_VidMemFree( LPDDRAWI_DIRECTDRAW_GBL this, int heap, FLATPTR ptr );
  422. if( lpDD != NULL )
  423. {
  424. DDHAL32_VidMemFree( lpDD, heap, fpMem );
  425. }
  426. } /* DDHAL_VidMemFree */
  427. /*
  428. * DD16_GetDriverFns
  429. */
  430. void DDAPI DD16_GetDriverFns( LPDDHALDDRAWFNS pfns )
  431. {
  432. pfns->dwSize = sizeof( DDHALDDRAWFNS );
  433. pfns->lpSetInfo = DDHAL_SetInfo;
  434. pfns->lpVidMemAlloc = DDHAL_VidMemAlloc;
  435. pfns->lpVidMemFree = DDHAL_VidMemFree;
  436. } /* DD16_GetDriverFns */
  437. /*
  438. * DD16_GetHALInfo
  439. */
  440. void DDAPI DD16_GetHALInfo( LPDDHALINFO pddhi )
  441. {
  442. LPDRIVERINFO pgi;
  443. pgi = lpDriverInfo;
  444. while( pgi != NULL )
  445. {
  446. if( pgi->ddHalInfo.hInstance == pddhi->hInstance )
  447. {
  448. break;
  449. }
  450. pgi = pgi->link;
  451. }
  452. if( pgi == NULL )
  453. {
  454. return;
  455. }
  456. DPF( 4, "GetHalInfo: lpHalInfo->GetDriverInfo = %lx", pgi->ddHalInfo.GetDriverInfo);
  457. DPF( 5, "GetHalInfo: lpHalInfo=%08lx", &pgi->ddHalInfo );
  458. DPF( 5, "GetHalInfo: pddhi=%08lx", pddhi );
  459. _fmemcpy( pddhi, &pgi->ddHalInfo, sizeof( DDHALINFO ) );
  460. } /* DD16_GetHALInfo */
  461. /*
  462. * DD16_DoneDriver
  463. */
  464. void DDAPI DD16_DoneDriver( DWORD hInstance )
  465. {
  466. LPDRIVERINFO pgi;
  467. LPDRIVERINFO prev;
  468. prev = NULL;
  469. pgi = lpDriverInfo;
  470. while( pgi != NULL )
  471. {
  472. if( pgi->ddHalInfo.hInstance == hInstance )
  473. {
  474. break;
  475. }
  476. prev = pgi;
  477. pgi = pgi->link;
  478. }
  479. if( pgi == NULL )
  480. {
  481. DPF( 0, "COULD NOT FIND HINSTANCE=%08lx", hInstance );
  482. return;
  483. }
  484. if( prev == NULL )
  485. {
  486. lpDriverInfo = pgi->link;
  487. }
  488. else
  489. {
  490. prev->link = pgi->link;
  491. }
  492. DPF( 5, "Freeing %08lx, hInstance=%08lx", pgi, hInstance );
  493. freeDriverInfo( pgi );
  494. LocalFree( OFFSETOF( pgi ) );
  495. } /* DD16_DoneDriver */
  496. /*
  497. * DD16_SetEventHandle
  498. */
  499. void DDAPI DD16_SetEventHandle( DWORD hInstance, DWORD dwEvent )
  500. {
  501. LPDRIVERINFO pgi;
  502. pgi = lpDriverInfo;
  503. while( pgi != NULL )
  504. {
  505. if( pgi->ddHalInfo.hInstance == hInstance )
  506. {
  507. break;
  508. }
  509. pgi = pgi->link;
  510. }
  511. if( pgi == NULL )
  512. {
  513. DPF( 0, "COULD NOT FIND HINSTANCE=%08lx", hInstance );
  514. return;
  515. }
  516. pgi->dwEvent = dwEvent;
  517. DPF( 5, "Got event handle: %08lx\n", dwEvent );
  518. } /* DD16_SetEventHandle */
  519. /*
  520. * DD16_IsWin95MiniDriver
  521. */
  522. BOOL DDAPI DD16_IsWin95MiniDriver( void )
  523. {
  524. DIBENGINE FAR *pde;
  525. HDC hdc;
  526. UINT rc;
  527. hdc = GetDC(NULL);
  528. rc = GetDeviceCaps(hdc, CAPS1);
  529. pde = GetPDevice(hdc);
  530. ReleaseDC(NULL, hdc);
  531. if( !(rc & C1_DIBENGINE) || IsBadReadPtr(pde, 2) ||
  532. pde->deType != 0x5250 )
  533. {
  534. #ifdef DEBUG
  535. if( !(rc & C1_DIBENGINE) )
  536. {
  537. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Driver is not a DibEngine driver" );
  538. }
  539. if( IsBadReadPtr(pde, 2) )
  540. {
  541. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Could not obtain pdevice!" );
  542. }
  543. else if( pde->deType != 0x5250 )
  544. {
  545. DPF( 0, "****DirectDraw/Direct3D DRIVER DISABLING ERROR****:Pdevice signature invalid" );
  546. }
  547. #endif
  548. return FALSE;
  549. }
  550. return TRUE;
  551. } /* DD16_IsWin95MiniDriver */
  552. #ifdef STREAMING
  553. /*
  554. * DDHAL_StreamingNotify
  555. */
  556. void DDAPI DDHAL_StreamingNotify( DWORD dw )
  557. {
  558. extern void DDAPI DD32_StreamingNotify( DWORD dw );
  559. DD32_StreamingNotify( dw );
  560. } /* DDHAL_StreamingNotify */
  561. #endif
  562. /*
  563. * convertV1DDHALINFO
  564. *
  565. * Convert an obsolete DDHALINFO structure to the latest and greatest structure.
  566. */
  567. void convertV1DDHALINFO( LPDDHALINFO_V1 lpddOld, LPDDHALINFO lpddNew )
  568. {
  569. int i;
  570. lpddNew->dwSize = sizeof( DDHALINFO );
  571. lpddNew->lpDDCallbacks = lpddOld->lpDDCallbacks;
  572. lpddNew->lpDDSurfaceCallbacks = lpddOld->lpDDSurfaceCallbacks;
  573. lpddNew->lpDDPaletteCallbacks = lpddOld->lpDDPaletteCallbacks;
  574. lpddNew->vmiData = lpddOld->vmiData;
  575. // ddCaps
  576. lpddNew->ddCaps.dwSize = lpddOld->ddCaps.dwSize;
  577. lpddNew->ddCaps.dwCaps = lpddOld->ddCaps.dwCaps;
  578. lpddNew->ddCaps.dwCaps2 = lpddOld->ddCaps.dwCaps2;
  579. lpddNew->ddCaps.dwCKeyCaps = lpddOld->ddCaps.dwCKeyCaps;
  580. lpddNew->ddCaps.dwFXCaps = lpddOld->ddCaps.dwFXCaps;
  581. lpddNew->ddCaps.dwFXAlphaCaps = lpddOld->ddCaps.dwFXAlphaCaps;
  582. lpddNew->ddCaps.dwPalCaps = lpddOld->ddCaps.dwPalCaps;
  583. lpddNew->ddCaps.dwSVCaps = lpddOld->ddCaps.dwSVCaps;
  584. lpddNew->ddCaps.dwAlphaBltConstBitDepths = lpddOld->ddCaps.dwAlphaBltConstBitDepths;
  585. lpddNew->ddCaps.dwAlphaBltPixelBitDepths = lpddOld->ddCaps.dwAlphaBltPixelBitDepths;
  586. lpddNew->ddCaps.dwAlphaBltSurfaceBitDepths = lpddOld->ddCaps.dwAlphaBltSurfaceBitDepths;
  587. lpddNew->ddCaps.dwAlphaOverlayConstBitDepths = lpddOld->ddCaps.dwAlphaOverlayConstBitDepths;
  588. lpddNew->ddCaps.dwAlphaOverlayPixelBitDepths = lpddOld->ddCaps.dwAlphaOverlayPixelBitDepths;
  589. lpddNew->ddCaps.dwAlphaOverlaySurfaceBitDepths = lpddOld->ddCaps.dwAlphaOverlaySurfaceBitDepths;
  590. lpddNew->ddCaps.dwZBufferBitDepths = lpddOld->ddCaps.dwZBufferBitDepths;
  591. lpddNew->ddCaps.dwVidMemTotal = lpddOld->ddCaps.dwVidMemTotal;
  592. lpddNew->ddCaps.dwVidMemFree = lpddOld->ddCaps.dwVidMemFree;
  593. lpddNew->ddCaps.dwMaxVisibleOverlays = lpddOld->ddCaps.dwMaxVisibleOverlays;
  594. lpddNew->ddCaps.dwCurrVisibleOverlays = lpddOld->ddCaps.dwCurrVisibleOverlays;
  595. lpddNew->ddCaps.dwNumFourCCCodes = lpddOld->ddCaps.dwNumFourCCCodes;
  596. lpddNew->ddCaps.dwAlignBoundarySrc = lpddOld->ddCaps.dwAlignBoundarySrc;
  597. lpddNew->ddCaps.dwAlignSizeSrc = lpddOld->ddCaps.dwAlignSizeSrc;
  598. lpddNew->ddCaps.dwAlignBoundaryDest = lpddOld->ddCaps.dwAlignBoundaryDest;
  599. lpddNew->ddCaps.dwAlignSizeDest = lpddOld->ddCaps.dwAlignSizeDest;
  600. lpddNew->ddCaps.dwAlignStrideAlign = lpddOld->ddCaps.dwAlignStrideAlign;
  601. lpddNew->ddCaps.ddsCaps = lpddOld->ddCaps.ddsCaps;
  602. lpddNew->ddCaps.dwMinOverlayStretch = lpddOld->ddCaps.dwMinOverlayStretch;
  603. lpddNew->ddCaps.dwMaxOverlayStretch = lpddOld->ddCaps.dwMaxOverlayStretch;
  604. lpddNew->ddCaps.dwMinLiveVideoStretch = lpddOld->ddCaps.dwMinLiveVideoStretch;
  605. lpddNew->ddCaps.dwMaxLiveVideoStretch = lpddOld->ddCaps.dwMaxLiveVideoStretch;
  606. lpddNew->ddCaps.dwMinHwCodecStretch = lpddOld->ddCaps.dwMinHwCodecStretch;
  607. lpddNew->ddCaps.dwMaxHwCodecStretch = lpddOld->ddCaps.dwMaxHwCodecStretch;
  608. lpddNew->ddCaps.dwSVBCaps = 0;
  609. lpddNew->ddCaps.dwSVBCKeyCaps = 0;
  610. lpddNew->ddCaps.dwSVBFXCaps = 0;
  611. lpddNew->ddCaps.dwVSBCaps = 0;
  612. lpddNew->ddCaps.dwVSBCKeyCaps = 0;
  613. lpddNew->ddCaps.dwVSBFXCaps = 0;
  614. lpddNew->ddCaps.dwSSBCaps = 0;
  615. lpddNew->ddCaps.dwSSBCKeyCaps = 0;
  616. lpddNew->ddCaps.dwSSBFXCaps = 0;
  617. lpddNew->ddCaps.dwReserved1 = lpddOld->ddCaps.dwReserved1;
  618. lpddNew->ddCaps.dwReserved2 = lpddOld->ddCaps.dwReserved2;
  619. lpddNew->ddCaps.dwReserved3 = lpddOld->ddCaps.dwReserved3;
  620. lpddNew->ddCaps.dwMaxVideoPorts = 0;
  621. lpddNew->ddCaps.dwCurrVideoPorts = 0;
  622. lpddNew->ddCaps.dwSVBCaps2 = 0;
  623. for(i=0; i<DD_ROP_SPACE; i++)
  624. {
  625. lpddNew->ddCaps.dwRops[i] = lpddOld->ddCaps.dwRops[i];
  626. lpddNew->ddCaps.dwSVBRops[i] = 0;
  627. lpddNew->ddCaps.dwVSBRops[i] = 0;
  628. lpddNew->ddCaps.dwSSBRops[i] = 0;
  629. }
  630. lpddNew->dwMonitorFrequency = lpddOld->dwMonitorFrequency;
  631. lpddNew->GetDriverInfo = NULL; // was unused hWndListBox in v1
  632. lpddNew->dwModeIndex = lpddOld->dwModeIndex;
  633. lpddNew->lpdwFourCC = lpddOld->lpdwFourCC;
  634. lpddNew->dwNumModes = lpddOld->dwNumModes;
  635. lpddNew->lpModeInfo = lpddOld->lpModeInfo;
  636. lpddNew->dwFlags = lpddOld->dwFlags;
  637. lpddNew->lpPDevice = lpddOld->lpPDevice;
  638. lpddNew->hInstance = lpddOld->hInstance;
  639. lpddNew->lpD3DGlobalDriverData = 0;
  640. lpddNew->lpD3DHALCallbacks = 0;
  641. lpddNew->lpDDExeBufCallbacks = NULL;
  642. }