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.

2327 lines
114 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddrawpr.h
  6. * Content: DirectDraw private header file
  7. * History:
  8. * Date By Reason
  9. * ==== == ======
  10. * 25-dec-94 craige initial implementation
  11. * 06-jan-95 craige video memory manager
  12. * 13-jan-95 craige re-worked to updated spec + ongoing work
  13. * 31-jan-95 craige and even more ongoing work...
  14. * 22-feb-95 craige use critical sections on Win95
  15. * 27-feb-95 craige new sync. macros
  16. * 03-mar-95 craige WaitForVerticalBlank stuff
  17. * 06-mar-95 craige HEL integration
  18. * 08-mar-95 craige GetFourCCCodes
  19. * 11-mar-95 craige palette stuff
  20. * 19-mar-95 craige use HRESULTs
  21. * 20-mar-95 craige new CSECT work
  22. * 23-mar-95 craige attachment work
  23. * 26-mar-95 craige added TMPALLOC and TMPFREE
  24. * 27-mar-95 craige linear or rectangular vidmem
  25. * 28-mar-95 craige switched to PALETTEENTRY from RGBQUAD
  26. * 29-mar-95 craige debug memory manager; build.h; hacks for DLL
  27. * unload problem...
  28. * 31-mar-95 craige use critical sections with palettes
  29. * 03-apr-95 craige added MAKE_SURF_RECT
  30. * 04-apr-95 craige added DD_GetPaletteEntries, DD_SetPaletteEntries
  31. * 06-apr-95 craige split out process list stuff; fill in free vidmem
  32. * 12-apr-95 craige add debugging to CSECT macros
  33. * 13-apr-95 craige EricEng's little contribution to our being late
  34. * 14-may-95 craige added DoneExclusiveMode, DD16_EnableReboot; cleaned out
  35. * obsolete junk
  36. * 23-may-95 craige no longer use MapLS_Pool; added Flush, GetBatchLimit
  37. * and SetBatchLimit
  38. * 24-may-95 craige added Restore
  39. * 28-may-95 craige unicode support; cleaned up HAL: added GetBltStatus;
  40. * GetFlipStatus; GetScanLine
  41. * 02-jun-95 craige added SetDisplayMode
  42. * 04-jun-95 craige added AllocSurfaceMem, IsLost
  43. * 05-jun-95 craige removed GetVersion, FreeAllSurfaces, DefWindowProc;
  44. * change GarbageCollect to Compact
  45. * 06-jun-95 craige added RestoreDisplayMode
  46. * 07-jun-95 craige added StartExclusiveMode
  47. * 10-jun-95 craige split out vmemmgr stuff
  48. * 13-jun-95 kylej move FindAttachedFlip to misc.c, added CanBeFlippable
  49. * 18-jun-95 craige specify pitch for rectangular heaps
  50. * 20-jun-95 craige added DD16_InquireVisRgn; make retail builds
  51. * not bother to check for NULL (since there are 4
  52. * billion other invalid ptrs we don't check for...)
  53. * 21-jun-95 craige new clipper stuff
  54. * 23-jun-95 craige ATTACHED_PROCESSES stuff
  55. * 25-jun-95 craige one ddraw mutex
  56. * 26-jun-95 craige reorganized surface structure
  57. * 27-jun-95 craige replaced batch limit/flush stuff with BltBatch
  58. * 30-jun-95 kylej function prototypes to support mult. prim. surfaces
  59. * 30-jun-95 craige changed GET_PIXEL_FORMAT to use HASPIXELFORMAT flag
  60. * 01-jul-95 craige hide composition & streaming stuff
  61. * 02-jul-95 craige SEH macros; added DD16_ChangeDisplaySettings
  62. * 03-jul-95 kylej Changed EnumSurfaces declaration
  63. * 03-jul-95 craige YEEHAW: new driver struct; Removed GetProcessPrimary
  64. * 05-jul-95 craige added Initialize fn to each object
  65. * 07-jul-95 craige added some VALIDEX_xxx structs
  66. * 07-jul-95 kylej proto XformRect, STRETCH_X and STRETCH_Y macros
  67. * 08-jul-95 craige added FindProcessDDObject; added InvalidateAllSurfaces
  68. * 09-jul-95 craige added debug output to win16 lock macro; added
  69. * ComputePitch, added hasvram flag to MoveToSystemMemory;
  70. * changed SetExclusiveMode to SetCooperativeLevel;
  71. * added ChangeToSoftwareColorKey
  72. * 10-jul-95 craige support SetOverlayPosition
  73. * 13-jul-95 craige ENTER_DDRAW is now the win16 lock;
  74. * Get/SetOverlayPosition takes LONGs
  75. * 13-jul-95 toddla remove _export from thunk functions
  76. * 18-jul-95 craige removed DD_Surface_Flush
  77. * 20-jul-95 craige internal reorg to prevent thunking during modeset
  78. * 28-jul-95 craige go back to private DDRAW lock
  79. * 31-jul-95 craige added DCIIsBanked
  80. * 01-aug-95 craige added ENTER/LEAVE_BOTH; DOHALCALL_NOWIN16
  81. * 04-aug-95 craige added InternalLock/Unlock
  82. * 10-aug-95 toddla changed proto of EnumDisplayModes
  83. * 10-aug-95 toddla added VALIDEX_DDSURFACEDESC_PTR
  84. * 12-aug-95 craige added use_full_lock parm to MoveToSystemMemory and
  85. * ChangeToSoftwareColorKey
  86. * 13-aug-95 craige flags parm for Flip
  87. * 21-aug-95 craige mode X support
  88. * 27-aug-95 craige bug 735: added SetPaletteAlways
  89. * bug 738: use GUID instead of IID
  90. * 02-sep-95 craige bug 786: verify dwSize in retail
  91. * 04-sep-95 craige bug 894: force flag to SetDisplayMode
  92. * 10-sep-95 toddla added string ids
  93. * 21-sep-95 craige bug 1215: added DD16_SetCertified
  94. * 11-nov-95 colinmc added new pointer validition macro for byte arrays
  95. * 27-nov-95 colinmc new member to return available vram of a given type
  96. * (defined by DDSCAPS)
  97. * 10-dec-95 colinmc added execute buffer support
  98. * 14-dec-95 colinmc added shared back and z-buffer support
  99. * 25-dec-95 craige added class factory support
  100. * 31-dec-95 craige added VALID_IID_PTR
  101. * 26-jan-96 jeffno FlipToGDISurface now only takes 1 arg
  102. * 09-feb-96 colinmc local surface objects now have invalid surface flag
  103. * 12-feb-96 jeffno Cheaper Mutex implementation for NT
  104. * 15-feb-96 jeffno GETCURRENTPID needs to call HackCurrentPID on both 95 and NT
  105. * 17-feb-96 colinmc Removed dependency on Direct3D include files
  106. * 24-feb-96 colinmc Added prototype for new member which is used to
  107. * determine if the callback tables have already been
  108. * initialized.
  109. * 02-mar-96 colinmc Simply disgusting and temporary hack to keep
  110. * interim drivers working
  111. * 14-mar-96 colinmc Changes for the clipper class factory
  112. * 17-mar-96 colinmc Bug 13124: flippable mip-maps
  113. * 20-mar-96 colinmc Bug 13634: unidirectional attachments cause infinite
  114. * loop on cleanup
  115. * 22-mar-96 colinmc Bug 13316: Uninitialized interfaces
  116. * 24-mar-96 colinmc Bug 14321: not possible to specify back buffer and
  117. * mip-map count in a single call
  118. * 10-apr-96 colinmc Bug 16903: HEL using obsolete FindProcessDDObject
  119. * 13-apr-96 colinmc Bug 17736: No driver notifcation of flip to GDI
  120. * 15-apr-96 colinmc Bug 16885: Can't pass NULL to initialize in C++
  121. * 16-apr-96 colinmc Bug 17921: Remove interim driver support
  122. * 26-mar-96 jeffno Removed cheap mutexes. Added check for mode change for NT's
  123. * ENTERDDRAW.
  124. * 29-apr-96 colinmc Bug 19954: Must query for Direct3D before texture or
  125. * device interface
  126. * 11-may-96 colinmc Bug 22293: New macro to validate GUID even if not
  127. * in debug
  128. * 17-may-96 kylej Bug 23301: validate DDHALINFO size >= current size
  129. * 28-jul-96 colinmc Bug 2613: Minimal support for secondary (stacked)
  130. * drivers.
  131. * 16-aug-96 craige include ddreg.h, added dwRegFlags + flag defns
  132. * 03-sep-96 craige added app compat stuff.
  133. * 23-sep-96 ketand added InternalGetClipList
  134. * 01-oct-96 ketand added TIMING routings
  135. * 05-oct-96 colinmc Work Item: Remove requirement on taking Win16 lock
  136. * for VRAM surfaces (not primary)
  137. * 12-oct-96 colinmc Improvements to Win16 locking code to reduce virtual
  138. * memory usage
  139. * 09-nov-96 colinmc Fixed problem with old and new drivers not working
  140. * with DirectDraw
  141. * 17-nov-96 colinmc New ref flag to control the enabling and disabling
  142. * of PrintScreen
  143. * 02-jan-97 colinmc Initial AGP implementation work
  144. * 12-jan-97 colinmc More Win16 lock work
  145. * 13-jan-97 jvanaken Basic support for IDirectDrawSurface3 interface
  146. * 18-jan-97 colinmc AGP VMM support
  147. * 21-jan-97 ketand Change DD16_SetPaletteEntries for multi-mon. Deleted
  148. * unused code.
  149. * 26-jan-97 ketand Remove unused DD16_GetPaletteEntries. (It didn't handle
  150. * multi-mon; and wasn't worth fixing.) Also, remove
  151. * globals that don't work anymore with multi-mon.
  152. * 30-jan-97 colinmc Work item 4125: Need time bomb for final
  153. * 01-feb-97 colinmc Bug 5457: Fixed Win16 lock problem causing hang
  154. * with mutliple AMovie instances on old cards
  155. * 02-feb-97 toddla pass driver name to DD16_GetMonitor functions
  156. * added DD16_GetDeviceConfig
  157. * 02-feb-97 colinmc Bug 5625: V1.0 DirectX drivers don't get recognized
  158. * due to bad size check on DDCALLBACKS
  159. * 05-feb-97 ketand Remove unused parameter from ClipRgnToRect
  160. * 22-feb-97 colinmc Enabled OWNDC for explicit system memory surfaces
  161. * 03-mar-97 smac Added kernel mode interface
  162. * 03-mar-97 jeffno Work item: Extended surface memory alignment
  163. * 04-mar-97 ketand Added UpdateOutstandingDC to track palette changes
  164. * 08-mar-97 colinmc Added support for DMA style AGP parts
  165. * 13-mar-97 colinmc Bug 6533: Pass uncached flag to VMM correctly
  166. * 22-mar-97 colinmc Bug 6673: Add compile time option to allow new
  167. * applications to run against legacy run times.
  168. * 23-mar-97 colinmc Bug 6673 again: Changed structure numbering scheme
  169. * for consistency's sake
  170. * 24-mar-97 jeffno Optimized Surfaces
  171. * 07-may-97 colinmc Moved AGP support detection from misc.c to ddagp.c
  172. * 30-sep-97 jeffno IDirectDraw4
  173. * 03-oct-97 jeffno DDSCAPS2 and DDSURFACEDESC2
  174. * 31-oct-97 johnstep Persistent-content surfaces for Windows 9x
  175. * 26-nov-97 t-craigs Added IDirectDrawPalette2
  176. * 19-dec-97 jvanaken IDDS4::Unlock now takes a pointer to a rectangle.
  177. *
  178. ***************************************************************************/
  179. #ifndef __DDRAWPR_INCLUDED__
  180. #define __DDRAWPR_INCLUDED__
  181. #ifndef WIN95
  182. #include <nt.h>
  183. #include <ntrtl.h>
  184. #include <nturtl.h>
  185. #include <stddef.h>
  186. #endif
  187. #ifdef WIN95
  188. #define WIN16_SEPARATE
  189. #endif
  190. #include "verinfo.h"
  191. #ifndef WIN32_LEAN_AND_MEAN
  192. #define WIN32_LEAN_AND_MEAN
  193. #endif
  194. #include <windows.h>
  195. #include <mmsystem.h>
  196. #if defined( WIN95 ) && !defined ( NT_BUILD_ENVIRONMENT )
  197. #undef PBT_APMRESUMEAUTOMATIC
  198. #include <pbt.h>
  199. #endif
  200. //#ifdef NT_BUILD_ENVIRONMENT
  201. /*
  202. * These are various definitions brought over from the win95 world, just to get us
  203. * compiling under the NT headers.
  204. */
  205. #ifdef WIN32
  206. /*
  207. * These come from \proj\dev\sdk\inc\winbase.h
  208. */
  209. #define FILE_FLAG_GLOBAL_HANDLE 0x00800000 // ;internal
  210. VOID // ;internal
  211. WINAPI // ;internal
  212. ReinitializeCriticalSection( // ;internal
  213. LPCRITICAL_SECTION lpCriticalSection // ;internal
  214. ); // ;internal
  215. //
  216. // Windows 9x stuff
  217. //
  218. #define CDS_EXCLUSIVE 0x80000000
  219. #define DISPLAY_DEVICE_VGA 0x00000010
  220. #define DCX_USESTYLE 0x00010000
  221. #endif //IS_32
  222. /*
  223. * These two come from \proj\dev\msdev\include\pbt.h
  224. */
  225. #define PBT_APMSUSPEND 0x0004
  226. #define PBT_APMSTANDBY 0x0005
  227. //#endif //NT_BUILD_ENVIRONMENT
  228. #include <string.h>
  229. #include <stddef.h>
  230. #if defined( IS_32 ) || defined( WIN32 ) || defined( _WIN32 )
  231. #undef IS_32
  232. #define IS_32
  233. #include <dibeng.inc>
  234. #ifndef HARDWARECURSOR
  235. //#pragma message("defining local version of HARDWARECURSOR")
  236. #define HARDWARECURSOR 0x0100 // new post-Win95 deFlag
  237. #endif
  238. #else
  239. #define IID void
  240. #endif
  241. #pragma warning( disable: 4704)
  242. #include "dpf.h"
  243. /*
  244. * registry stuff
  245. */
  246. #include "ddreg.h"
  247. /*
  248. * application compat. stuff
  249. */
  250. #define DDRAW_APPCOMPAT_MODEXONLY 0x00000001l
  251. #define DDRAW_APPCOMPAT_NODDSCAPSINDDSD 0x00000002l
  252. #define DDRAW_APPCOMPAT_MMXFORRGB 0x00000004l
  253. #define DDRAW_APPCOMPAT_EXPLICITMONITOR 0x00000008l
  254. #define DDRAW_APPCOMPAT_SCREENSAVER 0x00000010l
  255. #define DDRAW_APPCOMPAT_FORCEMODULATED 0x00000020l
  256. #define DDRAW_APPCOMPAT_TEXENUMINCL_0 0x00000040l // two bit field
  257. #define DDRAW_APPCOMPAT_TEXENUMINCL_1 0x00000080l
  258. #define DDRAW_APPCOMPAT_VALID 0x000000ffl
  259. #define DDRAW_REGFLAGS_MODEXONLY 0x00000001l
  260. #define DDRAW_REGFLAGS_EMULATIONONLY 0x00000002l
  261. #define DDRAW_REGFLAGS_SHOWFRAMERATE 0x00000004l
  262. #define DDRAW_REGFLAGS_ENABLEPRINTSCRN 0x00000008l
  263. #define DDRAW_REGFLAGS_FORCEAGPSUPPORT 0x00000010l
  264. #define DDRAW_REGFLAGS_DISABLEMMX 0x00000020l
  265. #define DDRAW_REGFLAGS_DISABLEWIDESURF 0x00000040l
  266. #define DDRAW_REGFLAGS_AGPPOLICYMAXBYTES 0x00000200l
  267. #define DDRAW_REGFLAGS_FORCEREFRESHRATE 0x00008000l
  268. #ifdef DEBUG
  269. #define DDRAW_REGFLAGS_DISABLENOSYSLOCK 0x00000080l
  270. #define DDRAW_REGFLAGS_FORCENOSYSLOCK 0x00000100l
  271. #endif
  272. #define DDRAW_REGFLAGS_NODDSCAPSINDDSD 0x00000400l
  273. #define DDRAW_REGFLAGS_DISABLEAGPSUPPORT 0x00000800l
  274. #ifdef DEBUG
  275. #define DDRAW_REGFLAGS_DISABLEINACTIVATE 0x00001000l
  276. #define DDRAW_REGFLAGS_PREGUARD 0x00002000l
  277. #define DDRAW_REGFLAGS_POSTGUARD 0x00004000l
  278. #endif
  279. #define DDRAW_REGFLAGS_USENONLOCALVIDMEM 0x00010000l
  280. #define DDRAW_REGFLAGS_ENUMERATEATTACHEDSECONDARIES 0x00008000l
  281. extern DWORD dwRegFlags;
  282. #include "memalloc.h"
  283. #if defined( IS_32 ) || defined( WIN32 ) || defined( _WIN32 )
  284. #include <objbase.h>
  285. #else
  286. #define IUnknown void
  287. #endif
  288. #include "ddrawi.h"
  289. #include "dwininfo.h"
  290. #ifdef WIN95
  291. #include "..\ddraw16\modex.h"
  292. #endif
  293. /*
  294. * Need this to get CDS_ macros under NT build environment for win95.
  295. * winuserp.h comes from private\windows\inc
  296. */
  297. #ifdef NT_BUILD_ENVIRONMENT
  298. #ifdef WIN32
  299. #include "winuserp.h"
  300. #endif
  301. #endif
  302. #include "ids.h"
  303. /*
  304. * NT kernel mode stub(ish)s
  305. */
  306. #ifndef WIN95
  307. #include "ddrawgdi.h"
  308. #endif
  309. /*
  310. * Driver version info
  311. */
  312. //========================================================================
  313. // advanced driver information
  314. //========================================================================
  315. typedef struct tagDDDRIVERINFOEX
  316. {
  317. DDDEVICEIDENTIFIER di;
  318. char szDeviceID[MAX_DDDEVICEID_STRING];
  319. } DDDRIVERINFOEX, * LPDDDRIVERINFOEX;
  320. /*
  321. * Direct3D interfacing defines.
  322. */
  323. #ifndef NO_D3D
  324. #include "ddd3dapi.h"
  325. #endif
  326. #ifdef __cplusplus
  327. extern "C" {
  328. #endif
  329. #ifdef WIN95
  330. #define USE_CRITSECTS
  331. extern void DDAPI DD16_SetEventHandle( DWORD hInstance, DWORD dwEvent );
  332. extern void DDAPI DD16_DoneDriver( DWORD hInstance );
  333. extern void DDAPI DD16_GetDriverFns( LPDDHALDDRAWFNS list );
  334. extern void DDAPI DD16_GetHALInfo( LPDDHALINFO pinfo );
  335. extern LONG DDAPI DD16_ChangeDisplaySettings( LPDEVMODE pdm, DWORD flags);
  336. extern HRGN DDAPI DD16_InquireVisRgn( HDC );
  337. extern void DDAPI DD16_SelectPalette( HDC, HPALETTE, BOOL );
  338. extern BOOL DDAPI DD16_SetPaletteEntries( HDC hdc, DWORD dwBase, DWORD dwNum, LPPALETTEENTRY, BOOL fPrimary );
  339. extern void DDAPI DD16_EnableReboot( BOOL );
  340. extern void DDAPI DD16_SetCertified( BOOL iscert );
  341. extern BOOL DDAPI DCIIsBanked( HDC hdc );
  342. #define GETCURRPID HackGetCurrentProcessId
  343. VOID WINAPI MakeCriticalSectionGlobal( CSECT_HANDLE lpcsCriticalSection );
  344. extern HDC DDAPI DD16_GetDC(HDC hdc, LPDDSURFACEDESC pddsd, LPPALETTEENTRY lpPalette);
  345. extern void DDAPI DD16_ReleaseDC(HDC hdc);
  346. extern BOOL DDAPI DD16_SafeMode(HDC hdc, BOOL fSafeMode);
  347. extern void DDAPI DD16_Exclude(DWORD dwPDevice, RECTL FAR *prcl);
  348. extern void DDAPI DD16_Unexclude(DWORD dwPDevice);
  349. extern int DDAPI DD16_Stretch(DWORD DstPtr, int DstPitch, UINT DstBPP, int DstX, int DstY, int DstDX, int DstDY,
  350. DWORD SrcPtr, int SrcPitch, UINT SrcBPP, int SrcX, int SrcY, int SrcDX, int SrcDY);
  351. extern BOOL DDAPI DD16_IsWin95MiniDriver( void );
  352. extern int DDAPI DD16_GetMonitorMaxSize(LPSTR szDevice);
  353. extern BOOL DDAPI DD16_GetMonitorRefreshRateRanges(LPSTR szDevice, int xres, int yres, int FAR *pmin, int FAR *pmax);
  354. extern DWORD DDAPI DD16_GetDeviceConfig(LPSTR szDevice, LPVOID lpConfig, DWORD size);
  355. extern BOOL DDAPI DD16_GetMonitorEDIDData(LPSTR szDevice, LPVOID lpEdidData);
  356. extern DWORD DDAPI DD16_GetRateFromRegistry( LPSTR szDevice );
  357. extern int DDAPI DD16_SetRateInRegistry( LPSTR szDevice, DWORD dwRateToRestore );
  358. #ifdef USE_ALIAS
  359. extern BOOL DDAPI DD16_FixupDIBEngine( void );
  360. #endif /* USE_ALIAS */
  361. extern WORD DDAPI DD16_MakeObjectPrivate(HDC hdc, BOOL fPrivate);
  362. extern BOOL DDAPI DD16_AttemptGamma(HDC hdc);
  363. extern BOOL DDAPI DD16_IsDeviceBusy(HDC hdc);
  364. #else
  365. #define DD16_DoneDriver( hInstance ) 0
  366. #define DD16_GetDriverFns( list ) 0
  367. #define DD16_GetHALInfo( pinfo ) 0
  368. #define DD16_ChangeDisplaySettings( pdm, flags) ChangeDisplaySettings( pdm, flags )
  369. #define DD16_SelectPalette( hdc, hpal ) SelectPalette( hdc, hpal, FALSE )
  370. #define DD16_EnableReboot( retboot ) 0
  371. #define DD16_WWOpen( ptr ) 0
  372. #define DD16_WWClose( ptr, newlist ) 0
  373. #define DD16_WWNotifyInit( pww, lpcallback, param ) 0
  374. #define DD16_WWGetClipList( pww, prect, rdsize, prd ) 0
  375. //
  376. // On NT, it is an assert that we are never called by DDHELP, so we should always be
  377. // working on the current process.
  378. //
  379. #define GETCURRPID GetCurrentProcessId
  380. #define DCIIsBanked( hdc ) FALSE
  381. #define DD16_IsWin95MiniDriver() TRUE
  382. #define DD16_SetCertified( iscert ) 0
  383. #define DD16_GetMonitorMaxSize(dev) 0
  384. #define DD16_GetMonitorRefreshRateRanges( dev, xres, yres, pmin, pmax) 0
  385. #define DD16_GetRateFromRegistry( szDevice ) 0
  386. #define DD16_SetRateInRegistry( szDevice, dwRateToRestore ) 0
  387. #ifdef USE_ALIAS
  388. #define DD16_FixupDIBEngine() TRUE
  389. #endif /* USE_ALIAS */
  390. #define DD16_AttemptGamma( hdc) 0
  391. #define DD16_IsDeviceBusy( hdc) 0
  392. #endif
  393. #ifndef NO_DDHELP
  394. #include "w95help.h"
  395. #endif //NO_DDHELP
  396. #define TRY _try
  397. #define EXCEPT(a) _except( a )
  398. extern LPDDRAWI_DDRAWCLIPPER_INT lpGlobalClipperList;
  399. /*
  400. * list of processes attached to DLL
  401. */
  402. typedef struct ATTACHED_PROCESSES
  403. {
  404. struct ATTACHED_PROCESSES *lpLink;
  405. DWORD dwPid;
  406. #ifdef WINNT
  407. DWORD dwNTToldYet;
  408. #endif
  409. } ATTACHED_PROCESSES, FAR *LPATTACHED_PROCESSES;
  410. //extern LPATTACHED_PROCESSES lpAttachedProcesses;
  411. /* Structure for keeping track of DCs that have
  412. * been handed out by DDraw for surfaces.
  413. */
  414. typedef struct _dcinfo
  415. {
  416. HDC hdc; // HDC associated with surface
  417. LPDDRAWI_DDRAWSURFACE_LCL pdds_lcl; // Surface associated with HDC
  418. struct _dcinfo * pdcinfoNext; // Pointer to next
  419. } DCINFO, *LPDCINFO;
  420. /*
  421. * Head of the list of DCs handed out.
  422. */
  423. extern DCINFO *g_pdcinfoHead;
  424. /*
  425. * macros for doing allocations of a temporary basis.
  426. * Tries alloca first, if that fails, it will allocate storage from the heap
  427. */
  428. #ifdef USEALLOCA
  429. #define TMPALLOC( ptr, size ) \
  430. ptr = _alloca( (size)+sizeof( DWORD ) ); \
  431. if( ptr == NULL ) \
  432. { \
  433. ptr = MemAlloc( (size)+sizeof( DWORD ) ); \
  434. if( ptr != NULL ) \
  435. { \
  436. *(DWORD *)ptr = 1; \
  437. (LPSTR) ptr += sizeof( DWORD ); \
  438. } \
  439. } \
  440. else \
  441. { \
  442. *(DWORD *)ptr = 0; \
  443. (LPSTR) ptr += sizeof( DWORD ); \
  444. }
  445. #define TMPFREE( ptr ) \
  446. if( ptr != NULL ) \
  447. { \
  448. (LPSTR) ptr -= sizeof( DWORD ); \
  449. if( (*(DWORD *) ptr) ) \
  450. { \
  451. MemFree( ptr ); \
  452. } \
  453. }
  454. #else
  455. #define TMPALLOC( ptr, size ) ptr = MemAlloc( size );
  456. #define TMPFREE( ptr ) MemFree( ptr );
  457. #endif
  458. /*
  459. * macros for getting at values that aren't always present in the surface
  460. * object
  461. */
  462. #define GET_PIXEL_FORMAT( thisx, thisl, pddpf ) \
  463. if( thisx->dwFlags & DDRAWISURF_HASPIXELFORMAT ) \
  464. { \
  465. pddpf = &thisl->ddpfSurface; \
  466. } \
  467. else \
  468. { \
  469. pddpf = &thisl->lpDD->vmiData.ddpfDisplay; \
  470. }
  471. /*
  472. * macro for building a rectangle that is the size of a surface.
  473. * For multi-monitor systems, we have a different code path
  474. * to deal with the fact that the upper-left coord may not be zero.
  475. */
  476. #define MAKE_SURF_RECT( surf, surf_lcl, r ) \
  477. r.top = 0; \
  478. r.left = 0; \
  479. r.bottom = (DWORD) surf->wHeight; \
  480. r.right = (DWORD) surf->wWidth;
  481. /*
  482. * macro for doing doing HAL call.
  483. *
  484. * Takes the Win16 lock for 32-bit Win95 driver routines. This serves a
  485. * 2-fold purpose:
  486. * 1) keeps the 16-bit portion of the driver safe
  487. * 2) 32-bit routine needs lock others out while its updating
  488. * its hardware
  489. */
  490. #if defined( WIN95 ) && defined( WIN16_SEPARATE )
  491. #define DOHALCALL( halcall, fn, data, rc, isHEL ) \
  492. if( (fn != _DDHAL_##halcall) && !isHEL ) { \
  493. ENTER_WIN16LOCK(); \
  494. rc = fn( &data ); \
  495. LEAVE_WIN16LOCK(); \
  496. } else { \
  497. rc = fn( &data ); \
  498. }
  499. #define DOHALCALL_NOWIN16( halcall, fn, data, rc, isHEL ) \
  500. rc = fn( &data );
  501. #else
  502. #define DOHALCALL( halcall, fn, data, rc, isHEL ) \
  503. if (fn) \
  504. rc = fn( &data );\
  505. else\
  506. rc = DDHAL_DRIVER_NOTHANDLED;
  507. #define DOHALCALL_NOWIN16( halcall, fn, data, rc, isHEL ) \
  508. if (fn) \
  509. rc = fn( &data );\
  510. else\
  511. rc = DDHAL_DRIVER_NOTHANDLED;
  512. #endif
  513. /*
  514. * macro for incrementing/decrementing the driver ref count
  515. */
  516. #define CHANGE_GLOBAL_CNT( pdrv, thisg, cnt ) \
  517. if( !(thisg->dwGlobalFlags & DDRAWISURFGBL_SYSMEMREQUESTED) ) \
  518. { \
  519. (int) pdrv->dwSurfaceLockCount += (int) (cnt); \
  520. }
  521. /*
  522. * reminder
  523. */
  524. #define QUOTE(x) #x
  525. #define QQUOTE(y) QUOTE(y)
  526. #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) "):" str
  527. /*
  528. * maximum timeout (in ms) when spinlocked on a surface
  529. */
  530. #define MAX_TIMEOUT 5000
  531. /*
  532. * defined in dllmain.c
  533. */
  534. extern CSECT_HANDLE lpDDCS;
  535. #ifdef WINNT
  536. extern HANDLE hDriverObjectListMutex;
  537. #else
  538. #ifdef IS_32
  539. extern CRITICAL_SECTION csDriverObjectList;
  540. #endif
  541. #endif
  542. #define MAX_TIMER_HWNDS 15
  543. extern HWND ghwndTopmostList[MAX_TIMER_HWNDS];
  544. extern int giTopmostCnt;
  545. extern BOOL bGammaCalibratorExists;
  546. extern BYTE szGammaCalibrator[MAX_PATH];
  547. extern DWORD dwForceRefreshRate;
  548. /*
  549. * blt flags
  550. */
  551. #define DDBLT_PRIVATE_ALIASPATTERN 0x80000000l
  552. /*
  553. * get the fail code based on what HAL and HEL support; used by BLT
  554. *
  555. * assumes variables halonly, helonly, fail are defined
  556. */
  557. #define GETFAILCODEBLT( testhal, testhel, halonly, helonly, flag ) \
  558. if( halonly ) { \
  559. if( !(testhal & flag) ) { \
  560. fail = TRUE; \
  561. } \
  562. } else if( helonly ) { \
  563. if( !(testhel & flag) ) { \
  564. fail = TRUE; \
  565. } \
  566. } else { \
  567. if( !(testhal & flag) ) { \
  568. if( !(testhel & flag) ) { \
  569. fail = TRUE; \
  570. } else { \
  571. helonly = TRUE; \
  572. } \
  573. } else { \
  574. halonly = TRUE; \
  575. } \
  576. }
  577. /*
  578. * get the fail code based on what HAL and HEL support
  579. *
  580. * assumes variables halonly, helonly, fail are defined
  581. */
  582. #define GETFAILCODE( testhal, testhel, flag ) \
  583. if( halonly ) \
  584. { \
  585. if( !(testhal & flag) ) \
  586. { \
  587. fail = TRUE; \
  588. } \
  589. } \
  590. else if( helonly ) \
  591. { \
  592. if( !(testhel & flag) ) \
  593. { \
  594. fail = TRUE; \
  595. } \
  596. } \
  597. else \
  598. { \
  599. if( !(testhal & flag) ) \
  600. { \
  601. if( !(testhel & flag) ) \
  602. { \
  603. fail = TRUE; \
  604. } \
  605. else \
  606. { \
  607. helonly = TRUE; \
  608. } \
  609. } \
  610. else \
  611. { \
  612. halonly = TRUE; \
  613. } \
  614. }
  615. typedef struct {
  616. DWORD src_height;
  617. DWORD src_width;
  618. DWORD dest_height;
  619. DWORD dest_width;
  620. BOOL halonly;
  621. BOOL helonly;
  622. LPDDHALSURFCB_BLT bltfn;
  623. LPDDHALSURFCB_BLT helbltfn;
  624. } SPECIAL_BLT_DATA, FAR *LPSPECIAL_BLT_DATA;
  625. /*
  626. * synchronization
  627. */
  628. #ifdef WINNT
  629. #define RELEASE_EXCLUSIVEMODE_MUTEX {if (hExclusiveModeMutex) ReleaseMutex(hExclusiveModeMutex);}
  630. #else
  631. #define RELEASE_EXCLUSIVEMODE_MUTEX ;
  632. #endif
  633. //--------------------------------- new cheap mutexes -------------------------------------------
  634. //
  635. // Global Critical Sections have two components. One piece is shared between all
  636. // applications using the global lock. This portion will typically reside in some
  637. // sort of shared memory
  638. //
  639. // The second piece is per-process. This contains a per-process handle to the shared
  640. // critical section lock semaphore. The semaphore is itself shared, but each process
  641. // may have a different handle value to the semaphore.
  642. //
  643. // Global critical sections are attached to by name. The application wishing to
  644. // attach must know the name of the critical section (actually the name of the shared
  645. // lock semaphore, and must know the address of the global portion of the critical
  646. // section
  647. //
  648. typedef struct _GLOBAL_SHARED_CRITICAL_SECTION {
  649. LONG LockCount;
  650. LONG RecursionCount;
  651. DWORD OwningThread;
  652. DWORD OwningProcess;
  653. DWORD Reserved;
  654. } GLOBAL_SHARED_CRITICAL_SECTION, *PGLOBAL_SHARED_CRITICAL_SECTION;
  655. typedef struct _GLOBAL_LOCAL_CRITICAL_SECTION {
  656. PGLOBAL_SHARED_CRITICAL_SECTION GlobalPortion;
  657. HANDLE LockSemaphore;
  658. DWORD Reserved1;
  659. DWORD Reserved2;
  660. } GLOBAL_LOCAL_CRITICAL_SECTION, *PGLOBAL_LOCAL_CRITICAL_SECTION;
  661. /*
  662. * The following functions are defined in mutex.c
  663. */
  664. BOOL
  665. WINAPI
  666. AttachToGlobalCriticalSection(
  667. PGLOBAL_LOCAL_CRITICAL_SECTION lpLocalPortion,
  668. PGLOBAL_SHARED_CRITICAL_SECTION lpGlobalPortion,
  669. LPCSTR lpName
  670. );
  671. BOOL
  672. WINAPI
  673. DetachFromGlobalCriticalSection(
  674. PGLOBAL_LOCAL_CRITICAL_SECTION lpLocalPortion
  675. );
  676. VOID
  677. WINAPI
  678. EnterGlobalCriticalSection(
  679. PGLOBAL_LOCAL_CRITICAL_SECTION lpLocalPortion
  680. );
  681. VOID
  682. WINAPI
  683. LeaveGlobalCriticalSection(
  684. PGLOBAL_LOCAL_CRITICAL_SECTION lpLocalPortion
  685. );
  686. void
  687. DestroyPIDsLock(
  688. PGLOBAL_SHARED_CRITICAL_SECTION GlobalPortion,
  689. DWORD dwPid,
  690. LPSTR lpName
  691. );
  692. #define DDRAW_FAST_CS_NAME "DdrawGlobalFastCrit"
  693. extern GLOBAL_LOCAL_CRITICAL_SECTION CheapMutexPerProcess;
  694. extern GLOBAL_SHARED_CRITICAL_SECTION CheapMutexCrossProcess;
  695. #define CHEAP_LEAVE {LeaveGlobalCriticalSection(&CheapMutexPerProcess);}
  696. #define CHEAP_ENTER {EnterGlobalCriticalSection(&CheapMutexPerProcess);}
  697. #ifdef WINNT
  698. // #define USE_CHEAP_MUTEX
  699. #define NT_USES_CRITICAL_SECTION
  700. #endif
  701. extern void ModeChangedOnENTERDDRAW(void); // in ddmodent.c
  702. extern ULONG uDisplaySettingsUnique;
  703. //
  704. #ifdef IS_32
  705. #ifndef USE_CRITSECTS
  706. #define INIT_DDRAW_CSECT()
  707. #define FINI_DDRAW_CSECT()
  708. #define ENTER_DDRAW()
  709. #define LEAVE_DDRAW()
  710. #define ENTER_DRIVERLISTCSECT()
  711. #define LEAVE_DRIVERLISTCSECT()
  712. #else //so use csects:
  713. #ifdef DEBUG
  714. //extern int iWin16Cnt;
  715. //extern int iDLLCSCnt;
  716. #define INCCSCNT() iDLLCSCnt++;
  717. #define DECCSCNT() iDLLCSCnt--;
  718. #define INCW16CNT() iWin16Cnt++;
  719. #define DECW16CNT() iWin16Cnt--;
  720. #else
  721. #define INCCSCNT()
  722. #define DECCSCNT()
  723. #define INCW16CNT()
  724. #define DECW16CNT()
  725. #endif //debug
  726. #ifdef WINNT
  727. extern HANDLE hDirectDrawMutex; //def'd in dllmain.c
  728. #ifdef USE_CHEAP_MUTEX
  729. //--------------------------------- new cheap mutexes -------------------------------------------
  730. #define ENTER_DDRAW() {CHEAP_ENTER;}
  731. #define ENTER_DDRAW_INDLLMAIN() CHEAP_ENTER
  732. #define LEAVE_DDRAW() CHEAP_LEAVE
  733. #define INIT_DDRAW_CSECT() \
  734. { \
  735. if (!AttachToGlobalCriticalSection(&CheapMutexPerProcess,&CheapMutexCrossProcess,DDRAW_FAST_CS_NAME) ) \
  736. {DPF(0,"===================== Mutex Creation FAILED =================");} \
  737. }
  738. #define FINI_DDRAW_CSECT() {DetachFromGlobalCriticalSection(&CheapMutexPerProcess);}
  739. #else
  740. #ifdef NT_USES_CRITICAL_SECTION
  741. //
  742. // Use critical sections
  743. //
  744. #define INIT_DDRAW_CSECT() InitializeCriticalSection( lpDDCS );
  745. #define FINI_DDRAW_CSECT() DeleteCriticalSection( lpDDCS );
  746. extern DWORD gdwRecursionCount;
  747. #define ENTER_DDRAW() \
  748. { \
  749. DWORD dwUniqueness; \
  750. EnterCriticalSection( (LPCRITICAL_SECTION) lpDDCS ); \
  751. gdwRecursionCount++; \
  752. dwUniqueness = DdQueryDisplaySettingsUniqueness(); \
  753. if (dwUniqueness != uDisplaySettingsUnique && \
  754. 1 == gdwRecursionCount) \
  755. { \
  756. ModeChangedOnENTERDDRAW(); \
  757. uDisplaySettingsUnique = dwUniqueness; \
  758. } \
  759. }
  760. #define ENTER_DDRAW_INDLLMAIN() \
  761. EnterCriticalSection( (LPCRITICAL_SECTION) lpDDCS ); \
  762. gdwRecursionCount++;
  763. #define LEAVE_DDRAW() { gdwRecursionCount--; LeaveCriticalSection( (LPCRITICAL_SECTION) lpDDCS );}
  764. #else
  765. //
  766. // Use a mutex object.
  767. //
  768. #define INIT_DDRAW_CSECT() \
  769. { if (hDirectDrawMutex) {DPF(0,"Direct draw mutex initialised twice!");} \
  770. else{ \
  771. hDirectDrawMutex = CreateMutex(NULL,FALSE,"DirectDrawMutexName"); \
  772. if (!hDirectDrawMutex) {DPF(0,"===================== Mutex Creation FAILED =================");}\
  773. } \
  774. }
  775. extern DWORD gdwRecursionCount;
  776. #define FINI_DDRAW_CSECT() { if (hDirectDrawMutex) CloseHandle(hDirectDrawMutex); }
  777. #define LEAVE_DDRAW() { gdwRecursionCount--;ReleaseMutex(hDirectDrawMutex); }
  778. #define ENTER_DDRAW() \
  779. { \
  780. DWORD dwUniqueness,dwWaitValue; \
  781. dwWaitValue = WaitForSingleObject(hDirectDrawMutex,INFINITE); \
  782. gdwRecursionCount++; \
  783. dwUniqueness = DdQueryDisplaySettingsUniqueness(); \
  784. if (dwUniqueness != uDisplaySettingsUnique && \
  785. 1 == gdwRecursionCount) \
  786. { \
  787. ModeChangedOnENTERDDRAW(); \
  788. uDisplaySettingsUnique = dwUniqueness; \
  789. } \
  790. }
  791. #define ENTER_DDRAW_INDLLMAIN() WaitForSingleObject(hDirectDrawMutex,INFINITE);
  792. #endif //use (expensive) mutexes
  793. #endif //use_cheap_mutex
  794. #define ENTER_DRIVERLISTCSECT() \
  795. WaitForSingleObject(hDriverObjectListMutex,INFINITE);
  796. #define LEAVE_DRIVERLISTCSECT() \
  797. ReleaseMutex(hDriverObjectListMutex);
  798. #else //not winnt:
  799. #ifdef WIN16_SEPARATE
  800. #define INIT_DDRAW_CSECT() \
  801. ReinitializeCriticalSection( lpDDCS ); \
  802. MakeCriticalSectionGlobal( lpDDCS );
  803. #define FINI_DDRAW_CSECT() \
  804. DeleteCriticalSection( lpDDCS );
  805. #define ENTER_DDRAW() \
  806. DPF( 7, "*****%08lx ENTER_DDRAW: CNT = %ld," REMIND( "" ), GETCURRPID(), iDLLCSCnt ); \
  807. EnterCriticalSection( (LPCRITICAL_SECTION) lpDDCS ); \
  808. INCCSCNT(); \
  809. DPF( 7, "*****%08lx GOT DDRAW CSECT: CNT = %ld," REMIND(""), GETCURRPID(), iDLLCSCnt );
  810. #define LEAVE_DDRAW() \
  811. DECCSCNT() \
  812. DPF( 7, "*****%08lx LEAVE_DDRAW: CNT = %ld," REMIND( "" ), GETCURRPID(), iDLLCSCnt ); \
  813. LeaveCriticalSection( (LPCRITICAL_SECTION) lpDDCS );
  814. #else //not WIN16_SEPARATE
  815. #define INIT_DDRAW_CSECT()
  816. #define FINI_DDRAW_CSECT()
  817. #define ENTER_DDRAW() \
  818. DPF( 7, "*****%08lx ENTER_WIN16LOCK: CNT = %ld," REMIND( "" ), GETCURRPID(), iWin16Cnt ); \
  819. _EnterSysLevel( lpWin16Lock ); \
  820. INCW16CNT(); \
  821. DPF( 7, "*****%08lx GOT WIN16LOCK: CNT = %ld," REMIND(""), GETCURRPID(), iWin16Cnt );
  822. #define LEAVE_DDRAW() \
  823. DECW16CNT() \
  824. DPF( 7, "*****%08lx LEAVE_WIN16LOCK: CNT = %ld," REMIND( "" ), GETCURRPID(), iWin16Cnt ); \
  825. _LeaveSysLevel( lpWin16Lock );
  826. #endif //win16_separate
  827. #define ENTER_DRIVERLISTCSECT() \
  828. EnterCriticalSection( &csDriverObjectList );
  829. #define LEAVE_DRIVERLISTCSECT() \
  830. LeaveCriticalSection( &csDriverObjectList );
  831. #endif //winnt
  832. #endif //use csects
  833. #if defined(WIN95)
  834. /*
  835. * selector management functions
  836. */
  837. extern DWORD _stdcall MapLS( LPVOID ); // flat -> 16:16
  838. extern void _stdcall UnMapLS( DWORD ); // unmap 16:16
  839. extern LPVOID _stdcall MapSLFix( DWORD ); // 16:16->flat
  840. extern LPVOID _stdcall MapSL( DWORD ); // 16:16->flat
  841. //extern void _stdcall UnMapSLFix( LPVOID ); // 16:16->flat
  842. /*
  843. * win16 lock
  844. */
  845. extern void _stdcall GetpWin16Lock( LPVOID FAR *);
  846. extern void _stdcall _EnterSysLevel( LPVOID );
  847. extern void _stdcall _LeaveSysLevel( LPVOID );
  848. extern LPVOID lpWin16Lock;
  849. #endif win95
  850. #endif //is_32
  851. #ifdef WIN95
  852. #ifdef WIN16_SEPARATE
  853. #define ENTER_WIN16LOCK() \
  854. DPF( 7, "*****%08lx ENTER_WIN16LOCK: CNT = %ld," REMIND( "" ), GETCURRPID(), iWin16Cnt ); \
  855. _EnterSysLevel( lpWin16Lock ); \
  856. INCW16CNT(); \
  857. DPF( 7, "*****%08lx GOT WIN16LOCK: CNT = %ld," REMIND(""), GETCURRPID(), iWin16Cnt );
  858. #define LEAVE_WIN16LOCK() \
  859. DECW16CNT() \
  860. DPF( 7,"*****%08lx LEAVE_WIN16LOCK: CNT = %ld," REMIND( "" ), GETCURRPID(), iWin16Cnt ); \
  861. _LeaveSysLevel( lpWin16Lock );
  862. #else
  863. #define ENTER_WIN16LOCK() badbadbad
  864. #define LEAVE_WIN16LOCK() badbadbad
  865. #endif
  866. #else
  867. #define ENTER_WIN16LOCK()
  868. #define LEAVE_WIN16LOCK()
  869. #endif
  870. #ifdef WIN16_SEPARATE
  871. #define ENTER_BOTH() \
  872. ENTER_DDRAW(); \
  873. ENTER_WIN16LOCK();
  874. #define LEAVE_BOTH() \
  875. LEAVE_WIN16LOCK(); \
  876. LEAVE_DDRAW();
  877. #else
  878. #define ENTER_BOTH() \
  879. ENTER_DDRAW();
  880. #define LEAVE_BOTH() \
  881. LEAVE_DDRAW();
  882. #endif
  883. /* We now have a special case in dllmain on NT... */
  884. #ifndef ENTER_DDRAW_INDLLMAIN
  885. #define ENTER_DDRAW_INDLLMAIN() ENTER_DDRAW()
  886. #endif
  887. #ifdef WIN95
  888. /*
  889. * DDHELP's handle for communicating with the DirectSound VXD. We need this
  890. * when we are executing DDRAW code with one of DDHELP's threads.
  891. */
  892. extern HANDLE hHelperDDVxd;
  893. /*
  894. * Macro to return the DirectSound VXD handle to use when communicating with
  895. * the VXD. This is necessary as we need to communicate with the VXD from
  896. * DirectDraw executing on a DDHELP thread. In which case we need to use
  897. * the VXD handle defined above (which is the VXD handle DDHELP got when it
  898. * loaded DDRAW.VXD). Otherwise, we use the VXD handle out of the given
  899. * local object.
  900. *
  901. * NOTE: We don't use GETCURRPID() or HackGetCurrentProcessId() as we want
  902. * the real PID not one that has been munged.
  903. */
  904. #define GETDDVXDHANDLE( pdrv_lcl ) \
  905. ( ( GetCurrentProcessId() == ( pdrv_lcl )->dwProcessId ) ? (HANDLE) ( ( pdrv_lcl )->hDDVxd ) : hHelperDDVxd )
  906. #else /* !WIN95 */
  907. #define GETDDVXDHANDLE( pdrv_lcl ) NULL
  908. #endif /* !WIN95 */
  909. #define VDPF(Args) DPF Args
  910. #include "ddheap.h"
  911. #include "ddagp.h"
  912. /* apphack.c */
  913. extern void FreeAppHackData(void);
  914. /* cliprgn.h */
  915. extern void ClipRgnToRect( LPRECT prect, LPRGNDATA prd );
  916. /* ddcsurf.c */
  917. extern BOOL isPowerOf2(DWORD dw, int* pPower);
  918. extern HRESULT checkSurfaceDesc( LPDDSURFACEDESC2 lpsd, LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD FAR *psflags, BOOL emulation, BOOL real_sysmem, LPDDRAWI_DIRECTDRAW_INT pdrv_int );
  919. extern DWORD ComputePitch( LPDDRAWI_DIRECTDRAW_GBL thisg, DWORD caps, DWORD width, UINT bpp );
  920. extern DWORD GetBytesFromPixels( DWORD pixels, UINT bpp );
  921. extern HRESULT InternalCreateSurface( LPDDRAWI_DIRECTDRAW_LCL thisg, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, LPDDRAWI_DIRECTDRAW_INT this_int );
  922. extern HRESULT AllocSurfaceMem( LPDDRAWI_DIRECTDRAW_LCL this_lcl, LPDDRAWI_DDRAWSURFACE_LCL *slist, int nsurf );
  923. #ifdef DEBUG
  924. void SurfaceSanityTest( LPDDRAWI_DIRECTDRAW_LCL pdrv, LPSTR title );
  925. #define SURFSANITY( a,b ) SurfaceSanityTest( a, b );
  926. #else
  927. #define SURFSANITY( a,b )
  928. #endif
  929. /* ddclip.c */
  930. extern HRESULT InternalCreateClipper( LPDDRAWI_DIRECTDRAW_GBL lpDD, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter, BOOL fInitialized, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl, LPDDRAWI_DIRECTDRAW_INT pdrv_int );
  931. void ProcessClipperCleanup( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  932. /* ddcreate.c */
  933. extern BOOL IsVGADevice(LPSTR szDevice);
  934. extern char g_szPrimaryDisplay[];
  935. extern BOOL xxxEnumDisplayDevicesA(LPVOID lpUnused, DWORD iDevice, struct _DISPLAY_DEVICEA *pdd, DWORD dwFlags);
  936. extern BOOL CurrentProcessCleanup( BOOL );
  937. extern LPHEAPALIGNMENT GetExtendedHeapAlignment( LPDDRAWI_DIRECTDRAW_GBL pddd , LPDDHAL_GETHEAPALIGNMENTDATA pghad, int iHeap);
  938. extern void RemoveDriverFromList( LPDDRAWI_DIRECTDRAW_INT lpDD, BOOL );
  939. extern void RemoveLocalFromList( LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl );
  940. extern LPDDRAWI_DIRECTDRAW_GBL DirectDrawObjectCreate( LPDDHALINFO lpDDHALInfo, BOOL reset, LPDDRAWI_DIRECTDRAW_GBL pdrv, HANDLE hDDVxd, char *szDrvName, DWORD dwDriverContext );
  941. extern LPDDRAWI_DIRECTDRAW_GBL FetchDirectDrawData( LPDDRAWI_DIRECTDRAW_GBL pdrv, BOOL reset, DWORD hInstance, HANDLE hDDVxd, char *szDrvName, DWORD dwDriverContext, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  942. extern LPVOID NewDriverInterface( LPDDRAWI_DIRECTDRAW_GBL pdrv, LPVOID lpvtbl );
  943. extern DWORD DirectDrawMsg(LPSTR msg);
  944. extern BOOL DirectDrawSupported( void );
  945. extern BOOL IsMultiMonitor( void );
  946. extern LPDDRAWI_DIRECTDRAW_GBL fetchModeXData(LPDDRAWI_DIRECTDRAW_GBL pdrv,LPDDHALMODEINFO pmi, HANDLE hDDVxd );
  947. #ifdef WINNT
  948. extern BOOL GetCurrentMode(LPDDRAWI_DIRECTDRAW_GBL, LPDDHALINFO lpHalInfo, char *szDrvName);
  949. extern HRESULT GetNTDeviceRect( LPSTR pDriverName, LPRECT lpRect );
  950. #endif
  951. extern HDC DD_CreateDC(LPSTR pdrvname);
  952. extern void DD_DoneDC(HDC hdc);
  953. #ifdef IS_32
  954. extern LONG xxxChangeDisplaySettingsExA(LPCSTR szDevice, LPDEVMODEA pdm, HWND hwnd, DWORD dwFlags,LPVOID lParam);
  955. extern HRESULT InternalDirectDrawCreate( GUID * lpGUID, LPDIRECTDRAW *lplpDD, LPDDRAWI_DIRECTDRAW_INT pnew_int, DWORD dwFlags );
  956. extern void UpdateRectFromDevice( LPDDRAWI_DIRECTDRAW_GBL pdrv );
  957. extern void UpdateAllDeviceRects( void );
  958. #endif
  959. /* ddiunk.c */
  960. extern HRESULT InitD3D( LPDDRAWI_DIRECTDRAW_INT this_int );
  961. extern HRESULT InitDDrawPrivateD3DContext( LPDDRAWI_DIRECTDRAW_INT this_int );
  962. /* dddefwp.c */
  963. extern HRESULT SetAppHWnd( LPDDRAWI_DIRECTDRAW_LCL thisg, HWND hWnd, DWORD dwFlags );
  964. extern VOID CleanupWindowList( DWORD pid );
  965. extern void ClipTheCursor(LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl, LPRECT lpRect);
  966. /* ddesurf.c */
  967. extern void FillDDSurfaceDesc( LPDDRAWI_DDRAWSURFACE_LCL psurf, LPDDSURFACEDESC lpdsd );
  968. extern void FillDDSurfaceDesc2( LPDDRAWI_DDRAWSURFACE_LCL psurf, LPDDSURFACEDESC2 lpdsd );
  969. extern void FillEitherDDSurfaceDesc( LPDDRAWI_DDRAWSURFACE_LCL psurf, LPDDSURFACEDESC2 lpdsd );
  970. /* ddfake.c */
  971. extern BOOL getBitMask( LPDDHALMODEINFO pmi );
  972. extern LPDDRAWI_DIRECTDRAW_GBL FakeDDCreateDriverObject( HDC hdc_dd, LPSTR szDrvName, LPDDRAWI_DIRECTDRAW_GBL, BOOL reset, HANDLE hDDVxd );
  973. extern DWORD BuildModes( LPSTR szDevice, LPDDHALMODEINFO FAR *ppddhmi );
  974. extern void BuildPixelFormat(HDC, LPDDHALMODEINFO, LPDDPIXELFORMAT);
  975. /* ddpal.c */
  976. extern void ResetSysPalette( LPDDRAWI_DDRAWSURFACE_GBL psurf, BOOL dofree );
  977. extern void ProcessPaletteCleanup( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  978. extern ULONG DDAPI InternalPaletteRelease( LPDDRAWI_DDRAWPALETTE_INT this_int );
  979. extern HRESULT SetPaletteAlways( LPDDRAWI_DDRAWSURFACE_INT psurf_int, LPDIRECTDRAWPALETTE lpDDPalette );
  980. /* ddraw.c */
  981. extern void DoneExclusiveMode( LPDDRAWI_DIRECTDRAW_LCL pdrv );
  982. extern void StartExclusiveMode( LPDDRAWI_DIRECTDRAW_LCL pdrv, DWORD dwFlags, DWORD pid );
  983. extern HRESULT FlipToGDISurface( LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl, LPDDRAWI_DDRAWSURFACE_INT psurf_int); //, FLATPTR fpprim );
  984. extern void CheckExclusiveMode(LPDDRAWI_DIRECTDRAW_LCL this_lcl, LPBOOL pbExclusiveExists, LPBOOL pbThisLclOwnsExclusive, BOOL bKeepMutex, HWND hwnd, BOOL bCanGetIt);
  985. /* ddsacc.c */
  986. void WINAPI AcquireDDThreadLock(void);
  987. void WINAPI ReleaseDDThreadLock(void);
  988. extern void RemoveProcessLocks( LPDDRAWI_DIRECTDRAW_LCL pdrv, LPDDRAWI_DDRAWSURFACE_LCL this_lcl, DWORD pid );
  989. extern HRESULT InternalLock( LPDDRAWI_DDRAWSURFACE_LCL thisx, LPVOID *pbits,
  990. LPRECT lpDestRect, DWORD dwFlags);
  991. extern HRESULT InternalUnlock( LPDDRAWI_DDRAWSURFACE_LCL thisx, LPVOID lpSurfaceData, LPRECT lpDestRect, DWORD dwFlags );
  992. #ifdef USE_ALIAS
  993. extern void BreakSurfaceLocks( LPDDRAWI_DDRAWSURFACE_GBL thisg );
  994. #endif /* USE_ALIAS */
  995. /* ddsatch.c */
  996. extern void UpdateMipMapCount( LPDDRAWI_DDRAWSURFACE_INT psurf_int );
  997. extern HRESULT AddAttachedSurface( LPDDRAWI_DDRAWSURFACE_INT psurf_from, LPDDRAWI_DDRAWSURFACE_INT psurf_to, BOOL implicit );
  998. extern void DeleteAttachedSurfaceLists( LPDDRAWI_DDRAWSURFACE_LCL psurf );
  999. #define DOA_DONTDELETEIMPLICIT FALSE
  1000. #define DOA_DELETEIMPLICIT TRUE
  1001. extern HRESULT DeleteOneAttachment( LPDDRAWI_DDRAWSURFACE_INT this_int, LPDDRAWI_DDRAWSURFACE_INT pattsurf_int, BOOL cleanup, BOOL delete_implicit );
  1002. extern HRESULT DeleteOneLink( LPDDRAWI_DDRAWSURFACE_INT this_int, LPDDRAWI_DDRAWSURFACE_INT pattsurf_int );
  1003. /* ddsblt.c */
  1004. extern void WaitForDriverToFinishWithSurface(LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl, LPDDRAWI_DDRAWSURFACE_LCL this_lcl );
  1005. extern LPDDRAWI_DDRAWSURFACE_LCL FindAttached( LPDDRAWI_DDRAWSURFACE_LCL ptr, DWORD caps );
  1006. extern HRESULT XformRect(RECT * prcSrc,RECT * prcDest,RECT * prcClippedDest,RECT * prcClippedSrc,DWORD scale_x,DWORD scale_y);
  1007. // SCALE_X and SCALE_Y are fixed point variables scaled 16.16. These macros used by calls to XformRect.
  1008. #define SCALE_X(rcSrc,rcDest) ( ((rcSrc.right - rcSrc.left) << 16) / (rcDest.right - rcDest.left))
  1009. #define SCALE_Y(rcSrc,rcDest) ( ((rcSrc.bottom - rcSrc.top) << 16) / (rcDest.bottom - rcDest.top))
  1010. /* ddsckey.c */
  1011. extern HRESULT CheckColorKey( DWORD dwFlags, LPDDRAWI_DIRECTDRAW_GBL pdrv, LPDDCOLORKEY lpDDColorKey, LPDWORD psflags, BOOL halonly, BOOL helonly );
  1012. extern HRESULT ChangeToSoftwareColorKey( LPDDRAWI_DDRAWSURFACE_INT this_int, BOOL );
  1013. /* ddsiunk.c */
  1014. extern LPDDRAWI_DDRAWSURFACE_LCL NewSurfaceLocal( LPDDRAWI_DDRAWSURFACE_LCL thisx, LPVOID lpvtbl );
  1015. extern LPDDRAWI_DDRAWSURFACE_INT NewSurfaceInterface( LPDDRAWI_DDRAWSURFACE_LCL thisx, LPVOID lpvtbl );
  1016. extern void DestroySurface( LPDDRAWI_DDRAWSURFACE_LCL thisg );
  1017. extern void LooseManagedSurface( LPDDRAWI_DDRAWSURFACE_LCL thisg );
  1018. extern DWORD InternalSurfaceRelease( LPDDRAWI_DDRAWSURFACE_INT this_int );
  1019. extern void ProcessSurfaceCleanup( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1020. extern void FreeD3DSurfaceIUnknowns( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1021. /* ddmode.c */
  1022. extern HRESULT SetDisplayMode( LPDDRAWI_DIRECTDRAW_LCL thisx, DWORD modeidx, BOOL force, BOOL useRefreshRate );
  1023. extern HRESULT RestoreDisplayMode( LPDDRAWI_DIRECTDRAW_LCL thisx, BOOL force );
  1024. extern void AddModeXModes( LPDDRAWI_DIRECTDRAW_GBL pdrv );
  1025. extern BOOL MonitorCanHandleMode(LPDDRAWI_DIRECTDRAW_GBL pddd, DWORD width, DWORD height, WORD refreshRate );
  1026. extern BOOL GetDDStereoMode( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD dwWidth, DWORD dwHeight, DWORD dwBpp, DWORD dwRefreshRate);
  1027. /* ddsurf.c */
  1028. extern HRESULT InternalGetBltStatus(LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl, LPDDRAWI_DDRAWSURFACE_LCL this_lcl , DWORD dwFlags );
  1029. extern HRESULT MoveToSystemMemory( LPDDRAWI_DDRAWSURFACE_INT this_int, BOOL hasvram, BOOL use_full_lock );
  1030. extern void InvalidateAllPrimarySurfaces( LPDDRAWI_DIRECTDRAW_GBL );
  1031. extern LPDDRAWI_DDRAWSURFACE_GBL FindGlobalPrimary( LPDDRAWI_DIRECTDRAW_GBL );
  1032. extern BOOL MatchPrimary( LPDDRAWI_DIRECTDRAW_GBL thisg, LPDDSURFACEDESC2 lpDDSD );
  1033. extern void InvalidateAllSurfaces( LPDDRAWI_DIRECTDRAW_GBL thisg, HANDLE hDDVxd, BOOL fRebuildAliases );
  1034. #ifdef SHAREDZ
  1035. extern LPDDRAWI_DDRAWSURFACE_GBL FindGlobalZBuffer( LPDDRAWI_DIRECTDRAW_GBL );
  1036. extern LPDDRAWI_DDRAWSURFACE_GBL FindGlobalBackBuffer( LPDDRAWI_DIRECTDRAW_GBL );
  1037. extern BOOL MatchSharedZBuffer( LPDDRAWI_DIRECTDRAW_GBL thisg, LPDDSURFACEDESC lpDDSD );
  1038. extern BOOL MatchSharedBackBuffer( LPDDRAWI_DIRECTDRAW_GBL thisg, LPDDSURFACEDESC lpDDSD );
  1039. #endif
  1040. extern HRESULT InternalPageLock( LPDDRAWI_DDRAWSURFACE_LCL this_lcl, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1041. extern HRESULT InternalPageUnlock( LPDDRAWI_DDRAWSURFACE_LCL this_lcl, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1042. extern LPDDRAWI_DDRAWSURFACE_INT getDDSInterface( LPDDRAWI_DIRECTDRAW_GBL pdrv, LPDDRAWI_DDRAWSURFACE_LCL this_lcl, LPVOID lpddcb );
  1043. extern HRESULT InternalGetDC( LPDDRAWI_DDRAWSURFACE_INT this_int, HDC FAR *lphdc );
  1044. extern HRESULT InternalReleaseDC( LPDDRAWI_DDRAWSURFACE_LCL this_lcl, HDC hdc );
  1045. extern HRESULT EXTERN_DDAPI GetSurfaceFromDC( HDC hdc, LPDIRECTDRAWSURFACE *ppdds, HDC *phdcDriver );
  1046. extern HRESULT InternalAssociateDC( HDC hdc, LPDDRAWI_DDRAWSURFACE_LCL pdds_lcl );
  1047. extern HRESULT InternalRemoveDCFromList( HDC hdc, LPDDRAWI_DDRAWSURFACE_LCL pdds_lcl );
  1048. // function from ddsprite.c to clean pid from master sprite list:
  1049. void ProcessSpriteCleanup(LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid);
  1050. #ifdef WIN95
  1051. extern void UpdateOutstandingDC( LPDDRAWI_DDRAWSURFACE_LCL psurf_lcl, LPDDRAWI_DDRAWPALETTE_GBL ppal_gbl );
  1052. extern void UpdateDCOnPaletteChanges( LPDDRAWI_DDRAWPALETTE_GBL ppal_gbl );
  1053. #else
  1054. #define UpdateOutstandingDC(x,y)
  1055. #define UpdateDCOnPaletteChanges(x)
  1056. #endif
  1057. #ifdef USE_ALIAS
  1058. /* ddalias.c */
  1059. extern HRESULT CreateHeapAliases( HANDLE hvxd, LPDDRAWI_DIRECTDRAW_GBL pdrv );
  1060. extern BOOL ReleaseHeapAliases( HANDLE hvxd, LPHEAPALIASINFO phaiInfo );
  1061. extern HRESULT MapHeapAliasesToVidMem( HANDLE hvxd, LPHEAPALIASINFO phaiInfo );
  1062. extern HRESULT MapHeapAliasesToDummyMem( HANDLE hvxd, LPHEAPALIASINFO phaiInfo );
  1063. extern FLATPTR GetAliasedVidMem( LPDDRAWI_DIRECTDRAW_LCL pdrv,
  1064. LPDDRAWI_DDRAWSURFACE_LCL surf_lcl,
  1065. FLATPTR fpVidMem );
  1066. #endif /* USE_ALIAS */
  1067. /* dllmain.c */
  1068. extern BOOL RemoveProcessFromDLL( DWORD pid );
  1069. /* misc.c */
  1070. extern BOOL CanBeFlippable( LPDDRAWI_DDRAWSURFACE_LCL thisg, LPDDRAWI_DDRAWSURFACE_LCL this_attach);
  1071. extern LPDDRAWI_DDRAWSURFACE_INT FindAttachedFlip( LPDDRAWI_DDRAWSURFACE_INT thisg );
  1072. extern LPDDRAWI_DDRAWSURFACE_INT FindAttachedSurfaceLeft( LPDDRAWI_DDRAWSURFACE_INT thisg );
  1073. extern LPDDRAWI_DDRAWSURFACE_INT FindAttachedMipMap( LPDDRAWI_DDRAWSURFACE_INT thisg );
  1074. extern LPDDRAWI_DDRAWSURFACE_INT FindParentMipMap( LPDDRAWI_DDRAWSURFACE_INT thisg );
  1075. #ifdef WIN95
  1076. extern HANDLE GetDXVxdHandle( void );
  1077. #endif /* WIN95 */
  1078. /* ddcallbk.c */
  1079. extern void InitCallbackTables( void );
  1080. extern BOOL CallbackTablesInitialized( void );
  1081. /* ddvp.c */
  1082. extern void ProcessVideoPortCleanup( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1083. extern HRESULT InternalStopVideo( LPDDRAWI_DDVIDEOPORT_INT this_int );
  1084. extern LPDDRAWI_DDVIDEOPORT_LCL GetVideoPortFromSurface( LPDDRAWI_DDRAWSURFACE_INT surf_int );
  1085. extern DWORD IsValidAutoFlipSurface( LPDDRAWI_DDRAWSURFACE_INT lpSurface_int );
  1086. #define IVAS_NOAUTOFLIPPING 0
  1087. #define IVAS_SOFTWAREAUTOFLIPPING 1
  1088. #define IVAS_HARDWAREAUTOFLIPPING 2
  1089. extern VOID RequireSoftwareAutoflip( LPDDRAWI_DDRAWSURFACE_INT lpSurface_int );
  1090. extern VOID SetRingZeroSurfaceData( LPDDRAWI_DDRAWSURFACE_LCL lpSurface_lcl );
  1091. extern DWORD FlipVideoPortSurface( LPDDRAWI_DDRAWSURFACE_INT , DWORD );
  1092. extern VOID OverrideOverlay( LPDDRAWI_DDRAWSURFACE_INT lpSurf_int, LPDWORD lpdwFlags );
  1093. extern BOOL MustSoftwareBob( LPDDRAWI_DDRAWSURFACE_INT lpSurf_int );
  1094. extern VOID RequireSoftwareBob( LPDDRAWI_DDRAWSURFACE_INT lpSurface_int );
  1095. extern VOID DecrementRefCounts( LPDDRAWI_DDRAWSURFACE_INT surf_int );
  1096. /* ddcolor.c */
  1097. extern VOID ReleaseColorControl( LPDDRAWI_DDRAWSURFACE_LCL lpSurface );
  1098. /* ddgamma.c */
  1099. extern VOID ReleaseGammaControl( LPDDRAWI_DDRAWSURFACE_LCL lpSurface );
  1100. extern BOOL SetGamma( LPDDRAWI_DDRAWSURFACE_LCL this_lcl, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1101. extern VOID RestoreGamma( LPDDRAWI_DDRAWSURFACE_LCL lpSurface, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1102. extern VOID InitGamma( LPDDRAWI_DIRECTDRAW_GBL pdrv, LPSTR szDrvName );
  1103. /* ddkernel.c */
  1104. extern HRESULT InternalReleaseKernelSurfaceHandle( LPDDRAWI_DDRAWSURFACE_LCL lpSurface, BOOL bLosingSurface );
  1105. extern HRESULT InternalCreateKernelSurfaceHandle( LPDDRAWI_DDRAWSURFACE_LCL lpSurface, PULONG_PTR lpHandle );
  1106. extern HRESULT UpdateKernelSurface( LPDDRAWI_DDRAWSURFACE_LCL lpSurface );
  1107. extern HRESULT UpdateKernelVideoPort( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort, DWORD dwFlags );
  1108. extern HRESULT GetKernelFieldNum( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort, LPDWORD lpdwFieldNum );
  1109. extern HRESULT SetKernelFieldNum( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort, DWORD dwFieldNum );
  1110. extern HRESULT SetKernelSkipPattern( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort, DWORD dwStartField, DWORD dwPatternSize, DWORD dwPattern );
  1111. extern HRESULT InitKernelInterface( LPDDRAWI_DIRECTDRAW_LCL lpDD );
  1112. extern HRESULT GetKernelSurfaceState( LPDDRAWI_DDRAWSURFACE_LCL lpSurf, LPDWORD lpdwStateFlags );
  1113. extern HRESULT ReleaseKernelInterface( LPDDRAWI_DIRECTDRAW_LCL lpDD );
  1114. extern BOOL CanSoftwareAutoflip( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort );
  1115. extern BOOL IsKernelInterfaceSupported( LPDDRAWI_DIRECTDRAW_LCL lpDD );
  1116. extern HRESULT SetKernelDOSBoxEvent( LPDDRAWI_DIRECTDRAW_LCL lpDD );
  1117. extern VOID EnableAutoflip( LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort, BOOL bEnable );
  1118. extern BOOL IsWindows98( VOID );
  1119. /* ddmc.c */
  1120. extern BOOL IsMotionCompSupported( LPDDRAWI_DIRECTDRAW_LCL this_lcl );
  1121. extern void ProcessMotionCompCleanup( LPDDRAWI_DIRECTDRAW_GBL pdrv, DWORD pid, LPDDRAWI_DIRECTDRAW_LCL pdrv_lcl );
  1122. /* private.c */
  1123. extern void FreeAllPrivateData(LPPRIVATEDATANODE * ppListHead);
  1124. /* factory.c */
  1125. extern HRESULT InternalCreateDDFactory2(void **, IUnknown * pUnkOuter);
  1126. // ddrestor.c
  1127. extern HRESULT AllocSurfaceContents(LPDDRAWI_DDRAWSURFACE_LCL this_lcl);
  1128. extern void FreeSurfaceContents(LPDDRAWI_DDRAWSURFACE_LCL this_lcl);
  1129. extern HRESULT BackupSurfaceContents(LPDDRAWI_DDRAWSURFACE_LCL this_lcl);
  1130. extern HRESULT RestoreSurfaceContents(LPDDRAWI_DDRAWSURFACE_LCL this_lcl);
  1131. extern void BackupAllSurfaces(LPDDRAWI_DIRECTDRAW_GBL this_gbl);
  1132. extern void MungeAutoflipCaps(LPDDRAWI_DIRECTDRAW_GBL pdrv);
  1133. /* ddrefrsh.c */
  1134. extern HRESULT DDGetMonitorInfo( LPDDRAWI_DIRECTDRAW_INT lpDD_int);
  1135. extern HRESULT ExpandModeTable( LPDDRAWI_DIRECTDRAW_GBL pddd );
  1136. extern BOOL CanMonitorHandleRefreshRate( LPDDRAWI_DIRECTDRAW_GBL pddd, DWORD dwWidth, DWORD dwHeight, int wRefresh );
  1137. /* drvinfo.c */
  1138. extern BOOL Voodoo1GoodToGo( GUID * pGuid );
  1139. /* A handy one from ddhel.c */
  1140. /* DDRAW16 doesn't need this. */
  1141. #ifdef WIN32
  1142. SCODE InitDIB(HDC hdc, LPBITMAPINFO lpbmi);
  1143. #endif
  1144. void ResetBITMAPINFO(LPDDRAWI_DIRECTDRAW_GBL thisg);
  1145. BOOL doPixelFormatsMatch(LPDDPIXELFORMAT lpddpf1,
  1146. LPDDPIXELFORMAT lpddpf2);
  1147. HRESULT ConvertToPhysColor(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl, LPDDARGB pSource, LPDWORD pdwPhysColor);
  1148. HRESULT ConvertFromPhysColor(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl, LPDWORD pdwPhysColor, LPDDARGB pDest);
  1149. extern DWORD GetSurfPFIndex(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl);
  1150. extern DWORD GetDxtBlkSize(DWORD dwFourCC);
  1151. /*
  1152. * HEL's public memory allocator
  1153. */
  1154. extern void HELFreeSurfaceSysMem(LPDDRAWI_DDRAWSURFACE_LCL lpsurf_lcl);
  1155. extern LPVOID HELAllocateSurfaceSysMem(LPDDRAWI_DDRAWSURFACE_LCL lpsurf_lcl, DWORD nWidth,
  1156. DWORD nHeight, LPDWORD lpdwSurfaceSize, LPLONG lpSurfPitch );
  1157. #ifndef NO_DDHELP
  1158. /* w95hack.c */
  1159. extern DWORD HackGetCurrentProcessId( void );
  1160. extern BOOL DDAPI DDNotify( LPDDHELPDATA phd );
  1161. extern void DDAPI DDNotifyModeSet( LPDDRAWI_DIRECTDRAW_GBL );
  1162. extern void DDAPI DDNotifyDOSBox( LPDDRAWI_DIRECTDRAW_GBL );
  1163. #endif //NO_DDHELP
  1164. #ifdef POSTPONED
  1165. /* Delegating IUnknown functions */
  1166. extern HRESULT EXTERN_DDAPI DD_DelegatingQueryInterface(LPDIRECTDRAW, REFIID, LPVOID FAR *);
  1167. extern DWORD EXTERN_DDAPI DD_DelegatingAddRef( LPDIRECTDRAW lpDD );
  1168. extern DWORD EXTERN_DDAPI DD_DelegatingRelease( LPDIRECTDRAW lpDD );
  1169. #endif
  1170. /* DirectDrawFactory2 functions */
  1171. extern HRESULT EXTERN_DDAPI DDFac2_QueryInterface(LPDIRECTDRAWFACTORY2, REFIID, LPVOID FAR *);
  1172. extern DWORD EXTERN_DDAPI DDFac2_AddRef( LPDIRECTDRAWFACTORY2 lpDDFac );
  1173. extern ULONG EXTERN_DDAPI DDFac2_Release( LPDIRECTDRAWFACTORY2 lpDDFac );
  1174. extern HRESULT EXTERN_DDAPI DDFac2_CreateDirectDraw(LPDIRECTDRAWFACTORY2, GUID FAR *, HWND, DWORD dwCoopLevelFlags, DWORD, IUnknown *, struct IDirectDraw4 ** );
  1175. #ifdef IS_32
  1176. #ifdef SM_CMONITORS
  1177. extern HRESULT EXTERN_DDAPI DDFac2_DirectDrawEnumerate(LPDIRECTDRAWFACTORY2 , LPDDENUMCALLBACKEX , LPVOID , DWORD );
  1178. #else
  1179. /*
  1180. * This def'n is a hack to keep us building under NT build which doesn't have the
  1181. * multimon headers in it yet
  1182. */
  1183. extern HRESULT EXTERN_DDAPI DDFac2_DirectDrawEnumerate(LPDIRECTDRAWFACTORY2 , LPDDENUMCALLBACK , LPVOID , DWORD );
  1184. #endif
  1185. #endif
  1186. /* DIRECTDRAW functions */
  1187. extern HRESULT EXTERN_DDAPI DD_UnInitedQueryInterface( LPDIRECTDRAW lpDD, REFIID riid, LPVOID FAR * ppvObj );
  1188. extern HRESULT EXTERN_DDAPI DD_QueryInterface( LPDIRECTDRAW lpDD, REFIID riid, LPVOID FAR * ppvObj );
  1189. extern DWORD EXTERN_DDAPI DD_AddRef( LPDIRECTDRAW lpDD );
  1190. extern DWORD EXTERN_DDAPI DD_Release( LPDIRECTDRAW lpDD );
  1191. extern HRESULT EXTERN_DDAPI DD_Compact( LPDIRECTDRAW lpDD );
  1192. extern HRESULT EXTERN_DDAPI DD_CreateClipper( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter );
  1193. extern HRESULT EXTERN_DDAPI DD_CreatePalette( LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter );
  1194. extern HRESULT EXTERN_DDAPI DD_CreateSurface( LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *pUnkOuter );
  1195. extern HRESULT EXTERN_DDAPI DD_CreateSurface4( LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *pUnkOuter );
  1196. extern HRESULT EXTERN_DDAPI DD_DuplicateSurface( LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE FAR *lplpDupDDSurface );
  1197. extern HRESULT EXTERN_DDAPI DD_EnumDisplayModes( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback );
  1198. extern HRESULT EXTERN_DDAPI DD_EnumDisplayModes4( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback );
  1199. extern HRESULT EXTERN_DDAPI DD_EnumSurfaces( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumCallback );
  1200. extern HRESULT EXTERN_DDAPI DD_EnumSurfaces4( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumCallback );
  1201. extern HRESULT EXTERN_DDAPI DD_FlipToGDISurface( LPDIRECTDRAW lpDD );
  1202. extern HRESULT EXTERN_DDAPI DD_GetCaps( LPDIRECTDRAW lpDD, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpHELCaps );
  1203. extern HRESULT EXTERN_DDAPI DD_GetColorKey( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey );
  1204. extern HRESULT EXTERN_DDAPI DD_GetDisplayMode( LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpSurfaceDesc );
  1205. extern HRESULT EXTERN_DDAPI DD_GetFourCCCodes(LPDIRECTDRAW,DWORD FAR *,DWORD FAR *);
  1206. extern HRESULT EXTERN_DDAPI DD_GetGDISurface( LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE FAR * );
  1207. extern HRESULT EXTERN_DDAPI DD_GetScanLine( LPDIRECTDRAW lpDD, LPDWORD );
  1208. extern HRESULT EXTERN_DDAPI DD_GetVerticalBlankStatus( LPDIRECTDRAW lpDD, BOOL FAR * );
  1209. extern HRESULT EXTERN_DDAPI DD_Initialize(LPDIRECTDRAW, GUID FAR *);
  1210. extern HRESULT EXTERN_DDAPI DD_SetColorKey( LPDIRECTDRAW lpDD, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey );
  1211. extern HRESULT EXTERN_DDAPI DD_SetCooperativeLevel(LPDIRECTDRAW,HWND,DWORD);
  1212. extern HRESULT EXTERN_DDAPI DD_SetDisplayMode(LPDIRECTDRAW,DWORD,DWORD,DWORD);
  1213. extern HRESULT EXTERN_DDAPI DD_SetDisplayMode2(LPDIRECTDRAW,DWORD,DWORD,DWORD,DWORD,DWORD);
  1214. extern HRESULT EXTERN_DDAPI DD_RestoreDisplayMode(LPDIRECTDRAW);
  1215. extern HRESULT EXTERN_DDAPI DD_GetMonitorFrequency( LPDIRECTDRAW lpDD, LPDWORD lpdwFrequency);
  1216. extern HRESULT EXTERN_DDAPI DD_WaitForVerticalBlank( LPDIRECTDRAW lpDD, DWORD dwFlags, HANDLE hEvent );
  1217. extern HRESULT EXTERN_DDAPI DD_GetAvailableVidMem( LPDIRECTDRAW lpDD, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree );
  1218. extern HRESULT EXTERN_DDAPI DD_GetAvailableVidMem4( LPDIRECTDRAW lpDD, LPDDSCAPS2 lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree );
  1219. extern HRESULT EXTERN_DDAPI DD_GetSurfaceFromDC( LPDIRECTDRAW lpDD, HDC, LPDIRECTDRAWSURFACE *);
  1220. extern HRESULT EXTERN_DDAPI DD_RestoreAllSurfaces( LPDIRECTDRAW lpDD );
  1221. extern HRESULT EXTERN_DDAPI DD_GetDeviceIdentifier( LPDIRECTDRAW lpDD, LPDDDEVICEIDENTIFIER, DWORD);
  1222. extern HRESULT EXTERN_DDAPI DD_GetDeviceIdentifier7( LPDIRECTDRAW lpDD, LPDDDEVICEIDENTIFIER2, DWORD);
  1223. extern HRESULT EXTERN_DDAPI DD_StartModeTest( LPDIRECTDRAW7 lpDD, LPSIZE lpModesToTest, DWORD dwNumEntries, DWORD dwFlags );
  1224. extern HRESULT EXTERN_DDAPI DD_EvaluateMode( LPDIRECTDRAW7 lpDD, DWORD dwFlags, DWORD *pSecondsUntilTimeout);
  1225. #ifdef IS_32
  1226. //streaming stuff confuses ddraw16
  1227. #ifndef __cplusplus
  1228. extern HRESULT EXTERN_DDAPI DD_CreateSurfaceFromStream( LPDIRECTDRAW4 lpDD, IStream *, LPDDSURFACEDESC2, DWORD, LPDIRECTDRAWSURFACE4 *, IUnknown *);
  1229. extern HRESULT EXTERN_DDAPI DD_CreateSurfaceFromFile( LPDIRECTDRAW4 lpDD, BSTR, LPDDSURFACEDESC2, DWORD, LPDIRECTDRAWSURFACE4 *, IUnknown *);
  1230. #endif
  1231. #endif
  1232. extern HRESULT EXTERN_DDAPI DD_CreateOptSurface( LPDIRECTDRAW, LPDDOPTSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *pUnkOuter);
  1233. extern HRESULT EXTERN_DDAPI DD_ListOptSurfaceGUIDS(LPDIRECTDRAW, DWORD *, LPGUID);
  1234. extern HRESULT EXTERN_DDAPI DD_CanOptimizeSurface(LPDIRECTDRAW, LPDDSURFACEDESC2, LPDDOPTSURFACEDESC, BOOL FAR *);
  1235. extern HRESULT EXTERN_DDAPI DD_TestCooperativeLevel(LPDIRECTDRAW);
  1236. /* DIRECTDRAWPALETTE functions */
  1237. extern HRESULT EXTERN_DDAPI DD_Palette_QueryInterface( LPDIRECTDRAWPALETTE lpDDPalette, REFIID riid, LPVOID FAR * ppvObj );
  1238. extern DWORD EXTERN_DDAPI DD_Palette_AddRef( LPDIRECTDRAWPALETTE lpDDPalette );
  1239. extern DWORD EXTERN_DDAPI DD_Palette_Release( LPDIRECTDRAWPALETTE lpDDPalette );
  1240. extern HRESULT EXTERN_DDAPI DD_Palette_GetCaps( LPDIRECTDRAWPALETTE lpDDPalette, LPDWORD lpdwFlags );
  1241. extern HRESULT EXTERN_DDAPI DD_Palette_Initialize( LPDIRECTDRAWPALETTE, LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable );
  1242. extern HRESULT EXTERN_DDAPI DD_Palette_SetEntries( LPDIRECTDRAWPALETTE lpDDPalette, DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries );
  1243. extern HRESULT EXTERN_DDAPI DD_Palette_GetEntries( LPDIRECTDRAWPALETTE lpDDPalette, DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries );
  1244. extern HRESULT EXTERN_DDAPI DD_Palette_SetPrivateData( LPDIRECTDRAWPALETTE, REFIID, LPVOID, DWORD, DWORD);
  1245. extern HRESULT EXTERN_DDAPI DD_Palette_GetPrivateData( LPDIRECTDRAWPALETTE, REFIID, LPVOID, LPDWORD);
  1246. extern HRESULT EXTERN_DDAPI DD_Palette_FreePrivateData( LPDIRECTDRAWPALETTE, REFIID );
  1247. extern HRESULT EXTERN_DDAPI DD_Palette_GetUniquenessValue( LPDIRECTDRAWPALETTE, LPDWORD );
  1248. extern HRESULT EXTERN_DDAPI DD_Palette_ChangeUniquenessValue( LPDIRECTDRAWPALETTE );
  1249. extern HRESULT EXTERN_DDAPI DD_Palette_IsEqual( LPDIRECTDRAWPALETTE, LPDIRECTDRAWPALETTE );
  1250. /* DIRECTDRAWCLIPPER functions */
  1251. extern HRESULT EXTERN_DDAPI DD_UnInitedClipperQueryInterface( LPDIRECTDRAWCLIPPER lpDD, REFIID riid, LPVOID FAR * ppvObj );
  1252. extern HRESULT EXTERN_DDAPI DD_Clipper_QueryInterface( LPVOID lpDDClipper, REFIID riid, LPVOID FAR * ppvObj );
  1253. extern ULONG EXTERN_DDAPI DD_Clipper_AddRef( LPVOID lpDDClipper );
  1254. extern ULONG EXTERN_DDAPI DD_Clipper_Release( LPVOID lpDDClipper );
  1255. extern HRESULT EXTERN_DDAPI DD_Clipper_GetClipList( LPDIRECTDRAWCLIPPER, LPRECT, LPRGNDATA, LPDWORD );
  1256. extern HRESULT EXTERN_DDAPI DD_Clipper_GetHWnd(LPDIRECTDRAWCLIPPER,HWND FAR *);
  1257. extern HRESULT EXTERN_DDAPI DD_Clipper_Initialize( LPDIRECTDRAWCLIPPER, LPDIRECTDRAW lpDD, DWORD dwFlags );
  1258. extern HRESULT EXTERN_DDAPI DD_Clipper_IsClipListChanged(LPDIRECTDRAWCLIPPER,BOOL FAR *);
  1259. extern HRESULT EXTERN_DDAPI DD_Clipper_SetClipList(LPDIRECTDRAWCLIPPER,LPRGNDATA, DWORD);
  1260. extern HRESULT EXTERN_DDAPI DD_Clipper_SetHWnd(LPDIRECTDRAWCLIPPER, DWORD, HWND );
  1261. extern HRESULT EXTERN_DDAPI DD_Clipper_SetNotificationCallback(LPDIRECTDRAWCLIPPER, DWORD,LPCLIPPERCALLBACK, LPVOID);
  1262. /* Private DIRECTDRAWCLIPPER functions */
  1263. extern HRESULT InternalGetClipList( LPDIRECTDRAWCLIPPER lpDDClipper, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize, LPDDRAWI_DIRECTDRAW_GBL pdrv);
  1264. /* DIRECTDRAWSURFACE functions */
  1265. extern HRESULT EXTERN_DDAPI DD_Surface_QueryInterface( LPVOID lpDDSurface, REFIID riid, LPVOID FAR * ppvObj );
  1266. extern ULONG EXTERN_DDAPI DD_Surface_AddRef( LPVOID lpDDSurface );
  1267. extern ULONG EXTERN_DDAPI DD_Surface_Release( LPVOID lpDDSurface );
  1268. extern HRESULT EXTERN_DDAPI DD_Surface_AddAttachedSurface(LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE);
  1269. extern HRESULT EXTERN_DDAPI DD_Surface_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE, LPRECT);
  1270. extern HRESULT EXTERN_DDAPI DD_Surface_AlphaBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDALPHABLTFX);
  1271. extern HRESULT EXTERN_DDAPI DD_Surface_Blt(LPDIRECTDRAWSURFACE,LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX);
  1272. extern HRESULT EXTERN_DDAPI DD_Surface_BltFast(LPDIRECTDRAWSURFACE,DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT, DWORD );
  1273. extern HRESULT EXTERN_DDAPI DD_Surface_BltBatch( LPDIRECTDRAWSURFACE, LPDDBLTBATCH, DWORD, DWORD );
  1274. extern HRESULT EXTERN_DDAPI DD_Surface_ChangeUniquenessValue( LPDIRECTDRAWSURFACE );
  1275. extern HRESULT EXTERN_DDAPI DD_Surface_DeleteAttachedSurfaces(LPDIRECTDRAWSURFACE, DWORD,LPDIRECTDRAWSURFACE);
  1276. extern HRESULT EXTERN_DDAPI DD_Surface_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE,LPVOID, LPDDENUMSURFACESCALLBACK );
  1277. extern HRESULT EXTERN_DDAPI DD_Surface_EnumOverlayZOrders(LPDIRECTDRAWSURFACE,DWORD,LPVOID,LPDDENUMSURFACESCALLBACK);
  1278. extern HRESULT EXTERN_DDAPI DD_Surface_Flip(LPDIRECTDRAWSURFACE,LPDIRECTDRAWSURFACE, DWORD);
  1279. extern HRESULT EXTERN_DDAPI DD_Surface_FreePrivateData(LPDIRECTDRAWSURFACE, REFIID);
  1280. extern HRESULT EXTERN_DDAPI DD_Surface_GetAttachedSurface(LPDIRECTDRAWSURFACE,LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *);
  1281. extern HRESULT EXTERN_DDAPI DD_Surface_GetAttachedSurface4(LPDIRECTDRAWSURFACE4,LPDDSCAPS2, LPDIRECTDRAWSURFACE4 FAR *);
  1282. extern HRESULT EXTERN_DDAPI DD_Surface_GetAttachedSurface7(LPDIRECTDRAWSURFACE7,LPDDSCAPS2, LPDIRECTDRAWSURFACE7 FAR *);
  1283. extern HRESULT EXTERN_DDAPI DD_Surface_GetBltStatus(LPDIRECTDRAWSURFACE,DWORD);
  1284. extern HRESULT EXTERN_DDAPI DD_Surface_GetCaps( LPDIRECTDRAWSURFACE lpDDSurface, LPDDSCAPS lpDDSCaps );
  1285. extern HRESULT EXTERN_DDAPI DD_Surface_GetCaps4( LPDIRECTDRAWSURFACE lpDDSurface, LPDDSCAPS2 lpDDSCaps );
  1286. extern HRESULT EXTERN_DDAPI DD_Surface_GetClipper( LPDIRECTDRAWSURFACE, LPDIRECTDRAWCLIPPER FAR * );
  1287. extern HRESULT EXTERN_DDAPI DD_Surface_GetColorKey( LPDIRECTDRAWSURFACE lpDDSurface, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey );
  1288. extern HRESULT EXTERN_DDAPI DD_Surface_GetDC( LPDIRECTDRAWSURFACE, HDC FAR * );
  1289. extern HRESULT EXTERN_DDAPI DD_Surface_GetDDInterface(LPDIRECTDRAWSURFACE lpDDSurface, LPVOID FAR *lplpDD );
  1290. extern HRESULT EXTERN_DDAPI DD_Surface_GetOverlayPosition( LPDIRECTDRAWSURFACE, LPLONG, LPLONG );
  1291. extern HRESULT EXTERN_DDAPI DD_Surface_GetPalette(LPDIRECTDRAWSURFACE,LPDIRECTDRAWPALETTE FAR*);
  1292. extern HRESULT EXTERN_DDAPI DD_Surface_GetPixelFormat(LPDIRECTDRAWSURFACE, LPDDPIXELFORMAT);
  1293. extern HRESULT EXTERN_DDAPI DD_Surface_GetPrivateData(LPDIRECTDRAWSURFACE, REFIID, LPVOID, LPDWORD);
  1294. extern HRESULT EXTERN_DDAPI DD_Surface_GetSurfaceDesc(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC);
  1295. extern HRESULT EXTERN_DDAPI DD_Surface_GetSurfaceDesc4(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC2);
  1296. extern HRESULT EXTERN_DDAPI DD_Surface_GetFlipStatus(LPDIRECTDRAWSURFACE,DWORD);
  1297. extern HRESULT EXTERN_DDAPI DD_Surface_GetUniquenessValue( LPDIRECTDRAWSURFACE, LPDWORD );
  1298. extern HRESULT EXTERN_DDAPI DD_Surface_Initialize( LPDIRECTDRAWSURFACE, LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc);
  1299. extern HRESULT EXTERN_DDAPI DD_Surface_IsLost( LPDIRECTDRAWSURFACE lpDDSurface );
  1300. extern HRESULT EXTERN_DDAPI DD_Surface_Lock(LPDIRECTDRAWSURFACE,LPRECT,LPDDSURFACEDESC lpDDSurfaceDesc, DWORD, HANDLE hEvent );
  1301. extern HRESULT EXTERN_DDAPI DD_Surface_PageLock(LPDIRECTDRAWSURFACE,DWORD);
  1302. extern HRESULT EXTERN_DDAPI DD_Surface_PageUnlock(LPDIRECTDRAWSURFACE,DWORD);
  1303. extern HRESULT EXTERN_DDAPI DD_Surface_ReleaseDC(LPDIRECTDRAWSURFACE,HDC );
  1304. #ifdef POSTPONED2
  1305. extern HRESULT EXTERN_DDAPI DD_Surface_Resize(LPDIRECTDRAWSURFACE,DWORD,DWORD,DWORD);
  1306. #endif //POSTPONED2
  1307. extern HRESULT EXTERN_DDAPI DD_Surface_Restore( LPDIRECTDRAWSURFACE lpDDSurface );
  1308. extern HRESULT EXTERN_DDAPI DD_Surface_SetBltOrder(LPDIRECTDRAWSURFACE,DWORD);
  1309. extern HRESULT EXTERN_DDAPI DD_Surface_SetClipper( LPDIRECTDRAWSURFACE, LPDIRECTDRAWCLIPPER );
  1310. extern HRESULT EXTERN_DDAPI DD_Surface_SetColorKey( LPDIRECTDRAWSURFACE lpDDSurface, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey );
  1311. extern HRESULT EXTERN_DDAPI DD_Surface_SetOverlayPosition( LPDIRECTDRAWSURFACE, LONG, LONG );
  1312. extern HRESULT EXTERN_DDAPI DD_Surface_SetPalette(LPDIRECTDRAWSURFACE,LPDIRECTDRAWPALETTE);
  1313. extern HRESULT EXTERN_DDAPI DD_Surface_SetPrivateData(LPDIRECTDRAWSURFACE, REFIID, LPVOID, DWORD, DWORD);
  1314. #ifdef POSTPONED2
  1315. extern HRESULT EXTERN_DDAPI DD_Surface_SetSpriteDisplayList(LPDIRECTDRAWSURFACE,LPDDSPRITE *,DWORD,DWORD,LPDIRECTDRAWSURFACE,DWORD);
  1316. #endif //POSTPONED2
  1317. extern HRESULT EXTERN_DDAPI DD_Surface_SetSurfaceDesc( LPDIRECTDRAWSURFACE3, LPDDSURFACEDESC, DWORD );
  1318. extern HRESULT EXTERN_DDAPI DD_Surface_SetSurfaceDesc4( LPDIRECTDRAWSURFACE3, LPDDSURFACEDESC2, DWORD );
  1319. extern HRESULT EXTERN_DDAPI DD_Surface_Unlock(LPDIRECTDRAWSURFACE,LPVOID);
  1320. extern HRESULT EXTERN_DDAPI DD_Surface_Unlock4(LPDIRECTDRAWSURFACE,LPRECT);
  1321. extern HRESULT EXTERN_DDAPI DD_Surface_UpdateOverlay(LPDIRECTDRAWSURFACE,LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX);
  1322. extern HRESULT EXTERN_DDAPI DD_Surface_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE,DWORD);
  1323. extern HRESULT EXTERN_DDAPI DD_Surface_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE,DWORD,LPDIRECTDRAWSURFACE);
  1324. extern HRESULT EXTERN_DDAPI DD_Surface_SetPriority(LPDIRECTDRAWSURFACE7 lpDDSurface, DWORD dwPriority);
  1325. extern HRESULT EXTERN_DDAPI DD_Surface_GetPriority(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDWORD lpdwPriority);
  1326. extern HRESULT EXTERN_DDAPI DD_Surface_SetLOD(LPDIRECTDRAWSURFACE7 lpDDSurface, DWORD dwLOD);
  1327. extern HRESULT EXTERN_DDAPI DD_Surface_GetLOD(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDWORD lpdwLOD);
  1328. /* DrawDrawVideoPortContainer functions */
  1329. extern HRESULT EXTERN_DDAPI DDVPC_QueryInterface(LPDDVIDEOPORTCONTAINER lpDVP, REFIID riid, LPVOID FAR * ppvObj );
  1330. extern DWORD EXTERN_DDAPI DDVPC_AddRef(LPDDVIDEOPORTCONTAINER lpDVP );
  1331. extern DWORD EXTERN_DDAPI DDVPC_Release( LPDDVIDEOPORTCONTAINER lpDD );
  1332. extern HRESULT EXTERN_DDAPI DDVPC_CreateVideoPort(LPDDVIDEOPORTCONTAINER lpDVP, DWORD dwFlags, LPDDVIDEOPORTDESC lpDesc, LPDIRECTDRAWVIDEOPORT FAR *lplpVideoPort, IUnknown FAR *pUnkOuter );
  1333. extern HRESULT EXTERN_DDAPI DDVPC_EnumVideoPorts(LPDDVIDEOPORTCONTAINER lpDVP, DWORD dwReserved, LPDDVIDEOPORTCAPS lpCaps, LPVOID lpContext, LPDDENUMVIDEOCALLBACK lpCallback );
  1334. extern HRESULT EXTERN_DDAPI DDVPC_GetVideoPortConnectInfo(LPDDVIDEOPORTCONTAINER lpDVP, DWORD dwVideoPortID, LPDWORD lpdwNumGUIDs, LPDDVIDEOPORTCONNECT lpConnect );
  1335. extern HRESULT EXTERN_DDAPI DDVPC_QueryVideoPortStatus(LPDDVIDEOPORTCONTAINER lpDVP, DWORD dwVideoPortID, LPDDVIDEOPORTSTATUS lpStatus );
  1336. /* DirectDrawVideoPort functions */
  1337. extern HRESULT EXTERN_DDAPI DD_VP_QueryInterface(LPDIRECTDRAWVIDEOPORT lpDVP, REFIID riid, LPVOID FAR * ppvObj );
  1338. extern DWORD EXTERN_DDAPI DD_VP_AddRef(LPDIRECTDRAWVIDEOPORT lpDVP );
  1339. extern DWORD EXTERN_DDAPI DD_VP_Release(LPDIRECTDRAWVIDEOPORT lpDVP );
  1340. extern HRESULT EXTERN_DDAPI DD_VP_SetTargetSurface(LPDIRECTDRAWVIDEOPORT lpDVP, LPDIRECTDRAWSURFACE lpSurface, DWORD dwFlags );
  1341. extern HRESULT EXTERN_DDAPI DD_VP_Flip(LPDIRECTDRAWVIDEOPORT lpDVP, LPDIRECTDRAWSURFACE lpSurface, DWORD );
  1342. extern HRESULT EXTERN_DDAPI DD_VP_GetBandwidth(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDPIXELFORMAT lpf, DWORD dwWidth, DWORD dwHeight, DWORD dwFlags, LPDDVIDEOPORTBANDWIDTH lpBandwidth );
  1343. extern HRESULT EXTERN_DDAPI DD_VP_GetInputFormats(LPDIRECTDRAWVIDEOPORT lpDVP, LPDWORD lpdwNum, LPDDPIXELFORMAT lpf, DWORD dwFlags );
  1344. extern HRESULT EXTERN_DDAPI DD_VP_GetOutputFormats(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDPIXELFORMAT lpf, LPDWORD lp1, LPDDPIXELFORMAT lp2, DWORD dwFlags );
  1345. extern HRESULT EXTERN_DDAPI DD_VP_GetCurrentAutoFlip(LPDIRECTDRAWVIDEOPORT lpDVP, LPDIRECTDRAWSURFACE FAR* lpSurf, LPDIRECTDRAWSURFACE FAR* lpVBI, LPBOOL lpField );
  1346. extern HRESULT EXTERN_DDAPI DD_VP_GetLastAutoFlip(LPDIRECTDRAWVIDEOPORT lpDVP, LPDIRECTDRAWSURFACE FAR* lpSurf, LPDIRECTDRAWSURFACE FAR* lpVBI, LPBOOL lpField );
  1347. extern HRESULT EXTERN_DDAPI DD_VP_GetField(LPDIRECTDRAWVIDEOPORT lpDVP, LPBOOL lpField );
  1348. extern HRESULT EXTERN_DDAPI DD_VP_GetLine(LPDIRECTDRAWVIDEOPORT lpDVP, LPDWORD lpdwLine );
  1349. extern HRESULT EXTERN_DDAPI DD_VP_StartVideo(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDVIDEOPORTINFO lpInfo );
  1350. extern HRESULT EXTERN_DDAPI DD_VP_StopVideo(LPDIRECTDRAWVIDEOPORT lpDVP );
  1351. extern HRESULT EXTERN_DDAPI DD_VP_UpdateVideo(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDVIDEOPORTINFO lpInfo );
  1352. extern HRESULT EXTERN_DDAPI DD_VP_WaitForSync(LPDIRECTDRAWVIDEOPORT lpDVP, DWORD dwFlags, DWORD dwLine, DWORD dwTimeOut );
  1353. extern HRESULT EXTERN_DDAPI DD_VP_SetFieldNumber(LPDIRECTDRAWVIDEOPORT lpDVP, DWORD dwFieldNum );
  1354. extern HRESULT EXTERN_DDAPI DD_VP_GetFieldNumber(LPDIRECTDRAWVIDEOPORT lpDVP, LPDWORD lpdwFieldNum );
  1355. extern HRESULT EXTERN_DDAPI DD_VP_SetSkipFieldPattern(LPDIRECTDRAWVIDEOPORT lpDVP, DWORD dwStartField, DWORD dwPattSize, DWORD dwPatt );
  1356. extern HRESULT EXTERN_DDAPI DD_VP_GetSignalStatus(LPDIRECTDRAWVIDEOPORT lpDVP, LPDWORD lpdwStatus );
  1357. extern HRESULT EXTERN_DDAPI DD_VP_GetColorControls(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDCOLORCONTROL lpColor );
  1358. extern HRESULT EXTERN_DDAPI DD_VP_SetColorControls(LPDIRECTDRAWVIDEOPORT lpDVP, LPDDCOLORCONTROL lpColor );
  1359. extern HRESULT EXTERN_DDAPI DD_VP_GetStateInfo(LPDIRECTDRAWVIDEOPORT lpDVP, LPDWORD lpdwStateFlags );
  1360. /* DrawDrawColorControl functions */
  1361. extern HRESULT EXTERN_DDAPI DD_Color_GetColorControls(LPDIRECTDRAWCOLORCONTROL lpDDCC, LPDDCOLORCONTROL lpColor );
  1362. extern HRESULT EXTERN_DDAPI DD_Color_SetColorControls(LPDIRECTDRAWCOLORCONTROL lpDDCC, LPDDCOLORCONTROL lpColor );
  1363. /* DrawDrawGammaControl functions */
  1364. extern HRESULT EXTERN_DDAPI DD_Gamma_GetGammaRamp(LPDIRECTDRAWGAMMACONTROL lpDDGC, DWORD dwFlags, LPVOID lpGammaTable );
  1365. extern HRESULT EXTERN_DDAPI DD_Gamma_SetGammaRamp(LPDIRECTDRAWGAMMACONTROL lpDDGC, DWORD dwFlags, LPVOID lpGammaTable );
  1366. /* DirectDrawKernel functions */
  1367. extern HRESULT EXTERN_DDAPI DD_Kernel_GetCaps(LPDIRECTDRAWKERNEL lpDDK, LPDDKERNELCAPS lpCaps );
  1368. extern HRESULT EXTERN_DDAPI DD_Kernel_GetKernelHandle(LPDIRECTDRAWKERNEL lpDDK, PULONG_PTR lpHandle );
  1369. extern HRESULT EXTERN_DDAPI DD_Kernel_ReleaseKernelHandle(LPDIRECTDRAWKERNEL lpDDK );
  1370. /* DirectDrawSurfaceKernel functions */
  1371. extern HRESULT EXTERN_DDAPI DD_SurfaceKernel_GetKernelHandle(LPDIRECTDRAWSURFACEKERNEL lpDDK, PULONG_PTR lpHandle );
  1372. extern HRESULT EXTERN_DDAPI DD_SurfaceKernel_ReleaseKernelHandle(LPDIRECTDRAWSURFACEKERNEL lpDDK );
  1373. /* DIrectDrawSurface and palette IPersist and IPersistStream functions */
  1374. #ifdef IS_32
  1375. extern HRESULT EXTERN_DDAPI DD_PStream_GetSizeMax(IPersistStream * lpSurfOrPalette, ULARGE_INTEGER * pMax);
  1376. extern HRESULT EXTERN_DDAPI DD_Surface_PStream_Save(LPDIRECTDRAWSURFACE lpDDS, IStream * pStrm, BOOL bClearDirty);
  1377. extern HRESULT EXTERN_DDAPI DD_Surface_PStream_IsDirty(LPDIRECTDRAWSURFACE lpDDS);
  1378. extern HRESULT EXTERN_DDAPI DD_Surface_Persist_GetClassID(LPDIRECTDRAWSURFACE lpDDS, CLSID * pClassID);
  1379. extern HRESULT EXTERN_DDAPI DD_Surface_PStream_Load(LPDIRECTDRAWSURFACE lpDDS, IStream * pStrm);
  1380. extern HRESULT EXTERN_DDAPI DD_Palette_PStream_Save(LPDIRECTDRAWPALETTE lpDDS, IStream * pStrm, BOOL bClearDirty);
  1381. extern HRESULT EXTERN_DDAPI DD_Palette_PStream_IsDirty(LPDIRECTDRAWPALETTE lpDDS);
  1382. extern HRESULT EXTERN_DDAPI DD_Palette_Persist_GetClassID(LPDIRECTDRAWPALETTE lpDDS, CLSID * pClassID);
  1383. extern HRESULT EXTERN_DDAPI DD_Palette_PStream_Load(LPDIRECTDRAWPALETTE lpDDS, IStream * pStrm);
  1384. #endif
  1385. /* DirectDrawOptSurface functions */
  1386. extern HRESULT EXTERN_DDAPI DD_OptSurface_GetOptSurfaceDesc(LPDIRECTDRAWSURFACE, LPDDOPTSURFACEDESC);
  1387. extern HRESULT EXTERN_DDAPI DD_OptSurface_LoadUnoptimizedSurf(LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE);
  1388. extern HRESULT EXTERN_DDAPI DD_OptSurface_CopyOptimizedSurf(LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE);
  1389. extern HRESULT EXTERN_DDAPI DD_OptSurface_Unoptimize(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *);
  1390. /* DrawDrawMotionCompContainer functions */
  1391. extern HRESULT EXTERN_DDAPI DDMCC_CreateMotionComp(LPDDVIDEOACCELERATORCONTAINER lpDDMCC, LPGUID lpGuid, LPDDVAUncompDataInfo lpUncompInfo, LPVOID lpData, DWORD dwDataSize, LPDIRECTDRAWVIDEOACCELERATOR FAR *lplpMotionComp, IUnknown FAR *pUnkOuter );
  1392. extern HRESULT EXTERN_DDAPI DDMCC_GetUncompressedFormats(LPDDVIDEOACCELERATORCONTAINER lpDDMCC, LPGUID lpGuid, LPDWORD lpNumFormats, LPDDPIXELFORMAT lpFormats );
  1393. extern HRESULT EXTERN_DDAPI DDMCC_GetMotionCompGUIDs(LPDDVIDEOACCELERATORCONTAINER lpDDMCC, LPDWORD lpNumGuids, LPGUID lpGuids );
  1394. extern HRESULT EXTERN_DDAPI DDMCC_GetCompBuffInfo(LPDDVIDEOACCELERATORCONTAINER lpDDMCC, LPGUID lpGuid, LPDDVAUncompDataInfo lpUncompInfo, LPDWORD lpNumBuffInfo, LPDDVACompBufferInfo lpCompBuffInfo );
  1395. extern HRESULT EXTERN_DDAPI DDMCC_GetInternalMoCompInfo(LPDDVIDEOACCELERATORCONTAINER lpDDMCC, LPGUID lpGuid, LPDDVAUncompDataInfo lpUncompInfo, LPDDVAInternalMemInfo lpMemInfo );
  1396. /* DrawDrawMotionComp functions */
  1397. extern HRESULT EXTERN_DDAPI DD_MC_QueryInterface(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC, REFIID riid, LPVOID FAR * ppvObj );
  1398. extern DWORD EXTERN_DDAPI DD_MC_AddRef(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC);
  1399. extern DWORD EXTERN_DDAPI DD_MC_Release(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC);
  1400. extern HRESULT EXTERN_DDAPI DD_MC_BeginFrame(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC, LPDDVABeginFrameInfo lpInfo);
  1401. extern HRESULT EXTERN_DDAPI DD_MC_EndFrame(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC, LPDDVAEndFrameInfo lpInfo);
  1402. extern HRESULT EXTERN_DDAPI DD_MC_QueryRenderStatus(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC, LPDIRECTDRAWSURFACE7 lpSurface, DWORD dwFlags);
  1403. extern HRESULT EXTERN_DDAPI DD_MC_RenderMacroBlocks(LPDIRECTDRAWVIDEOACCELERATOR lpDDMC, DWORD dwFunction, LPVOID lpInput, DWORD dwInputSize, LPVOID lpOutput, DWORD dwOutSize, DWORD dwNumBuffers, LPDDVABUFFERINFO lpBuffInfo);
  1404. //#endif //WIN95
  1405. /*
  1406. * HAL fns
  1407. */
  1408. //#ifdef WIN95
  1409. /*
  1410. * thunk helper fns
  1411. */
  1412. extern DWORD DDAPI _DDHAL_CreatePalette( LPDDHAL_CREATEPALETTEDATA lpCreatePaletteData );
  1413. extern DWORD DDAPI DDThunk16_CreatePalette( LPDDHAL_CREATEPALETTEDATA lpCreatePaletteData );
  1414. extern DWORD DDAPI _DDHAL_CreateSurface( LPDDHAL_CREATESURFACEDATA lpCreateSurfaceData );
  1415. extern DWORD DDAPI DDThunk16_CreateSurface( LPDDHAL_CREATESURFACEDATA lpCreateSurfaceData );
  1416. extern DWORD DDAPI _DDHAL_CanCreateSurface( LPDDHAL_CANCREATESURFACEDATA lpCanCreateSurfaceData );
  1417. extern DWORD DDAPI DDThunk16_CanCreateSurface( LPDDHAL_CANCREATESURFACEDATA lpCanCreateSurfaceData );
  1418. extern DWORD DDAPI _DDHAL_WaitForVerticalBlank( LPDDHAL_WAITFORVERTICALBLANKDATA lpWaitForVerticalBlankData );
  1419. extern DWORD DDAPI DDThunk16_WaitForVerticalBlank( LPDDHAL_WAITFORVERTICALBLANKDATA lpWaitForVerticalBlankData );
  1420. extern DWORD DDAPI _DDHAL_DestroyDriver( LPDDHAL_DESTROYDRIVERDATA lpDestroyDriverData );
  1421. extern DWORD DDAPI DDThunk16_DestroyDriver( LPDDHAL_DESTROYDRIVERDATA lpDestroyDriverData );
  1422. extern DWORD DDAPI _DDHAL_SetMode( LPDDHAL_SETMODEDATA lpSetModeData );
  1423. extern DWORD DDAPI DDThunk16_SetMode( LPDDHAL_SETMODEDATA lpSetModeData );
  1424. extern DWORD DDAPI _DDHAL_GetScanLine( LPDDHAL_GETSCANLINEDATA lpGetScanLineData );
  1425. extern DWORD DDAPI DDThunk16_GetScanLine( LPDDHAL_GETSCANLINEDATA lpGetScanLineData );
  1426. extern DWORD DDAPI _DDHAL_SetExclusiveMode( LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiveModeData );
  1427. extern DWORD DDAPI DDThunk16_SetExclusiveMode( LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiveModeData );
  1428. extern DWORD DDAPI _DDHAL_FlipToGDISurface( LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurfaceData );
  1429. extern DWORD DDAPI DDThunk16_FlipToGDISurface( LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurfaceData );
  1430. extern DWORD DDAPI _DDHAL_GetAvailDriverMemory ( LPDDHAL_GETAVAILDRIVERMEMORYDATA lpGetAvailDriverMemoryData );
  1431. extern DWORD DDAPI DDThunk16_GetAvailDriverMemory ( LPDDHAL_GETAVAILDRIVERMEMORYDATA lpGetAvailDriverMemoryData );
  1432. extern DWORD DDAPI _DDHAL_UpdateNonLocalHeap ( LPDDHAL_UPDATENONLOCALHEAPDATA lpUpdateNonLocalHeapData );
  1433. extern DWORD DDAPI DDThunk16_UpdateNonLocalHeap ( LPDDHAL_UPDATENONLOCALHEAPDATA lpUpdateNonLocalHeapData );
  1434. /*
  1435. * Palette Object HAL fns
  1436. */
  1437. extern DWORD DDAPI _DDHAL_DestroyPalette( LPDDHAL_DESTROYPALETTEDATA );
  1438. extern DWORD DDAPI DDThunk16_DestroyPalette( LPDDHAL_DESTROYPALETTEDATA );
  1439. extern DWORD DDAPI _DDHAL_SetEntries( LPDDHAL_SETENTRIESDATA );
  1440. extern DWORD DDAPI DDThunk16_SetEntries( LPDDHAL_SETENTRIESDATA );
  1441. /*
  1442. * Surface Object HAL fns
  1443. */
  1444. extern DWORD DDAPI _DDHAL_DestroySurface( LPDDHAL_DESTROYSURFACEDATA lpDestroySurfaceData );
  1445. extern DWORD DDAPI DDThunk16_DestroySurface( LPDDHAL_DESTROYSURFACEDATA lpDestroySurfaceData );
  1446. extern DWORD DDAPI _DDHAL_Flip( LPDDHAL_FLIPDATA lpFlipData );
  1447. extern DWORD DDAPI DDThunk16_Flip( LPDDHAL_FLIPDATA lpFlipData );
  1448. extern DWORD DDAPI _DDHAL_Blt( LPDDHAL_BLTDATA lpBltData );
  1449. extern DWORD DDAPI DDThunk16_Blt( LPDDHAL_BLTDATA lpBltData );
  1450. extern DWORD DDAPI _DDHAL_Lock( LPDDHAL_LOCKDATA lpLockData );
  1451. extern DWORD DDAPI DDThunk16_Lock( LPDDHAL_LOCKDATA lpLockData );
  1452. extern DWORD DDAPI _DDHAL_Unlock( LPDDHAL_UNLOCKDATA lpUnlockData );
  1453. extern DWORD DDAPI DDThunk16_Unlock( LPDDHAL_UNLOCKDATA lpUnlockData );
  1454. extern DWORD DDAPI _DDHAL_AddAttachedSurface( LPDDHAL_ADDATTACHEDSURFACEDATA lpAddAttachedSurfaceData );
  1455. extern DWORD DDAPI DDThunk16_AddAttachedSurface( LPDDHAL_ADDATTACHEDSURFACEDATA lpAddAttachedSurfaceData );
  1456. extern DWORD DDAPI _DDHAL_SetColorKey( LPDDHAL_SETCOLORKEYDATA lpSetColorKeyData );
  1457. extern DWORD DDAPI DDThunk16_SetColorKey( LPDDHAL_SETCOLORKEYDATA lpSetColorKeyData );
  1458. extern DWORD DDAPI _DDHAL_SetClipList( LPDDHAL_SETCLIPLISTDATA lpSetClipListData );
  1459. extern DWORD DDAPI DDThunk16_SetClipList( LPDDHAL_SETCLIPLISTDATA lpSetClipListData );
  1460. extern DWORD DDAPI _DDHAL_UpdateOverlay( LPDDHAL_UPDATEOVERLAYDATA lpUpdateOverlayData );
  1461. extern DWORD DDAPI DDThunk16_UpdateOverlay( LPDDHAL_UPDATEOVERLAYDATA lpUpdateOverlayData );
  1462. extern DWORD DDAPI _DDHAL_SetOverlayPosition( LPDDHAL_SETOVERLAYPOSITIONDATA lpSetOverlayPositionData );
  1463. extern DWORD DDAPI DDThunk16_SetOverlayPosition( LPDDHAL_SETOVERLAYPOSITIONDATA lpSetOverlayPositionData );
  1464. extern DWORD DDAPI _DDHAL_SetPalette( LPDDHAL_SETPALETTEDATA lpSetPaletteData );
  1465. extern DWORD DDAPI DDThunk16_SetPalette( LPDDHAL_SETPALETTEDATA lpSetPaletteData );
  1466. extern DWORD DDAPI _DDHAL_GetBltStatus( LPDDHAL_GETBLTSTATUSDATA lpGetBltStatusData );
  1467. extern DWORD DDAPI DDThunk16_GetBltStatus( LPDDHAL_GETBLTSTATUSDATA lpGetBltStatusData );
  1468. extern DWORD DDAPI _DDHAL_GetFlipStatus( LPDDHAL_GETFLIPSTATUSDATA lpGetFlipStatusData );
  1469. extern DWORD DDAPI DDThunk16_GetFlipStatus( LPDDHAL_GETFLIPSTATUSDATA lpGetFlipStatusData );
  1470. /*
  1471. * Execute Buffer Pseudo Object HAL fns
  1472. *
  1473. * NOTE: No DDThunk16 equivalents as these are just dummy place holders to keep
  1474. * DOHALCALL happy.
  1475. */
  1476. extern DWORD DDAPI _DDHAL_CanCreateExecuteBuffer( LPDDHAL_CANCREATESURFACEDATA lpCanCreateSurfaceData );
  1477. extern DWORD DDAPI _DDHAL_CreateExecuteBuffer( LPDDHAL_CREATESURFACEDATA lpCreateSurfaceData );
  1478. extern DWORD DDAPI _DDHAL_DestroyExecuteBuffer( LPDDHAL_DESTROYSURFACEDATA lpDestroySurfaceData );
  1479. extern DWORD DDAPI _DDHAL_LockExecuteBuffer( LPDDHAL_LOCKDATA lpLockData );
  1480. extern DWORD DDAPI _DDHAL_UnlockExecuteBuffer( LPDDHAL_UNLOCKDATA lpUnlockData );
  1481. /*
  1482. * Video Port Pseudo Object HAL fns
  1483. *
  1484. * NOTE: No DDThunk16 equivalents as these are just dummy place holders to keep
  1485. * DOHALCALL happy.
  1486. */
  1487. extern DWORD DDAPI _DDHAL_GetVideoPortConnectInfo( LPDDHAL_GETVPORTCONNECTDATA lpGetTypeData );
  1488. extern DWORD DDAPI _DDHAL_CanCreateVideoPort( LPDDHAL_CANCREATEVPORTDATA lpCanCreateData );
  1489. extern DWORD DDAPI _DDHAL_CreateVideoPort( LPDDHAL_CREATEVPORTDATA lpCreateData );
  1490. extern DWORD DDAPI _DDHAL_DestroyVideoPort( LPDDHAL_DESTROYVPORTDATA lpDestroyData );
  1491. extern DWORD DDAPI _DDHAL_GetVideoPortInputFormats( LPDDHAL_GETVPORTINPUTFORMATDATA lpGetFormatData );
  1492. extern DWORD DDAPI _DDHAL_GetVideoPortOutputFormats( LPDDHAL_GETVPORTOUTPUTFORMATDATA lpGetFormatData );
  1493. extern DWORD DDAPI _DDHAL_GetVideoPortBandwidthInfo( LPDDHAL_GETVPORTBANDWIDTHDATA lpGetBandwidthData );
  1494. extern DWORD DDAPI _DDHAL_UpdateVideoPort( LPDDHAL_UPDATEVPORTDATA lpUpdateData );
  1495. extern DWORD DDAPI _DDHAL_GetVideoPortField( LPDDHAL_GETVPORTFIELDDATA lpGetFieldData );
  1496. extern DWORD DDAPI _DDHAL_GetVideoPortLine( LPDDHAL_GETVPORTLINEDATA lpGetLineData );
  1497. extern DWORD DDAPI _DDHAL_WaitForVideoPortSync( LPDDHAL_WAITFORVPORTSYNCDATA lpWaitSyncData );
  1498. extern DWORD DDAPI _DDHAL_FlipVideoPort( LPDDHAL_FLIPVPORTDATA lpFlipData );
  1499. extern DWORD DDAPI _DDHAL_GetVideoPortFlipStatus( LPDDHAL_GETVPORTFLIPSTATUSDATA lpFlipData );
  1500. extern DWORD DDAPI _DDHAL_GetVideoSignalStatus( LPDDHAL_GETVPORTSIGNALDATA lpData );
  1501. extern DWORD DDAPI _DDHAL_VideoColorControl( LPDDHAL_VPORTCOLORDATA lpData );
  1502. /*
  1503. * Color Control Pseudo Object HAL fns
  1504. */
  1505. extern DWORD DDAPI _DDHAL_ColorControl( LPDDHAL_COLORCONTROLDATA lpColorData );
  1506. extern DWORD DDAPI DDThunk16_ColorControl( LPDDHAL_COLORCONTROLDATA lpColorData );
  1507. /*
  1508. * Kernel Pseudo Object HAL fns
  1509. */
  1510. extern DWORD DDAPI _DDHAL_SyncSurfaceData( LPDDHAL_SYNCSURFACEDATA lpSyncData );
  1511. extern DWORD DDAPI _DDHAL_SyncVideoPortData( LPDDHAL_SYNCVIDEOPORTDATA lpSyncData );
  1512. /*
  1513. * MotionComp Pseudo Object HAL fns
  1514. */
  1515. extern DWORD DDAPI _DDHAL_GetMoCompGuids( LPDDHAL_GETMOCOMPGUIDSDATA lpGetGuidData );
  1516. extern DWORD DDAPI _DDHAL_GetMoCompFormats( LPDDHAL_GETMOCOMPFORMATSDATA lpGetFormatData );
  1517. extern DWORD DDAPI _DDHAL_CreateMoComp( LPDDHAL_CREATEMOCOMPDATA lpCreateData );
  1518. extern DWORD DDAPI _DDHAL_GetMoCompBuffInfo( LPDDHAL_GETMOCOMPCOMPBUFFDATA lpBuffData );
  1519. extern DWORD DDAPI _DDHAL_GetInternalMoCompInfo( LPDDHAL_GETINTERNALMOCOMPDATA lpInternalData );
  1520. extern DWORD DDAPI _DDHAL_DestroyMoComp( LPDDHAL_DESTROYMOCOMPDATA lpDestroyData );
  1521. extern DWORD DDAPI _DDHAL_BeginMoCompFrame( LPDDHAL_BEGINMOCOMPFRAMEDATA lpFrameData );
  1522. extern DWORD DDAPI _DDHAL_EndMoCompFrame( LPDDHAL_ENDMOCOMPFRAMEDATA lpFrameData );
  1523. extern DWORD DDAPI _DDHAL_RenderMoComp( LPDDHAL_RENDERMOCOMPDATA lpRenderData );
  1524. extern DWORD DDAPI _DDHAL_QueryMoCompStatus( LPDDHAL_QUERYMOCOMPSTATUSDATA lpStatusData );
  1525. #ifdef POSTPONED
  1526. extern DWORD DDAPI _DDHAL_CanOptimizeSurface( LPDDHAL_CANOPTIMIZESURFACEDATA);
  1527. extern DWORD DDAPI _DDHAL_OptimizeSurface( LPDDHAL_OPTIMIZESURFACEDATA);
  1528. extern DWORD DDAPI _DDHAL_UnOptimizeSurface( LPDDHAL_UNOPTIMIZESURFACEDATA);
  1529. extern DWORD DDAPI _DDHAL_CopyOptSurface( LPDDHAL_COPYOPTSURFACEDATA);
  1530. #endif
  1531. //#endif
  1532. #ifdef POSTPONED
  1533. #ifdef IS_32
  1534. /*
  1535. * DirectDrawFactory2 implementation
  1536. */
  1537. typedef struct _DDFACTORY2
  1538. {
  1539. IDirectDrawFactory2Vtbl *lpVtbl;
  1540. DWORD dwRefCnt;
  1541. /* internal data */
  1542. } DDFACTORY2, FAR * LPDDFACTORY2;
  1543. #endif
  1544. #endif //POSTPONED
  1545. /*
  1546. * Macros for checking interface versions
  1547. */
  1548. #define LOWERTHANDDRAW7(lpDD) \
  1549. (lpDD->lpVtbl == &ddCallbacks || lpDD->lpVtbl == &dd2Callbacks || lpDD->lpVtbl == &dd4Callbacks )
  1550. #define LOWERTHANDDRAW4(lpDD) \
  1551. (lpDD->lpVtbl == &ddCallbacks || lpDD->lpVtbl == &dd2Callbacks)
  1552. #define LOWERTHANDDRAW3(lpDD) \
  1553. (lpDD->lpVtbl == &ddCallbacks || lpDD->lpVtbl == &dd2Callbacks)
  1554. #define LOWERTHANSURFACE7(lpDDS) \
  1555. (lpDDS->lpVtbl == &ddSurfaceCallbacks || lpDDS->lpVtbl == &ddSurface2Callbacks || \
  1556. lpDDS->lpVtbl == &ddSurface3Callbacks || lpDDS->lpVtbl == &ddSurface4Callbacks )
  1557. #define LOWERTHANSURFACE4(lpDDS) \
  1558. (lpDDS->lpVtbl == &ddSurfaceCallbacks || lpDDS->lpVtbl == &ddSurface2Callbacks || lpDDS->lpVtbl == &ddSurface3Callbacks )
  1559. /*
  1560. * This macro allows testing an interface pointer to see if it's one that come from
  1561. * our implementation of ddraw, or somebody else's
  1562. */
  1563. #define IS_NATIVE_DDRAW_INTERFACE(ptr) \
  1564. ( ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&ddCallbacks) || \
  1565. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd2Callbacks) || \
  1566. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd4Callbacks) || \
  1567. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd7Callbacks) || \
  1568. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd2UninitCallbacks) || \
  1569. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd4UninitCallbacks) || \
  1570. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&dd5UninitCallbacks) || \
  1571. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&ddVideoPortContainerCallbacks) || \
  1572. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&ddKernelCallbacks) || \
  1573. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&ddMotionCompContainerCallbacks) || \
  1574. ((IUnknownVtbl*)ptr->lpVtbl == (IUnknownVtbl*)&ddUninitCallbacks) )
  1575. /*
  1576. * This macro tests if this ddraw interface is one for which child objects should take
  1577. * a ref count on that interface and thus achieve immortality wrt that interface.
  1578. */
  1579. #define CHILD_SHOULD_TAKE_REFCNT(dd_int) (!LOWERTHANDDRAW3(dd_int))
  1580. /*
  1581. * macros for checking if surface as been lost due to mode change
  1582. * NOTE: The flag for determining if a surface is lost or not is now
  1583. * stored in the local than global object. This prevents the scenario
  1584. * where a surface being shared by two processes is lost and restored
  1585. * by one of them - giving the other no notification that the contents
  1586. * of the surface are gone.
  1587. */
  1588. #define SURFACE_LOST( lcl_ptr ) (((lcl_ptr)->dwFlags & DDRAWISURF_INVALID))
  1589. /*
  1590. * Useful palette macros
  1591. *
  1592. * All these flags are really iritating to handle but but changing
  1593. * to use a numeric palette size would require an API change and
  1594. * internal structure mods (visible to the driver) so I am sticking
  1595. * with flags.
  1596. */
  1597. #define SIZE_PCAPS_TO_FLAGS( pcaps ) \
  1598. (((pcaps) & DDPCAPS_1BIT) ? DDRAWIPAL_2 : \
  1599. (((pcaps) & DDPCAPS_2BIT) ? DDRAWIPAL_4 : \
  1600. (((pcaps) & DDPCAPS_4BIT) ? DDRAWIPAL_16 : DDRAWIPAL_256)))
  1601. #define SIZE_FLAGS_TO_PCAPS( flags ) \
  1602. (((flags) & DDRAWIPAL_2) ? DDPCAPS_1BIT : \
  1603. (((flags) & DDRAWIPAL_4) ? DDPCAPS_2BIT : \
  1604. (((flags) & DDRAWIPAL_16) ? DDPCAPS_4BIT : DDPCAPS_8BIT)))
  1605. #define FLAGS_TO_SIZE( flags ) \
  1606. (((flags) & DDRAWIPAL_2) ? 2 : \
  1607. (((flags) & DDRAWIPAL_4) ? 4 : \
  1608. (((flags) & DDRAWIPAL_16) ? 16 : 256)))
  1609. /*
  1610. * has Direct3D been initialized for this DirectDraw driver object?
  1611. */
  1612. #define D3D_INITIALIZED( lcl_ptr ) (( NULL != (lcl_ptr)->pD3DIUnknown) && ( NULL != (lcl_ptr)->hD3DInstance ))
  1613. #if defined( _WIN32 ) && !defined( WINNT )
  1614. /*
  1615. * Macros and types to support secondary (stacked) drivers.
  1616. *
  1617. * NOTE: This stuff is only relevant to 32-bit DirectDraw and the GUIDs
  1618. * confuse DDRAW16.
  1619. */
  1620. #define MAX_SECONDARY_DRIVERNAME MAX_PATH
  1621. #define MAX_SECONDARY_ENTRYPOINTNAME 32UL
  1622. #define DEFAULT_SECONDARY_ENTRYPOINTNAME "GetInfo"
  1623. #define REGSTR_PATH_SECONDARY "Software\\Microsoft\\DirectDraw\\Secondary"
  1624. #define REGSTR_VALUE_SECONDARY_ENTRYPOINTNAME "Entry"
  1625. #define REGSTR_VALUE_SECONDARY_DRIVERNAME "Name"
  1626. typedef DWORD (WINAPI * LPSECONDARY_PATCHHALINFO)(
  1627. LPDDHALINFO lpDDHALInfo,
  1628. LPDDHAL_DDCALLBACKS lpDDCallbacks,
  1629. LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks,
  1630. LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks,
  1631. LPDDHAL_DDEXEBUFCALLBACKS lpDDExeBufCallbacks);
  1632. typedef LPSECONDARY_PATCHHALINFO (WINAPI * LPSECONDARY_VALIDATE)(LPGUID lpGuid);
  1633. DEFINE_GUID( guidCertifiedSecondaryDriver, 0x8061d4e0,0xe895,0x11cf,0xa2,0xe0,0x00,0xaa,0x00,0xb9,0x33,0x56 );
  1634. #endif
  1635. #if defined( _WIN32 )
  1636. DEFINE_GUID( guidVoodoo1A, 0x3a0cfd01,0x9320,0x11cf,0xac,0xa1,0x00,0xa0,0x24,0x13,0xc2,0xe2 );
  1637. DEFINE_GUID( guidVoodoo1B, 0xaba52f41,0xf744,0x11cf,0xb4,0x52,0x00,0x00,0x1d,0x1b,0x41,0x26 );
  1638. #endif
  1639. /*
  1640. * macros for validating pointers
  1641. */
  1642. extern DIRECTDRAWCALLBACKS ddCallbacks;
  1643. extern DIRECTDRAWCALLBACKS ddUninitCallbacks;
  1644. extern DIRECTDRAW2CALLBACKS dd2UninitCallbacks;
  1645. extern DIRECTDRAW2CALLBACKS dd2Callbacks;
  1646. extern DIRECTDRAW4CALLBACKS dd4UninitCallbacks;
  1647. extern DIRECTDRAW4CALLBACKS dd4Callbacks;
  1648. extern DIRECTDRAW7CALLBACKS dd7UninitCallbacks;
  1649. extern DIRECTDRAW7CALLBACKS dd7Callbacks;
  1650. extern DIRECTDRAWSURFACECALLBACKS ddSurfaceCallbacks;
  1651. extern DIRECTDRAWSURFACE2CALLBACKS ddSurface2Callbacks;
  1652. extern DIRECTDRAWSURFACE3CALLBACKS ddSurface3Callbacks;
  1653. extern DIRECTDRAWSURFACE4CALLBACKS ddSurface4Callbacks;
  1654. extern DIRECTDRAWSURFACE7CALLBACKS ddSurface7Callbacks;
  1655. extern DIRECTDRAWCLIPPERCALLBACKS ddClipperCallbacks;
  1656. extern DIRECTDRAWCLIPPERCALLBACKS ddUninitClipperCallbacks;
  1657. extern DIRECTDRAWPALETTECALLBACKS ddPaletteCallbacks;
  1658. extern DDVIDEOPORTCONTAINERCALLBACKS ddVideoPortContainerCallbacks;
  1659. extern DIRECTDRAWVIDEOPORTCALLBACKS ddVideoPortCallbacks;
  1660. extern DIRECTDRAWKERNELCALLBACKS ddKernelCallbacks;
  1661. extern DIRECTDRAWSURFACEKERNELCALLBACKS ddSurfaceKernelCallbacks;
  1662. extern DIRECTDRAWPALETTECALLBACKS ddPaletteCallbacks;
  1663. extern DIRECTDRAWCOLORCONTROLCALLBACKS ddColorControlCallbacks;
  1664. extern DIRECTDRAWGAMMACONTROLCALLBACKS ddGammaControlCallbacks;
  1665. #ifdef POSTPONED
  1666. extern NONDELEGATINGUNKNOWNCALLBACKS ddNonDelegatingUnknownCallbacks;
  1667. extern NONDELEGATINGUNKNOWNCALLBACKS ddUninitNonDelegatingUnknownCallbacks;
  1668. extern LPVOID NonDelegatingIUnknownInterface;
  1669. extern LPVOID UninitNonDelegatingIUnknownInterface;
  1670. #endif
  1671. extern DDVIDEOACCELERATORCONTAINERCALLBACKS ddMotionCompContainerCallbacks;
  1672. extern DIRECTDRAWVIDEOACCELERATORCALLBACKS ddMotionCompCallbacks;
  1673. #ifdef POSTPONED
  1674. extern DDFACTORY2CALLBACKS ddFactory2Callbacks;
  1675. extern DIRECTDRAWPALETTE2CALLBACKS ddPalette2Callbacks;
  1676. extern DIRECTDRAWPALETTEPERSISTCALLBACKS ddPalettePersistCallbacks;
  1677. extern DIRECTDRAWPALETTEPERSISTSTREAMCALLBACKS ddPalettePersistStreamCallbacks;
  1678. extern DIRECTDRAWSURFACEPERSISTCALLBACKS ddSurfacePersistCallbacks;
  1679. extern DIRECTDRAWSURFACEPERSISTSTREAMCALLBACKS ddSurfacePersistStreamCallbacks;
  1680. extern DIRECTDRAWOPTSURFACECALLBACKS ddOptSurfaceCallbacks;
  1681. #endif
  1682. #ifndef DEBUG
  1683. #define FAST_CHECKING
  1684. #endif
  1685. /*
  1686. * VALIDEX_xxx macros are the same for debug and retail
  1687. */
  1688. #define VALIDEX_PTR( ptr, size ) \
  1689. (!IsBadReadPtr( ptr, size) )
  1690. #define VALIDEX_IID_PTR( ptr ) \
  1691. (!IsBadReadPtr( ptr, sizeof( IID )) )
  1692. #define VALIDEX_PTR_PTR( ptr ) \
  1693. (!IsBadWritePtr( ptr, sizeof( LPVOID )) )
  1694. #define VALIDEX_CODE_PTR( ptr ) \
  1695. (!IsBadCodePtr( (LPVOID) ptr ) )
  1696. #define VALIDEX_GUID_PTR( ptr ) \
  1697. (!IsBadReadPtr( ptr, sizeof( GUID ) ) )
  1698. #define VALIDEX_DIRECTDRAWFACTORY2_PTR( ptr ) \
  1699. (!IsBadWritePtr( ptr, sizeof( DDFACTORY2 )) && \
  1700. (ptr->lpVtbl == &ddFactory2Callbacks) )
  1701. #define VALIDEX_DIRECTDRAW_PTR( ptr ) \
  1702. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DIRECTDRAW_INT )) && \
  1703. ( (ptr->lpVtbl == &ddCallbacks) || \
  1704. (ptr->lpVtbl == &dd2Callbacks) || \
  1705. (ptr->lpVtbl == &dd4Callbacks) || \
  1706. (ptr->lpVtbl == &dd7Callbacks) || \
  1707. (ptr->lpVtbl == &dd2UninitCallbacks) || \
  1708. (ptr->lpVtbl == &dd4UninitCallbacks) || \
  1709. (ptr->lpVtbl == &dd7UninitCallbacks) || \
  1710. (ptr->lpVtbl == &ddVideoPortContainerCallbacks) || \
  1711. (ptr->lpVtbl == &ddKernelCallbacks) || \
  1712. (ptr->lpVtbl == &ddMotionCompContainerCallbacks) || \
  1713. (ptr->lpVtbl == &ddUninitCallbacks) ) )
  1714. #define VALIDEX_DIRECTDRAWSURFACE_PTR( ptr ) \
  1715. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDRAWSURFACE_INT )) && \
  1716. ( (ptr->lpVtbl == &ddSurfaceCallbacks ) || \
  1717. (ptr->lpVtbl == &ddSurface7Callbacks ) || \
  1718. (ptr->lpVtbl == &ddSurface4Callbacks ) || \
  1719. (ptr->lpVtbl == &ddSurface3Callbacks ) || \
  1720. (ptr->lpVtbl == &ddSurface2Callbacks ) || \
  1721. (ptr->lpVtbl == &ddSurfaceKernelCallbacks ) || \
  1722. (ptr->lpVtbl == &ddColorControlCallbacks ) || \
  1723. (ptr->lpVtbl == &ddGammaControlCallbacks ) ) )
  1724. #define VALIDEX_DIRECTDRAWPALETTE_PTR( ptr ) \
  1725. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDRAWPALETTE_INT )) && \
  1726. (ptr->lpVtbl == &ddPaletteCallbacks) )
  1727. #define VALIDEX_DIRECTDRAWCLIPPER_PTR( ptr ) \
  1728. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDRAWCLIPPER_INT )) && \
  1729. ( (ptr->lpVtbl == &ddClipperCallbacks) || \
  1730. (ptr->lpVtbl == &ddUninitClipperCallbacks) ) )
  1731. #define VALIDEX_DDCOLORCONTROL_PTR( ptr ) \
  1732. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDCOLORCONTROL_INT )) && \
  1733. (ptr->lpVtbl == &ddColorControlCallbacks) )
  1734. #define VALIDEX_DDDEVICEIDENTIFIER_PTR( ptr ) (!IsBadWritePtr( ptr, sizeof( DDDEVICEIDENTIFIER )))
  1735. #define VALIDEX_DDDEVICEIDENTIFIER2_PTR( ptr ) (!IsBadWritePtr( ptr, sizeof( DDDEVICEIDENTIFIER2 )))
  1736. /*
  1737. * These macros validate the size (in debug and retail) of callback
  1738. * tables.
  1739. *
  1740. * NOTE: It is essential that the comparison against the current
  1741. * callback size expected by this DirectDraw the comparison operator
  1742. * be >= rather than ==. This is to ensure that newer drivers can run
  1743. * against older DirectDraws.
  1744. */
  1745. #define VALIDEX_DDCALLBACKSSIZE( ptr ) \
  1746. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1747. ( ( ( ptr )->dwSize == DDCALLBACKSSIZE_V1 ) || \
  1748. ( ( ptr )->dwSize >= DDCALLBACKSSIZE ) ) )
  1749. #define VALIDEX_DDSURFACECALLBACKSSIZE( ptr ) \
  1750. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1751. ( ( ptr )->dwSize >= DDSURFACECALLBACKSSIZE ) )
  1752. #define VALIDEX_DDPALETTECALLBACKSSIZE( ptr ) \
  1753. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1754. ( ( ptr )->dwSize >= DDPALETTECALLBACKSSIZE ) )
  1755. #define VALIDEX_DDPALETTECALLBACKSSIZE( ptr ) \
  1756. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1757. ( ( ptr )->dwSize >= DDPALETTECALLBACKSSIZE ) )
  1758. #define VALIDEX_DDEXEBUFCALLBACKSSIZE( ptr ) \
  1759. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1760. ( ( ptr )->dwSize >= DDEXEBUFCALLBACKSSIZE ) )
  1761. #define VALIDEX_DDVIDEOPORTCALLBACKSSIZE( ptr ) \
  1762. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1763. ( ( ptr )->dwSize >= DDVIDEOPORTCALLBACKSSIZE ) )
  1764. #define VALIDEX_DDMOTIONCOMPCALLBACKSSIZE( ptr ) \
  1765. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1766. ( ( ptr )->dwSize >= DDMOTIONCOMPCALLBACKSSIZE ) )
  1767. #define VALIDEX_DDCOLORCONTROLCALLBACKSSIZE( ptr ) \
  1768. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1769. ( ( ptr )->dwSize >= DDCOLORCONTROLCALLBACKSSIZE ) )
  1770. #define VALIDEX_DDMISCELLANEOUSCALLBACKSSIZE( ptr ) \
  1771. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1772. ( ( ptr )->dwSize >= DDMISCELLANEOUSCALLBACKSSIZE ) )
  1773. #define VALIDEX_DDMISCELLANEOUS2CALLBACKSSIZE( ptr ) \
  1774. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1775. ( ( ptr )->dwSize >= DDMISCELLANEOUS2CALLBACKSSIZE ) )
  1776. #define VALIDEX_D3DCALLBACKS2SIZE( ptr ) \
  1777. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1778. ( (( ptr )->dwSize >= D3DHAL_CALLBACKS2SIZE ) ))
  1779. #define VALIDEX_D3DCOMMANDBUFFERCALLBACKSSIZE( ptr ) \
  1780. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1781. ( ( ptr )->dwSize >= D3DHAL_COMMANDBUFFERCALLBACKSSIZE ) )
  1782. #define VALIDEX_D3DCALLBACKS3SIZE( ptr ) \
  1783. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1784. ( ( ptr )->dwSize >= D3DHAL_CALLBACKS3SIZE ) )
  1785. #define VALIDEX_DDKERNELCALLBACKSSIZE( ptr ) \
  1786. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1787. ( ( ptr )->dwSize >= DDKERNELCALLBACKSSIZE ) )
  1788. #define VALIDEX_DDUMODEDRVINFOSIZE( ptr ) \
  1789. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1790. ( ( ptr )->dwSize >= DDHAL_DDUMODEDRVINFOSIZE ) )
  1791. #define VALIDEX_DDOPTSURFKMODEINFOSIZE( ptr ) \
  1792. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1793. ( ( ptr )->dwSize >= DDOPTSURFACEKMODEINFOSIZE ) )
  1794. #define VALIDEX_DDOPTSURFUMODEINFOSIZE( ptr ) \
  1795. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1796. ( ( ptr )->dwSize >= DDOPTSURFACEUMODEINFOSIZE ) )
  1797. #ifndef WIN95
  1798. #define VALIDEX_DDNTCALLBACKSSIZE( ptr ) \
  1799. ( ( ( ( ptr )->dwSize % sizeof( LPVOID ) ) == 0 ) && \
  1800. ( ( ptr )->dwSize >= DDNTCALLBACKSSIZE ) )
  1801. #endif
  1802. #ifndef FAST_CHECKING
  1803. #define VALID_DIRECTDRAW_PTR( ptr ) VALIDEX_DIRECTDRAW_PTR( ptr )
  1804. #define VALID_DIRECTDRAWFACTORY2_PTR( ptr ) VALIDEX_DIRECTDRAWFACTORY2_PTR( ptr )
  1805. #define VALID_DIRECTDRAWSURFACE_PTR( ptr ) VALIDEX_DIRECTDRAWSURFACE_PTR( ptr )
  1806. #define VALID_DIRECTDRAWPALETTE_PTR( ptr ) VALIDEX_DIRECTDRAWPALETTE_PTR( ptr )
  1807. #define VALID_DIRECTDRAWCLIPPER_PTR( ptr ) VALIDEX_DIRECTDRAWCLIPPER_PTR( ptr )
  1808. #define VALID_DDSURFACEDESC_PTR( ptr ) \
  1809. (!IsBadWritePtr( ptr, sizeof( DDSURFACEDESC ) ) && \
  1810. (ptr->dwSize == sizeof( DDSURFACEDESC )))
  1811. #define VALID_DDSURFACEDESC2_PTR( ptr ) \
  1812. (!IsBadWritePtr( ptr, sizeof( DDSURFACEDESC2 ) ) && \
  1813. (ptr->dwSize == sizeof( DDSURFACEDESC2 )))
  1814. #define VALID_DDVIDEOPORTDESC_PTR( ptr ) \
  1815. (!IsBadWritePtr( ptr, sizeof( DDVIDEOPORTDESC ) ) && \
  1816. (ptr->dwSize == sizeof( DDVIDEOPORTDESC )) )
  1817. #define VALID_DDVIDEOPORTCAPS_PTR( ptr ) \
  1818. (!IsBadWritePtr( ptr, sizeof( DDVIDEOPORTCAPS ) ) && \
  1819. (ptr->dwSize == sizeof( DDVIDEOPORTCAPS )) )
  1820. #define VALID_DDVIDEOPORTINFO_PTR( ptr ) \
  1821. (!IsBadWritePtr( ptr, sizeof( DDVIDEOPORTINFO ) ) && \
  1822. (ptr->dwSize == sizeof( DDVIDEOPORTINFO )) )
  1823. #define VALID_DDVIDEOPORTBANDWIDTH_PTR( ptr ) \
  1824. (!IsBadWritePtr( ptr, sizeof( DDVIDEOPORTBANDWIDTH ) ) && \
  1825. (ptr->dwSize == sizeof( DDVIDEOPORTBANDWIDTH )) )
  1826. #define VALID_DDVIDEOPORTSTATUS_PTR( ptr ) \
  1827. (!IsBadWritePtr( ptr, sizeof( DDVIDEOPORTSTATUS ) ) && \
  1828. (ptr->dwSize == sizeof( DDVIDEOPORTSTATUS )) )
  1829. #define VALID_DDCOLORCONTROL_PTR( ptr ) \
  1830. (!IsBadWritePtr( ptr, sizeof( DDCOLORCONTROL ) ) && \
  1831. (ptr->dwSize == sizeof( DDCOLORCONTROL )) )
  1832. #define VALID_DDKERNELCAPS_PTR( ptr ) \
  1833. (!IsBadWritePtr( ptr, sizeof( DDKERNELCAPS ) ) && \
  1834. (ptr->dwSize == sizeof( DDKERNELCAPS )) )
  1835. #define VALID_DWORD_PTR( ptr ) \
  1836. (!IsBadWritePtr( ptr, sizeof( DWORD ) ))
  1837. #define VALID_BOOL_PTR( ptr ) \
  1838. (!IsBadWritePtr( ptr, sizeof( BOOL ) ))
  1839. #define VALID_HDC_PTR( ptr ) \
  1840. (!IsBadWritePtr( ptr, sizeof( HDC ) ))
  1841. #define VALID_DDPIXELFORMAT_PTR( ptr ) \
  1842. (!IsBadWritePtr( ptr, sizeof( DDPIXELFORMAT ) ) && \
  1843. (ptr->dwSize == sizeof( DDPIXELFORMAT )) )
  1844. #define VALID_DDCOLORKEY_PTR( ptr ) \
  1845. (!IsBadWritePtr( ptr, sizeof( DDCOLORKEY ) ) )
  1846. #define VALID_RGNDATA_PTR( ptr, size ) \
  1847. (!IsBadWritePtr( ptr, size ) )
  1848. #define VALID_RECT_PTR( ptr ) \
  1849. (!IsBadWritePtr( ptr, sizeof( RECT ) ) )
  1850. #define VALID_DDBLTFX_PTR( ptr ) \
  1851. (!IsBadWritePtr( ptr, sizeof( DDBLTFX ) ) && \
  1852. (ptr->dwSize == sizeof( DDBLTFX )) )
  1853. #define VALID_DDBLTBATCH_PTR( ptr ) \
  1854. (!IsBadWritePtr( ptr, sizeof( DDBLTBATCH ) ) )
  1855. #define VALID_DDOVERLAYFX_PTR( ptr ) \
  1856. (!IsBadWritePtr( ptr, sizeof( DDOVERLAYFX ) ) && \
  1857. (ptr->dwSize == sizeof( DDOVERLAYFX )) )
  1858. #define VALID_DDSCAPS_PTR( ptr ) \
  1859. (!IsBadWritePtr( ptr, sizeof( DDSCAPS ) ) )
  1860. #define VALID_DDSCAPS2_PTR( ptr ) \
  1861. (!IsBadWritePtr( ptr, sizeof( DDSCAPS2 ) ) )
  1862. #define VALID_PTR_PTR( ptr ) \
  1863. (!IsBadWritePtr( ptr, sizeof( LPVOID )) )
  1864. #define VALID_IID_PTR( ptr ) \
  1865. (!IsBadReadPtr( ptr, sizeof( IID )) )
  1866. #define VALID_HWND_PTR( ptr ) \
  1867. (!IsBadWritePtr( (LPVOID) ptr, sizeof( HWND )) )
  1868. #define VALID_VMEM_PTR( ptr ) \
  1869. (!IsBadWritePtr( (LPVOID) ptr, sizeof( VMEM )) )
  1870. #define VALID_POINTER_ARRAY( ptr, cnt ) \
  1871. (!IsBadWritePtr( ptr, sizeof( LPVOID ) * cnt ) )
  1872. #define VALID_PALETTEENTRY_ARRAY( ptr, cnt ) \
  1873. (!IsBadWritePtr( ptr, sizeof( PALETTEENTRY ) * cnt ) )
  1874. #define VALID_HANDLE_PTR( ptr ) \
  1875. (!IsBadWritePtr( ptr, sizeof( HANDLE )) )
  1876. #define VALID_DDCORECAPS_PTR( ptr ) \
  1877. (!IsBadWritePtr( ptr, sizeof( DDCORECAPS ) ) && \
  1878. (ptr->dwSize == sizeof( DDCORECAPS ) ) )
  1879. #define VALID_DDCAPS_PTR( ptr ) \
  1880. ( ( !IsBadWritePtr( ptr, sizeof( DWORD ) ) ) && \
  1881. ( !IsBadWritePtr( ptr, ptr->dwSize ) ) && \
  1882. ( ( ptr->dwSize == sizeof( DDCAPS_DX1 ) ) || \
  1883. ( ptr->dwSize == sizeof( DDCAPS_DX3 ) ) || \
  1884. ( ptr->dwSize == sizeof( DDCAPS_DX5 ) ) || \
  1885. ( ptr->dwSize == sizeof( DDCAPS_DX6 ) ) || \
  1886. ( ptr->dwSize == sizeof( DDCAPS_DX7 ) ) ) )
  1887. #define VALID_READ_DDSURFACEDESC_ARRAY( ptr, cnt ) \
  1888. (!IsBadReadPtr( ptr, sizeof( DDSURFACEDESC ) * cnt ) )
  1889. #define VALID_DWORD_ARRAY( ptr, cnt ) \
  1890. (!IsBadWritePtr( ptr, sizeof( DWORD ) * cnt ) )
  1891. #define VALID_GUID_PTR( ptr ) \
  1892. (!IsBadReadPtr( ptr, sizeof( GUID ) ) )
  1893. #define VALID_BYTE_ARRAY( ptr, cnt ) \
  1894. (!IsBadWritePtr( ptr, sizeof( BYTE ) * cnt ) )
  1895. #define VALID_PTR( ptr, size ) \
  1896. (!IsBadReadPtr( ptr, size) )
  1897. #define VALID_DDVIDEOPORT_PTR( ptr ) \
  1898. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDVIDEOPORT_INT )) && \
  1899. (ptr->lpVtbl == &ddVideoPortCallbacks) )
  1900. #define VALID_DDOPTSURFACEDESC_PTR( ptr ) \
  1901. (!IsBadWritePtr( ptr, sizeof( DDOPTSURFACEDESC ) ) && \
  1902. (ptr->dwSize == sizeof( DDOPTSURFACEDESC )))
  1903. #define VALID_DDMOTIONCOMP_PTR( ptr ) \
  1904. (!IsBadWritePtr( ptr, sizeof( DDRAWI_DDMOTIONCOMP_INT )) && \
  1905. (ptr->lpVtbl == &ddMotionCompCallbacks) )
  1906. #else
  1907. #define VALID_PTR( ptr, size ) 1
  1908. #define VALID_DIRECTDRAW_PTR( ptr ) 1
  1909. #define VALID_DIRECTDRAWFACTORY2_PTR( ptr ) 1
  1910. #define VALID_DIRECTDRAWSURFACE_PTR( ptr ) 1
  1911. #define VALID_DIRECTDRAWPALETTE_PTR( ptr ) 1
  1912. #define VALID_DIRECTDRAWCLIPPER_PTR( ptr ) 1
  1913. #define VALID_DDSURFACEDESC_PTR( ptr ) (ptr->dwSize == sizeof( DDSURFACEDESC ))
  1914. #define VALID_DDSURFACEDESC2_PTR( ptr ) (ptr->dwSize == sizeof( DDSURFACEDESC2 ))
  1915. #define VALID_DDVIDEOPORTDESC_PTR( ptr ) (ptr->dwSize == sizeof( DDVIDEOPORTDESC ))
  1916. #define VALID_DDVIDEOPORTCAPS_PTR( ptr ) (ptr->dwSize == sizeof( DDVIDEOPORTCAPS ))
  1917. #define VALID_DDVIDEOPORTINFO_PTR( ptr ) (ptr->dwSize == sizeof( DDVIDEOPORTINFO ))
  1918. #define VALID_DDVIDEOPORTBANDWIDTH_PTR( ptr ) (ptr->dwSize == sizeof( DDVIDEOPORTBANDWIDTH ))
  1919. #define VALID_DDVIDEOPORTSTATUS_PTR( ptr ) (ptr->dwSize == sizeof( DDVIDEOPORTSTATUS ))
  1920. #define VALID_DDCOLORCONTROL_PTR( ptr ) (ptr->dwSize == sizeof( DDCOLORCONTROL ))
  1921. #define VALID_DDKERNELCAPS_PTR( ptr) (ptr->dwSize == sizeof( DDKERNELCAPS ))
  1922. #define VALID_DWORD_PTR( ptr ) 1
  1923. #define VALID_BOOL_PTR( ptr ) 1
  1924. #define VALID_HDC_PTR( ptr ) 1
  1925. #define VALID_DDPIXELFORMAT_PTR( ptr ) (ptr->dwSize == sizeof( DDPIXELFORMAT ))
  1926. #define VALID_DDCOLORKEY_PTR( ptr ) 1
  1927. #define VALID_RGNDATA_PTR( ptr ) 1
  1928. #define VALID_RECT_PTR( ptr ) 1
  1929. #define VALID_DDOVERLAYFX_PTR( ptr ) (ptr->dwSize == sizeof( DDOVERLAYFX ))
  1930. #define VALID_DDBLTFX_PTR( ptr ) (ptr->dwSize == sizeof( DDBLTFX ))
  1931. #define VALID_DDBLTBATCH_PTR( ptr ) 1
  1932. #define VALID_DDMASK_PTR( ptr ) 1
  1933. #define VALID_DDSCAPS_PTR( ptr ) 1
  1934. #define VALID_DDSCAPS2_PTR( ptr ) 1
  1935. #define VALID_PTR_PTR( ptr ) 1
  1936. #define VALID_IID_PTR( ptr ) 1
  1937. #define VALID_HWND_PTR( ptr ) 1
  1938. #define VALID_VMEM_PTR( ptr ) 1
  1939. #define VALID_POINTER_ARRAY( ptr, cnt ) 1
  1940. #define VALID_PALETTEENTRY_ARRAY( ptr, cnt ) 1
  1941. #define VALID_HANDLE_PTR( ptr ) 1
  1942. #define VALID_DDCORECAPS_PTR( ptr ) (ptr->dwSize == sizeof( DDCORECAPS )
  1943. #define VALID_DDCAPS_PTR( ptr ) \
  1944. ( ( ptr->dwSize == sizeof( DDCAPS_DX1 ) ) || \
  1945. ( ptr->dwSize == sizeof( DDCAPS_DX3 ) ) || \
  1946. ( ptr->dwSize == sizeof( DDCAPS_DX5 ) ) || \
  1947. ( ptr->dwSize == sizeof( DDCAPS_DX6 ) ) || \
  1948. ( ptr->dwSize == sizeof( DDCAPS_DX7 ) ) )
  1949. #define VALID_READ_DDSURFACEDESC_ARRAY( ptr, cnt ) 1
  1950. #define VALID_DWORD_ARRAY( ptr, cnt ) 1
  1951. #define VALID_GUID_PTR( ptr ) 1
  1952. #define VALID_BYTE_ARRAY( ptr, cnt ) 1
  1953. #define VALID_DDVIDEOPORT_PTR( ptr ) 1
  1954. #define VALID_DDOPTSURFACEDESC_PTR( ptr ) (ptr->dwSize == sizeof( DDOPTSURFACEDESC ))
  1955. #define VALID_DDMOTIONCOMP_PTR( ptr ) 1
  1956. #endif
  1957. /*
  1958. * All global (i.e. cross-process) values now reside in an instance of the following structure.
  1959. * This instance is in its own shared data section.
  1960. */
  1961. #undef GLOBALS_IN_STRUCT
  1962. #ifdef GLOBALS_IN_STRUCT
  1963. #define GLOBAL_STORAGE_CLASS
  1964. typedef struct
  1965. {
  1966. #else
  1967. #define GLOBAL_STORAGE_CLASS extern
  1968. #endif
  1969. /*
  1970. * This member should stay at the top in order to guarantee that it be intialized to zero
  1971. * -see dllmain.c 's instance of this structure
  1972. */
  1973. GLOBAL_STORAGE_CLASS DWORD dwRefCnt;
  1974. GLOBAL_STORAGE_CLASS DWORD dwLockCount;
  1975. GLOBAL_STORAGE_CLASS DWORD dwFakeCurrPid;
  1976. GLOBAL_STORAGE_CLASS DWORD dwGrimReaperPid;
  1977. GLOBAL_STORAGE_CLASS LPDDWINDOWINFO lpWindowInfo; // the list of WINDOWINFO structures
  1978. GLOBAL_STORAGE_CLASS LPDDRAWI_DIRECTDRAW_INT lpDriverObjectList;
  1979. GLOBAL_STORAGE_CLASS LPDDRAWI_DIRECTDRAW_LCL lpDriverLocalList;
  1980. GLOBAL_STORAGE_CLASS volatile DWORD dwMarker;
  1981. /*
  1982. * This is the globally maintained list of clippers not owned by any
  1983. * DirectDraw object. All clippers created with DirectDrawClipperCreate
  1984. * are placed on this list. Those created by IDirectDraw_CreateClipper
  1985. * are placed on the clipper list of thier owning DirectDraw object.
  1986. *
  1987. * The objects on this list are NOT released when an app's DirectDraw
  1988. * object is released. They remain alive until explictly released or
  1989. * the app. dies.
  1990. */
  1991. GLOBAL_STORAGE_CLASS LPDDRAWI_DDRAWCLIPPER_INT lpGlobalClipperList;
  1992. GLOBAL_STORAGE_CLASS HINSTANCE hModule;
  1993. GLOBAL_STORAGE_CLASS LPATTACHED_PROCESSES lpAttachedProcesses;
  1994. GLOBAL_STORAGE_CLASS BOOL bFirstTime;
  1995. #ifdef DEBUG
  1996. GLOBAL_STORAGE_CLASS int iDLLCSCnt;
  1997. GLOBAL_STORAGE_CLASS int iWin16Cnt;
  1998. #endif
  1999. /*
  2000. * Winnt specific global statics
  2001. */
  2002. /*
  2003. *Hel globals:
  2004. */
  2005. // used to count how many drivers are currently using the HEL
  2006. GLOBAL_STORAGE_CLASS DWORD dwHELRefCnt;
  2007. #ifdef WINNT
  2008. GLOBAL_STORAGE_CLASS LPDCISURFACEINFO gpdci;
  2009. #endif
  2010. #ifdef DEBUG
  2011. // these are used by myCreateSurface
  2012. GLOBAL_STORAGE_CLASS int gcSurfMem; // surface memory in bytes
  2013. GLOBAL_STORAGE_CLASS int gcSurf; // number of surfaces
  2014. #endif
  2015. GLOBAL_STORAGE_CLASS DWORD dwHelperPid;
  2016. #ifdef WINNT
  2017. GLOBAL_STORAGE_CLASS HANDLE hExclusiveModeMutex;
  2018. GLOBAL_STORAGE_CLASS HANDLE hCheckExclusiveModeMutex;
  2019. #endif
  2020. #ifdef GLOBALS_IN_STRUCT
  2021. } GLOBALS;
  2022. /*
  2023. * And this is the pointer to the globals. Each process has an instance (contained in dllmain.c)
  2024. */
  2025. //extern GLOBALS * gp;
  2026. extern GLOBALS g_s;
  2027. #endif //globals in struct
  2028. /*
  2029. * IMPORTANT NOTE: This function validates the HAL information passed to us from the driver.
  2030. * It is vital that we code this check so that we will pass HAL information structures
  2031. * larger than the ones we know about so that new drivers can work with old DirectDraws.
  2032. */
  2033. #define VALIDEX_DDHALINFO_PTR( ptr ) \
  2034. ( ( ( ( ptr )->dwSize == sizeof( DDHALINFO_V1 ) ) || \
  2035. ( ( ptr )->dwSize == DDHALINFOSIZE_V2 ) || \
  2036. ( ( ptr )->dwSize >= sizeof( DDHALINFO ) ) ) && \
  2037. !IsBadWritePtr( ( ptr ), ( UINT ) ( ( ptr )->dwSize ) ) )
  2038. #define VALIDEX_STR_PTR( ptr, len ) \
  2039. (!IsBadReadPtr( ptr, 1 ) && (lstrlen( ptr ) <len) )
  2040. #define VALIDEX_DDSURFACEDESC_PTR( ptr ) \
  2041. (!IsBadWritePtr( ptr, sizeof( DDSURFACEDESC ) ) && \
  2042. (ptr->dwSize == sizeof( DDSURFACEDESC )) )
  2043. #define VALIDEX_DDSURFACEDESC2_PTR( ptr ) \
  2044. (!IsBadWritePtr( ptr, sizeof( DDSURFACEDESC2 ) ) && \
  2045. (ptr->dwSize == sizeof( DDSURFACEDESC2 )) )
  2046. /* Turn on D3D stats collection for Debug builds HERE */
  2047. #define COLLECTSTATS DBG
  2048. #ifdef __cplusplus
  2049. } // extern "C"
  2050. #endif
  2051. #endif