Source code of Windows XP (NT5)
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.

3909 lines
169 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddrawi.h
  6. * Content: DirectDraw internal header file
  7. * Used by DirectDraw and by the display drivers.
  8. *@@BEGIN_MSINTERNAL
  9. * See ddrawpr.h for all information private to DirectDraw.
  10. * History:
  11. * Date By Reason
  12. * ==== == ======
  13. * 25-dec-94 craige initial implementation
  14. * 06-jan-95 craige video memory manager integration
  15. * 13-jan-95 craige re-worked to updated spec + ongoing work
  16. * 21-jan-95 craige made 32-bit + ongoing work
  17. * 31-jan-95 craige and even more ongoing work...
  18. * 04-feb-95 craige performance tuning, ongoing work
  19. * 22-feb-95 craige use critical sections on Win95
  20. * 02-mar-95 craige work work work
  21. * 06-mar-95 craige HEL integration
  22. * 11-mar-95 craige palette stuff
  23. * 17-mar-95 craige COM interface
  24. * 19-mar-95 craige use HRESULTs, use same process list handling for
  25. * driver objects as surface and palette
  26. * 20-mar-95 craige new CSECT work
  27. * 23-mar-95 craige attachment work
  28. * 27-mar-95 craige linear or rectangular vidmem
  29. * 28-mar-95 craige RGBQUAD -> PALETTEENTRY; other palette stuff
  30. * 29-mar-95 craige removed Eitherxxx caps from DIRECTDRAW
  31. * 31-mar-95 craige use critical sections with palettes
  32. * 04-apr-95 craige palette tweaks
  33. * 06-apr-95 craige split out process list stuff
  34. * 10-apr-95 craige bug 3,16 - palette issues
  35. * 13-apr-95 craige EricEng's little contribution to our being late
  36. * 06-may-95 craige use driver-level csects only
  37. * 09-may-95 craige escape call to get 32-bit DLL
  38. * 14-may-95 craige cleaned out obsolete junk
  39. * 15-may-95 craige made separate VMEM struct for rect & linear
  40. * 24-may-95 kylej removed obsolete ZOrder variables
  41. * 24-may-95 craige removed dwOrigNumHeaps
  42. * 28-may-95 craige cleaned up HAL: added GetBltStatus;GetFlipStatus;
  43. * GetScanLine
  44. * 02-jun-95 craige added PROCESS_LIST2 to DIRECTDRAW object; removed
  45. * hWndPal from DIRECTDRAW object; added lpDDSurface
  46. * to DIRECTDRAWPALETTE object
  47. * 06-jun-95 craige maintain entire primary surface in DIRECTDRAW object
  48. * 07-jun-95 craige moved DCLIST to PROCESSLIST
  49. * 10-jun-95 craige split out vmemmgr stuff
  50. * 12-jun-95 craige new process list stuff
  51. * 16-jun-95 craige removed fpVidMemOrig; new surface structure
  52. * 20-jun-95 kylej added is_excl field to DDHAL_CREATEPALETTEDATA struct
  53. * 21-jun-95 craige added DirectDrawClipper object; removed clipping
  54. * info from surface object
  55. * 22-jun-95 craige more clipping work
  56. * 25-jun-95 craige one ddraw mutex
  57. * 26-jun-95 craige reorganized surface structure
  58. * 27-jun-95 craige added dwModeCreatedIn to surface
  59. * 30-jun-95 kylej removed lpPrimarySurface, dwZDepth, dwAlphaDepth
  60. * from direct draw object. Modified some surface and
  61. * direct draw object flags.
  62. * 01-jul-95 craige hide composition & streaming stuff
  63. * 02-jul-95 craige added extra reserved field for HEL
  64. * 03-jul-95 craige YEEHAW: new driver struct; added pUnkOuter to all objects
  65. * 09-jul-95 craige track win16lock info in driver struct; added
  66. * DDHAL_DRIVER_NOCKEYHW
  67. * 10-jul-95 craige support SetOverlayPosition
  68. * 13-jul-95 craige removed old junk from ddraw object; added new mode stuff;
  69. * changed Get/SetOverlayPosition to use longs;
  70. * fixed duplicate flag in DDRAWIPAL_xxx
  71. * 14-jul-95 craige added VIDMEM_ISHEAP
  72. * 20-jul-95 craige internal reorg to prevent thunking during modeset;
  73. * palette bugs
  74. * 22-jul-95 craige bug 230 - unsupported starting modes
  75. * 29-jul-95 toddla remove unused palette stuff
  76. * 31-jul-95 toddla added DD_HAL_VERSION
  77. * 01-aug-95 toddla added dwPDevice to DDRAWI_DIRECTDRAW_GBL
  78. * 10-aug-95 craige added VALID_ALIGNMENT
  79. * 13-aug-95 craige internal/external version of DD_HAL_VERSION
  80. * 21-aug-95 craige mode X support
  81. * 27-aug-95 craige bug 742: added DDRAWIPAL_ALLOW256
  82. * 08-nov-95 colinmc added DDRAWIPAL flags to support 1, 2 and 4 bit
  83. * RGB and indexed palettes
  84. * 21-nov-95 colinmc made Direct3D a queryable interface off DirectDraw
  85. * 23-nov-95 colinmc made Direct3D textures and devices queryable off
  86. * DirectDraw surfaces
  87. * 09-dec-95 colinmc execute buffer support
  88. * 12-dec-95 colinmc shared back and z-buffer support (run away, run away...)
  89. * 22-dec-95 colinmc Direct3D support no longer conditional
  90. * 02-jan-96 kylej New interface structures, no vtbl in local objects
  91. * 10-jan-96 colinmc Aggregate IUnknowns of surfaces now maintained as
  92. * list
  93. * 18-jan-96 jeffno Changed free entries in DDRAW_GBL and SURFACE_LCL to NT
  94. * kernel-mode handles
  95. * 29-jan-96 colinmc Aggregated IUnknowns now stored in additional
  96. * surface structure
  97. * 09-feb-96 colinmc Addition of lost surface flag to local surface
  98. * objects
  99. * 17-feb-96 colinmc Fixed execute buffer size restriction problem
  100. * 01-mar-96 kylej Change DDCAPS size
  101. * 03-mar-96 colinmc Hack to keep interim drivers working
  102. * 13-mar-96 craige Bug 7528: hw that doesn't have modex
  103. * 14-mar-96 colinmc Class factory support for clippers
  104. * 24-mar-96 colinmc Bug 14321: not possible to specify back buffer and
  105. * mip-map count in a single call
  106. * 13-apr-96 colinmc Bug 17736: no notification to driver of when GDI
  107. * frame buffer is being displayed
  108. * 16-apr-96 kylej Bug 17900: DBLNODE struct incompatible with ddraw 1
  109. * 05-sep-96 craige added dwAppHackFlags to DDRAWI_DIRECTDRAW_LCL struct.
  110. * 01-oct-96 ketand added GetAvailDriverMemory
  111. * 05-oct-96 colinmc Work Item: Removing the restriction on taking Win16
  112. * lock on VRAM surfaces (not including the primary)
  113. * 07-oct-96 colinmc Fixed build breaker with GetAvailDriverMem
  114. * 07-oct-96 ketand Created DDRAWSURFACE_GBL_MORE
  115. * 12-oct-96 colinmc Improvements to Win16 locking code to reduce virtual
  116. * memory usage
  117. * 09-nov-96 colinmc Fixed problem with old and new drivers not working
  118. * with DirectDraw
  119. * 15-nov-96 colinmc Finally removed DDSCAPS_3D and moved the definition
  120. * of DDSCAPS_EXECUTEBUFFER to here so that it was
  121. * visible from the DDK.
  122. * 08-dec-96 colinmc Initial AGP support
  123. * 12-jan-97 colinmc More Win16 lock work
  124. * 13-jan-97 jvanaken Basic support for IDirectDrawSurface3 interface
  125. * 21-jan-97 ketand Deleted Winwatch/Streaming/Composition. Add multi-mon support.
  126. * 27-jan-97 colinmc AGP support
  127. * 29-jan-97 colinmc Fixed build breaker
  128. * 29-jan-97 smac Removed old ring 0 code
  129. * 29-jan-97 jeffno Mode13 support. A new flag in DDMODEINFO.
  130. * 01-feb-97 colinmc Bug 5574: Need to remove USE_ALIAS from headers
  131. * Bug 4665: Extra bytes per surface for driver
  132. * 02-feb-97 colinmc Bug 5625: DirectX drivers not longer be recognized
  133. * due to bad size validation on DDCALLBACKS
  134. * 24-feb-97 ketand Add dwContext to GETDRIVERINFODATA for NT and multimon
  135. * 03-mar-97 smac Added kernel mode interface
  136. * 03-mar-97 jeffno Work item: Extended surface memory alignment
  137. * 08-mar-97 colinmc New function to allow surface pointer to be
  138. * specified
  139. * 11-mar-97 jeffno Asynchronous DMA support
  140. * 23-mar-97 colinmc Bug 6673: Change structure numbering scheme for
  141. * consistency's sake and pass version number to the
  142. * driver. Also update the runtime version number
  143. * passed in the DCI command
  144. * 24-mar-97 jeffno Optimized Surfaces
  145. * 30-sep-97 jeffno IDirectDraw4
  146. * 03-oct-97 jeffno DDSCAPS2 and DDSURFACEDESC2
  147. * 31-oct-97 johnstep Persistent-content surfaces for Windows 9x
  148. * 05-nov-97 jvanaken Support for AlphaBlt and SetSpriteDisplayList
  149. * 26-nov-97 t-craigs IDirectDrawPalette2 and a few changes/additions to Surface4
  150. *@@END_MSINTERNAL
  151. *
  152. ***************************************************************************/
  153. #ifndef __DDRAWI_INCLUDED__
  154. #define __DDRAWI_INCLUDED__
  155. //
  156. // This is a helper for external driver builds.
  157. //
  158. #if (!defined(WIN95)) && (!defined(WINNT))
  159. #define WIN95
  160. #endif
  161. /*
  162. * METAQUESTION: Why are Windows handles stored as DWORDs instead of
  163. * their proper types?
  164. * METAANSWER: To make the thunk to the 16-bit side completely painless.
  165. */
  166. #define OBJECT_ISROOT 0x80000000l // object is root object
  167. /*
  168. * stuff for drivers
  169. */
  170. #ifndef _WIN32
  171. typedef long HRESULT;
  172. typedef LPVOID REFIID;
  173. #ifndef GUID_DEFINED
  174. #define GUID_DEFINED
  175. typedef struct _GUID {
  176. ULONG Data1;
  177. unsigned short Data2;
  178. unsigned short Data3;
  179. unsigned char Data4[8];
  180. } GUID;
  181. #endif // !defined(GUID_DEFINED)
  182. typedef GUID FAR *LPGUID;
  183. #define MAKE_HRESULT(sev,fac,code) \
  184. ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  185. #endif
  186. /*
  187. * These definitions are required to allow polymorphic structure members (i.e. those
  188. * that are referred to both as DWORDs and as pointers) to resolve into a type
  189. * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit
  190. * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD.
  191. */
  192. #ifndef MAXULONG_PTR
  193. #define ULONG_PTR DWORD
  194. #define PULONG_PTR LPDWORD
  195. #endif //MAXULONG_PTR
  196. //@@BEGIN_MSINTERNAL
  197. // Include ddrawp.h for DirectDraw and D3D builds. DDK includes ddraw.h
  198. #ifdef MSBUILD
  199. #include "ddrawp.h"
  200. #include "dvpp.h"
  201. #include "ddkernel.h"
  202. #else
  203. //@@END_MSINTERNAL
  204. #include "ddraw.h"
  205. #include "dvp.h"
  206. #include "ddkernel.h"
  207. //@@BEGIN_MSINTERNAL
  208. #endif
  209. #include "ddmcp.h"
  210. //@@END_MSINTERNAL
  211. #include "dmemmgr.h"
  212. #ifdef IS_16
  213. // ddraw16 16-bit compiler cannot handle 32-bit d3d headers included by d3dhal.h
  214. // so for ddraw16 build, explicitly list d3dhal ptr types here
  215. #define LPD3DHAL_GLOBALDRIVERDATA ULONG_PTR
  216. #define LPD3DHAL_CALLBACKS ULONG_PTR
  217. #define LPD3DHAL_CALLBACKS2 ULONG_PTR
  218. #define LPD3DHAL_CALLBACKS3 ULONG_PTR
  219. #define LPD3DHAL_D3DEXTENDEDCAPS ULONG_PTR
  220. #define LPD3DHAL_COMMANDBUFFERCALLBACKS ULONG_PTR
  221. //@@BEGIN_MSINTERNAL
  222. #else
  223. #include "d3dhalp.h"
  224. //@@END_MSINTERNAL
  225. #endif
  226. #ifndef _WIN32
  227. /*
  228. * these error codes are DIFFERENT in Win32 and Win16!!!!
  229. */
  230. #undef E_NOTIMPL
  231. #undef E_OUTOFMEMORY
  232. #undef E_INVALIDARG
  233. #undef E_FAIL
  234. #define E_NOTIMPL 0x80004001L
  235. #define E_OUTOFMEMORY 0x8007000EL
  236. #define E_INVALIDARG 0x80070057L
  237. #define E_FAIL 0x80004005L
  238. #endif
  239. #define DDUNSUPPORTEDMODE ((DWORD) -1)
  240. #define VALID_ALIGNMENT( align ) (!((align == 0) || (align % 2) != 0 ))
  241. #ifdef _WIN32
  242. /*
  243. * These GUIDs are used to identify driver info structures, not interfaces,
  244. * so the prefix GUID_ is used instead of IID_.
  245. *
  246. */
  247. DEFINE_GUID( GUID_MiscellaneousCallbacks, 0xefd60cc0, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
  248. DEFINE_GUID( GUID_VideoPortCallbacks, 0xefd60cc1, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
  249. DEFINE_GUID( GUID_ColorControlCallbacks, 0xefd60cc2, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
  250. DEFINE_GUID( GUID_VideoPortCaps, 0xefd60cc3, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
  251. DEFINE_GUID( GUID_D3DCallbacks2, 0x0ba584e1, 0x70b6, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
  252. DEFINE_GUID( GUID_D3DCallbacks3, 0xddf41230, 0xec0a, 0x11d0, 0xa9, 0xb6, 0x00, 0xaa, 0x00, 0xc0, 0x99, 0x3e);
  253. DEFINE_GUID( GUID_NonLocalVidMemCaps, 0x86c4fa80, 0x8d84, 0x11d0, 0x94, 0xe8, 0x00, 0xc0, 0x4f, 0xc3, 0x41, 0x37);
  254. DEFINE_GUID( GUID_KernelCallbacks, 0x80863800, 0x6B06, 0x11D0, 0x9B, 0x06, 0x0, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
  255. DEFINE_GUID( GUID_KernelCaps, 0xFFAA7540, 0x7AA8, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
  256. DEFINE_GUID( GUID_D3DExtendedCaps, 0x7de41f80, 0x9d93, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
  257. DEFINE_GUID( GUID_ZPixelFormats, 0x93869880, 0x36cf, 0x11d1, 0x9b, 0x1b, 0x0, 0xaa, 0x0, 0xbb, 0xb8, 0xae);
  258. DEFINE_GUID( GUID_DDMoreSurfaceCaps, 0x3b8a0466, 0xf269, 0x11d1, 0x88, 0x0b, 0x0, 0xc0, 0x4f, 0xd9, 0x30, 0xc5);
  259. DEFINE_GUID( GUID_DDStereoMode, 0xf828169c, 0xa8e8, 0x11d2, 0xa1, 0xf2, 0x0, 0xa0, 0xc9, 0x83, 0xea, 0xf6);
  260. DEFINE_GUID( GUID_OptSurfaceKmodeInfo, 0xe05c8472, 0x51d4, 0x11d1, 0x8c, 0xce, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
  261. DEFINE_GUID( GUID_OptSurfaceUmodeInfo, 0x9d792804, 0x5fa8, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
  262. DEFINE_GUID( GUID_UserModeDriverInfo, 0xf0b0e8e2, 0x5f97, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
  263. DEFINE_GUID( GUID_UserModeDriverPassword, 0x97f861b6, 0x60a1, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
  264. DEFINE_GUID(GUID_D3DParseUnknownCommandCallback, 0x2e04ffa0, 0x98e4, 0x11d1, 0x8c, 0xe1, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
  265. DEFINE_GUID( GUID_MotionCompCallbacks, 0xb1122b40, 0x5dA5, 0x11d1, 0x8f, 0xcF, 0x00, 0xc0, 0x4f, 0xc2, 0x9b, 0x4e);
  266. #ifndef WIN95
  267. DEFINE_GUID( GUID_NTCallbacks, 0x6fe9ecde, 0xdf89, 0x11d1, 0x9d, 0xb0, 0x00, 0x60, 0x08, 0x27, 0x71, 0xba);
  268. #endif
  269. DEFINE_GUID( GUID_Miscellaneous2Callbacks, 0x406B2F00, 0x3E5A, 0x11D1, 0xB6, 0x40, 0x00, 0xAA, 0x00, 0xA1, 0xF9, 0x6A);
  270. //@@BEGIN_MSINTERNAL
  271. DEFINE_GUID( GUID_DDMoreCaps, 0x880baf30, 0xb030, 0x11d0, 0x8e, 0xa7, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b);
  272. //@@END_MSINTERNAL
  273. #endif //_WIN32
  274. // The Callback that the drivers can use to parse unknown commands
  275. // passed to them via the DrawPrimitives2 callback. The driver obtains this
  276. // callback thru a GetDriverInfo call with GUID_D3DParseUnknownCommandCallback
  277. // made by ddraw somewhere around the initialization time.
  278. #ifdef __cplusplus
  279. extern "C"
  280. #endif
  281. HRESULT CALLBACK D3DParseUnknownCommand (LPVOID lpvCommands,
  282. LPVOID *lplpvReturnedCommand);
  283. /*
  284. * This DDPF flag is used by drivers to signify that this format is new and may be
  285. * a candidate for hiding from certain applications
  286. * KEEP THIS DEFINITION IN SYNC WITH THAT OF DDPF_RESERVED1 IN DDRAW.H
  287. */
  288. #define DDPF_NOVEL_TEXTURE_FORMAT 0x00100000l
  289. /*
  290. * List of processes attached to a DirectDraw object
  291. */
  292. typedef struct _PROCESS_LIST
  293. {
  294. struct _PROCESS_LIST FAR *lpLink;
  295. DWORD dwProcessId;
  296. DWORD dwRefCnt;
  297. DWORD dwAlphaDepth;
  298. DWORD dwZDepth;
  299. } PROCESS_LIST;
  300. typedef PROCESS_LIST FAR *LPPROCESS_LIST;
  301. /*
  302. * Information about the refresh rates that monitor/display card can support
  303. */
  304. typedef struct _DDMONITORINFO
  305. {
  306. WORD Manufacturer; // Montor manufacturer
  307. WORD Product; // Monitor product ID
  308. DWORD SerialNumber; // Monitor serial number
  309. GUID DeviceIdentifier; // From DDDEVICEIDENTIFIER, describes card/driver
  310. int Mode640x480; // Highest refresh rate support, 0 if none, -1 if untested
  311. int Mode800x600;
  312. int Mode1024x768;
  313. int Mode1280x1024;
  314. int Mode1600x1200;
  315. int ModeReserved1;
  316. int ModeReserved2;
  317. int ModeReserved3;
  318. } DDMONITORINFO, FAR *LPDDMONITORINFO;
  319. //@@BEGIN_MSINTERNAL
  320. /*
  321. * Mode test context and mode list structures used by StartModeTest API
  322. */
  323. typedef struct _MODETESTDATA
  324. {
  325. DWORD dwWidth;
  326. DWORD dwHeight;
  327. DWORD dwBPP;
  328. DWORD dwRefreshRate;
  329. } MODETESTDATA, * LPMODETESTDATA;
  330. typedef struct _MODETESTCONTEXT
  331. {
  332. DWORD dwTimeStamp;
  333. DWORD dwNumModes;
  334. DWORD dwCurrentMode;
  335. DWORD dwOrigModeIndex;
  336. LPMODETESTDATA lpModeList;
  337. } MODETESTCONTEXT, * LPMODETESTCONTEXT;
  338. //@@END_MSINTERNAL
  339. /*
  340. * DeleteFromActiveProcessList return codes
  341. */
  342. #define DELETED_OK 0
  343. #define DELETED_LASTONE 1
  344. #define DELETED_NOTFOUND 2
  345. #define DDBLT_ANYALPHA \
  346. (DDBLT_ALPHASRCSURFACEOVERRIDE | \
  347. DDBLT_ALPHASRCCONSTOVERRIDE | \
  348. DDBLT_ALPHASRC | \
  349. DDBLT_ALPHADESTSURFACEOVERRIDE | \
  350. DDBLT_ALPHADESTCONSTOVERRIDE | \
  351. DDBLT_ALPHADEST)
  352. #define DDOVER_ANYALPHA \
  353. (DDOVER_ALPHASRCSURFACEOVERRIDE | \
  354. DDOVER_ALPHASRCCONSTOVERRIDE | \
  355. DDOVER_ALPHASRC | \
  356. DDOVER_ALPHADESTSURFACEOVERRIDE | \
  357. DDOVER_ALPHADESTCONSTOVERRIDE | \
  358. DDOVER_ALPHADEST)
  359. typedef struct IDirectDrawClipperVtbl DIRECTDRAWCLIPPERCALLBACKS;
  360. typedef struct IDirectDrawPaletteVtbl DIRECTDRAWPALETTECALLBACKS;
  361. typedef struct IDirectDrawSurfaceVtbl DIRECTDRAWSURFACECALLBACKS;
  362. typedef struct IDirectDrawSurface2Vtbl DIRECTDRAWSURFACE2CALLBACKS;
  363. typedef struct IDirectDrawSurface3Vtbl DIRECTDRAWSURFACE3CALLBACKS;
  364. typedef struct IDirectDrawSurface4Vtbl DIRECTDRAWSURFACE4CALLBACKS;
  365. typedef struct IDirectDrawSurface7Vtbl DIRECTDRAWSURFACE7CALLBACKS;
  366. typedef struct IDirectDrawColorControlVtbl DIRECTDRAWCOLORCONTROLCALLBACKS;
  367. typedef struct IDirectDrawVtbl DIRECTDRAWCALLBACKS;
  368. typedef struct IDirectDraw2Vtbl DIRECTDRAW2CALLBACKS;
  369. typedef struct IDirectDraw4Vtbl DIRECTDRAW4CALLBACKS;
  370. typedef struct IDirectDraw7Vtbl DIRECTDRAW7CALLBACKS;
  371. typedef struct IDirectDrawKernelVtbl DIRECTDRAWKERNELCALLBACKS;
  372. typedef struct IDirectDrawSurfaceKernelVtbl DIRECTDRAWSURFACEKERNELCALLBACKS;
  373. typedef struct IDirectDrawGammaControlVtbl DIRECTDRAWGAMMACONTROLCALLBACKS;
  374. //@@BEGIN_MSINTERNAL
  375. #ifdef POSTPONED
  376. typedef struct IDirectDrawFactory2Vtbl DDFACTORY2CALLBACKS;
  377. typedef struct IDirectDrawPalette2Vtbl DIRECTDRAWPALETTE2CALLBACKS;
  378. typedef struct IPersistVtbl DIRECTDRAWSURFACEPERSISTCALLBACKS;
  379. typedef struct IPersistStreamVtbl DIRECTDRAWSURFACEPERSISTSTREAMCALLBACKS;
  380. typedef struct IPersistVtbl DIRECTDRAWPALETTEPERSISTCALLBACKS;
  381. typedef struct IPersistStreamVtbl DIRECTDRAWPALETTEPERSISTSTREAMCALLBACKS;
  382. typedef struct IDirectDrawOptSurfaceVtbl DIRECTDRAWOPTSURFACECALLBACKS;
  383. #endif //POSTPONED
  384. //@@END_MSINTERNAL
  385. typedef DIRECTDRAWCLIPPERCALLBACKS FAR *LPDIRECTDRAWCLIPPERCALLBACKS;
  386. typedef DIRECTDRAWPALETTECALLBACKS FAR *LPDIRECTDRAWPALETTECALLBACKS;
  387. typedef DIRECTDRAWSURFACECALLBACKS FAR *LPDIRECTDRAWSURFACECALLBACKS;
  388. typedef DIRECTDRAWCALLBACKS FAR *LPDIRECTDRAWCALLBACKS;
  389. #ifdef __cplusplus
  390. extern "C" {
  391. #endif
  392. #if defined( IS_32 ) || defined( WIN32 ) || defined( _WIN32 )
  393. #undef IS_32
  394. #define IS_32
  395. #define DDAPI WINAPI
  396. #define EXTERN_DDAPI WINAPI
  397. #else
  398. #define DDAPI __loadds WINAPI
  399. #define EXTERN_DDAPI __export WINAPI
  400. #endif
  401. //@@BEGIN_MSINTERNAL
  402. #ifdef POSTPONED
  403. typedef struct _NONDELEGATINGUNKNOWNCALLBACKS
  404. {
  405. HRESULT (DDAPI *QueryInterface) (LPDIRECTDRAW, REFIID, LPVOID FAR * );
  406. DWORD (DDAPI *AddRef) (LPDIRECTDRAW);
  407. DWORD (DDAPI *Release) (LPDIRECTDRAW);
  408. } NONDELEGATINGUNKNOWNCALLBACKS;
  409. #endif
  410. //@@END_MSINTERNAL
  411. /*
  412. * DCI escape
  413. */
  414. #ifndef DCICOMMAND
  415. #define DCICOMMAND 3075 // escape value
  416. #endif
  417. /*
  418. * this is the DirectDraw version
  419. * passed to the driver in DCICMD.dwVersion
  420. *
  421. * Most older HALs will fail if DD_VERSION does not match what they
  422. * are expecting. Therefore, DD_VERSION cannot change if we want DX5+ to
  423. * run on DX2/3 HALs. For this reason, we added a new version call that
  424. * allows the HAL to know the real version of DirectDraw, which is equal
  425. * to DD_RUNTIME_VERSION. This is for informational purposes only. HALs
  426. * should not fail DirectDraw if they receive an unknown DirectDraw runtime
  427. * version.
  428. */
  429. #define DD_VERSION 0x00000200l
  430. #define DD_RUNTIME_VERSION 0x00000700l
  431. /*
  432. * this is the HAL version.
  433. * the driver returns this number from QUERYESCSUPPORT/DCICOMMAND
  434. */
  435. #define DD_HAL_VERSION 0x0100
  436. //@@BEGIN_MSINTERNAL
  437. #define DD_HAL_VERSION_EXTERNAL 0x0100
  438. #undef DD_HAL_VERSION
  439. #define DD_HAL_VERSION 0x00ff // special internal version
  440. //@@END_MSINTERNAL
  441. #include "dciddi.h"
  442. #define DDCREATEDRIVEROBJECT 10 // create an object
  443. #define DDGET32BITDRIVERNAME 11 // get a 32-bit driver name
  444. #define DDNEWCALLBACKFNS 12 // new callback fns coming
  445. #define DDVERSIONINFO 13 // tells driver the ddraw version
  446. typedef struct
  447. {
  448. char szName[260]; // 32-bit driver name
  449. char szEntryPoint[64]; // entry point
  450. DWORD dwContext; // context to pass to entry point
  451. } DD32BITDRIVERDATA, FAR *LPDD32BITDRIVERDATA;
  452. typedef struct
  453. {
  454. DWORD dwHALVersion; // Version of DirectDraw for which the HAL was created
  455. ULONG_PTR dwReserved1; // Reserved for future use
  456. ULONG_PTR dwReserved2; // Reserved for future use
  457. } DDVERSIONDATA, FAR *LPDDVERSIONDATA;
  458. typedef DWORD (FAR PASCAL *LPDD32BITDRIVERINIT)(DWORD dwContext);
  459. /*
  460. * pointer to video meory
  461. */
  462. typedef ULONG_PTR FLATPTR;
  463. /*
  464. * indicates that DDRAW.DLL has been unloaded...
  465. */
  466. #define DDRAW_DLL_UNLOADED (LPVOID) 1
  467. /*
  468. * critical section types
  469. */
  470. typedef LPVOID CSECT_HANDLE;
  471. #ifdef NOUSE_CRITSECTS
  472. typedef xxx CSECT; // generate an error for now
  473. #else
  474. #if defined( IS_32 ) && !defined( _NOCSECT_TYPE )
  475. typedef CRITICAL_SECTION CSECT;
  476. typedef CSECT *LPCSECT;
  477. #else
  478. typedef struct
  479. {
  480. DWORD vals[6];
  481. } CSECT;
  482. typedef void FAR *LPCSECT;
  483. #endif
  484. #endif
  485. /*
  486. * DLL names
  487. */
  488. #define DDHAL_DRIVER_DLLNAME "DDRAW16.DLL"
  489. #define DDHAL_APP_DLLNAME "DDRAW.DLL"
  490. /*
  491. * maximum size of a driver name
  492. */
  493. #ifndef CCHDEVICENAME
  494. #define CCHDEVICENAME 32
  495. #endif
  496. #define MAX_DRIVER_NAME CCHDEVICENAME
  497. /*
  498. * largest palette supported
  499. */
  500. #define MAX_PALETTE_SIZE 256
  501. /*
  502. * maximum number of surfaces that can be autoflipped between
  503. */
  504. #define MAX_AUTOFLIP_BUFFERS 10
  505. /*
  506. * Indicates the surface is an execute buffer, i.e., a linear chunk of system
  507. * or video memory that holds a Direct3D display list. A driver reports this
  508. * cap to indicate that it can create execute buffers in video memory and
  509. * Direct3D uses this bit to request execute buffers. However, it is not
  510. * visible to via the API.
  511. */
  512. #define DDSCAPS_EXECUTEBUFFER DDSCAPS_RESERVED2
  513. /*
  514. * Indicates to the driver that the "execute" buffer that is to be created is actually
  515. * a vertex buffer. Used by CreateVertexBuffer in D3D
  516. */
  517. #define DDSCAPS2_VERTEXBUFFER DDSCAPS2_RESERVED1
  518. /*
  519. * Indicates to the driver that the "execute" buffer that is to be created is actually
  520. * a command buffer. Used by internally in D3D
  521. */
  522. #define DDSCAPS2_COMMANDBUFFER DDSCAPS2_RESERVED2
  523. /*
  524. * pre-declare pointers to structs containing data for DDHAL fns
  525. */
  526. typedef struct _DDHAL_CREATEPALETTEDATA FAR *LPDDHAL_CREATEPALETTEDATA;
  527. typedef struct _DDHAL_CREATESURFACEDATA FAR *LPDDHAL_CREATESURFACEDATA;
  528. typedef struct _DDHAL_CANCREATESURFACEDATA FAR *LPDDHAL_CANCREATESURFACEDATA;
  529. typedef struct _DDHAL_WAITFORVERTICALBLANKDATA FAR *LPDDHAL_WAITFORVERTICALBLANKDATA;
  530. typedef struct _DDHAL_DESTROYDRIVERDATA FAR *LPDDHAL_DESTROYDRIVERDATA;
  531. typedef struct _DDHAL_SETMODEDATA FAR *LPDDHAL_SETMODEDATA;
  532. typedef struct _DDHAL_DRVSETCOLORKEYDATA FAR *LPDDHAL_DRVSETCOLORKEYDATA;
  533. typedef struct _DDHAL_GETSCANLINEDATA FAR *LPDDHAL_GETSCANLINEDATA;
  534. typedef struct _DDHAL_DESTROYPALETTEDATA FAR *LPDDHAL_DESTROYPALETTEDATA;
  535. typedef struct _DDHAL_SETENTRIESDATA FAR *LPDDHAL_SETENTRIESDATA;
  536. typedef struct _DDHAL_BLTDATA FAR *LPDDHAL_BLTDATA;
  537. typedef struct _DDHAL_LOCKDATA FAR *LPDDHAL_LOCKDATA;
  538. typedef struct _DDHAL_UNLOCKDATA FAR *LPDDHAL_UNLOCKDATA;
  539. typedef struct _DDHAL_UPDATEOVERLAYDATA FAR *LPDDHAL_UPDATEOVERLAYDATA;
  540. typedef struct _DDHAL_SETOVERLAYPOSITIONDATA FAR *LPDDHAL_SETOVERLAYPOSITIONDATA;
  541. typedef struct _DDHAL_SETPALETTEDATA FAR *LPDDHAL_SETPALETTEDATA;
  542. typedef struct _DDHAL_FLIPDATA FAR *LPDDHAL_FLIPDATA;
  543. typedef struct _DDHAL_DESTROYSURFACEDATA FAR *LPDDHAL_DESTROYSURFACEDATA;
  544. typedef struct _DDHAL_SETCLIPLISTDATA FAR *LPDDHAL_SETCLIPLISTDATA;
  545. typedef struct _DDHAL_ADDATTACHEDSURFACEDATA FAR *LPDDHAL_ADDATTACHEDSURFACEDATA;
  546. typedef struct _DDHAL_SETCOLORKEYDATA FAR *LPDDHAL_SETCOLORKEYDATA;
  547. typedef struct _DDHAL_GETBLTSTATUSDATA FAR *LPDDHAL_GETBLTSTATUSDATA;
  548. typedef struct _DDHAL_GETFLIPSTATUSDATA FAR *LPDDHAL_GETFLIPSTATUSDATA;
  549. typedef struct _DDHAL_SETEXCLUSIVEMODEDATA FAR *LPDDHAL_SETEXCLUSIVEMODEDATA;
  550. typedef struct _DDHAL_FLIPTOGDISURFACEDATA FAR *LPDDHAL_FLIPTOGDISURFACEDATA;
  551. typedef struct _DDHAL_CANCREATEVPORTDATA FAR *LPDDHAL_CANCREATEVPORTDATA;
  552. typedef struct _DDHAL_CREATEVPORTDATA FAR *LPDDHAL_CREATEVPORTDATA;
  553. typedef struct _DDHAL_FLIPVPORTDATA FAR *LPDDHAL_FLIPVPORTDATA;
  554. typedef struct _DDHAL_GETVPORTCONNECTDATA FAR *LPDDHAL_GETVPORTCONNECTDATA;
  555. typedef struct _DDHAL_GETVPORTBANDWIDTHDATA FAR *LPDDHAL_GETVPORTBANDWIDTHDATA;
  556. typedef struct _DDHAL_GETVPORTINPUTFORMATDATA FAR *LPDDHAL_GETVPORTINPUTFORMATDATA;
  557. typedef struct _DDHAL_GETVPORTOUTPUTFORMATDATA FAR *LPDDHAL_GETVPORTOUTPUTFORMATDATA;
  558. typedef struct _DDHAL_GETVPORTFIELDDATA FAR *LPDDHAL_GETVPORTFIELDDATA;
  559. typedef struct _DDHAL_GETVPORTLINEDATA FAR *LPDDHAL_GETVPORTLINEDATA;
  560. typedef struct _DDHAL_DESTROYVPORTDATA FAR *LPDDHAL_DESTROYVPORTDATA;
  561. typedef struct _DDHAL_GETVPORTFLIPSTATUSDATA FAR *LPDDHAL_GETVPORTFLIPSTATUSDATA;
  562. typedef struct _DDHAL_UPDATEVPORTDATA FAR *LPDDHAL_UPDATEVPORTDATA;
  563. typedef struct _DDHAL_WAITFORVPORTSYNCDATA FAR *LPDDHAL_WAITFORVPORTSYNCDATA;
  564. typedef struct _DDHAL_GETVPORTSIGNALDATA FAR *LPDDHAL_GETVPORTSIGNALDATA;
  565. typedef struct _DDHAL_VPORTCOLORDATA FAR *LPDDHAL_VPORTCOLORDATA;
  566. typedef struct _DDHAL_COLORCONTROLDATA FAR *LPDDHAL_COLORCONTROLDATA;
  567. typedef struct _DDHAL_GETAVAILDRIVERMEMORYDATA FAR *LPDDHAL_GETAVAILDRIVERMEMORYDATA;
  568. typedef struct _DDHAL_UPDATENONLOCALHEAPDATA FAR *LPDDHAL_UPDATENONLOCALHEAPDATA;
  569. typedef struct _DDHAL_GETHEAPALIGNMENTDATA FAR *LPDDHAL_GETHEAPALIGNMENTDATA;
  570. typedef struct _DDHAL_GETDRIVERINFODATA FAR *LPDDHAL_GETDRIVERINFODATA;
  571. typedef struct _DDHAL_SYNCSURFACEDATA FAR *LPDDHAL_SYNCSURFACEDATA;
  572. typedef struct _DDHAL_SYNCVIDEOPORTDATA FAR *LPDDHAL_SYNCVIDEOPORTDATA;
  573. typedef struct _DDHAL_GETMOCOMPGUIDSDATA FAR *LPDDHAL_GETMOCOMPGUIDSDATA;
  574. typedef struct _DDHAL_GETMOCOMPFORMATSDATA FAR *LPDDHAL_GETMOCOMPFORMATSDATA;
  575. typedef struct _DDHAL_CREATEMOCOMPDATA FAR *LPDDHAL_CREATEMOCOMPDATA;
  576. typedef struct _DDHAL_GETMOCOMPCOMPBUFFDATA FAR *LPDDHAL_GETMOCOMPCOMPBUFFDATA;
  577. typedef struct _DDHAL_GETINTERNALMOCOMPDATA FAR *LPDDHAL_GETINTERNALMOCOMPDATA;
  578. typedef struct _DDHAL_BEGINMOCOMPFRAMEDATA FAR *LPDDHAL_BEGINMOCOMPFRAMEDATA;
  579. typedef struct _DDHAL_ENDMOCOMPFRAMEDATA FAR *LPDDHAL_ENDMOCOMPFRAMEDATA;
  580. typedef struct _DDHAL_RENDERMOCOMPDATA FAR *LPDDHAL_RENDERMOCOMPDATA;
  581. typedef struct _DDHAL_QUERYMOCOMPSTATUSDATA FAR *LPDDHAL_QUERYMOCOMPSTATUSDATA;
  582. typedef struct _DDHAL_DESTROYMOCOMPDATA FAR *LPDDHAL_DESTROYMOCOMPDATA;
  583. typedef struct _DDHAL_CREATESURFACEEXDATA FAR *LPDDHAL_CREATESURFACEEXDATA;
  584. typedef struct _DDHAL_GETDRIVERSTATEDATA FAR *LPDDHAL_GETDRIVERSTATEDATA;
  585. typedef struct _DDHAL_DESTROYDDLOCALDATA FAR *LPDDHAL_DESTROYDDLOCALDATA;
  586. //@@BEGIN_MSINTERNAL
  587. #ifdef POSTPONED2
  588. typedef struct _DDHAL_SETSPRITEDISPLAYLISTDATA FAR *LPDDHAL_SETSPRITEDISPLAYLISTDATA;
  589. typedef struct _DDHAL_RESIZEDATA FAR *LPDDHAL_RESIZEDATA;
  590. typedef struct _DDHAL_CAPTURECOMPOSITIONBUFFERDATA FAR *LPDDHAL_CAPTURECOMPOSITIONBUFFERDATA;
  591. #endif //POSTPONED2
  592. //@@END_MSINTERNAL
  593. /*
  594. * value in the fpVidMem; indicates dwBlockSize is valid (surface object)
  595. */
  596. #define DDHAL_PLEASEALLOC_BLOCKSIZE 0x00000002l
  597. /*
  598. * Values in fpVidMem: Indicates dwLinearSizde is valid.
  599. * THIS VALUE CAN ONLY BE USED BY A D3D Optimize DRIVER FUNCTION
  600. * IT IS INVALID FOR A DRIVER TO RETURN THIS VALUE FROM CreateSurface32.
  601. */
  602. #define DDHAL_PLEASEALLOC_LINEARSIZE 0x00000003l
  603. /*
  604. * DRIVER SERVICES
  605. *
  606. * These services exported from ddraw.dll can be called by the HAL.
  607. * They are intended for use by the d3d Optimize HAL call.
  608. */
  609. extern HRESULT DDAPI LateAllocateSurfaceMem(
  610. LPDIRECTDRAWSURFACE lpSurface,
  611. DWORD dwPleaseAllocType,
  612. DWORD dwWidthInBytesOrSize,
  613. DWORD dwHeight);
  614. LPDIRECTDRAWSURFACE GetNextMipMap(
  615. LPDIRECTDRAWSURFACE lpLevel);
  616. /*
  617. * video memory data structures (passed in DDHALINFO)
  618. */
  619. typedef struct _VIDMEM
  620. {
  621. DWORD dwFlags; // flags
  622. FLATPTR fpStart; // start of memory chunk
  623. union
  624. {
  625. FLATPTR fpEnd; // end of memory chunk
  626. DWORD dwWidth; // width of chunk (rectanglar memory)
  627. };
  628. DDSCAPS ddsCaps; // what this memory CANNOT be used for
  629. DDSCAPS ddsCapsAlt; // what this memory CANNOT be used for if it must
  630. union
  631. {
  632. LPVMEMHEAP lpHeap; // heap pointer, used by DDRAW
  633. DWORD dwHeight; // height of chunk (rectanguler memory)
  634. };
  635. } VIDMEM;
  636. typedef VIDMEM FAR *LPVIDMEM;
  637. /*
  638. * flags for vidmem struct
  639. */
  640. #define VIDMEM_ISLINEAR 0x00000001l // heap is linear
  641. #define VIDMEM_ISRECTANGULAR 0x00000002l // heap is rectangular
  642. #define VIDMEM_ISHEAP 0x00000004l // heap is preallocated by driver
  643. #define VIDMEM_ISNONLOCAL 0x00000008l // heap populated with non-local video memory
  644. #define VIDMEM_ISWC 0x00000010l // heap populated with write combining memory
  645. #define VIDMEM_HEAPDISABLED 0x00000020l // heap disabled
  646. typedef struct _VIDMEMINFO
  647. {
  648. /* 0*/ FLATPTR fpPrimary; // pointer to primary surface
  649. /* 4*/ DWORD dwFlags; // flags
  650. /* 8*/ DWORD dwDisplayWidth; // current display width
  651. /* c*/ DWORD dwDisplayHeight; // current display height
  652. /*10*/ LONG lDisplayPitch; // current display pitch
  653. /*14*/ DDPIXELFORMAT ddpfDisplay; // pixel format of display
  654. /*34*/ DWORD dwOffscreenAlign; // byte alignment for offscreen surfaces
  655. /*38*/ DWORD dwOverlayAlign; // byte alignment for overlays
  656. /*3c*/ DWORD dwTextureAlign; // byte alignment for textures
  657. /*40*/ DWORD dwZBufferAlign; // byte alignment for z buffers
  658. /*44*/ DWORD dwAlphaAlign; // byte alignment for alpha
  659. /*48*/ DWORD dwNumHeaps; // number of memory heaps in vmList
  660. /*4c*/ LPVIDMEM pvmList; // array of heaps
  661. } VIDMEMINFO;
  662. typedef VIDMEMINFO FAR *LPVIDMEMINFO;
  663. typedef struct _HEAPALIAS // PRIVATE
  664. {
  665. FLATPTR fpVidMem; // start of aliased vid mem
  666. LPVOID lpAlias; // start of heap alias
  667. DWORD dwAliasSize; // size of alias allocated
  668. } HEAPALIAS;
  669. typedef HEAPALIAS FAR *LPHEAPALIAS;
  670. typedef struct _HEAPALIASINFO // PRIVATE
  671. {
  672. DWORD dwRefCnt; // reference count of these aliases
  673. DWORD dwFlags; // flags
  674. DWORD dwNumHeaps; // number of aliased heaps
  675. LPHEAPALIAS lpAliases; // array of heaps
  676. } HEAPALIASINFO;
  677. typedef HEAPALIASINFO FAR *LPHEAPALIASINFO;
  678. #define HEAPALIASINFO_MAPPEDREAL 0x00000001l // PRIVATE: heap aliases mapped to real video memory
  679. #define HEAPALIASINFO_MAPPEDDUMMY 0x00000002l // PRIVATE: heap aliased mapped to dummy memory
  680. typedef struct _DDRAWI_DIRECTDRAW_INT FAR *LPDDRAWI_DIRECTDRAW_INT;
  681. typedef struct _DDRAWI_DIRECTDRAW_LCL FAR *LPDDRAWI_DIRECTDRAW_LCL;
  682. typedef struct _DDRAWI_DIRECTDRAW_GBL FAR *LPDDRAWI_DIRECTDRAW_GBL;
  683. typedef struct _DDRAWI_DDRAWSURFACE_GBL FAR *LPDDRAWI_DDRAWSURFACE_GBL;
  684. typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE FAR *LPDDRAWI_DDRAWSURFACE_GBL_MORE;
  685. typedef struct _DDRAWI_DDRAWPALETTE_GBL FAR *LPDDRAWI_DDRAWPALETTE_GBL;
  686. typedef struct _DDRAWI_DDRAWPALETTE_INT FAR *LPDDRAWI_DDRAWPALETTE_INT;
  687. typedef struct _DDRAWI_DDRAWCLIPPER_INT FAR *LPDDRAWI_DDRAWCLIPPER_INT;
  688. typedef struct _DDRAWI_DDRAWCLIPPER_GBL FAR *LPDDRAWI_DDRAWCLIPPER_GBL;
  689. typedef struct _DDRAWI_DDRAWSURFACE_MORE FAR *LPDDRAWI_DDRAWSURFACE_MORE;
  690. typedef struct _DDRAWI_DDRAWSURFACE_LCL FAR *LPDDRAWI_DDRAWSURFACE_LCL;
  691. typedef struct _DDRAWI_DDRAWSURFACE_INT FAR *LPDDRAWI_DDRAWSURFACE_INT;
  692. typedef struct _DDRAWI_DDVIDEOPORT_INT FAR *LPDDRAWI_DDVIDEOPORT_INT;
  693. typedef struct _DDRAWI_DDVIDEOPORT_LCL FAR *LPDDRAWI_DDVIDEOPORT_LCL;
  694. typedef struct _DDRAWI_DDRAWPALETTE_LCL FAR *LPDDRAWI_DDRAWPALETTE_LCL;
  695. typedef struct _DDRAWI_DDRAWCLIPPER_LCL FAR *LPDDRAWI_DDRAWCLIPPER_LCL;
  696. typedef struct _DDRAWI_DDMOTIONCOMP_INT FAR *LPDDRAWI_DDMOTIONCOMP_INT;
  697. typedef struct _DDRAWI_DDMOTIONCOMP_LCL FAR *LPDDRAWI_DDMOTIONCOMP_LCL;
  698. /*
  699. * List of IUnknowns aggregated by a DirectDraw surface.
  700. */
  701. typedef struct _IUNKNOWN_LIST
  702. {
  703. struct _IUNKNOWN_LIST FAR *lpLink;
  704. GUID FAR *lpGuid;
  705. IUnknown FAR *lpIUnknown;
  706. } IUNKNOWN_LIST;
  707. typedef IUNKNOWN_LIST FAR *LPIUNKNOWN_LIST;
  708. /*
  709. * hardware emulation layer stuff
  710. */
  711. typedef BOOL (FAR PASCAL *LPDDHEL_INIT)(LPDDRAWI_DIRECTDRAW_GBL,BOOL);
  712. /*
  713. * These structures contain the entry points in the display driver that
  714. * DDRAW will call. Entries that the display driver does not care about
  715. * should be NULL. Passed to DDRAW in DDHALINFO.
  716. */
  717. /*
  718. * DIRECTDRAW object callbacks
  719. */
  720. typedef DWORD (FAR PASCAL *LPDDHAL_SETCOLORKEY)(LPDDHAL_DRVSETCOLORKEYDATA );
  721. typedef DWORD (FAR PASCAL *LPDDHAL_CANCREATESURFACE)(LPDDHAL_CANCREATESURFACEDATA );
  722. typedef DWORD (FAR PASCAL *LPDDHAL_WAITFORVERTICALBLANK)(LPDDHAL_WAITFORVERTICALBLANKDATA );
  723. typedef DWORD (FAR PASCAL *LPDDHAL_CREATESURFACE)(LPDDHAL_CREATESURFACEDATA);
  724. typedef DWORD (FAR PASCAL *LPDDHAL_DESTROYDRIVER)(LPDDHAL_DESTROYDRIVERDATA);
  725. typedef DWORD (FAR PASCAL *LPDDHAL_SETMODE)(LPDDHAL_SETMODEDATA);
  726. typedef DWORD (FAR PASCAL *LPDDHAL_CREATEPALETTE)(LPDDHAL_CREATEPALETTEDATA);
  727. typedef DWORD (FAR PASCAL *LPDDHAL_GETSCANLINE)(LPDDHAL_GETSCANLINEDATA);
  728. typedef DWORD (FAR PASCAL *LPDDHAL_SETEXCLUSIVEMODE)(LPDDHAL_SETEXCLUSIVEMODEDATA);
  729. typedef DWORD (FAR PASCAL *LPDDHAL_FLIPTOGDISURFACE)(LPDDHAL_FLIPTOGDISURFACEDATA);
  730. typedef DWORD (FAR PASCAL *LPDDHAL_GETDRIVERINFO)(LPDDHAL_GETDRIVERINFODATA);
  731. typedef struct _DDHAL_DDCALLBACKS
  732. {
  733. DWORD dwSize;
  734. DWORD dwFlags;
  735. LPDDHAL_DESTROYDRIVER DestroyDriver;
  736. LPDDHAL_CREATESURFACE CreateSurface;
  737. LPDDHAL_SETCOLORKEY SetColorKey;
  738. LPDDHAL_SETMODE SetMode;
  739. LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
  740. LPDDHAL_CANCREATESURFACE CanCreateSurface;
  741. LPDDHAL_CREATEPALETTE CreatePalette;
  742. LPDDHAL_GETSCANLINE GetScanLine;
  743. // *** New fields for DX2 *** //
  744. LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode;
  745. LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface;
  746. //@@BEGIN_MSINTERNAL
  747. // For backward compatibility with pre-DX5 runtimes, must not
  748. // add fields to this structure. Use GetDriverInfo instead.
  749. //@@END_MSINTERNAL
  750. } DDHAL_DDCALLBACKS;
  751. typedef DDHAL_DDCALLBACKS FAR *LPDDHAL_DDCALLBACKS;
  752. #define DDCALLBACKSSIZE_V1 ( offsetof( DDHAL_DDCALLBACKS, SetExclusiveMode ) )
  753. #define DDCALLBACKSSIZE sizeof( DDHAL_DDCALLBACKS )
  754. #define DDHAL_CB32_DESTROYDRIVER 0x00000001l
  755. #define DDHAL_CB32_CREATESURFACE 0x00000002l
  756. #define DDHAL_CB32_SETCOLORKEY 0x00000004l
  757. #define DDHAL_CB32_SETMODE 0x00000008l
  758. #define DDHAL_CB32_WAITFORVERTICALBLANK 0x00000010l
  759. #define DDHAL_CB32_CANCREATESURFACE 0x00000020l
  760. #define DDHAL_CB32_CREATEPALETTE 0x00000040l
  761. #define DDHAL_CB32_GETSCANLINE 0x00000080l
  762. #define DDHAL_CB32_SETEXCLUSIVEMODE 0x00000100l
  763. #define DDHAL_CB32_FLIPTOGDISURFACE 0x00000200l
  764. /*
  765. * DIRECTDRAWPALETTE object callbacks
  766. */
  767. typedef DWORD (FAR PASCAL *LPDDHALPALCB_DESTROYPALETTE)(LPDDHAL_DESTROYPALETTEDATA );
  768. typedef DWORD (FAR PASCAL *LPDDHALPALCB_SETENTRIES)(LPDDHAL_SETENTRIESDATA );
  769. typedef struct _DDHAL_DDPALETTECALLBACKS
  770. {
  771. DWORD dwSize;
  772. DWORD dwFlags;
  773. LPDDHALPALCB_DESTROYPALETTE DestroyPalette;
  774. LPDDHALPALCB_SETENTRIES SetEntries;
  775. } DDHAL_DDPALETTECALLBACKS;
  776. typedef DDHAL_DDPALETTECALLBACKS FAR *LPDDHAL_DDPALETTECALLBACKS;
  777. #define DDPALETTECALLBACKSSIZE sizeof( DDHAL_DDPALETTECALLBACKS )
  778. #define DDHAL_PALCB32_DESTROYPALETTE 0x00000001l
  779. #define DDHAL_PALCB32_SETENTRIES 0x00000002l
  780. /*
  781. * DIRECTDRAWSURFACE object callbacks
  782. */
  783. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_LOCK)(LPDDHAL_LOCKDATA);
  784. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_UNLOCK)(LPDDHAL_UNLOCKDATA);
  785. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_BLT)(LPDDHAL_BLTDATA);
  786. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_UPDATEOVERLAY)(LPDDHAL_UPDATEOVERLAYDATA);
  787. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETOVERLAYPOSITION)(LPDDHAL_SETOVERLAYPOSITIONDATA);
  788. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETPALETTE)(LPDDHAL_SETPALETTEDATA);
  789. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_FLIP)(LPDDHAL_FLIPDATA);
  790. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_DESTROYSURFACE)(LPDDHAL_DESTROYSURFACEDATA);
  791. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETCLIPLIST)(LPDDHAL_SETCLIPLISTDATA);
  792. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_ADDATTACHEDSURFACE)(LPDDHAL_ADDATTACHEDSURFACEDATA);
  793. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETCOLORKEY)(LPDDHAL_SETCOLORKEYDATA);
  794. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_GETBLTSTATUS)(LPDDHAL_GETBLTSTATUSDATA);
  795. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_GETFLIPSTATUS)(LPDDHAL_GETFLIPSTATUSDATA);
  796. typedef struct _DDHAL_DDSURFACECALLBACKS
  797. {
  798. DWORD dwSize;
  799. DWORD dwFlags;
  800. LPDDHALSURFCB_DESTROYSURFACE DestroySurface;
  801. LPDDHALSURFCB_FLIP Flip;
  802. LPDDHALSURFCB_SETCLIPLIST SetClipList;
  803. LPDDHALSURFCB_LOCK Lock;
  804. LPDDHALSURFCB_UNLOCK Unlock;
  805. LPDDHALSURFCB_BLT Blt;
  806. LPDDHALSURFCB_SETCOLORKEY SetColorKey;
  807. LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface;
  808. LPDDHALSURFCB_GETBLTSTATUS GetBltStatus;
  809. LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus;
  810. LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay;
  811. LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition;
  812. LPVOID reserved4;
  813. LPDDHALSURFCB_SETPALETTE SetPalette;
  814. } DDHAL_DDSURFACECALLBACKS;
  815. typedef DDHAL_DDSURFACECALLBACKS FAR *LPDDHAL_DDSURFACECALLBACKS;
  816. #define DDSURFACECALLBACKSSIZE sizeof( DDHAL_DDSURFACECALLBACKS )
  817. #define DDHAL_SURFCB32_DESTROYSURFACE 0x00000001l
  818. #define DDHAL_SURFCB32_FLIP 0x00000002l
  819. #define DDHAL_SURFCB32_SETCLIPLIST 0x00000004l
  820. #define DDHAL_SURFCB32_LOCK 0x00000008l
  821. #define DDHAL_SURFCB32_UNLOCK 0x00000010l
  822. #define DDHAL_SURFCB32_BLT 0x00000020l
  823. #define DDHAL_SURFCB32_SETCOLORKEY 0x00000040l
  824. #define DDHAL_SURFCB32_ADDATTACHEDSURFACE 0x00000080l
  825. #define DDHAL_SURFCB32_GETBLTSTATUS 0x00000100l
  826. #define DDHAL_SURFCB32_GETFLIPSTATUS 0x00000200l
  827. #define DDHAL_SURFCB32_UPDATEOVERLAY 0x00000400l
  828. #define DDHAL_SURFCB32_SETOVERLAYPOSITION 0x00000800l
  829. #define DDHAL_SURFCB32_RESERVED4 0x00001000l
  830. #define DDHAL_SURFCB32_SETPALETTE 0x00002000l
  831. // This structure can be queried from the driver from DX5 onward
  832. // using GetDriverInfo with GUID_MiscellaneousCallbacks
  833. typedef DWORD (FAR PASCAL *LPDDHAL_GETAVAILDRIVERMEMORY)(LPDDHAL_GETAVAILDRIVERMEMORYDATA);
  834. typedef DWORD (FAR PASCAL *LPDDHAL_UPDATENONLOCALHEAP)(LPDDHAL_UPDATENONLOCALHEAPDATA);
  835. typedef DWORD (FAR PASCAL *LPDDHAL_GETHEAPALIGNMENT)(LPDDHAL_GETHEAPALIGNMENTDATA);
  836. /*
  837. * This prototype is identical to that of GetBltStatus
  838. */
  839. typedef struct _DDHAL_DDMISCELLANEOUSCALLBACKS {
  840. DWORD dwSize;
  841. DWORD dwFlags;
  842. LPDDHAL_GETAVAILDRIVERMEMORY GetAvailDriverMemory;
  843. LPDDHAL_UPDATENONLOCALHEAP UpdateNonLocalHeap;
  844. LPDDHAL_GETHEAPALIGNMENT GetHeapAlignment;
  845. /*
  846. * The GetSysmemBltStatus callback uses the same prototype as GetBltStatus.
  847. * It is legal to point both pointers to the same driver routine.
  848. */
  849. LPDDHALSURFCB_GETBLTSTATUS GetSysmemBltStatus;
  850. } DDHAL_DDMISCELLANEOUSCALLBACKS, *LPDDHAL_DDMISCELLANEOUSCALLBACKS;
  851. #define DDHAL_MISCCB32_GETAVAILDRIVERMEMORY 0x00000001l
  852. #define DDHAL_MISCCB32_UPDATENONLOCALHEAP 0x00000002l
  853. #define DDHAL_MISCCB32_GETHEAPALIGNMENT 0x00000004l
  854. #define DDHAL_MISCCB32_GETSYSMEMBLTSTATUS 0x00000008l
  855. #define DDMISCELLANEOUSCALLBACKSSIZE sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS)
  856. //@@BEGIN_MSINTERNAL
  857. #ifndef WIN95
  858. // This structure can be queried from the driver from NT5 onward
  859. // using GetDriverInfo with GUID_NTCallbacks
  860. typedef DWORD (FAR PASCAL *LPDDHAL_SETEXCLUSIVEMODE)(LPDDHAL_SETEXCLUSIVEMODEDATA);
  861. typedef DWORD (FAR PASCAL *LPDDHAL_FLIPTOGDISURFACE)(LPDDHAL_FLIPTOGDISURFACEDATA);
  862. typedef struct _DDHAL_DDNTCALLBACKS {
  863. DWORD dwSize;
  864. DWORD dwFlags;
  865. LPVOID FreeDriverMemory; // kernel-mode only
  866. LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode;
  867. LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface;
  868. } DDHAL_DDNTCALLBACKS, *LPDDHAL_DDNTCALLBACKS;
  869. #define DDHAL_NTCB32_FREEDRIVERMEMORY 0x00000001l
  870. #define DDHAL_NTCB32_SETEXCLUSIVEMODE 0x00000002l
  871. #define DDHAL_NTCB32_FLIPTOGDISURFACE 0x00000004l
  872. #define DDNTCALLBACKSSIZE sizeof(DDHAL_DDNTCALLBACKS)
  873. #endif //WINNT
  874. //@@END_MSINTERNAL
  875. // DDHAL_DDMISCELLANEOUS2CALLBACKS:
  876. // This structure can be queried from the driver from DX7 onward
  877. // using GetDriverInfo with GUID_Miscellaneous2Callbacks
  878. typedef DWORD (FAR PASCAL *LPDDHAL_CREATESURFACEEX)(LPDDHAL_CREATESURFACEEXDATA);
  879. typedef DWORD (FAR PASCAL *LPDDHAL_GETDRIVERSTATE)(LPDDHAL_GETDRIVERSTATEDATA);
  880. typedef DWORD (FAR PASCAL *LPDDHAL_DESTROYDDLOCAL)(LPDDHAL_DESTROYDDLOCALDATA);
  881. //@@BEGIN_MSINTERNAL
  882. typedef DWORD (FAR PASCAL *LPDDHAL_ALPHABLT)(LPDDHAL_BLTDATA);
  883. #ifdef POSTPONED2
  884. typedef DWORD (FAR PASCAL *LPDDHAL_SETSPRITEDISPLAYLIST)(LPDDHAL_SETSPRITEDISPLAYLISTDATA);
  885. typedef DWORD (FAR PASCAL *LPDDHAL_RESIZE)(LPDDHAL_RESIZEDATA);
  886. typedef DWORD (FAR PASCAL *LPDDHAL_CAPTURECOMPOSITIONBUFFER)(LPDDHAL_CAPTURECOMPOSITIONBUFFERDATA);
  887. #endif //POSTPONED2
  888. //@@END_MSINTERNAL
  889. typedef struct _DDHAL_DDMISCELLANEOUS2CALLBACKS {
  890. DWORD dwSize;
  891. DWORD dwFlags;
  892. //@@BEGIN_MSINTERNAL
  893. #if 1
  894. LPDDHAL_ALPHABLT AlphaBlt;
  895. #else
  896. //@@END_MSINTERNAL
  897. LPVOID Reserved;
  898. //@@BEGIN_MSINTERNAL
  899. #endif
  900. //@@END_MSINTERNAL
  901. LPDDHAL_CREATESURFACEEX CreateSurfaceEx;
  902. LPDDHAL_GETDRIVERSTATE GetDriverState;
  903. LPDDHAL_DESTROYDDLOCAL DestroyDDLocal;
  904. //@@BEGIN_MSINTERNAL
  905. #ifdef POSTPONED2
  906. LPDDHAL_SETSPRITEDISPLAYLIST SetSpriteDisplayList;
  907. LPDDHAL_RESIZE Resize;
  908. LPDDHAL_CAPTURECOMPOSITIONBUFFER CaptureCompositionBuffer;
  909. #endif //POSTPONED2
  910. //@@END_MSINTERNAL
  911. } DDHAL_DDMISCELLANEOUS2CALLBACKS, *LPDDHAL_DDMISCELLANEOUS2CALLBACKS;
  912. #define DDHAL_MISC2CB32_CREATESURFACEEX 0x00000002l
  913. #define DDHAL_MISC2CB32_GETDRIVERSTATE 0x00000004l
  914. #define DDHAL_MISC2CB32_DESTROYDDLOCAL 0x00000008l
  915. //@@BEGIN_MSINTERNAL
  916. #define DDHAL_MISC2CB32_ALPHABLT 0x00000001l
  917. // ***** POSTPONED2 fields must NOT be ahead of other field as dwFlags bits must be contiguous
  918. // ValidateCallbacks() is enforing this ******
  919. #ifdef POSTPONED2
  920. #define DDHAL_MISC2CB32_SETSPRITEDISPLAYLIST 0x00000008l
  921. #define DDHAL_MISC2CB32_RESIZE 0x00000010l
  922. #define DDHAL_MISC2CB32_CAPTURECOMPOSITIONBUFFER 0x00000020l
  923. #endif //POSTPONED2
  924. //@@END_MSINTERNAL
  925. #define DDMISCELLANEOUS2CALLBACKSSIZE sizeof(DDHAL_DDMISCELLANEOUS2CALLBACKS)
  926. /*
  927. * DIRECTDRAWEXEBUF pseudo object callbacks
  928. *
  929. * NOTE: Execute buffers are not a distinct object type, they piggy back off
  930. * the surface data structures and high level API. However, they have their
  931. * own HAL callbacks as they may have different driver semantics from "normal"
  932. * surfaces. They also piggy back off the HAL data structures.
  933. *
  934. * !!! NOTE: Need to resolve whether we export execute buffer copying as a
  935. * blit or some other from of copy instruction.
  936. */
  937. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_CANCREATEEXEBUF)(LPDDHAL_CANCREATESURFACEDATA );
  938. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_CREATEEXEBUF)(LPDDHAL_CREATESURFACEDATA);
  939. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_DESTROYEXEBUF)(LPDDHAL_DESTROYSURFACEDATA);
  940. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_LOCKEXEBUF)(LPDDHAL_LOCKDATA);
  941. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_UNLOCKEXEBUF)(LPDDHAL_UNLOCKDATA);
  942. typedef struct _DDHAL_DDEXEBUFCALLBACKS
  943. {
  944. DWORD dwSize;
  945. DWORD dwFlags;
  946. LPDDHALEXEBUFCB_CANCREATEEXEBUF CanCreateExecuteBuffer;
  947. LPDDHALEXEBUFCB_CREATEEXEBUF CreateExecuteBuffer;
  948. LPDDHALEXEBUFCB_DESTROYEXEBUF DestroyExecuteBuffer;
  949. LPDDHALEXEBUFCB_LOCKEXEBUF LockExecuteBuffer;
  950. LPDDHALEXEBUFCB_UNLOCKEXEBUF UnlockExecuteBuffer;
  951. } DDHAL_DDEXEBUFCALLBACKS;
  952. typedef DDHAL_DDEXEBUFCALLBACKS FAR *LPDDHAL_DDEXEBUFCALLBACKS;
  953. #define DDEXEBUFCALLBACKSSIZE sizeof( DDHAL_DDEXEBUFCALLBACKS )
  954. #define DDHAL_EXEBUFCB32_CANCREATEEXEBUF 0x00000001l
  955. #define DDHAL_EXEBUFCB32_CREATEEXEBUF 0x00000002l
  956. #define DDHAL_EXEBUFCB32_DESTROYEXEBUF 0x00000004l
  957. #define DDHAL_EXEBUFCB32_LOCKEXEBUF 0x00000008l
  958. #define DDHAL_EXEBUFCB32_UNLOCKEXEBUF 0x00000010l
  959. /*
  960. * DIRECTVIDEOPORT object callbacks
  961. */
  962. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_CANCREATEVIDEOPORT)(LPDDHAL_CANCREATEVPORTDATA);
  963. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_CREATEVIDEOPORT)(LPDDHAL_CREATEVPORTDATA);
  964. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_FLIP)(LPDDHAL_FLIPVPORTDATA);
  965. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETBANDWIDTH)(LPDDHAL_GETVPORTBANDWIDTHDATA);
  966. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETINPUTFORMATS)(LPDDHAL_GETVPORTINPUTFORMATDATA);
  967. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETOUTPUTFORMATS)(LPDDHAL_GETVPORTOUTPUTFORMATDATA);
  968. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETFIELD)(LPDDHAL_GETVPORTFIELDDATA);
  969. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETLINE)(LPDDHAL_GETVPORTLINEDATA);
  970. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETVPORTCONNECT)(LPDDHAL_GETVPORTCONNECTDATA);
  971. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_DESTROYVPORT)(LPDDHAL_DESTROYVPORTDATA);
  972. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETFLIPSTATUS)(LPDDHAL_GETVPORTFLIPSTATUSDATA);
  973. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_UPDATE)(LPDDHAL_UPDATEVPORTDATA);
  974. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_WAITFORSYNC)(LPDDHAL_WAITFORVPORTSYNCDATA);
  975. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_GETSIGNALSTATUS)(LPDDHAL_GETVPORTSIGNALDATA);
  976. typedef DWORD (FAR PASCAL *LPDDHALVPORTCB_COLORCONTROL)(LPDDHAL_VPORTCOLORDATA);
  977. typedef struct _DDHAL_DDVIDEOPORTCALLBACKS
  978. {
  979. DWORD dwSize;
  980. DWORD dwFlags;
  981. LPDDHALVPORTCB_CANCREATEVIDEOPORT CanCreateVideoPort;
  982. LPDDHALVPORTCB_CREATEVIDEOPORT CreateVideoPort;
  983. LPDDHALVPORTCB_FLIP FlipVideoPort;
  984. LPDDHALVPORTCB_GETBANDWIDTH GetVideoPortBandwidth;
  985. LPDDHALVPORTCB_GETINPUTFORMATS GetVideoPortInputFormats;
  986. LPDDHALVPORTCB_GETOUTPUTFORMATS GetVideoPortOutputFormats;
  987. LPVOID lpReserved1;
  988. LPDDHALVPORTCB_GETFIELD GetVideoPortField;
  989. LPDDHALVPORTCB_GETLINE GetVideoPortLine;
  990. LPDDHALVPORTCB_GETVPORTCONNECT GetVideoPortConnectInfo;
  991. LPDDHALVPORTCB_DESTROYVPORT DestroyVideoPort;
  992. LPDDHALVPORTCB_GETFLIPSTATUS GetVideoPortFlipStatus;
  993. LPDDHALVPORTCB_UPDATE UpdateVideoPort;
  994. LPDDHALVPORTCB_WAITFORSYNC WaitForVideoPortSync;
  995. LPDDHALVPORTCB_GETSIGNALSTATUS GetVideoSignalStatus;
  996. LPDDHALVPORTCB_COLORCONTROL ColorControl;
  997. } DDHAL_DDVIDEOPORTCALLBACKS;
  998. typedef DDHAL_DDVIDEOPORTCALLBACKS FAR *LPDDHAL_DDVIDEOPORTCALLBACKS;
  999. #define DDVIDEOPORTCALLBACKSSIZE sizeof( DDHAL_DDVIDEOPORTCALLBACKS )
  1000. #define DDHAL_VPORT32_CANCREATEVIDEOPORT 0x00000001l
  1001. #define DDHAL_VPORT32_CREATEVIDEOPORT 0x00000002l
  1002. #define DDHAL_VPORT32_FLIP 0x00000004l
  1003. #define DDHAL_VPORT32_GETBANDWIDTH 0x00000008l
  1004. #define DDHAL_VPORT32_GETINPUTFORMATS 0x00000010l
  1005. #define DDHAL_VPORT32_GETOUTPUTFORMATS 0x00000020l
  1006. #define DDHAL_VPORT32_GETFIELD 0x00000080l
  1007. #define DDHAL_VPORT32_GETLINE 0x00000100l
  1008. #define DDHAL_VPORT32_GETCONNECT 0x00000200l
  1009. #define DDHAL_VPORT32_DESTROY 0x00000400l
  1010. #define DDHAL_VPORT32_GETFLIPSTATUS 0x00000800l
  1011. #define DDHAL_VPORT32_UPDATE 0x00001000l
  1012. #define DDHAL_VPORT32_WAITFORSYNC 0x00002000l
  1013. #define DDHAL_VPORT32_GETSIGNALSTATUS 0x00004000l
  1014. #define DDHAL_VPORT32_COLORCONTROL 0x00008000l
  1015. /*
  1016. * DIRECTDRAWCOLORCONTROL object callbacks
  1017. */
  1018. typedef DWORD (FAR PASCAL *LPDDHALCOLORCB_COLORCONTROL)(LPDDHAL_COLORCONTROLDATA);
  1019. typedef struct _DDHAL_DDCOLORCONTROLCALLBACKS
  1020. {
  1021. DWORD dwSize;
  1022. DWORD dwFlags;
  1023. LPDDHALCOLORCB_COLORCONTROL ColorControl;
  1024. } DDHAL_DDCOLORCONTROLCALLBACKS;
  1025. typedef DDHAL_DDCOLORCONTROLCALLBACKS FAR *LPDDHAL_DDCOLORCONTROLCALLBACKS;
  1026. #define DDCOLORCONTROLCALLBACKSSIZE sizeof( DDHAL_DDCOLORCONTROLCALLBACKS )
  1027. #define DDHAL_COLOR_COLORCONTROL 0x00000001l
  1028. /*
  1029. * DIRECTDRAWSURFACEKERNEL object callbacks
  1030. * This structure can be queried from the driver from DX5 onward
  1031. * using GetDriverInfo with GUID_KernelCallbacks
  1032. */
  1033. typedef DWORD (FAR PASCAL *LPDDHALKERNELCB_SYNCSURFACE)(LPDDHAL_SYNCSURFACEDATA);
  1034. typedef DWORD (FAR PASCAL *LPDDHALKERNELCB_SYNCVIDEOPORT)(LPDDHAL_SYNCVIDEOPORTDATA);
  1035. typedef struct _DDHAL_DDKERNELCALLBACKS
  1036. {
  1037. DWORD dwSize;
  1038. DWORD dwFlags;
  1039. LPDDHALKERNELCB_SYNCSURFACE SyncSurfaceData;
  1040. LPDDHALKERNELCB_SYNCVIDEOPORT SyncVideoPortData;
  1041. } DDHAL_DDKERNELCALLBACKS, *LPDDHAL_DDKERNELCALLBACKS;
  1042. #define DDHAL_KERNEL_SYNCSURFACEDATA 0x00000001l
  1043. #define DDHAL_KERNEL_SYNCVIDEOPORTDATA 0x00000002l
  1044. #define DDKERNELCALLBACKSSIZE sizeof(DDHAL_DDKERNELCALLBACKS)
  1045. typedef HRESULT (WINAPI *LPDDGAMMACALIBRATORPROC)( LPDDGAMMARAMP, LPBYTE);
  1046. /*
  1047. * DIRECTDRAWMOTIONCOMP object callbacks
  1048. */
  1049. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_GETGUIDS)( LPDDHAL_GETMOCOMPGUIDSDATA);
  1050. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_GETFORMATS)( LPDDHAL_GETMOCOMPFORMATSDATA);
  1051. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_CREATE)( LPDDHAL_CREATEMOCOMPDATA);
  1052. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_GETCOMPBUFFINFO)( LPDDHAL_GETMOCOMPCOMPBUFFDATA);
  1053. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_GETINTERNALINFO)( LPDDHAL_GETINTERNALMOCOMPDATA);
  1054. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_BEGINFRAME)( LPDDHAL_BEGINMOCOMPFRAMEDATA);
  1055. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_ENDFRAME)( LPDDHAL_ENDMOCOMPFRAMEDATA);
  1056. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_RENDER)( LPDDHAL_RENDERMOCOMPDATA);
  1057. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_QUERYSTATUS)( LPDDHAL_QUERYMOCOMPSTATUSDATA);
  1058. typedef DWORD (FAR PASCAL *LPDDHALMOCOMPCB_DESTROY)( LPDDHAL_DESTROYMOCOMPDATA);
  1059. typedef struct _DDHAL_DDMOTIONCOMPCALLBACKS
  1060. {
  1061. DWORD dwSize;
  1062. DWORD dwFlags;
  1063. LPDDHALMOCOMPCB_GETGUIDS GetMoCompGuids;
  1064. LPDDHALMOCOMPCB_GETFORMATS GetMoCompFormats;
  1065. LPDDHALMOCOMPCB_CREATE CreateMoComp;
  1066. LPDDHALMOCOMPCB_GETCOMPBUFFINFO GetMoCompBuffInfo;
  1067. LPDDHALMOCOMPCB_GETINTERNALINFO GetInternalMoCompInfo;
  1068. LPDDHALMOCOMPCB_BEGINFRAME BeginMoCompFrame;
  1069. LPDDHALMOCOMPCB_ENDFRAME EndMoCompFrame;
  1070. LPDDHALMOCOMPCB_RENDER RenderMoComp;
  1071. LPDDHALMOCOMPCB_QUERYSTATUS QueryMoCompStatus;
  1072. LPDDHALMOCOMPCB_DESTROY DestroyMoComp;
  1073. } DDHAL_DDMOTIONCOMPCALLBACKS;
  1074. typedef DDHAL_DDMOTIONCOMPCALLBACKS FAR *LPDDHAL_DDMOTIONCOMPCALLBACKS;
  1075. #define DDMOTIONCOMPCALLBACKSSIZE sizeof( DDHAL_DDMOTIONCOMPCALLBACKS )
  1076. #define DDHAL_MOCOMP32_GETGUIDS 0x00000001
  1077. #define DDHAL_MOCOMP32_GETFORMATS 0x00000002
  1078. #define DDHAL_MOCOMP32_CREATE 0x00000004
  1079. #define DDHAL_MOCOMP32_GETCOMPBUFFINFO 0x00000008
  1080. #define DDHAL_MOCOMP32_GETINTERNALINFO 0x00000010
  1081. #define DDHAL_MOCOMP32_BEGINFRAME 0x00000020
  1082. #define DDHAL_MOCOMP32_ENDFRAME 0x00000040
  1083. #define DDHAL_MOCOMP32_RENDER 0x00000080
  1084. #define DDHAL_MOCOMP32_QUERYSTATUS 0x00000100
  1085. #define DDHAL_MOCOMP32_DESTROY 0x00000200
  1086. //@@BEGIN_MSINTERNAL
  1087. #ifdef POSTPONED
  1088. /*
  1089. * DDHAL_DDUMODEDRVINFO object callbacks
  1090. * Contains the data required for supporting user mode drivers.
  1091. * This structure can be queried from the driver from DX6 onwards using:
  1092. * GetDriverInfo with GUID_UserModeDriverInfo
  1093. */
  1094. typedef struct _DDHAL_DDUMODEDRVINFO
  1095. {
  1096. DWORD dwSize;
  1097. DWORD dwFlags;
  1098. LPSTR lpszDllName;
  1099. GUID uniqueGuid;
  1100. ULONG_PTR dwReserved1;
  1101. } DDHAL_DDUMODEDRVINFO, *LPDDHAL_DDUMODEDRVINFO;
  1102. #define DDHAL_DDUMODEDRVINFOSIZE sizeof( DDHAL_DDUMODEDRVINFO )
  1103. #define DDHAL_UMODEDRV_DLLNAME 0x00000001
  1104. #define DDHAL_UMODEDRV_UNIQGUID 0x00000002
  1105. #define DDHAL_UMODEDRV_ALL 0x00000003
  1106. /*
  1107. * DDHAL_DDUMODEDRVPASSWD object callbacks
  1108. * This structure is used to query the usermode driver for its password GUID
  1109. * (GetDriverInfo with GUID_UserModeDriverPassword)
  1110. */
  1111. typedef struct _DDHAL_DDUMODEDRVPASSWD
  1112. {
  1113. DWORD dwSize;
  1114. DWORD dwFlags;
  1115. GUID passwdGuid;
  1116. } DDHAL_DDUMODEDRVPASSWD, *LPDDHAL_DDUMODEDRVPASSWD;
  1117. #define DDHAL_DDUMODEDRVPASSWDSIZE sizeof( DDHAL_DDUMODEDRVPASSWD )
  1118. #define DDHAL_UMODEDRV_GUID 0x00000001
  1119. /*
  1120. * This structure is used to store relevant information about the
  1121. * user-mode driver in DDRAW_GBL
  1122. */
  1123. typedef struct _DDUMODEDRVINFO
  1124. {
  1125. LPVOID lpszDllName; // need not be saved
  1126. HMODULE hUmodeDll;
  1127. GUID uniqueGuid; // need not be saved
  1128. LPDDHAL_GETDRIVERINFO GetDriverInfo;
  1129. } DDUMODEDRVINFO, *LPDDUMODEDRVINFO;
  1130. //
  1131. // DDOPTSURFACE
  1132. // Contains the callbacks and data required for supporting Optimized surfaces.
  1133. // This structure can be queried from the driver from DX6 onwards using:
  1134. // GetDriverInfo with GUID_OptSurfaceKmodeInfo and
  1135. // GetUmodeDriverInfo with GUID_OptSurfaceUmodeInfo.
  1136. //
  1137. typedef DWORD (FAR PASCAL *LPDDHALOPTSURFCB_CANOPTIMIZESURFACE)( LPDDHAL_CANOPTIMIZESURFACEDATA);
  1138. typedef DWORD (FAR PASCAL *LPDDHALOPTSURFCB_OPTIMIZESURFACE)( LPDDHAL_OPTIMIZESURFACEDATA);
  1139. typedef DWORD (FAR PASCAL *LPDDHALOPTSURFCB_UNOPTIMIZESURFACE)( LPDDHAL_UNOPTIMIZESURFACEDATA);
  1140. typedef DWORD (FAR PASCAL *LPDDHALOPTSURFCB_COPYOPTSURFACE)( LPDDHAL_COPYOPTSURFACEDATA);
  1141. typedef DWORD (FAR PASCAL *LPDDHALOPTSURFCB_KMODESVC)( LPDDHAL_KMODESVCDATA);
  1142. //
  1143. // This structure is used to store the Opt Surface information
  1144. // in DDRAWI_GBL
  1145. //
  1146. typedef struct _DDOPTSURFACEINFO
  1147. {
  1148. // Umode information
  1149. DWORD dwNumGuids;
  1150. LPGUID lpGuidArray;
  1151. LPDDHALOPTSURFCB_CANOPTIMIZESURFACE CanOptimizeSurface;
  1152. LPDDHALOPTSURFCB_OPTIMIZESURFACE OptimizeSurface;
  1153. LPDDHALOPTSURFCB_UNOPTIMIZESURFACE UnOptimizeSurface;
  1154. LPDDHALOPTSURFCB_COPYOPTSURFACE CopyOptSurface;
  1155. // Kmode information
  1156. LPDDHALOPTSURFCB_KMODESVC KmodeService;
  1157. } DDOPTSURFACEINFO, *LPDDOPTSURFACEINFO;
  1158. //
  1159. // This structure is used for obtaining Opt Surface kernel mode data
  1160. //
  1161. typedef struct _DDHAL_DDOPTSURFACEKMODEINFO
  1162. {
  1163. DWORD dwSize;
  1164. DWORD dwFlags;
  1165. LPDDHALOPTSURFCB_KMODESVC KmodeService;
  1166. ULONG_PTR dwReserved2;
  1167. } DDHAL_DDOPTSURFACEKMODEINFO, *LPDDHAL_DDOPTSURFACEKMODEINFO;
  1168. #define DDOPTSURFACEKMODEINFOSIZE sizeof( DDHAL_DDOPTSURFACEKMODEINFO )
  1169. #define DDHAL_OPTSURFKMODE_KMODESVC 0x00000001
  1170. #define DDHAL_OPTSURFKMODE_ALL 0x00000001
  1171. //
  1172. // This structure is used for obtaining Opt Surface user mode data
  1173. //
  1174. typedef struct _DDHAL_DDOPTSURFACEUMODEINFO
  1175. {
  1176. DWORD dwSize;
  1177. DWORD dwFlags;
  1178. DWORD dwNumGuids;
  1179. LPGUID lpGuidArray;
  1180. LPDDHALOPTSURFCB_CANOPTIMIZESURFACE CanOptimizeSurface;
  1181. LPDDHALOPTSURFCB_OPTIMIZESURFACE OptimizeSurface;
  1182. LPDDHALOPTSURFCB_UNOPTIMIZESURFACE UnOptimizeSurface;
  1183. LPDDHALOPTSURFCB_COPYOPTSURFACE CopyOptSurface;
  1184. ULONG_PTR dwReserved1;
  1185. ULONG_PTR dwReserved2;
  1186. } DDHAL_DDOPTSURFACEUMODEINFO, *LPDDHAL_DDOPTSURFACEUMODEINFO;
  1187. #define DDOPTSURFACEUMODEINFOSIZE sizeof( DDHAL_DDOPTSURFACEUMODEINFO )
  1188. #define DDHAL_OPTSURFUMODE_NUMGUIDS 0x00000001
  1189. #define DDHAL_OPTSURFUMODE_GUIDARRAY 0x00000002
  1190. #define DDHAL_OPTSURFUMODE_CANOPTIMIZESURFACE 0x00000004
  1191. #define DDHAL_OPTSURFUMODE_OPTIMIZESURFACE 0x00000008
  1192. #define DDHAL_OPTSURFUMODE_UNOPTIMIZESURFACE 0x00000010
  1193. #define DDHAL_OPTSURFUMODE_COPYOPTSURFACE 0x00000020
  1194. #define DDHAL_OPTSURFUMODE_ALL 0x0000003f
  1195. #endif //POSTPONED
  1196. //@@END_MSINTERNAL
  1197. /*
  1198. * CALLBACK RETURN VALUES
  1199. * * these are values returned by the driver from the above callback routines
  1200. */
  1201. /*
  1202. * indicates that the display driver didn't do anything with the call
  1203. */
  1204. #define DDHAL_DRIVER_NOTHANDLED 0x00000000l
  1205. /*
  1206. * indicates that the display driver handled the call; HRESULT value is valid
  1207. */
  1208. #define DDHAL_DRIVER_HANDLED 0x00000001l
  1209. /*
  1210. * indicates that the display driver couldn't handle the call because it
  1211. * ran out of color key hardware resources
  1212. */
  1213. #define DDHAL_DRIVER_NOCKEYHW 0x00000002l
  1214. /*
  1215. * Capabilities structure for non-local video memory
  1216. */
  1217. typedef struct _DDNONLOCALVIDMEMCAPS
  1218. {
  1219. DWORD dwSize;
  1220. DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts
  1221. DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts
  1222. DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts
  1223. DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts
  1224. DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts
  1225. } DDNONLOCALVIDMEMCAPS;
  1226. typedef struct _DDNONLOCALVIDMEMCAPS FAR *LPDDNONLOCALVIDMEMCAPS;
  1227. /*
  1228. * More driver surface capabilities (in addition to those described in DDCORECAPS).
  1229. * This struct contains the caps bits added to the DDCAPS.ddsCaps structure in DX6.
  1230. */
  1231. typedef struct _DDMORESURFACECAPS
  1232. {
  1233. DWORD dwSize; // size of DDMORESURFACECAPS structure
  1234. DDSCAPSEX ddsCapsMore;
  1235. /*
  1236. * The DDMORESURFACECAPS struct is of variable size. The following list may be
  1237. * filled in by DX6-aware drivers (see DDVERSIONINFO) to restrict their
  1238. * video memory heaps (those which are exposed to DirectDraw) to
  1239. * certain sets of DDSCAPS_ bits. Thse entries are exactly analogous to
  1240. * the ddsCaps and ddsCapsAlt members of the VIDMEM structures listed in
  1241. * the VIDMEMINFO.pvmList member of DDHALINFO.vmiData. There should be
  1242. * exactly DDHALINFO.vmiData.dwNumHeaps copies of tagExtendedHeapRestrictions
  1243. * in this struct. The size of this struct is thus:
  1244. * DDMORESURFACECAPS.dwSize = sizeof(DDMORESURFACECAPS) +
  1245. * (DDHALINFO.vmiData.dwNumHeaps-1) * sizeof(DDSCAPSEX)*2;
  1246. * Note the -1 accounts for the fact that DDMORESURFACECAPS is declared to have 1
  1247. * tagExtendedHeapRestrictions member.
  1248. */
  1249. struct tagExtendedHeapRestrictions
  1250. {
  1251. DDSCAPSEX ddsCapsEx;
  1252. DDSCAPSEX ddsCapsExAlt;
  1253. } ddsExtendedHeapRestrictions[1];
  1254. } DDMORESURFACECAPS, FAR * LPDDMORESURFACECAPS;
  1255. // Stereo, driver returns DD_OK if mode is ok for stereo
  1256. typedef struct _DDSTEREOMODE
  1257. {
  1258. DWORD dwSize; // size of DDSTEREOMODECAPS structure
  1259. DWORD dwHeight;
  1260. DWORD dwWidth;
  1261. DWORD dwBpp;
  1262. DWORD dwRefreshRate;
  1263. BOOL bSupported; // driver supports this video mode...
  1264. } DDSTEREOMODE, FAR * LPDDSTEREOMODE;
  1265. //@@BEGIN_MSINTERNAL
  1266. // For DX7, we define more DDraw driver caps (in addition to those in DDCORECAPS).
  1267. typedef struct _DDMORECAPS
  1268. {
  1269. DWORD dwSize; // size of DDMORECAPS structure
  1270. DWORD dwAlphaCaps; // driver-specific alpha caps for overlays & Vmem->Vmem blts
  1271. DWORD dwSVBAlphaCaps; // driver-specific alpha capabilities for System->Vmem blts
  1272. DWORD dwVSBAlphaCaps; // driver-specific alpha capabilities for Vmem->System blts
  1273. DWORD dwSSBAlphaCaps; // driver-specific alpha capabilities for System->System blts
  1274. DWORD dwFilterCaps; // driver-specific filter caps for overlays & Vmem->Vmem blts
  1275. DWORD dwSVBFilterCaps; // driver-specific filter capabilities for System->Vmem blts
  1276. DWORD dwVSBFilterCaps; // driver-specific filter capabilities for Vmem->System blts
  1277. DWORD dwSSBFilterCaps; // driver-specific filter capabilities for System->System blts
  1278. #ifdef POSTPONED2
  1279. DWORD dwTransformCaps; // driver-specific transform caps for overlays & Vmem->Vmem blts
  1280. DWORD dwSVBTransformCaps; // driver-specific transform capabilities for System->Vmem blts
  1281. DWORD dwVSBTransformCaps; // driver-specific transform capabilities for Vmem->System blts
  1282. DWORD dwSSBTransformCaps; // driver-specific transformn capabilities for System->System blts
  1283. DWORD dwBltAffineMinifyLimit; // minification limit for affine-transformed blits
  1284. DWORD dwOverlayAffineMinifyLimit; // minification limit for affine-transformed overlays
  1285. #endif
  1286. } DDMORECAPS, FAR * LPDDMORECAPS;
  1287. //@@END_MSINTERNAL
  1288. //@@BEGIN_MSINTERNAL
  1289. /*
  1290. * Private:
  1291. * Client data list element and head pointer
  1292. */
  1293. typedef struct _PRIVATEDATANODE
  1294. {
  1295. GUID guid;
  1296. LPBYTE pData;
  1297. DWORD cbData;
  1298. DWORD dwFlags;
  1299. DWORD dwContentsStamp;
  1300. struct _PRIVATEDATANODE *pNext;
  1301. } PRIVATEDATANODE, FAR* LPPRIVATEDATANODE;
  1302. //@@END_MSINTERNAL
  1303. /*
  1304. * DDRAW palette interface struct
  1305. */
  1306. typedef struct _DDRAWI_DDRAWPALETTE_INT
  1307. {
  1308. LPVOID lpVtbl; // pointer to array of interface methods
  1309. LPDDRAWI_DDRAWPALETTE_LCL lpLcl; // pointer to interface data
  1310. LPDDRAWI_DDRAWPALETTE_INT lpLink; // link to next interface
  1311. DWORD dwIntRefCnt; // interface reference count
  1312. //@@BEGIN_MSINTERNAL
  1313. ULONG_PTR dwReserved1; // for DDrawEx
  1314. ULONG_PTR dwReserved2; // for DDrawEx
  1315. //@@END_MSINTERNAL
  1316. } DDRAWI_DDRAWPALETTE_INT;
  1317. /*
  1318. * DDRAW internal version of DIRECTDRAWPALETTE object; it has data after the vtable
  1319. */
  1320. typedef struct _DDRAWI_DDRAWPALETTE_GBL
  1321. {
  1322. DWORD dwRefCnt; // reference count
  1323. DWORD dwFlags; // flags
  1324. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // PRIVATE: DIRECTDRAW object
  1325. DWORD dwProcessId; // owning process
  1326. LPPALETTEENTRY lpColorTable; // array of palette entries
  1327. union
  1328. {
  1329. ULONG_PTR dwReserved1; // reserved for use by display driver which created this object
  1330. HPALETTE hHELGDIPalette;
  1331. };
  1332. /*
  1333. * Fields added in version 5.0. Check if the ddraw version >= 5 (passed during
  1334. * driver initialization) to see if these fields will be present.
  1335. */
  1336. DWORD dwDriverReserved; // For use by HAL, regardless of who created object
  1337. DWORD dwContentsStamp; // Incremented when palette changes.
  1338. /*
  1339. * Fields added in version 6
  1340. */
  1341. DWORD dwSaveStamp; // Incremented when palette changes.
  1342. /*
  1343. * And in version 7
  1344. */
  1345. DWORD dwHandle; //Handle used in drawprim2 palette notification
  1346. } DDRAWI_DDRAWPALETTE_GBL;
  1347. //@@BEGIN_MSINTERNAL
  1348. /* Macro to bump the contents stamp so drivers can cheaply check for changed palette data.
  1349. * Zero means no information
  1350. */
  1351. #define BUMP_PALETTE_STAMP(pal_gbl) \
  1352. if ( pal_gbl->dwContentsStamp ) \
  1353. { \
  1354. pal_gbl->dwContentsStamp++; \
  1355. if ( 0 == pal_gbl->dwContentsStamp) \
  1356. pal_gbl->dwContentsStamp++; \
  1357. }
  1358. //@@END_MSINTERNAL
  1359. /*
  1360. * (CMcC) The palette no longer maintains a back pointer to the owning surface
  1361. * (there may now be many owning surfaces). So the lpDDSurface is now dwReserved0
  1362. * (this mod. assumes that sizeof(DWORD) == sizeof(LPDDRAWI_DDRAWSURFACE_LCL). A
  1363. * fairly safe assumption I think.
  1364. */
  1365. typedef struct _DDRAWI_DDRAWPALETTE_LCL
  1366. {
  1367. DWORD lpPalMore; // pointer to additional local data
  1368. LPDDRAWI_DDRAWPALETTE_GBL lpGbl; // pointer to data
  1369. ULONG_PTR dwUnused0; // not currently used.
  1370. DWORD dwLocalRefCnt; // local ref cnt
  1371. IUnknown FAR *pUnkOuter; // outer IUnknown
  1372. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // pointer to owning local driver object
  1373. ULONG_PTR dwReserved1; // reserved for use by display driver
  1374. /*
  1375. * Added for DX6
  1376. */
  1377. //@@BEGIN_MSINTERNAL
  1378. #if 1
  1379. LPPRIVATEDATANODE pPrivateDataHead;
  1380. IUnknown * pAddrefedThisOwner; //This is the ddraw object that created this
  1381. //palette, if nonzero. Must Release it when palette
  1382. //is released.
  1383. LPDDRAWI_DIRECTDRAW_INT lpDD_Int; // pointer to owning int
  1384. #else //1
  1385. //@@END_MSINTERNAL
  1386. ULONG_PTR dwDDRAWReserved1;
  1387. ULONG_PTR dwDDRAWReserved2;
  1388. ULONG_PTR dwDDRAWReserved3;
  1389. //@@BEGIN_MSINTERNAL
  1390. #endif //1
  1391. //@@END_MSINTERNAL
  1392. } DDRAWI_DDRAWPALETTE_LCL;
  1393. // bit definition for dwFlags in DDRAWI_DDRAWPALETTE_GBL and
  1394. // dwPaletteFlags in D3DHAL_DP2SETPALETTE
  1395. #define DDRAWIPAL_256 0x00000001l // 256 entry palette
  1396. #define DDRAWIPAL_16 0x00000002l // 16 entry palette
  1397. #define DDRAWIPAL_GDI 0x00000004l // palette allocated through GDI
  1398. #define DDRAWIPAL_STORED_8 0x00000008l // palette stored as 8bpp/entry
  1399. #define DDRAWIPAL_STORED_16 0x00000010l // palette stored as 16bpp/entry
  1400. #define DDRAWIPAL_STORED_24 0x00000020l // palette stored as 24bpp/entry
  1401. #define DDRAWIPAL_EXCLUSIVE 0x00000040l // palette being used in exclusive mode
  1402. #define DDRAWIPAL_INHEL 0x00000080l // palette is done in the hel
  1403. #define DDRAWIPAL_DIRTY 0x00000100l // gdi palette out 'o sync
  1404. #define DDRAWIPAL_ALLOW256 0x00000200l // can fully update palette
  1405. #define DDRAWIPAL_4 0x00000400l // 4 entry palette
  1406. #define DDRAWIPAL_2 0x00000800l // 2 entry palette
  1407. #define DDRAWIPAL_STORED_8INDEX 0x00001000l // palette stored as 8-bit index into dst palette
  1408. #define DDRAWIPAL_ALPHA 0x00002000l // palette entries contain alpha
  1409. /*
  1410. * DDRAW clipper interface struct
  1411. */
  1412. typedef struct _DDRAWI_DDRAWCLIPPER_INT
  1413. {
  1414. LPVOID lpVtbl; // pointer to array of interface methods
  1415. LPDDRAWI_DDRAWCLIPPER_LCL lpLcl; // pointer to interface data
  1416. LPDDRAWI_DDRAWCLIPPER_INT lpLink; // link to next interface
  1417. DWORD dwIntRefCnt; // interface reference count
  1418. //@@BEGIN_MSINTERNAL
  1419. ULONG_PTR dwReserved1; // for DDrawEx
  1420. ULONG_PTR dwReserved2; // for DDrawEx
  1421. //@@END_MSINTERNAL
  1422. } DDRAWI_DDRAWCLIPPER_INT;
  1423. /*
  1424. * DDRAW internal version of DIRECTDRAWCLIPPER object; it has data after the vtable
  1425. */
  1426. typedef struct _DDRAWI_DDRAWCLIPPER_GBL
  1427. {
  1428. DWORD dwRefCnt; // reference count
  1429. DWORD dwFlags; // flags
  1430. LPDDRAWI_DIRECTDRAW_GBL lpDD; // PRIVATE: DIRECTDRAW object
  1431. DWORD dwProcessId; // owning process
  1432. ULONG_PTR dwReserved1; // reserved for use by display driver
  1433. ULONG_PTR hWnd; // window
  1434. LPRGNDATA lpStaticClipList; // clip list set by app
  1435. } DDRAWI_DDRAWCLIPPER_GBL;
  1436. /*
  1437. * (CMcC) As with palettes, the clipper no longer maintains a back pointer to the
  1438. * owning surface (there may now be many owning surfaces). So the lpDDSurface
  1439. * is now dwReserved0 (this mod. assumes that sizeof(DWORD) ==
  1440. * sizeof(LPDDRAWI_DDRAWSURFACE_LCL). A fairly safe assumption I think.
  1441. */
  1442. typedef struct _DDRAWI_DDRAWCLIPPER_LCL
  1443. {
  1444. DWORD lpClipMore; // pointer to additional local data
  1445. LPDDRAWI_DDRAWCLIPPER_GBL lpGbl; // pointer to data
  1446. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // pointer to owning local DD object
  1447. DWORD dwLocalRefCnt; // local ref cnt
  1448. IUnknown FAR *pUnkOuter; // outer IUnknown
  1449. LPDDRAWI_DIRECTDRAW_INT lpDD_int; // pointer to owning DD object interface
  1450. ULONG_PTR dwReserved1; // reserved for use by display driver
  1451. IUnknown * pAddrefedThisOwner; //This is the ddraw object that created this
  1452. //clipper, if nonzero. Must Release it when clipper
  1453. //is released.
  1454. } DDRAWI_DDRAWCLIPPER_LCL;
  1455. #define DDRAWICLIP_WATCHWINDOW 0x00000001l
  1456. #define DDRAWICLIP_ISINITIALIZED 0x00000002l
  1457. #define DDRAWICLIP_INMASTERSPRITELIST 0x00000004l // clipper is referenced in master sprite list
  1458. /*
  1459. * ATTACHLIST - internally used to maintain list of attached surfaces
  1460. */
  1461. typedef struct _ATTACHLIST
  1462. {
  1463. DWORD dwFlags;
  1464. struct _ATTACHLIST FAR *lpLink; // link to next attached surface
  1465. struct _DDRAWI_DDRAWSURFACE_LCL FAR *lpAttached; // attached surface local obj
  1466. struct _DDRAWI_DDRAWSURFACE_INT FAR *lpIAttached; // attached surface interface
  1467. } ATTACHLIST;
  1468. typedef ATTACHLIST FAR *LPATTACHLIST;
  1469. #define DDAL_IMPLICIT 0x00000001l
  1470. /*
  1471. * DBLNODE - a node in a doubly-linked list of surface interfaces
  1472. */
  1473. typedef struct _DBLNODE
  1474. {
  1475. struct _DBLNODE FAR *next; // link to next node
  1476. struct _DBLNODE FAR *prev; // link to previous node
  1477. LPDDRAWI_DDRAWSURFACE_LCL object; // link to object
  1478. LPDDRAWI_DDRAWSURFACE_INT object_int; // object interface
  1479. } DBLNODE;
  1480. typedef DBLNODE FAR *LPDBLNODE;
  1481. /*
  1482. * ACCESSRECTLIST - internally used to all rectangles that are accessed on a surface
  1483. */
  1484. typedef struct _ACCESSRECTLIST
  1485. {
  1486. struct _ACCESSRECTLIST FAR *lpLink; // link to next attached surface
  1487. RECT rDest; // rectangle being used
  1488. LPDDRAWI_DIRECTDRAW_LCL lpOwner; // owning local object
  1489. LPVOID lpSurfaceData; // associated screen ptr
  1490. DWORD dwFlags; // PRIVATE: flags
  1491. LPHEAPALIASINFO lpHeapAliasInfo; // PRIVATE: aliased heaps being used by this lock
  1492. } ACCESSRECTLIST;
  1493. typedef ACCESSRECTLIST FAR *LPACCESSRECTLIST;
  1494. #define ACCESSRECT_VRAMSTYLE 0x00000001L // PRIVATE: this lock is vram style (vidmem or implict sysmem)
  1495. #define ACCESSRECT_NOTHOLDINGWIN16LOCK 0x00000002L // PRIVATE: this lock is not holding the Win16 lock
  1496. #define ACCESSRECT_BROKEN 0x00000004L // PRIVATE: this lock was broken by an invalidate - don't call HAL on unlock
  1497. #ifndef WIN95
  1498. typedef struct _DISPLAYMODEINFO
  1499. {
  1500. WORD wWidth;
  1501. WORD wHeight;
  1502. WORD wBPP;
  1503. WORD wRefreshRate;
  1504. } DISPLAYMODEINFO;
  1505. typedef struct _DISPLAYMODEINFO *LPDISPLAYMODEINFO;
  1506. #define EQUAL_DISPLAYMODE(a, b) (0 == memcmp(&(a), &(b), sizeof (DISPLAYMODEINFO)))
  1507. #endif
  1508. //@@BEGIN_MSINTERNAL
  1509. /*
  1510. * Interface addref/release tracking structs
  1511. */
  1512. //#define REFTRACKING
  1513. #ifdef REFTRACKING
  1514. typedef struct _DDRAWI_REFTRACKNODE
  1515. {
  1516. LPVOID pReturnAddress;
  1517. DWORD dwAddrefCount;
  1518. DWORD dwReleaseCount;
  1519. struct _DDRAWI_REFTRACKNODE FAR * pNext;
  1520. } DDRAWI_REFTRACKNODE, FAR * LPDDRAWI_REFTRACKNODE;
  1521. typedef struct _DDRAWI_REFTRACK
  1522. {
  1523. LPVOID pLastAddref;
  1524. LPVOID pLastRelease;
  1525. LPDDRAWI_REFTRACKNODE pHead;
  1526. } DDRAW_REFTRACK;
  1527. //in ddisunk.c:
  1528. extern void AddRefTrack(LPVOID * p);
  1529. extern void ReleaseTrack(LPVOID * p);
  1530. extern void DumpRefTrack(LPVOID p);
  1531. #define REFTRACKVAR DDRAW_REFTRACK RefTrack;
  1532. #define ADDREFTRACK(pInt) AddRefTrack(&pInt)
  1533. #define RELEASETRACK(pInt) ReleaseTrack(&pInt)
  1534. #define DUMPREFTRACK(pInt) DumpRefTrack(pInt)
  1535. #else
  1536. #define REFTRACKVAR
  1537. #define ADDREFTRACK(a)
  1538. #define RELEASETRACK(a)
  1539. #define DUMPREFTRACK(pInt)
  1540. #endif //REFTRACKING
  1541. //@@END_MSINTERNAL
  1542. /*
  1543. * DDRAW surface interface struct
  1544. */
  1545. typedef struct _DDRAWI_DDRAWSURFACE_INT
  1546. {
  1547. LPVOID lpVtbl; // pointer to array of interface methods
  1548. LPDDRAWI_DDRAWSURFACE_LCL lpLcl; // pointer to interface data
  1549. LPDDRAWI_DDRAWSURFACE_INT lpLink; // link to next interface
  1550. DWORD dwIntRefCnt; // interface reference count
  1551. //@@BEGIN_MSINTERNAL
  1552. ULONG_PTR dwReserved1; // for DDrawEx
  1553. ULONG_PTR dwReserved2; // for DDrawEx
  1554. REFTRACKVAR
  1555. //@@END_MSINTERNAL
  1556. } DDRAWI_DDRAWSURFACE_INT;
  1557. /*
  1558. * DDRAW internal version of DIRECTDRAWSURFACE struct
  1559. *
  1560. * the GBL structure is global data for all duplicate objects
  1561. */
  1562. typedef struct _DDRAWI_DDRAWSURFACE_GBL
  1563. {
  1564. DWORD dwRefCnt; // reference count
  1565. DWORD dwGlobalFlags; // global flags
  1566. union
  1567. {
  1568. LPACCESSRECTLIST lpRectList; // list of accesses
  1569. DWORD dwBlockSizeY; // block size that display driver requested (return)
  1570. };
  1571. union
  1572. {
  1573. LPVMEMHEAP lpVidMemHeap; // heap vidmem was alloc'ed from
  1574. DWORD dwBlockSizeX; // block size that display driver requested (return)
  1575. };
  1576. union
  1577. {
  1578. LPDDRAWI_DIRECTDRAW_GBL lpDD; // internal DIRECTDRAW object
  1579. LPVOID lpDDHandle; // handle to internal DIRECTDRAW object
  1580. // for use by display driver
  1581. // when calling fns in DDRAW16.DLL
  1582. };
  1583. FLATPTR fpVidMem; // pointer to video memory
  1584. union
  1585. {
  1586. LONG lPitch; // pitch of surface
  1587. DWORD dwLinearSize; // linear size of non-rectangular surface
  1588. };
  1589. WORD wHeight; // height of surface
  1590. WORD wWidth; // width of surface
  1591. DWORD dwUsageCount; // number of access to this surface
  1592. ULONG_PTR dwReserved1; // reserved for use by display driver
  1593. //
  1594. // NOTE: this part of the structure is ONLY allocated if the pixel
  1595. // format differs from that of the primary display
  1596. //
  1597. DDPIXELFORMAT ddpfSurface; // pixel format of surface
  1598. } DDRAWI_DDRAWSURFACE_GBL;
  1599. /*
  1600. * This is an extender structure that is allocated off the end of the SURFACE_GBL
  1601. * structure. DO NOT place any structures whose size can change in here.
  1602. */
  1603. #define GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl) \
  1604. (*(LPDDRAWI_DDRAWSURFACE_GBL_MORE *) \
  1605. ((BYTE *)psurf_gbl - sizeof(DWORD_PTR)))
  1606. /*
  1607. * Return the physical memory pointer for a given surface global object.
  1608. *
  1609. * NOTE: The physical memory pointer is ONLY valid for surfaces allocated from
  1610. * non-local video memory. This field will not be valid for system memory or
  1611. * local video memory surfaces.
  1612. */
  1613. #define SURFACE_PHYSICALVIDMEM( psurf_gbl ) \
  1614. ( GET_LPDDRAWSURFACE_GBL_MORE( psurf_gbl )->fpPhysicalVidMem )
  1615. /*
  1616. * NOTE: This structure contains a set of fields for describing linear to physical
  1617. * page mappings in the case of page locked system memory. It can also contain the
  1618. * physical surface pointer of a surface in non-local memory. As there is no point
  1619. * in having both a linear to physical page translation table and a physical memory
  1620. * pointer for the same surface they are placed in a union.
  1621. */
  1622. typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE
  1623. {
  1624. DWORD dwSize;
  1625. union
  1626. {
  1627. DWORD dwPhysicalPageTable; // Physical address of page table (array of physical addresses/one per 4K page)
  1628. FLATPTR fpPhysicalVidMem; // Physical address of surface (non-local video memory only)
  1629. };
  1630. LPDWORD pPageTable; // Linear address of page table
  1631. DWORD cPages; // Number of Pages
  1632. ULONG_PTR dwSavedDCContext; // PRIVATE: For use by DDSurface::GetDC
  1633. FLATPTR fpAliasedVidMem; // PRIVATE: Alias for original fpVidMem
  1634. ULONG_PTR dwDriverReserved; // Reserved for driver use (both system and video memory surfaces)
  1635. ULONG_PTR dwHELReserved; // PRIVATE: For HEL use only
  1636. DWORD cPageUnlocks; // Incremented whenever a surface is PageUnlocked
  1637. ULONG_PTR hKernelSurface; // Kernel handle for this surface
  1638. DWORD dwKernelRefCnt; // Ref count for kernel handle
  1639. LPDDCOLORCONTROL lpColorInfo; // PRIVATE: Initial color control settings
  1640. FLATPTR fpNTAlias; // PRIVATE: Used internally by NT DirectDraw
  1641. DWORD dwContentsStamp; // Changes when surface data may have changed. 0 means no information
  1642. LPVOID lpvUnswappedDriverReserved; // Reserved for use by display driver. Is not swapped when Flip is called on this surface
  1643. //@@BEGIN_MSINTERNAL
  1644. #if 1
  1645. LPVOID pvContents; // Persistent-content memory
  1646. DWORD dwBackupStamp; // Value of dwContentsStamp when contents restored
  1647. DWORD dwSaveStamp; // Value of dwContentsStamp when contents saved via IPersistX
  1648. #else //1
  1649. //@@END_MSINTERNAL
  1650. LPVOID lpDDRAWReserved2;
  1651. DWORD dwDDRAWReserved1;
  1652. DWORD dwDDRAWReserved2;
  1653. //@@BEGIN_MSINTERNAL
  1654. #endif //1
  1655. //@@END_MSINTERNAL
  1656. FLATPTR fpAliasOfVidMem; // PRIVATE: The original VidMem pointer of which fpAliasedVidMem is an alias of
  1657. // This is used to compare with a given fpVidMem to see if we can use the cached fpAliasedVidMem or
  1658. // if we need to call GetAliasedVidMem.
  1659. } DDRAWI_DDRAWSURFACE_GBL_MORE;
  1660. //@@BEGIN_MSINTERNAL
  1661. /* Macro to bump the contents stamp so drivers can cheaply check for changed surface data.
  1662. * Zero means no information
  1663. */
  1664. #define BUMP_SURFACE_STAMP(surf_gbl) \
  1665. if ( GET_LPDDRAWSURFACE_GBL_MORE(surf_gbl)->dwContentsStamp ) \
  1666. { \
  1667. GET_LPDDRAWSURFACE_GBL_MORE(surf_gbl)->dwContentsStamp++; \
  1668. if ( 0 ==GET_LPDDRAWSURFACE_GBL_MORE(surf_gbl)->dwContentsStamp) \
  1669. GET_LPDDRAWSURFACE_GBL_MORE(surf_gbl)->dwContentsStamp++; \
  1670. }
  1671. //@@END_MSINTERNAL
  1672. //@@BEGIN_MSINTERNAL
  1673. #define NUM_RECTS_IN_REGIONLIST 6
  1674. /* This holds the list of dirty regions for D3D texture managed surfaces */
  1675. typedef struct _REGIONLIST
  1676. {
  1677. RGNDATAHEADER rdh;
  1678. RECTL rect[NUM_RECTS_IN_REGIONLIST];
  1679. } REGIONLIST;
  1680. typedef REGIONLIST *LPREGIONLIST;
  1681. //@@END_MSINTERNAL
  1682. /*
  1683. * a structure holding additional LCL surface information (can't simply be appended
  1684. * to the LCL structure as that structure is of variable size).
  1685. */
  1686. typedef struct _DDRAWI_DDRAWSURFACE_MORE
  1687. {
  1688. DWORD dwSize;
  1689. IUNKNOWN_LIST FAR *lpIUnknowns; // IUnknowns aggregated by this surface
  1690. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // Pointer to the DirectDraw local object
  1691. DWORD dwPageLockCount; // count of pagelocks
  1692. DWORD dwBytesAllocated; // size of sys mem allocated
  1693. LPDDRAWI_DIRECTDRAW_INT lpDD_int; // Pointer to the DirectDraw interface
  1694. DWORD dwMipMapCount; // Number of mip-map levels in the chain
  1695. LPDDRAWI_DDRAWCLIPPER_INT lpDDIClipper; // Interface to attached clipper object
  1696. //------- Fields added in Version 5.0 -------
  1697. LPHEAPALIASINFO lpHeapAliasInfo; // PRIVATE: Aliased heaps being referenced by this lock
  1698. DWORD dwOverlayFlags; // Current overlay flags
  1699. VOID *rgjunc; // Blitter function table for new blitter
  1700. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port currently writting data to this surface
  1701. LPDDOVERLAYFX lpddOverlayFX; // current overlay fx
  1702. DDSCAPSEX ddsCapsEx;
  1703. DWORD dwTextureStage; // stage in multitexture cascade
  1704. //@@BEGIN_MSINTERNAL
  1705. #if 1
  1706. LPVOID lpD3DDevIList;
  1707. LPPRIVATEDATANODE pPrivateDataHead;
  1708. IUnknown * pAddrefedThisOwner; //This is the ddraw object that created this
  1709. //surface, if nonzero. Must Release it when surface
  1710. //is released.
  1711. DWORD dwPFIndex; // pixel-format index (cached by AlphaBlt HEL)
  1712. BOOL * lpbDirty; //this bit is for D3D Texture Manage syncronization
  1713. //if it's set, D3D has to flush batched DPs
  1714. //and then refresh its video copy and clear it to
  1715. //FALSE. Blt,Lock,GetDC will set it.
  1716. #else //1
  1717. //@@END_MSINTERNAL
  1718. LPVOID lpDDRAWReserved;
  1719. LPVOID lpDDRAWReserved2;
  1720. LPVOID lpDDrawReserved3;
  1721. DWORD dwDDrawReserved4;
  1722. LPVOID lpDDrawReserved5;
  1723. //@@BEGIN_MSINTERNAL
  1724. #endif //1
  1725. //@@END_MSINTERNAL
  1726. LPDWORD lpGammaRamp;
  1727. LPDWORD lpOriginalGammaRamp;
  1728. //@@BEGIN_MSINTERNAL
  1729. #if 1
  1730. LPREGIONLIST lpRegionList;
  1731. #ifndef WIN95
  1732. DISPLAYMODEINFO dmiCreated; // NT: mode surface created in
  1733. #endif
  1734. // This is the new Surface handle generated by the ddraw runtime
  1735. // This is sent to the driver as a cookie to associate a particular
  1736. // surface by the CreateSurfaceEx DDI.
  1737. DWORD dwSurfaceHandle;
  1738. ULARGE_INTEGER qwBatch; // batch number that refers to this texture (D3D)
  1739. LPVOID lpTex;
  1740. #else //1
  1741. //@@END_MSINTERNAL
  1742. LPVOID lpDDrawReserved6;
  1743. #ifndef WIN95
  1744. DISPLAYMODEINFO dmiDDrawReserved7;
  1745. #endif
  1746. DWORD dwSurfaceHandle; // cookie for use with CreateSurfaceEx DDI
  1747. DWORD qwDDrawReserved8[2];
  1748. LPVOID lpDDrawReserved9;
  1749. //@@BEGIN_MSINTERNAL
  1750. #endif //1
  1751. //@@END_MSINTERNAL
  1752. DWORD cSurfaces; //PRIVATE
  1753. LPDDSURFACEDESC2 pCreatedDDSurfaceDesc2; //PRIVATE
  1754. LPDDRAWI_DDRAWSURFACE_LCL *slist; //PRIVATE
  1755. DWORD dwFVF; // saved FVF flags for exe bufs
  1756. LPVOID lpVB; //PRIVATE
  1757. } DDRAWI_DDRAWSURFACE_MORE;
  1758. /*
  1759. * Special values assigned to dwPFIndex member of DDRAWI_DDRAWSURFACE_MORE.
  1760. */
  1761. #define PFINDEX_UNINITIALIZED (0UL) // pixel-format index is in uninitialized state
  1762. #define PFINDEX_UNSUPPORTED (~0UL) // surface's pixel format is not supported by HEL
  1763. /*
  1764. * the LCL structure is local data for each individual surface object
  1765. */
  1766. struct _DDRAWI_DDRAWSURFACE_LCL
  1767. {
  1768. LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore; // pointer to additional local data
  1769. LPDDRAWI_DDRAWSURFACE_GBL lpGbl; // pointer to surface shared data
  1770. ULONG_PTR hDDSurface; // NT Kernel-mode handle was dwUnused0
  1771. LPATTACHLIST lpAttachList; // link to surfaces we attached to
  1772. LPATTACHLIST lpAttachListFrom;// link to surfaces that attached to this one
  1773. DWORD dwLocalRefCnt; // object refcnt
  1774. DWORD dwProcessId; // owning process
  1775. DWORD dwFlags; // flags
  1776. DDSCAPS ddsCaps; // capabilities of surface
  1777. union
  1778. {
  1779. LPDDRAWI_DDRAWPALETTE_INT lpDDPalette; // associated palette
  1780. LPDDRAWI_DDRAWPALETTE_INT lp16DDPalette; // 16-bit ptr to associated palette
  1781. };
  1782. union
  1783. {
  1784. LPDDRAWI_DDRAWCLIPPER_LCL lpDDClipper; // associated clipper
  1785. LPDDRAWI_DDRAWCLIPPER_INT lp16DDClipper; // 16-bit ptr to associated clipper
  1786. };
  1787. DWORD dwModeCreatedIn;
  1788. DWORD dwBackBufferCount; // number of back buffers created
  1789. DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
  1790. DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
  1791. // IUnknown FAR *pUnkOuter; // outer IUnknown
  1792. ULONG_PTR hDC; // owned dc
  1793. ULONG_PTR dwReserved1; // reserved for use by display driver
  1794. /*
  1795. * NOTE: this part of the structure is ONLY allocated if the surface
  1796. * can be used for overlays. ddckCKSrcOverlay MUST NOT BE MOVED
  1797. * from the start of this area.
  1798. */
  1799. DDCOLORKEY ddckCKSrcOverlay;// color key for source overlay use
  1800. DDCOLORKEY ddckCKDestOverlay;// color key for destination overlay use
  1801. LPDDRAWI_DDRAWSURFACE_INT lpSurfaceOverlaying; // surface we are overlaying
  1802. DBLNODE dbnOverlayNode;
  1803. /*
  1804. * overlay rectangle, used by DDHEL
  1805. */
  1806. RECT rcOverlaySrc;
  1807. RECT rcOverlayDest;
  1808. /*
  1809. * the below values are kept here for ddhel. they're set by UpdateOverlay,
  1810. * they're used whenever the overlays are redrawn.
  1811. */
  1812. DWORD dwClrXparent; // the *actual* color key (override, colorkey, or CLR_INVALID)
  1813. DWORD dwAlpha; // the per surface alpha
  1814. /*
  1815. * overlay position
  1816. */
  1817. LONG lOverlayX; // current x position
  1818. LONG lOverlayY; // current y position
  1819. };
  1820. typedef struct _DDRAWI_DDRAWSURFACE_LCL DDRAWI_DDRAWSURFACE_LCL;
  1821. #define DDRAWISURFGBL_MEMFREE 0x00000001L // video memory has been freed
  1822. #define DDRAWISURFGBL_SYSMEMREQUESTED 0x00000002L // surface is in system memory at request of user
  1823. #define DDRAWISURFGBL_ISGDISURFACE 0x00000004L // This surface represents what GDI thinks is front buffer
  1824. #define DDRAWISURFGBL_SOFTWAREAUTOFLIP 0x00000008L // This surface is autoflipped using software
  1825. #define DDRAWISURFGBL_LOCKNOTHOLDINGWIN16LOCK 0x00000010L // PRIVATE: a vram lock of the entire surface is not holding the Win16 lock
  1826. #define DDRAWISURFGBL_LOCKVRAMSTYLE 0x00000020L // PRIVATE: entire surface was locked with VRAM style lock
  1827. #define DDRAWISURFGBL_LOCKBROKEN 0x00000040L // PRIVATE: a lock of the entire surface was broken by an invalidate
  1828. #define DDRAWISURFGBL_IMPLICITHANDLE 0x00000080L // This dwKernelHandle was created implicitly
  1829. #define DDRAWISURFGBL_ISCLIENTMEM 0x00000100L // PRIVATE: the memory pointer to by fpVidMem was allocated by the client
  1830. #define DDRAWISURFGBL_HARDWAREOPSOURCE 0x00000200L // This surface was the source for an asynchronous hardware operation
  1831. #define DDRAWISURFGBL_HARDWAREOPDEST 0x00000400L // This surface was dest for an asynchronous hardware operation
  1832. #define DDRAWISURFGBL_HARDWAREOPSTARTED (DDRAWISURFGBL_HARDWAREOPSOURCE|DDRAWISURFGBL_HARDWAREOPDEST)
  1833. #define DDRAWISURFGBL_VPORTINTERLEAVED 0x00000800L // This surface contains interleaved video port data
  1834. #define DDRAWISURFGBL_VPORTDATA 0x00001000L // This surface received data from the video port
  1835. #define DDRAWISURFGBL_LATEALLOCATELINEAR 0x00002000L // Optimized surface was allocated as a formless chunk. lPitch invalid, dwLinearSize valid.
  1836. #define DDRAWISURFGBL_SYSMEMEXECUTEBUFFER 0x00004000L // Driver sets this flag to tell ddraw that the surface was allocated in system memory
  1837. #define DDRAWISURFGBL_FASTLOCKHELD 0x00008000L // PRIVATE: indicates that InternLock took the fast path
  1838. #define DDRAWISURFGBL_READONLYLOCKHELD 0x00010000L // PRIVATE: indicates that the application indicated read-only lock
  1839. /*
  1840. * NOTE: This flag was previously DDRAWISURFGBL_INVALID. This flags has been retired
  1841. * and replaced by DDRAWISURF_INVALID in the local object.
  1842. */
  1843. #define DDRAWISURFGBL_RESERVED0 0x80000000L // Reserved flag
  1844. #define DDRAWISURF_ATTACHED 0x00000001L // surface is attached to another
  1845. #define DDRAWISURF_IMPLICITCREATE 0x00000002L // surface implicitly created
  1846. #define DDRAWISURF_ISFREE 0x00000004L // surface already freed (temp flag)
  1847. #define DDRAWISURF_ATTACHED_FROM 0x00000008L // surface has others attached to it
  1848. #define DDRAWISURF_IMPLICITROOT 0x00000010L // surface root of implicit creation
  1849. #define DDRAWISURF_PARTOFPRIMARYCHAIN 0x00000020L // surface is part of primary chain
  1850. #define DDRAWISURF_DATAISALIASED 0x00000040L // used for thunking
  1851. #define DDRAWISURF_HASDC 0x00000080L // has a DC
  1852. #define DDRAWISURF_HASCKEYDESTOVERLAY 0x00000100L // surface has CKDestOverlay
  1853. #define DDRAWISURF_HASCKEYDESTBLT 0x00000200L // surface has CKDestBlt
  1854. #define DDRAWISURF_HASCKEYSRCOVERLAY 0x00000400L // surface has CKSrcOverlay
  1855. #define DDRAWISURF_HASCKEYSRCBLT 0x00000800L // surface has CKSrcBlt
  1856. #define DDRAWISURF_LOCKEXCLUDEDCURSOR 0x00001000L // surface was locked and excluded cursor
  1857. #define DDRAWISURF_HASPIXELFORMAT 0x00002000L // surface structure has pixel format data
  1858. #define DDRAWISURF_HASOVERLAYDATA 0x00004000L // surface structure has overlay data
  1859. #define DDRAWISURF_SETGAMMA 0x00008000L // gamma ramp for this surface is active
  1860. #define DDRAWISURF_SW_CKEYDESTOVERLAY 0x00010000L // surface expects to process colorkey in software
  1861. #define DDRAWISURF_SW_CKEYDESTBLT 0x00020000L // surface expects to process colorkey in software
  1862. #define DDRAWISURF_SW_CKEYSRCOVERLAY 0x00040000L // surface expects to process colorkey in software
  1863. #define DDRAWISURF_SW_CKEYSRCBLT 0x00080000L // surface expects to process colorkey in software
  1864. #define DDRAWISURF_HW_CKEYDESTOVERLAY 0x00100000L // surface expects to process colorkey in hardware
  1865. #define DDRAWISURF_HW_CKEYDESTBLT 0x00200000L // surface expects to process colorkey in hardware
  1866. #define DDRAWISURF_HW_CKEYSRCOVERLAY 0x00400000L // surface expects to process colorkey in hardware
  1867. #define DDRAWISURF_HW_CKEYSRCBLT 0x00800000L // surface expects to process colorkey in hardware
  1868. #define DDRAWISURF_INMASTERSPRITELIST 0x01000000l // surface is referenced in master sprite list
  1869. #define DDRAWISURF_HELCB 0x02000000L // surface is the ddhel cb. must call hel for lock/blt.
  1870. #define DDRAWISURF_FRONTBUFFER 0x04000000L // surface was originally a front buffer
  1871. #define DDRAWISURF_BACKBUFFER 0x08000000L // surface was originally backbuffer
  1872. #define DDRAWISURF_INVALID 0x10000000L // surface has been invalidated by mode set
  1873. #define DDRAWISURF_DCIBUSY 0x20000000L // HEL has turned off BUSY so DCI would work
  1874. #define DDRAWISURF_GETDCNULL 0x40000000L // getdc could not lock and so returned GetDC(NULL)
  1875. //#define DDRAWISURF_CANTLOCK 0x20000000L // surface cannot be locked (primary created by HEL)
  1876. #define DDRAWISURF_STEREOSURFACELEFT 0x20000000L // surface is left of stereo pair
  1877. #define DDRAWISURF_DRIVERMANAGED 0x40000000L // Surface is a driver managed texture (D3D)
  1878. #define DDRAWISURF_DCILOCK 0x80000000L // Surface was locked using DCIBeginAccess
  1879. /*
  1880. * rop stuff
  1881. */
  1882. #define ROP_HAS_SOURCE 0x00000001l
  1883. #define ROP_HAS_PATTERN 0x00000002l
  1884. #define ROP_HAS_SOURCEPATTERN ROP_HAS_SOURCE | ROP_HAS_PATTERN
  1885. /*
  1886. * mode information
  1887. */
  1888. typedef struct _DDHALMODEINFO
  1889. {
  1890. DWORD dwWidth; // width (in pixels) of mode
  1891. DWORD dwHeight; // height (in pixels) of mode
  1892. LONG lPitch; // pitch (in bytes) of mode
  1893. DWORD dwBPP; // bits per pixel
  1894. WORD wFlags; // flags
  1895. WORD wRefreshRate; // refresh rate
  1896. DWORD dwRBitMask; // red bit mask
  1897. DWORD dwGBitMask; // green bit mask
  1898. DWORD dwBBitMask; // blue bit mask
  1899. DWORD dwAlphaBitMask; // alpha bit mask
  1900. } DDHALMODEINFO;
  1901. typedef DDHALMODEINFO FAR *LPDDHALMODEINFO;
  1902. #define DDMODEINFO_PALETTIZED 0x0001 // mode is palettized
  1903. #define DDMODEINFO_MODEX 0x0002 // mode is a modex mode
  1904. #define DDMODEINFO_UNSUPPORTED 0x0004 // mode is not supported by driver
  1905. /*
  1906. * Note internally, standard VGA modes are tagged as MODEX and STANDARDVGA
  1907. */
  1908. #define DDMODEINFO_STANDARDVGA 0x0008 // mode is standard vga, e.g. mode 0x13
  1909. #define DDMODEINFO_MAXREFRESH 0x0010 // refresh rate specified is the max supported
  1910. #define DDMODEINFO_STEREO 0x0020 // mode can be switched to stereo
  1911. //@@BEGIN_MSINTERNAL
  1912. /*
  1913. * This means that the mode marked as 16bpp is really 555
  1914. */
  1915. #define DDMODEINFO_555MODE 0x0100
  1916. /*
  1917. * This mode should only be used with DX7 or higher interfaces.
  1918. */
  1919. #define DDMODEINFO_DX7ONLY 0x0200
  1920. #define DDMODEINFO_VALID 0x003C // valid
  1921. #define LISTGROWSIZE 1024
  1922. typedef struct _DDSURFACELISTENTRY
  1923. {
  1924. DWORD dwFlags;
  1925. DWORD nextentry;
  1926. LPDDRAWI_DDRAWSURFACE_LCL lpSurface;
  1927. } DDSURFACELISTENTRY;
  1928. typedef DDSURFACELISTENTRY FAR* LPDDSURFACELISTENTRY;
  1929. typedef struct _DWLIST
  1930. {
  1931. LPDDSURFACELISTENTRY dwList; // array to hold handles, dynamically allocated
  1932. // dwList[0] is the size of array dwList if allocated
  1933. DWORD dwFreeList; // point to the first unused slot in dwList
  1934. } DWLIST;
  1935. typedef DWLIST FAR* LPDWLIST;
  1936. #ifdef WIN95
  1937. #define SURFACEHANDLELIST(this_lcl) (this_lcl->SurfaceHandleList)
  1938. #else //WIN95
  1939. #define SURFACEHANDLELIST(this_lcl) (this_lcl->lpGbl->SurfaceHandleList)
  1940. #endif //WIN95
  1941. //@@END_MSINTERNAL
  1942. /*
  1943. * DDRAW interface struct
  1944. */
  1945. typedef struct _DDRAWI_DIRECTDRAW_INT
  1946. {
  1947. LPVOID lpVtbl; // pointer to array of interface methods
  1948. LPDDRAWI_DIRECTDRAW_LCL lpLcl; // pointer to interface data
  1949. LPDDRAWI_DIRECTDRAW_INT lpLink; // link to next interface
  1950. DWORD dwIntRefCnt; // interface reference count
  1951. //@@BEGIN_MSINTERNAL
  1952. ULONG_PTR dwReserved1; // for DDrawEx
  1953. ULONG_PTR dwReserved2; // for DDrawEx
  1954. //@@END_MSINTERNAL
  1955. } DDRAWI_DIRECTDRAW_INT;
  1956. /*
  1957. * DDRAW version of DirectDraw object; it has data after the vtable
  1958. *
  1959. * all entries marked as PRIVATE are not for use by the display driver
  1960. */
  1961. typedef struct _DDHAL_CALLBACKS
  1962. {
  1963. DDHAL_DDCALLBACKS cbDDCallbacks; // addresses in display driver for DIRECTDRAW object HAL
  1964. DDHAL_DDSURFACECALLBACKS cbDDSurfaceCallbacks; // addresses in display driver for DIRECTDRAWSURFACE object HAL
  1965. DDHAL_DDPALETTECALLBACKS cbDDPaletteCallbacks; // addresses in display driver for DIRECTDRAWPALETTE object HAL
  1966. DDHAL_DDCALLBACKS HALDD; // HAL for DIRECTDRAW object
  1967. DDHAL_DDSURFACECALLBACKS HALDDSurface; // HAL for DIRECTDRAWSURFACE object
  1968. DDHAL_DDPALETTECALLBACKS HALDDPalette; // HAL for DIRECTDRAWPALETTE object
  1969. DDHAL_DDCALLBACKS HELDD; // HEL for DIRECTDRAW object
  1970. DDHAL_DDSURFACECALLBACKS HELDDSurface; // HEL for DIRECTDRAWSURFACE object
  1971. DDHAL_DDPALETTECALLBACKS HELDDPalette; // HEL for DIRECTDRAWPALETTE object
  1972. DDHAL_DDEXEBUFCALLBACKS cbDDExeBufCallbacks; // addresses in display driver for DIRECTDRAWEXEBUF pseudo object HAL
  1973. DDHAL_DDEXEBUFCALLBACKS HALDDExeBuf; // HAL for DIRECTDRAWEXEBUF pseudo object
  1974. DDHAL_DDEXEBUFCALLBACKS HELDDExeBuf; // HEL for DIRECTDRAWEXEBUF preudo object
  1975. DDHAL_DDVIDEOPORTCALLBACKS cbDDVideoPortCallbacks; // addresses in display driver for VideoPort object HAL
  1976. DDHAL_DDVIDEOPORTCALLBACKS HALDDVideoPort; // HAL for DIRECTDRAWVIDEOPORT psuedo object
  1977. DDHAL_DDCOLORCONTROLCALLBACKS cbDDColorControlCallbacks; // addresses in display driver for color control object HAL
  1978. DDHAL_DDCOLORCONTROLCALLBACKS HALDDColorControl; // HAL for DIRECTDRAWCOLORCONTROL psuedo object
  1979. DDHAL_DDMISCELLANEOUSCALLBACKS cbDDMiscellaneousCallbacks;
  1980. DDHAL_DDMISCELLANEOUSCALLBACKS HALDDMiscellaneous;
  1981. DDHAL_DDKERNELCALLBACKS cbDDKernelCallbacks;
  1982. DDHAL_DDKERNELCALLBACKS HALDDKernel;
  1983. DDHAL_DDMOTIONCOMPCALLBACKS cbDDMotionCompCallbacks;
  1984. DDHAL_DDMOTIONCOMPCALLBACKS HALDDMotionComp;
  1985. //@@BEGIN_MSINTERNAL
  1986. #ifndef WIN95
  1987. DDHAL_DDNTCALLBACKS cbDDNTCallbacks;
  1988. DDHAL_DDNTCALLBACKS HALDDNT;
  1989. #endif
  1990. DDHAL_DDMISCELLANEOUS2CALLBACKS HELDDMiscellaneous2; // HEL
  1991. DDHAL_DDMISCELLANEOUS2CALLBACKS HALDDMiscellaneous2; // HAL (32-bit, no thunk)
  1992. //@@END_MSINTERNAL
  1993. } DDHAL_CALLBACKS, far *LPDDHAL_CALLBACKS;
  1994. //@@BEGIN_MSINTERNAL
  1995. /*
  1996. * READ THIS - READ THIS - READ THIS - READ THIS - READ THIS - READ THIS
  1997. *
  1998. * Why have this structure and the API visible DDCAPS? Well we want to grow
  1999. * DDCAPS so the application can get at new caps. but we can't grow the
  2000. * DDCAPS that the driver returns to us because it is embeded by value in
  2001. * DDCOREINFO and chaging is size would break drivers - sigh.Therefore this
  2002. * structure, DDCORECAPS, is the caps structure returned to us by the driver
  2003. * in DDHALINFO.
  2004. *
  2005. * IT HAS A FIXED SIZE AND MUST NEVER GROW OR SHRINK. Whereas the public
  2006. * DDCAPS will grow as new capabilities are added. If new caps are needed
  2007. * they should be returned through a GetDriverInfo call rather than
  2008. * through growing DDCORECAPS.
  2009. *
  2010. * The field names of this structure must be maintained in sync. with the
  2011. * those in the public DDCAPS structure. So if you rename a field at the
  2012. * API level rename it here also (but don't break drivers)
  2013. */
  2014. //@@END_MSINTERNAL
  2015. /*
  2016. * This structure mirrors the first entries of the DDCAPS but is of a fixed
  2017. * size and will not grow as DDCAPS grows. This is the structure your driver
  2018. * returns in DDCOREINFO. Additional caps will be requested via a GetDriverInfo
  2019. * call.
  2020. */
  2021. typedef struct _DDCORECAPS
  2022. {
  2023. DWORD dwSize; // size of the DDDRIVERCAPS structure
  2024. DWORD dwCaps; // driver specific capabilities
  2025. DWORD dwCaps2; // more driver specific capabilites
  2026. DWORD dwCKeyCaps; // color key capabilities of the surface
  2027. DWORD dwFXCaps; // driver specific stretching and effects capabilites
  2028. DWORD dwFXAlphaCaps; // alpha driver specific capabilities
  2029. DWORD dwPalCaps; // palette capabilities
  2030. DWORD dwSVCaps; // stereo vision capabilities
  2031. DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8
  2032. DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8
  2033. DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8
  2034. DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8
  2035. DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8
  2036. DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8
  2037. DWORD dwZBufferBitDepths; // DDBD_8,16,24,32
  2038. DWORD dwVidMemTotal; // total amount of video memory
  2039. DWORD dwVidMemFree; // amount of free video memory
  2040. DWORD dwMaxVisibleOverlays; // maximum number of visible overlays
  2041. DWORD dwCurrVisibleOverlays; // current number of visible overlays
  2042. DWORD dwNumFourCCCodes; // number of four cc codes
  2043. DWORD dwAlignBoundarySrc; // source rectangle alignment
  2044. DWORD dwAlignSizeSrc; // source rectangle byte size
  2045. DWORD dwAlignBoundaryDest; // dest rectangle alignment
  2046. DWORD dwAlignSizeDest; // dest rectangle byte size
  2047. DWORD dwAlignStrideAlign; // stride alignment
  2048. DWORD dwRops[DD_ROP_SPACE]; // ROPS supported
  2049. DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities
  2050. DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2051. DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2052. DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2053. DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2054. DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2055. DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  2056. DWORD dwReserved1; // reserved
  2057. DWORD dwReserved2; // reserved
  2058. DWORD dwReserved3; // reserved
  2059. DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts
  2060. DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts
  2061. DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts
  2062. DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts
  2063. DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts
  2064. DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts
  2065. DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts
  2066. DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts
  2067. DWORD dwSSBCaps; // driver specific capabilities for System->System blts
  2068. DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts
  2069. DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts
  2070. DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts
  2071. DWORD dwMaxVideoPorts; // maximum number of usable video ports
  2072. DWORD dwCurrVideoPorts; // current number of video ports used
  2073. DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts
  2074. } DDCORECAPS;
  2075. typedef DDCORECAPS FAR* LPDDCORECAPS;
  2076. typedef struct _DDRAWI_DIRECTDRAW_GBL
  2077. {
  2078. /* 0*/ DWORD dwRefCnt; // reference count
  2079. /* 4*/ DWORD dwFlags; // flags
  2080. /* 8*/ FLATPTR fpPrimaryOrig; // primary surf vid mem. ptr
  2081. /* c*/ DDCORECAPS ddCaps; // driver caps
  2082. /*148*/ DWORD dwInternal1; // Private to ddraw.dll
  2083. /*16c*/ DWORD dwUnused1[9]; // not currently used
  2084. /*170*/ LPDDHAL_CALLBACKS lpDDCBtmp; // HAL callbacks
  2085. /*174*/ LPDDRAWI_DDRAWSURFACE_INT dsList; // PRIVATE: list of all surfaces
  2086. /*178*/ LPDDRAWI_DDRAWPALETTE_INT palList; // PRIVATE: list of all palettes
  2087. /*17c*/ LPDDRAWI_DDRAWCLIPPER_INT clipperList; // PRIVATE: list of all clippers
  2088. /*180*/ LPDDRAWI_DIRECTDRAW_GBL lp16DD; // PRIVATE: 16-bit ptr to this struct
  2089. /*184*/ DWORD dwMaxOverlays; // maximum number of overlays
  2090. /*188*/ DWORD dwCurrOverlays; // current number of visible overlays
  2091. /*18c*/ DWORD dwMonitorFrequency; // monitor frequency in current mode
  2092. /*190*/ DDCORECAPS ddHELCaps; // HEL capabilities
  2093. /*2cc*/ DWORD dwUnused2[50]; // not currently used
  2094. /*394*/ DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
  2095. /*39c*/ DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
  2096. /*3a4*/ VIDMEMINFO vmiData; // info about vid memory
  2097. /*3f4*/ LPVOID lpDriverHandle; // handle for use by display driver
  2098. /* */ // to call fns in DDRAW16.DLL
  2099. /*3f8*/ LPDDRAWI_DIRECTDRAW_LCL lpExclusiveOwner; // PRIVATE: exclusive local object
  2100. /*3fc*/ DWORD dwModeIndex; // current mode index
  2101. /*400*/ DWORD dwModeIndexOrig; // original mode index
  2102. /*404*/ DWORD dwNumFourCC; // number of fourcc codes supported
  2103. /*408*/ DWORD FAR *lpdwFourCC; // PRIVATE: fourcc codes supported
  2104. /*40c*/ DWORD dwNumModes; // number of modes supported
  2105. /*410*/ LPDDHALMODEINFO lpModeInfo; // PRIVATE: mode information
  2106. /*424*/ PROCESS_LIST plProcessList; // PRIVATE: list of processes using driver
  2107. /*428*/ DWORD dwSurfaceLockCount; // total number of outstanding locks
  2108. /*42c*/ DWORD dwAliasedLockCnt; // PRIVATE: number of outstanding aliased locks
  2109. /*430*/ ULONG_PTR dwReserved3; // reserved for use by display driver
  2110. /*434*/ ULONG_PTR hDD; // PRIVATE: NT Kernel-mode handle (was dwFree3).
  2111. /*438*/ char cObsolete[12]; // Obsolete field, do not use
  2112. /*444*/ DWORD dwReserved1; // reserved for use by display driver
  2113. /*448*/ DWORD dwReserved2; // reserved for use by display driver
  2114. /*44c*/ DBLNODE dbnOverlayRoot; // The root node of the doubly-
  2115. /* */ // linked list of overlay z orders.
  2116. /*45c*/ volatile LPWORD lpwPDeviceFlags; // driver physical device flags
  2117. /*460*/ DWORD dwPDevice; // driver physical device (16:16 pointer)
  2118. /*464*/ DWORD dwWin16LockCnt; // count on win16 holds
  2119. /*468*/ DWORD dwUnused3; // was lpWin16LockOwner
  2120. /*46c*/ DWORD hInstance; // instance handle of driver
  2121. /*470*/ DWORD dwEvent16; // 16-bit event
  2122. /*474*/ DWORD dwSaveNumModes; // saved number of modes supported
  2123. /* */ //------- Fields added in Version 2.0 -------
  2124. //@@BEGIN_MSINTERNAL
  2125. #if 1 //Masked for DDK
  2126. /*478*/ LPD3DHAL_GLOBALDRIVERDATA lpD3DGlobalDriverData; // Global D3D Data
  2127. /*47c*/ LPD3DHAL_CALLBACKS lpD3DHALCallbacks; // D3D HAL Callbacks
  2128. #else
  2129. //@@END_MSINTERNAL
  2130. /*478*/ ULONG_PTR lpD3DGlobalDriverData; // Global D3D Data
  2131. /*47c*/ ULONG_PTR lpD3DHALCallbacks; // D3D HAL Callbacks
  2132. //@@BEGIN_MSINTERNAL
  2133. #endif
  2134. //@@END_MSINTERNAL
  2135. /*480*/ DDCORECAPS ddBothCaps; // logical AND of driver and HEL caps
  2136. /* */ //------- Fields added in Version 5.0 -------
  2137. /*5bc*/ LPDDVIDEOPORTCAPS lpDDVideoPortCaps;// Info returned by the HAL (an array if more than one video port)
  2138. /*5c0*/ LPDDRAWI_DDVIDEOPORT_INT dvpList; // PRIVATE: list of all video ports
  2139. //@@BEGIN_MSINTERNAL
  2140. #if 1 //Masked for DDK
  2141. /*5c4*/ LPD3DHAL_CALLBACKS2 lpD3DHALCallbacks2; // Post-DX3 D3D HAL callbacks
  2142. #else
  2143. //@@END_MSINTERNAL
  2144. /*5c4*/ ULONG_PTR lpD3DHALCallbacks2; // Post-DX3 D3D HAL callbacks
  2145. //@@BEGIN_MSINTERNAL
  2146. #endif //1
  2147. //@@END_MSINTERNAL
  2148. /*5c8*/ RECT rectDevice; // rectangle (in desktop coord) for device
  2149. /*5d8*/ DWORD cMonitors; // number of monitors in the system
  2150. /*5dc*/ LPVOID gpbmiSrc; // PRIVATE: used by HEL
  2151. /*5e0*/ LPVOID gpbmiDest; // PRIVATE: used by HEL
  2152. /*5e4*/ LPHEAPALIASINFO phaiHeapAliases; // PRIVATE: video memory heap aliases
  2153. /*5e8*/ ULONG_PTR hKernelHandle;
  2154. /*5ec*/ ULONG_PTR pfnNotifyProc; // Notification proc registered w/ VDD
  2155. /*5f0*/ LPDDKERNELCAPS lpDDKernelCaps; // Capabilies of kernel mode interface
  2156. /*5f4*/ LPDDNONLOCALVIDMEMCAPS lpddNLVCaps; // hardware non-local to local vidmem caps
  2157. /*5f8*/ LPDDNONLOCALVIDMEMCAPS lpddNLVHELCaps; // emulation layer non-local to local vidmem caps
  2158. /*5fc*/ LPDDNONLOCALVIDMEMCAPS lpddNLVBothCaps; // logical AND of hardware and emulation non-local to local vidmem caps
  2159. //@@BEGIN_MSINTERNAL
  2160. #if 1 //Masked for DDK
  2161. /*600*/ LPD3DHAL_D3DEXTENDEDCAPS lpD3DExtendedCaps; // extended caps for D3D
  2162. #else
  2163. //@@END_MSINTERNAL
  2164. /*600*/ ULONG_PTR lpD3DExtendedCaps; // extended caps for D3D
  2165. //@@BEGIN_MSINTERNAL
  2166. #endif //1
  2167. //@@END_MSINTERNAL
  2168. /* */ //--------Fields added in Version 5.0A
  2169. /*604*/ DWORD dwDOSBoxEvent; // Event set when returning from a DOS box
  2170. /*608*/ RECT rectDesktop; // Desktop coordinates
  2171. /*618*/ char cDriverName[MAX_DRIVER_NAME]; // Display name
  2172. /* */ //------- Fields added in Version 6.0 -------
  2173. //@@BEGIN_MSINTERNAL
  2174. #if 1 //Masked for DDK
  2175. /*638*/ LPD3DHAL_CALLBACKS3 lpD3DHALCallbacks3; // DX6 D3D callbacks
  2176. #else
  2177. //@@END_MSINTERNAL
  2178. /*638*/ ULONG_PTR lpD3DHALCallbacks3; // DX6 D3D callbacks
  2179. //@@BEGIN_MSINTERNAL
  2180. #endif //1
  2181. //@@END_MSINTERNAL
  2182. /*63c*/ DWORD dwNumZPixelFormats; // Number of z-buffer+stencil pixel formats
  2183. /*640*/ LPDDPIXELFORMAT lpZPixelFormats; // Pointer to array of z-buffer pixel formats
  2184. /*644*/ LPDDRAWI_DDMOTIONCOMP_INT mcList; // PRIVATE: list of all motion comp objects
  2185. /*648*/ DWORD hDDVxd; // handle to ddraw.vxd
  2186. /*64c*/ DDSCAPSEX ddsCapsMore; // as queried via GUID_DDMoreSurfaceCaps
  2187. //@@BEGIN_MSINTERNAL
  2188. /*658*/ DWORD dwBusyDueToAliasedLock; // Almost identical semantics as dwAliasedLockCnt,
  2189. // except not incremented for execute buffer locks.
  2190. #ifndef WIN95
  2191. DISPLAYMODEINFO dmiCurrent; // NT: current display mode
  2192. #endif
  2193. /*65c*/ LPDDRAWI_DDRAWSURFACE_INT dsFreeList; // PRIVATE: freed interface list, moved from dsList and ready to be recycled
  2194. /*660*/ DD32BITDRIVERDATA dd32BitDriverData;
  2195. /*780*/ LPDDMORECAPS lpddMoreCaps; // more hardware caps bits for DX7
  2196. /*784*/ LPDDMORECAPS lpddHELMoreCaps; // more HEL caps bits for DX7
  2197. /*788*/ LPDDMORECAPS lpddBothMoreCaps; // bitwise AND of more hardware and HEL caps bits for DX7
  2198. /*78c*/ DDSCAPSEX ddsHELCapsMore; // as queried via GUID_DDMoreSurfaceCaps
  2199. /* */ LPDDMONITORINFO lpMonitorInfo; // What refresh rates the monitor/card support
  2200. /* */ LPDDHAL_GETDRIVERINFO pGetDriverInfo;
  2201. #ifdef WINNT
  2202. DWLIST SurfaceHandleList; // array to hold handles, dynamically allocated
  2203. #endif //WINNT
  2204. #ifdef POSTPONED
  2205. /**/ LPDDUMODEDRVINFO lpDDUmodeDrvInfo; // Usermode driver info
  2206. /**/ LPDDOPTSURFACEINFO lpDDOptSurfaceInfo; //Optimized Surface Information
  2207. #endif //POSTPONED
  2208. #ifdef POSTPONED2
  2209. /**/ LPVOID lpMasterSpriteList; // master sprite list
  2210. #endif //POSTPONED2
  2211. //@@END_MSINTERNAL
  2212. } DDRAWI_DIRECTDRAW_GBL;
  2213. //@@BEGIN_MSINTERNAL
  2214. typedef void (FAR PASCAL * LPPALETTEUPDATENOTIFY)(IUnknown FAR * pD3DIUnknown, DWORD dwPaletteHandle, DWORD dwStartIndex, DWORD dwNumberOfIndices, LPPALETTEENTRY pFirstIndex);
  2215. typedef void (FAR PASCAL * LPPALETTEASSOCIATENOTIFY)(IUnknown FAR * pD3DIUnknown, DWORD dwPaletteHandle, DWORD dwPaletteFlags, DWORD dwSurfaceHandle );
  2216. typedef void (FAR PASCAL * LPSURFACEFLIPNOTIFY)(IUnknown FAR * pD3DIUnknown);
  2217. typedef HRESULT (FAR PASCAL * FLUSHD3DDEVICES) (LPDDRAWI_DDRAWSURFACE_LCL surf_lcl);
  2218. typedef void (FAR PASCAL * D3DTEXTUREUPDATE) (IUnknown FAR * pD3DIUnknown);
  2219. typedef HRESULT (FAR PASCAL * D3DCREATETEXTURE)(LPDIRECTDRAWSURFACE7 pDDS);
  2220. typedef void (FAR PASCAL * D3DDESTROYTEXTURE)(LPVOID pTex);
  2221. typedef void (FAR PASCAL * LPBREAKVBLOCK)(LPVOID lpVB);
  2222. typedef HRESULT (FAR PASCAL * D3DSETPRIORITY)(LPVOID lpTexI, DWORD dwPriority);
  2223. typedef HRESULT (FAR PASCAL * D3DGETPRIORITY)(LPVOID lpTexI, LPDWORD lpdwPriority);
  2224. typedef HRESULT (FAR PASCAL * D3DSETLOD)(LPVOID lpTexI, DWORD dwLOD);
  2225. typedef HRESULT (FAR PASCAL * D3DGETLOD)(LPVOID lpTexI, LPDWORD lpdwLOD);
  2226. #define PALETTEUPDATENOTIFY_NAME "PaletteUpdateNotify"
  2227. #define PALETTEASSOCIATENOTIFY_NAME "PaletteAssociateNotify"
  2228. #define SURFACEFLIPNOTIFY_NAME "SurfaceFlipNotify"
  2229. #define FLUSHD3DDEVICES_NAME "FlushD3DDevices"
  2230. #define FLUSHD3DDEVICES2_NAME "FlushD3DDevices2"
  2231. #define D3DTEXTUREUPDATE_NAME "D3DTextureUpdate"
  2232. #define D3DCREATETEXTURE_NAME "CreateTexture"
  2233. #define D3DDESTROYTEXTURE_NAME "DestroyTexture"
  2234. #define D3DSETPRIORITY_NAME "SetPriority"
  2235. #define D3DGETPRIORITY_NAME "GetPriority"
  2236. #define D3DSETLOD_NAME "SetLOD"
  2237. #define D3DGETLOD_NAME "GetLOD"
  2238. #define BREAKVBLOCK_NAME "D3DBreakVBLock"
  2239. //@@END_MSINTERNAL
  2240. typedef struct _DDRAWI_DIRECTDRAW_LCL
  2241. {
  2242. DWORD lpDDMore; // pointer to additional local data
  2243. LPDDRAWI_DIRECTDRAW_GBL lpGbl; // pointer to data
  2244. DWORD dwUnused0; // not currently used
  2245. DWORD dwLocalFlags; // local flags (DDRAWILCL_)
  2246. DWORD dwLocalRefCnt; // local ref cnt
  2247. DWORD dwProcessId; // owning process id
  2248. IUnknown FAR *pUnkOuter; // outer IUnknown
  2249. DWORD dwObsolete1;
  2250. ULONG_PTR hWnd;
  2251. ULONG_PTR hDC;
  2252. DWORD dwErrorMode;
  2253. LPDDRAWI_DDRAWSURFACE_INT lpPrimary;
  2254. LPDDRAWI_DDRAWSURFACE_INT lpCB;
  2255. DWORD dwPreferredMode;
  2256. //------- Fields added in Version 2.0 -------
  2257. HINSTANCE hD3DInstance; // Handle of Direct3D's DLL.
  2258. IUnknown FAR *pD3DIUnknown; // Direct3D's aggregated IUnknown.
  2259. LPDDHAL_CALLBACKS lpDDCB; // HAL callbacks
  2260. ULONG_PTR hDDVxd; // handle to ddraw.vxd
  2261. //------- Fields added in Version 5.0 -------
  2262. DWORD dwAppHackFlags; // app compatibilty flags
  2263. //------- Fields added in Version 5.A -------
  2264. ULONG_PTR hFocusWnd; // Focus window set via SetCoopLevel
  2265. DWORD dwHotTracking; // Reactive menu etc setting cached while fullscreen
  2266. DWORD dwIMEState; // IME toolbar setting cached while fullscreen
  2267. //------- Fields added in Version 6.0 -------
  2268. ULONG_PTR hWndPopup;
  2269. ULONG_PTR hDD; // PRIVATE: NT Kernel-mode handle
  2270. //@@BEGIN_MSINTERNAL
  2271. #ifdef SHAREDZ
  2272. LPDDRAWI_DDRAWSURFACE_INT lpSharedZ; // Shared z-buffer (if any).
  2273. LPDDRAWI_DDRAWSURFACE_INT lpSharedBack; // Shared back-buffer (if any).
  2274. #endif
  2275. #ifndef WIN95
  2276. DISPLAYMODEINFO dmiPreferred; // NT: preferred display mode
  2277. #endif
  2278. //@@END_MSINTERNAL
  2279. ULONG_PTR hGammaCalibrator; // Private
  2280. LPDDGAMMACALIBRATORPROC lpGammaCalibrator; // Private
  2281. //@@BEGIN_MSINTERNAL
  2282. #ifdef WIN95
  2283. DWLIST SurfaceHandleList; // array to hold handles, dynamically allocated
  2284. #endif //WIN95
  2285. LPDDRAWI_DIRECTDRAW_LCL lpLink; // link to next local
  2286. LPPALETTEUPDATENOTIFY pPaletteUpdateNotify;
  2287. LPPALETTEASSOCIATENOTIFY pPaletteAssociateNotify;
  2288. LPSURFACEFLIPNOTIFY pSurfaceFlipNotify;
  2289. DWORD cbitsPaletteBitfieldBitCount;
  2290. LPDWORD pPaletteHandleUsedBitfield;
  2291. FLUSHD3DDEVICES pFlushD3DDevices;
  2292. FLUSHD3DDEVICES pFlushD3DDevices2;
  2293. D3DTEXTUREUPDATE pD3DTextureUpdate;
  2294. D3DCREATETEXTURE pD3DCreateTexture;
  2295. D3DDESTROYTEXTURE pD3DDestroyTexture;
  2296. D3DSETPRIORITY pD3DSetPriority;
  2297. D3DGETPRIORITY pD3DGetPriority;
  2298. D3DSETLOD pD3DSetLOD;
  2299. D3DGETLOD pD3DGetLOD;
  2300. LPDIRECTDRAWSURFACECALLBACKS pddSurfaceCallbacks;
  2301. LPMODETESTCONTEXT lpModeTestContext; // Keeps track of current mode test
  2302. DWORD dwNumTexLocks; // D3D texturing stats counter
  2303. DWORD dwNumTexGetDCs; // D3D texturing stats counter
  2304. #ifndef WIN95
  2305. DWORD dwCursorShadow; // Cursor shadow turned off while fullscreen
  2306. #endif
  2307. LPBREAKVBLOCK pBreakVBLock; // Private
  2308. //@@END_MSINTERNAL
  2309. } DDRAWI_DIRECTDRAW_LCL;
  2310. #define DDRAWILCL_HASEXCLUSIVEMODE 0x00000001l
  2311. #define DDRAWILCL_ISFULLSCREEN 0x00000002l
  2312. #define DDRAWILCL_SETCOOPCALLED 0x00000004l
  2313. #define DDRAWILCL_ACTIVEYES 0x00000008l
  2314. #define DDRAWILCL_ACTIVENO 0x00000010l
  2315. #define DDRAWILCL_HOOKEDHWND 0x00000020l
  2316. #define DDRAWILCL_ALLOWMODEX 0x00000040l
  2317. #define DDRAWILCL_V1SCLBEHAVIOUR 0x00000080l
  2318. #define DDRAWILCL_MODEHASBEENCHANGED 0x00000100l
  2319. #define DDRAWILCL_CREATEDWINDOW 0x00000200l
  2320. #define DDRAWILCL_DIRTYDC 0x00000400l // Set on ChangeDisplaySettings, cleared when device DC is reinited
  2321. #define DDRAWILCL_DISABLEINACTIVATE 0x00000800l
  2322. #define DDRAWILCL_CURSORCLIPPED 0x00001000l
  2323. #define DDRAWILCL_EXPLICITMONITOR 0x00002000l // device was chosen explicitly i.e. not DDrawCreate(NULL)
  2324. #define DDRAWILCL_MULTITHREADED 0x00004000l // App threaten to be multithreaded
  2325. #define DDRAWILCL_FPUSETUP 0x00008000l // D3D does not need to switch to single prec/exceptions disabled each time
  2326. #define DDRAWILCL_POWEREDDOWN 0x00010000l // Private: indicates that screen saver is powered down
  2327. #define DDRAWILCL_DIRECTDRAW7 0x00020000l // PRIVATE: Marks if this is a IDirectDraw7 object
  2328. #define DDRAWILCL_ATTEMPTEDD3DCONTEXT 0x00040000l // PRIVATE: Marks if this ddraw local has attempted to create a d3d context
  2329. #define DDRAWILCL_FPUPRESERVE 0x00080000l // D3D needs to switch to single prec/exceptions disabled each time
  2330. #define DDRAWI_xxxxxxxxx1 0x00000001l // unused
  2331. #define DDRAWI_xxxxxxxxx2 0x00000002l // unused
  2332. #define DDRAWI_VIRTUALDESKTOP 0x00000008l // driver is really a multi-monitor virtual desktop
  2333. #define DDRAWI_MODEX 0x00000010l // driver is using modex
  2334. #define DDRAWI_DISPLAYDRV 0x00000020l // driver is display driver
  2335. #define DDRAWI_FULLSCREEN 0x00000040l // driver in fullscreen mode
  2336. #define DDRAWI_MODECHANGED 0x00000080l // display mode has been changed
  2337. #define DDRAWI_NOHARDWARE 0x00000100l // no driver hardware at all
  2338. #define DDRAWI_PALETTEINIT 0x00000200l // GDI palette stuff has been initalized
  2339. #define DDRAWI_NOEMULATION 0x00000400l // no emulation at all
  2340. #define DDRAWI_HASCKEYDESTOVERLAY 0x00000800l // driver has CKDestOverlay
  2341. #define DDRAWI_HASCKEYSRCOVERLAY 0x00001000l // driver has CKSrcOverlay
  2342. #define DDRAWI_HASGDIPALETTE 0x00002000l // GDI palette exists on primary surface
  2343. #define DDRAWI_EMULATIONINITIALIZED 0x00004000l // emulation is initialized
  2344. #define DDRAWI_HASGDIPALETTE_EXCLUSIVE 0x00008000l // exclusive mode palette
  2345. #define DDRAWI_MODEXILLEGAL 0x00010000l // modex is not supported by this hardware
  2346. #define DDRAWI_FLIPPEDTOGDI 0x00020000l // driver has been flipped to show GDI surface
  2347. #define DDRAWI_NEEDSWIN16FORVRAMLOCK 0x00040000l // PRIVATE: Win16 lock must be taken when locking a VRAM surface
  2348. #define DDRAWI_PDEVICEVRAMBITCLEARED 0x00080000l // PRIVATE: the PDEVICE's VRAM bit was cleared by a lock
  2349. #define DDRAWI_STANDARDVGA 0x00100000l // Device is using standard VGA mode (DDRAWI_MODEX will be set)
  2350. #define DDRAWI_EXTENDEDALIGNMENT 0x00200000l // At least one heap has extended alignment. Ignore alignment in VIDMEMINFO
  2351. #define DDRAWI_CHANGINGMODE 0x00400000l // Currently in the middle of a mode change
  2352. #define DDRAWI_GDIDRV 0x00800000l // Driver is a GDI driver
  2353. #define DDRAWI_ATTACHEDTODESKTOP 0x01000000l // Device is attached to the desktop
  2354. #define DDRAWI_UMODELOADED 0x02000000l // User mode driver dll is loaded
  2355. #define DDRAWI_DDRAWDATANOTFETCHED 0x04000000l // PRIVATE: Marks mode-change data fetched (NT)
  2356. #define DDRAWI_SECONDARYDRIVERLOADED 0x08000000l // PRIVATE: Marks if a secndary PVR-style HAL was loaded
  2357. #define DDRAWI_TESTINGMODES 0x10000000l // PRIVATE: A mode test in is progress
  2358. //@@BEGIN_MSINTERNAL
  2359. #ifdef IS_16
  2360. __inline BOOL IsD3DManaged(psurf_lcl)
  2361. LPDDRAWI_DDRAWSURFACE_LCL psurf_lcl;
  2362. #else
  2363. __inline BOOL IsD3DManaged(LPDDRAWI_DDRAWSURFACE_LCL psurf_lcl)
  2364. #endif
  2365. {
  2366. if(psurf_lcl->dwFlags & DDRAWISURF_DRIVERMANAGED)
  2367. {
  2368. return FALSE;
  2369. }
  2370. else
  2371. {
  2372. return ((psurf_lcl->lpSurfMore->ddsCapsEx.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)) ? TRUE : FALSE);
  2373. }
  2374. }
  2375. #ifdef IS_16
  2376. __inline void MarkDirty(surf_lcl)
  2377. LPDDRAWI_DDRAWSURFACE_LCL surf_lcl;
  2378. #else
  2379. __inline void MarkDirty(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl)
  2380. #endif // IS_16
  2381. {
  2382. if(surf_lcl->lpSurfMore->lpbDirty)
  2383. {
  2384. *(surf_lcl->lpSurfMore->lpbDirty) = TRUE;
  2385. if(surf_lcl->lpSurfMore->lpDD_lcl->dwLocalFlags & DDRAWILCL_DIRECTDRAW7)
  2386. {
  2387. #ifdef DDASSERT
  2388. DDASSERT(surf_lcl->lpSurfMore->lpDD_lcl->pD3DTextureUpdate);
  2389. DDASSERT(surf_lcl->lpSurfMore->lpDD_lcl->pD3DIUnknown);
  2390. #endif
  2391. surf_lcl->lpSurfMore->lpDD_lcl->pD3DTextureUpdate(surf_lcl->lpSurfMore->lpDD_lcl->pD3DIUnknown);
  2392. }
  2393. }
  2394. }
  2395. /* Flush all batched D3D drawprimitives that's using this surface */
  2396. #ifdef IS_16
  2397. __inline void FlushD3DStates(surf_lcl)
  2398. LPDDRAWI_DDRAWSURFACE_LCL surf_lcl;
  2399. #else
  2400. __inline void FlushD3DStates(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl)
  2401. #endif // IS_16
  2402. {
  2403. if(surf_lcl->lpSurfMore->lpDD_lcl->pD3DIUnknown)
  2404. surf_lcl->lpSurfMore->lpDD_lcl->pFlushD3DDevices(surf_lcl);
  2405. }
  2406. #ifdef IS_16
  2407. __inline BOOL IsToplevel(surf_lcl)
  2408. LPDDRAWI_DDRAWSURFACE_LCL surf_lcl;
  2409. #else
  2410. __inline BOOL IsToplevel(LPDDRAWI_DDRAWSURFACE_LCL surf_lcl)
  2411. #endif // IS_16
  2412. {
  2413. return !((surf_lcl->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_MIPMAPSUBLEVEL) ||
  2414. ((surf_lcl->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_CUBEMAP) &&
  2415. (surf_lcl->lpAttachListFrom != NULL)));
  2416. }
  2417. //@@END_MSINTERNAL
  2418. /*
  2419. * VideoPort object interface
  2420. */
  2421. typedef struct _DDRAWI_DDVIDEOPORT_INT
  2422. {
  2423. LPVOID lpVtbl; // pointer to array of interface methods
  2424. LPDDRAWI_DDVIDEOPORT_LCL lpLcl; // pointer to interface data
  2425. LPDDRAWI_DDVIDEOPORT_INT lpLink; // link to next interface
  2426. DWORD dwIntRefCnt; // interface reference count
  2427. DWORD dwFlags; // Private
  2428. } DDRAWI_DDVIDEOPORT_INT;
  2429. typedef struct _DDRAWI_DDVIDEOPORT_LCL
  2430. {
  2431. LPDDRAWI_DIRECTDRAW_LCL lpDD; // pointer to DIRECTDRAW_LCL
  2432. DDVIDEOPORTDESC ddvpDesc; // description used at create time
  2433. DDVIDEOPORTINFO ddvpInfo; // most recent video port info
  2434. LPDDRAWI_DDRAWSURFACE_INT lpSurface; // surface receiving the data
  2435. LPDDRAWI_DDRAWSURFACE_INT lpVBISurface; // surface receiving the VBI data
  2436. LPDDRAWI_DDRAWSURFACE_INT *lpFlipInts; // PRIVATE: surfaces currently being autoflipped
  2437. DWORD dwNumAutoflip; // Number of current autoflip surfaces
  2438. DWORD dwProcessID; // ID of process owning this video port
  2439. DWORD dwStateFlags;
  2440. DWORD dwFlags;
  2441. DWORD dwRefCnt;
  2442. FLATPTR fpLastFlip; // Location from which we last flipped
  2443. ULONG_PTR dwReserved1; // Reserved for display driver
  2444. ULONG_PTR dwReserved2; // Reserved for display driver
  2445. HANDLE hDDVideoPort; // NT Kernel-mode handle
  2446. DWORD dwNumVBIAutoflip;//Number of VBI surfaces currently being autoflipped
  2447. LPDDVIDEOPORTDESC lpVBIDesc; // PRIVATE
  2448. LPDDVIDEOPORTDESC lpVideoDesc; // PRIVATE
  2449. LPDDVIDEOPORTINFO lpVBIInfo; // PRIVATE
  2450. LPDDVIDEOPORTINFO lpVideoInfo; // PRIVATE
  2451. DWORD dwVBIProcessID; // ID of process owning this video port
  2452. } DDRAWI_DDVIDEOPORT_LCL;
  2453. #define DDRAWIVPORT_ON 0x00000001 // Video port is pumping data
  2454. #define DDRAWIVPORT_SOFTWARE_AUTOFLIP 0x00000002 // Video port cannot use hardware autoflip
  2455. #define DDRAWIVPORT_COLORKEYANDINTERP 0x00000004 // Overlay cannot bob and colorkey at same time
  2456. #define DDRAWIVPORT_NOKERNELHANDLES 0x00000008 // Unable to allocate kernel resources
  2457. #define DDRAWIVPORT_SOFTWARE_BOB 0x00000010 // All bobbing must be performed in software
  2458. #define DDRAWIVPORT_VBION 0x00000020 // Video is on for the VBI region
  2459. #define DDRAWIVPORT_VIDEOON 0x00000040 // Video is on for the video region
  2460. /*
  2461. * MotionComp object interface
  2462. */
  2463. typedef struct _DDRAWI_DDMOTIONCOMP_INT
  2464. {
  2465. LPVOID lpVtbl;
  2466. LPDDRAWI_DDMOTIONCOMP_LCL lpLcl;
  2467. LPDDRAWI_DDMOTIONCOMP_INT lpLink;
  2468. DWORD dwIntRefCnt;
  2469. } DDRAWI_DDMOTIONCOMP_INT;
  2470. typedef struct _DDRAWI_DDMOTIONCOMP_LCL
  2471. {
  2472. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  2473. GUID guid;
  2474. DWORD dwUncompWidth;
  2475. DWORD dwUncompHeight;
  2476. DDPIXELFORMAT ddUncompPixelFormat;
  2477. DWORD dwInternalFlags;
  2478. DWORD dwRefCnt;
  2479. DWORD dwProcessId;
  2480. HANDLE hMoComp;
  2481. DWORD dwDriverReserved1;
  2482. DWORD dwDriverReserved2;
  2483. DWORD dwDriverReserved3;
  2484. LPVOID lpDriverReserved1;
  2485. LPVOID lpDriverReserved2;
  2486. LPVOID lpDriverReserved3;
  2487. } DDRAWI_DDMOTIONCOMP_LCL;
  2488. //@@BEGIN_MSINTERNAL
  2489. /*
  2490. * The following structure is equivalent to the DDHALINFO structure defined in DirectDraw 1.0.
  2491. * It is used by DirectDraw internally to interpret the DDHALINFO information passed from drivers written
  2492. * prior to DirectDraw 2.0. New applications and drivers should use the DDHALINFO structure defined after
  2493. * this one. DirectDraw distinguishes between the structures via the dwSize field.
  2494. */
  2495. typedef struct _DDHALINFO_V1
  2496. {
  2497. DWORD dwSize;
  2498. LPDDHAL_DDCALLBACKS lpDDCallbacks; // direct draw object callbacks
  2499. LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks; // surface object callbacks
  2500. LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks; // palette object callbacks
  2501. VIDMEMINFO vmiData; // video memory info
  2502. DDCAPS_DX1 ddCaps; // hw specific caps
  2503. DWORD dwMonitorFrequency; // monitor frequency in current mode
  2504. DWORD hWndListBox; // list box for debug output
  2505. DWORD dwModeIndex; // current mode: index into array
  2506. LPDWORD lpdwFourCC; // fourcc codes supported
  2507. DWORD dwNumModes; // number of modes supported
  2508. LPDDHALMODEINFO lpModeInfo; // mode information
  2509. DWORD dwFlags; // create flags
  2510. LPVOID lpPDevice; // physical device ptr
  2511. DWORD hInstance; // instance handle of driver
  2512. } DDHALINFO_V1;
  2513. typedef DDHALINFO_V1 FAR *LPDDHALINFO_V1;
  2514. #define DDHALINFOSIZE_V1 sizeof( DDHALINFO_V1)
  2515. //@@END_MSINTERNAL
  2516. /*
  2517. * structure for display driver to call DDHAL_Create with
  2518. */
  2519. typedef struct _DDHALINFO
  2520. {
  2521. DWORD dwSize;
  2522. LPDDHAL_DDCALLBACKS lpDDCallbacks; // direct draw object callbacks
  2523. LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks; // surface object callbacks
  2524. LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks; // palette object callbacks
  2525. VIDMEMINFO vmiData; // video memory info
  2526. DDCORECAPS ddCaps; // core hw specific caps
  2527. DWORD dwMonitorFrequency; // monitor frequency in current mode
  2528. LPDDHAL_GETDRIVERINFO GetDriverInfo; // callback to get arbitrary vtable from driver
  2529. DWORD dwModeIndex; // current mode: index into array
  2530. LPDWORD lpdwFourCC; // fourcc codes supported
  2531. DWORD dwNumModes; // number of modes supported
  2532. LPDDHALMODEINFO lpModeInfo; // mode information
  2533. DWORD dwFlags; // create flags
  2534. LPVOID lpPDevice; // physical device ptr
  2535. DWORD hInstance; // instance handle of driver
  2536. //------- Fields added in Version 2.0 -------
  2537. //@@BEGIN_MSINTERNAL
  2538. #if 1 //Masked for DDK
  2539. LPD3DHAL_GLOBALDRIVERDATA lpD3DGlobalDriverData; // D3D global Data
  2540. LPD3DHAL_CALLBACKS lpD3DHALCallbacks; // D3D callbacks
  2541. #else //1
  2542. //@@END_MSINTERNAL
  2543. ULONG_PTR lpD3DGlobalDriverData; // D3D global Data
  2544. ULONG_PTR lpD3DHALCallbacks; // D3D callbacks
  2545. //@@BEGIN_MSINTERNAL
  2546. #endif //1
  2547. // For backward compatibility with pre-DX5 runtimes, must not
  2548. // add fields to this structure. Use GetDriverInfo instead.
  2549. //@@END_MSINTERNAL
  2550. LPDDHAL_DDEXEBUFCALLBACKS lpDDExeBufCallbacks; // Execute buffer pseudo object callbacks
  2551. } DDHALINFO;
  2552. typedef DDHALINFO FAR *LPDDHALINFO;
  2553. #define DDHALINFOSIZE_V2 sizeof( DDHALINFO )
  2554. #define DDHALINFO_ISPRIMARYDISPLAY 0x00000001l // indicates driver is primary display driver
  2555. #define DDHALINFO_MODEXILLEGAL 0x00000002l // indicates this hardware does not support modex modes
  2556. #define DDHALINFO_GETDRIVERINFOSET 0x00000004l // indicates that GetDriverInfo is set
  2557. /*
  2558. * DDRAW16.DLL entry points
  2559. */
  2560. typedef BOOL (DDAPI *LPDDHAL_SETINFO)( LPDDHALINFO lpDDHalInfo, BOOL reset );
  2561. typedef FLATPTR (DDAPI *LPDDHAL_VIDMEMALLOC)( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight );
  2562. typedef void (DDAPI *LPDDHAL_VIDMEMFREE)( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem );
  2563. extern BOOL DDAPI DDHAL_SetInfo( LPDDHALINFO lpDDHALInfo, BOOL reset );
  2564. extern FLATPTR DDAPI DDHAL_VidMemAlloc( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight );
  2565. extern void DDAPI DDHAL_VidMemFree( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem );
  2566. typedef struct
  2567. {
  2568. DWORD dwSize;
  2569. LPDDHAL_SETINFO lpSetInfo;
  2570. LPDDHAL_VIDMEMALLOC lpVidMemAlloc;
  2571. LPDDHAL_VIDMEMFREE lpVidMemFree;
  2572. } DDHALDDRAWFNS;
  2573. typedef DDHALDDRAWFNS FAR *LPDDHALDDRAWFNS;
  2574. /****************************************************************************
  2575. *
  2576. * DDHAL structures for Surface Object callbacks
  2577. *
  2578. ***************************************************************************/
  2579. //@@BEGIN_MSINTERNAL
  2580. /*
  2581. * This special flag is seen only by drivers. The DD runtime sets this
  2582. * bit in DDHAL_BLTDATA.dwFlags if the dwAFlags and ddargbScaleFactors
  2583. * members at the end of the DDHAL_BLTDATA structure are valid.
  2584. * The flag is always set if the DDHAL_BLTDATA structure is passed to
  2585. * the driver via the AlphaBlt HAL callback; otherwise, the flag is zero.
  2586. */
  2587. #define DDBLT_AFLAGS 0x80000000L
  2588. /*
  2589. * This flag will be set in DDHAL_BLTDATA.dwAFlags if the call was originated
  2590. * by the AlphaBlt API method. If the call was originated by the Blt API,
  2591. * this flag will not be set.
  2592. * Drivers which have a unified Blt/AlphaBlt DDI can use this flag to distinguish
  2593. * between the two API calls.
  2594. */
  2595. #define DDABLT_SRCOVERDEST 0x00000001L
  2596. //@@END_MSINTERNAL
  2597. /*
  2598. * structure for passing information to DDHAL Blt and AlphaBlt fns
  2599. */
  2600. typedef struct _DDHAL_BLTDATA
  2601. {
  2602. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2603. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  2604. RECTL rDest; // dest rect
  2605. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  2606. RECTL rSrc; // src rect
  2607. DWORD dwFlags; // blt flags
  2608. DWORD dwROPFlags; // ROP flags (valid for ROPS only)
  2609. DDBLTFX bltFX; // blt FX
  2610. HRESULT ddRVal; // return value
  2611. LPDDHALSURFCB_BLT Blt; // PRIVATE: ptr to callback
  2612. BOOL IsClipped; // clipped blt?
  2613. RECTL rOrigDest; // unclipped dest rect
  2614. // (only valid if IsClipped)
  2615. RECTL rOrigSrc; // unclipped src rect
  2616. // (only valid if IsClipped)
  2617. DWORD dwRectCnt; // count of dest rects
  2618. // (only valid if IsClipped)
  2619. LPRECT prDestRects; // array of dest rects
  2620. //@@BEGIN_MSINTERNAL
  2621. DWORD dwAFlags; // DDABLT_ flags (for AlphaBlt DDI)
  2622. DDARGB ddargbScaleFactors; // RGBA scaling factors (AlphaBlt)
  2623. //@@END_MSINTERNAL
  2624. } DDHAL_BLTDATA;
  2625. /*
  2626. * structure for passing information to DDHAL Lock fn
  2627. */
  2628. typedef struct _DDHAL_LOCKDATA
  2629. {
  2630. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2631. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2632. DWORD bHasRect; // rArea is valid
  2633. RECTL rArea; // area being locked
  2634. LPVOID lpSurfData; // pointer to screen memory (return value)
  2635. HRESULT ddRVal; // return value
  2636. LPDDHALSURFCB_LOCK Lock; // PRIVATE: ptr to callback
  2637. DWORD dwFlags; // DDLOCK flags
  2638. } DDHAL_LOCKDATA;
  2639. /*
  2640. * structure for passing information to DDHAL Unlock fn
  2641. */
  2642. typedef struct _DDHAL_UNLOCKDATA
  2643. {
  2644. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2645. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2646. HRESULT ddRVal; // return value
  2647. LPDDHALSURFCB_UNLOCK Unlock; // PRIVATE: ptr to callback
  2648. } DDHAL_UNLOCKDATA;
  2649. /*
  2650. * structure for passing information to DDHAL UpdateOverlay fn
  2651. */
  2652. typedef struct _DDHAL_UPDATEOVERLAYDATA
  2653. {
  2654. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2655. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  2656. RECTL rDest; // dest rect
  2657. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  2658. RECTL rSrc; // src rect
  2659. DWORD dwFlags; // flags
  2660. DDOVERLAYFX overlayFX; // overlay FX
  2661. HRESULT ddRVal; // return value
  2662. LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay; // PRIVATE: ptr to callback
  2663. } DDHAL_UPDATEOVERLAYDATA;
  2664. /*
  2665. * structure for passing information to DDHAL UpdateOverlay fn
  2666. */
  2667. typedef struct _DDHAL_SETOVERLAYPOSITIONDATA
  2668. {
  2669. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2670. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  2671. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  2672. LONG lXPos; // x position
  2673. LONG lYPos; // y position
  2674. HRESULT ddRVal; // return value
  2675. LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition; // PRIVATE: ptr to callback
  2676. } DDHAL_SETOVERLAYPOSITIONDATA;
  2677. /*
  2678. * structure for passing information to DDHAL SetPalette fn
  2679. */
  2680. typedef struct _DDHAL_SETPALETTEDATA
  2681. {
  2682. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2683. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2684. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette to set to surface
  2685. HRESULT ddRVal; // return value
  2686. LPDDHALSURFCB_SETPALETTE SetPalette; // PRIVATE: ptr to callback
  2687. BOOL Attach; // attach this palette?
  2688. } DDHAL_SETPALETTEDATA;
  2689. /*
  2690. * structure for passing information to DDHAL Flip fn
  2691. */
  2692. typedef struct _DDHAL_FLIPDATA
  2693. {
  2694. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2695. LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurr; // current surface
  2696. LPDDRAWI_DDRAWSURFACE_LCL lpSurfTarg; // target surface (to flip to)
  2697. DWORD dwFlags; // flags
  2698. HRESULT ddRVal; // return value
  2699. LPDDHALSURFCB_FLIP Flip; // PRIVATE: ptr to callback
  2700. LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurrLeft; // current surface
  2701. LPDDRAWI_DDRAWSURFACE_LCL lpSurfTargLeft; // target surface (to flip to)
  2702. } DDHAL_FLIPDATA;
  2703. /*
  2704. * structure for passing information to DDHAL DestroySurface fn
  2705. */
  2706. typedef struct _DDHAL_DESTROYSURFACEDATA
  2707. {
  2708. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2709. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2710. HRESULT ddRVal; // return value
  2711. LPDDHALSURFCB_DESTROYSURFACE DestroySurface;// PRIVATE: ptr to callback
  2712. } DDHAL_DESTROYSURFACEDATA;
  2713. /*
  2714. * structure for passing information to DDHAL SetClipList fn
  2715. */
  2716. typedef struct _DDHAL_SETCLIPLISTDATA
  2717. {
  2718. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2719. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2720. HRESULT ddRVal; // return value
  2721. LPDDHALSURFCB_SETCLIPLIST SetClipList; // PRIVATE: ptr to callback
  2722. } DDHAL_SETCLIPLISTDATA;
  2723. /*
  2724. * structure for passing information to DDHAL AddAttachedSurface fn
  2725. */
  2726. typedef struct _DDHAL_ADDATTACHEDSURFACEDATA
  2727. {
  2728. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2729. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2730. LPDDRAWI_DDRAWSURFACE_LCL lpSurfAttached; // surface to attach
  2731. HRESULT ddRVal; // return value
  2732. LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface; // PRIVATE: ptr to callback
  2733. } DDHAL_ADDATTACHEDSURFACEDATA;
  2734. /*
  2735. * structure for passing information to DDHAL SetColorKey fn
  2736. */
  2737. typedef struct _DDHAL_SETCOLORKEYDATA
  2738. {
  2739. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2740. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2741. DWORD dwFlags; // flags
  2742. DDCOLORKEY ckNew; // new color key
  2743. HRESULT ddRVal; // return value
  2744. LPDDHALSURFCB_SETCOLORKEY SetColorKey; // PRIVATE: ptr to callback
  2745. } DDHAL_SETCOLORKEYDATA;
  2746. /*
  2747. * structure for passing information to DDHAL GetBltStatus fn
  2748. */
  2749. typedef struct _DDHAL_GETBLTSTATUSDATA
  2750. {
  2751. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2752. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2753. DWORD dwFlags; // flags
  2754. HRESULT ddRVal; // return value
  2755. LPDDHALSURFCB_GETBLTSTATUS GetBltStatus; // PRIVATE: ptr to callback
  2756. } DDHAL_GETBLTSTATUSDATA;
  2757. /*
  2758. * structure for passing information to DDHAL GetFlipStatus fn
  2759. */
  2760. typedef struct _DDHAL_GETFLIPSTATUSDATA
  2761. {
  2762. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2763. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2764. DWORD dwFlags; // flags
  2765. HRESULT ddRVal; // return value
  2766. LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus; // PRIVATE: ptr to callback
  2767. } DDHAL_GETFLIPSTATUSDATA;
  2768. /****************************************************************************
  2769. *
  2770. * DDHAL structures for Palette Object callbacks
  2771. *
  2772. ***************************************************************************/
  2773. /*
  2774. * structure for passing information to DDHAL DestroyPalette fn
  2775. */
  2776. typedef struct _DDHAL_DESTROYPALETTEDATA
  2777. {
  2778. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2779. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette struct
  2780. HRESULT ddRVal; // return value
  2781. LPDDHALPALCB_DESTROYPALETTE DestroyPalette; // PRIVATE: ptr to callback
  2782. } DDHAL_DESTROYPALETTEDATA;
  2783. /*
  2784. * structure for passing information to DDHAL SetEntries fn
  2785. */
  2786. typedef struct _DDHAL_SETENTRIESDATA
  2787. {
  2788. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2789. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette struct
  2790. DWORD dwBase; // base palette index
  2791. DWORD dwNumEntries; // number of palette entries
  2792. LPPALETTEENTRY lpEntries; // color table
  2793. HRESULT ddRVal; // return value
  2794. LPDDHALPALCB_SETENTRIES SetEntries; // PRIVATE: ptr to callback
  2795. } DDHAL_SETENTRIESDATA;
  2796. /****************************************************************************
  2797. *
  2798. * DDHAL structures for Driver Object callbacks
  2799. *
  2800. ***************************************************************************/
  2801. /*
  2802. * structure for passing information to DDHAL CreateSurface fn
  2803. */
  2804. typedef struct _DDHAL_CREATESURFACEDATA
  2805. {
  2806. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2807. LPDDSURFACEDESC lpDDSurfaceDesc;// description of surface being created
  2808. LPDDRAWI_DDRAWSURFACE_LCL FAR *lplpSList; // list of created surface objects
  2809. DWORD dwSCnt; // number of surfaces in SList
  2810. HRESULT ddRVal; // return value
  2811. LPDDHAL_CREATESURFACE CreateSurface; // PRIVATE: ptr to callback
  2812. } DDHAL_CREATESURFACEDATA;
  2813. /*
  2814. * structure for passing information to DDHAL CanCreateSurface fn
  2815. */
  2816. typedef struct _DDHAL_CANCREATESURFACEDATA
  2817. {
  2818. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2819. LPDDSURFACEDESC lpDDSurfaceDesc; // description of surface being created
  2820. DWORD bIsDifferentPixelFormat;// pixel format differs from primary surface
  2821. HRESULT ddRVal; // return value
  2822. LPDDHAL_CANCREATESURFACE CanCreateSurface; // PRIVATE: ptr to callback
  2823. } DDHAL_CANCREATESURFACEDATA;
  2824. /*
  2825. * structure for passing information to DDHAL CreatePalette fn
  2826. */
  2827. typedef struct _DDHAL_CREATEPALETTEDATA
  2828. {
  2829. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2830. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // ddraw palette struct
  2831. LPPALETTEENTRY lpColorTable; // colors to go in palette
  2832. HRESULT ddRVal; // return value
  2833. LPDDHAL_CREATEPALETTE CreatePalette; // PRIVATE: ptr to callback
  2834. BOOL is_excl; // process has exclusive mode
  2835. } DDHAL_CREATEPALETTEDATA;
  2836. /*
  2837. * Return if the vertical blank is in progress
  2838. */
  2839. #define DDWAITVB_I_TESTVB 0x80000006l
  2840. /*
  2841. * structure for passing information to DDHAL WaitForVerticalBlank fn
  2842. */
  2843. typedef struct _DDHAL_WAITFORVERTICALBLANKDATA
  2844. {
  2845. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2846. DWORD dwFlags; // flags
  2847. DWORD bIsInVB; // is in vertical blank
  2848. ULONG_PTR hEvent; // event
  2849. HRESULT ddRVal; // return value
  2850. LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank; // PRIVATE: ptr to callback
  2851. } DDHAL_WAITFORVERTICALBLANKDATA;
  2852. /*
  2853. * structure for passing information to DDHAL DestroyDriver fn
  2854. */
  2855. typedef struct _DDHAL_DESTROYDRIVERDATA
  2856. {
  2857. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2858. HRESULT ddRVal; // return value
  2859. LPDDHAL_DESTROYDRIVER DestroyDriver; // PRIVATE: ptr to callback
  2860. } DDHAL_DESTROYDRIVERDATA;
  2861. /*
  2862. * structure for passing information to DDHAL SetMode fn
  2863. */
  2864. typedef struct _DDHAL_SETMODEDATA
  2865. {
  2866. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2867. DWORD dwModeIndex; // new mode
  2868. HRESULT ddRVal; // return value
  2869. LPDDHAL_SETMODE SetMode; // PRIVATE: ptr to callback
  2870. BOOL inexcl; // in exclusive mode
  2871. BOOL useRefreshRate; // use the refresh rate data in the mode info
  2872. } DDHAL_SETMODEDATA;
  2873. /*
  2874. * structure for passing information to DDHAL driver SetColorKey fn
  2875. */
  2876. typedef struct _DDHAL_DRVSETCOLORKEYDATA
  2877. {
  2878. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  2879. DWORD dwFlags; // flags
  2880. DDCOLORKEY ckNew; // new color key
  2881. HRESULT ddRVal; // return value
  2882. LPDDHAL_SETCOLORKEY SetColorKey; // PRIVATE: ptr to callback
  2883. } DDHAL_DRVSETCOLORKEYDATA;
  2884. /*
  2885. * structure for passing information to DDHAL GetScanLine fn
  2886. */
  2887. typedef struct _DDHAL_GETSCANLINEDATA
  2888. {
  2889. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2890. DWORD dwScanLine; // returned scan line
  2891. HRESULT ddRVal; // return value
  2892. LPDDHAL_GETSCANLINE GetScanLine; // PRIVATE: ptr to callback
  2893. } DDHAL_GETSCANLINEDATA;
  2894. /*
  2895. * structure for passing information to DDHAL SetExclusiveMode fn
  2896. */
  2897. typedef struct _DDHAL_SETEXCLUSIVEMODEDATA
  2898. {
  2899. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2900. DWORD dwEnterExcl; // TRUE if entering exclusive mode, FALSE is leaving
  2901. DWORD dwReserved; // reserved for future use
  2902. HRESULT ddRVal; // return value
  2903. LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode; // PRIVATE: ptr to callback
  2904. } DDHAL_SETEXCLUSIVEMODEDATA;
  2905. /*
  2906. * structure for passing information to DDHAL FlipToGDISurface fn
  2907. */
  2908. typedef struct _DDHAL_FLIPTOGDISURFACEDATA
  2909. {
  2910. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  2911. DWORD dwToGDI; // TRUE if flipping to the GDI surface, FALSE if flipping away
  2912. DWORD dwReserved; // reserved for future use
  2913. HRESULT ddRVal; // return value
  2914. LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface; // PRIVATE: ptr to callback
  2915. } DDHAL_FLIPTOGDISURFACEDATA;
  2916. /****************************************************************************
  2917. *
  2918. * DDHAL structures for VideoPort callbacks
  2919. *
  2920. ***************************************************************************/
  2921. /*
  2922. * structure for passing information to DDHAL CanCreateVideoPort fn
  2923. */
  2924. typedef struct _DDHAL_CANCREATEVPORTDATA
  2925. {
  2926. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2927. LPDDVIDEOPORTDESC lpDDVideoPortDesc;
  2928. HRESULT ddRVal; // return value
  2929. LPDDHALVPORTCB_CANCREATEVIDEOPORT CanCreateVideoPort; // PRIVATE: ptr to callback
  2930. } DDHAL_CANCREATEVPORTDATA;
  2931. /*
  2932. * structure for passing information to DDHAL CreateVideoPort fn
  2933. */
  2934. typedef struct _DDHAL_CREATEVPORTDATA
  2935. {
  2936. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2937. LPDDVIDEOPORTDESC lpDDVideoPortDesc;
  2938. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port created
  2939. HRESULT ddRVal; // return value
  2940. LPDDHALVPORTCB_CREATEVIDEOPORT CreateVideoPort; // PRIVATE: ptr to callback
  2941. } DDHAL_CREATEVPORTDATA;
  2942. /*
  2943. * structure for passing information to DDHAL FlipVideoPort fn
  2944. */
  2945. typedef struct _DDHAL_FLIPVPORTDATA
  2946. {
  2947. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2948. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  2949. LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurr; // current surface
  2950. LPDDRAWI_DDRAWSURFACE_LCL lpSurfTarg; // target surface
  2951. HRESULT ddRVal; // return value
  2952. LPDDHALVPORTCB_FLIP FlipVideoPort; // PRIVATE: ptr to callback
  2953. } DDHAL_FLIPVPORTDATA;
  2954. /*
  2955. * structure for passing information to DDHAL GetVideoPortBandwidth fn
  2956. */
  2957. typedef struct _DDHAL_GETVPORTBANDWIDTHDATA
  2958. {
  2959. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2960. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  2961. LPDDPIXELFORMAT lpddpfFormat; // Format for bandwidth
  2962. DWORD dwWidth;
  2963. DWORD dwHeight;
  2964. DWORD dwFlags; // Prescale factor for bandwidth
  2965. LPDDVIDEOPORTBANDWIDTH lpBandwidth; // Returned bandwidth parameters
  2966. HRESULT ddRVal; // return value
  2967. LPDDHALVPORTCB_GETBANDWIDTH GetVideoPortBandwidth; // PRIVATE: ptr to callback
  2968. } DDHAL_GETVPORTBANDWIDTHDATA;
  2969. /*
  2970. * structure for passing information to DDHAL GetVideoPortInputFormats fn
  2971. */
  2972. typedef struct _DDHAL_GETVPORTINPUTFORMATDATA
  2973. {
  2974. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2975. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  2976. DWORD dwFlags; // VBI, regular, or both
  2977. LPDDPIXELFORMAT lpddpfFormat; // Array of formats
  2978. DWORD dwNumFormats; // # of formats in array
  2979. HRESULT ddRVal; // return value
  2980. LPDDHALVPORTCB_GETINPUTFORMATS GetVideoPortInputFormats; // PRIVATE: ptr to callback
  2981. } DDHAL_GETVPORTINPUTFORMATDATA;
  2982. /*
  2983. * structure for passing information to DDHAL GetVideoPortOutputFormats fn
  2984. */
  2985. typedef struct _DDHAL_GETVPORTOUTPUTFORMATDATA
  2986. {
  2987. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  2988. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  2989. DWORD dwFlags; // VBI, regular, or both
  2990. LPDDPIXELFORMAT lpddpfInputFormat; // Input format
  2991. LPDDPIXELFORMAT lpddpfOutputFormats; // Array of output formats
  2992. DWORD dwNumFormats; // # of formats in array
  2993. HRESULT ddRVal; // return value
  2994. LPDDHALVPORTCB_GETOUTPUTFORMATS GetVideoPortOutputFormats; // PRIVATE: ptr to callback
  2995. } DDHAL_GETVPORTOUTPUTFORMATDATA;
  2996. /*
  2997. * structure for passing information to DDHAL GetVideoPortField fn
  2998. */
  2999. typedef struct _DDHAL_GETVPORTFIELDDATA
  3000. {
  3001. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3002. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3003. BOOL bField; // TRUE if even
  3004. HRESULT ddRVal; // return value
  3005. LPDDHALVPORTCB_GETFIELD GetVideoPortField; // PRIVATE: ptr to callback
  3006. } DDHAL_GETVPORTFIELDDATA;
  3007. /*
  3008. * structure for passing information to DDHAL GetVideoPortLine fn
  3009. */
  3010. typedef struct _DDHAL_GETVPORTLINEDATA
  3011. {
  3012. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3013. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3014. DWORD dwLine; // Current line counter
  3015. HRESULT ddRVal; // return value
  3016. LPDDHALVPORTCB_GETLINE GetVideoPortLine; // PRIVATE: ptr to callback
  3017. } DDHAL_GETVPORTLINEDATA;
  3018. /*
  3019. * structure for passing information to DDHAL GetVideoPortConnectInfo fn
  3020. */
  3021. typedef struct _DDHAL_GETVPORTCONNECTDATA
  3022. {
  3023. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3024. DWORD dwPortId; // ID of desired video port
  3025. LPDDVIDEOPORTCONNECT lpConnect; // Array of DDVIDEOPORTCONNECT structures
  3026. DWORD dwNumEntries; // # of structures in array
  3027. HRESULT ddRVal; // return value
  3028. LPDDHALVPORTCB_GETVPORTCONNECT GetVideoPortConnectInfo; // PRIVATE: ptr to callback
  3029. } DDHAL_GETVPORTCONNECTDATA;
  3030. /*
  3031. * structure for passing information to DDHAL DestroyVideoPort fn
  3032. */
  3033. typedef struct _DDHAL_DESTROYVPORTDATA
  3034. {
  3035. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3036. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3037. HRESULT ddRVal; // return value
  3038. LPDDHALVPORTCB_DESTROYVPORT DestroyVideoPort; // PRIVATE: ptr to callback
  3039. } DDHAL_DESTROYVPORTDATA;
  3040. /*
  3041. * structure for passing information to DDHAL GetVideoPortFlipStatus fn
  3042. */
  3043. typedef struct _DDHAL_GETVPORTFLIPSTATUSDATA
  3044. {
  3045. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3046. FLATPTR fpSurface; // surface struct
  3047. HRESULT ddRVal; // return value
  3048. LPDDHALVPORTCB_GETFLIPSTATUS GetVideoPortFlipStatus; // PRIVATE: ptr to callback
  3049. } DDHAL_GETVPORTFLIPSTATUSDATA;
  3050. /*
  3051. * structure for passing information to DDHAL UpdateVideoPort fn
  3052. */
  3053. typedef struct _DDHAL_UPDATEVPORTDATA
  3054. {
  3055. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3056. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3057. LPDDRAWI_DDRAWSURFACE_INT *lplpDDSurface; // surface struct
  3058. LPDDRAWI_DDRAWSURFACE_INT *lplpDDVBISurface; // VBI surface structure
  3059. LPDDVIDEOPORTINFO lpVideoInfo; // Video information
  3060. DWORD dwFlags; // DDRAWI_VPORTSTART, DDRAWI_VPORTSTOP, DDRAWI_VPORTUPDATE
  3061. DWORD dwNumAutoflip; // # of autoflip surfaces. If > 1, lpDDSurface and lpDDVBISurface are arrays.
  3062. DWORD dwNumVBIAutoflip; // # of autoflip surfaces. If > 1, lpDDSurface and lpDDVBISurface are arrays.
  3063. HRESULT ddRVal; // return value
  3064. LPDDHALVPORTCB_UPDATE UpdateVideoPort; // PRIVATE: ptr to callback
  3065. } DDHAL_UPDATEVPORTDATA;
  3066. #define DDRAWI_VPORTSTART 0x0001
  3067. #define DDRAWI_VPORTSTOP 0x0002
  3068. #define DDRAWI_VPORTUPDATE 0x0003
  3069. /*
  3070. * structure for passing information to DDHAL WaitForVideoPortSync fn
  3071. */
  3072. typedef struct _DDHAL_WAITFORVPORTSYNCDATA
  3073. {
  3074. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3075. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3076. DWORD dwFlags; // DDVPEVENT_XXXX
  3077. DWORD dwLine;
  3078. DWORD dwTimeOut; // Max time to wait before returning
  3079. HRESULT ddRVal; // return value
  3080. LPDDHALVPORTCB_WAITFORSYNC WaitForVideoPortSync; // PRIVATE: ptr to callback
  3081. } DDHAL_WAITFORVPORTSYNCDATA;
  3082. /*
  3083. * structure for passing information to DDHAL GetVideoSignalStatus fn
  3084. */
  3085. typedef struct _DDHAL_GETVPORTSIGNALDATA
  3086. {
  3087. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3088. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3089. DWORD dwStatus; // Video signal status
  3090. HRESULT ddRVal; // return value
  3091. LPDDHALVPORTCB_GETSIGNALSTATUS GetVideoSignalStatus;// PRIVATE: ptr to callback
  3092. } DDHAL_GETVPORTSIGNALDATA;
  3093. /*
  3094. * structure for passing information to DDHAL GetVideoSignalStatus fn
  3095. */
  3096. typedef struct _DDHAL_VPORTCOLORDATA
  3097. {
  3098. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3099. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3100. DWORD dwFlags; // Video signal status
  3101. LPDDCOLORCONTROL lpColorData;
  3102. HRESULT ddRVal; // return value
  3103. LPDDHALVPORTCB_COLORCONTROL ColorControl; // PRIVATE: ptr to callback
  3104. } DDHAL_VPORTCOLORDATA;
  3105. #define DDRAWI_VPORTGETCOLOR 0x0001
  3106. #define DDRAWI_VPORTSETCOLOR 0x0002
  3107. /****************************************************************************
  3108. *
  3109. * DDHAL structures for Color Control callbacks
  3110. *
  3111. ***************************************************************************/
  3112. /*
  3113. * structure for passing information to DDHAL ColorControl fn
  3114. */
  3115. typedef struct _DDHAL_COLORCONTROLDATA
  3116. {
  3117. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3118. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface
  3119. LPDDCOLORCONTROL lpColorData; // color control information
  3120. DWORD dwFlags; // DDRAWI_GETCOLOR/DDRAWI_SETCOLOR
  3121. HRESULT ddRVal; // return value
  3122. LPDDHALCOLORCB_COLORCONTROL ColorControl; // PRIVATE: ptr to callback
  3123. } DDHAL_COLORCONTROLDATA;
  3124. #define DDRAWI_GETCOLOR 0x0001
  3125. #define DDRAWI_SETCOLOR 0x0002
  3126. /****************************************************************************
  3127. *
  3128. * DDHAL structure for GetDriverData callback
  3129. *
  3130. ***************************************************************************/
  3131. typedef struct _DDHAL_GETDRIVERINFODATA {
  3132. // Input fields filled in by DirectDraw
  3133. DWORD dwSize; // Size of this structure
  3134. DWORD dwFlags; // Flags
  3135. GUID guidInfo; // GUID that DirectX is querying for
  3136. DWORD dwExpectedSize; // Size of callbacks structure expected by DirectDraw.
  3137. LPVOID lpvData; // Buffer that will receive the requested data
  3138. // Output fields filled in by driver
  3139. DWORD dwActualSize; // Size of callbacks structure expected by driver
  3140. HRESULT ddRVal; // Return value from driver
  3141. // Input field: Context information for driver
  3142. // On Win95, this is the dwReserved3 field of the DIRECTDRAW_GBL
  3143. // On NT, this is the hDD field of DIRECTDRAW_GBL
  3144. ULONG_PTR dwContext; // Context Information
  3145. } DDHAL_GETDRIVERINFODATA;
  3146. /****************************************************************************
  3147. *
  3148. * DDHAL structure for misc. driver callbacks
  3149. *
  3150. ***************************************************************************/
  3151. /*
  3152. * structure for passing information to DDHAL GetAvailDriverMemory fn
  3153. */
  3154. typedef struct _DDHAL_GETAVAILDRIVERMEMORYDATA
  3155. {
  3156. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3157. DDSCAPS DDSCaps; // caps for type of surface memory
  3158. DWORD dwTotal; // total memory for this kind of surface
  3159. DWORD dwFree; // free memory for this kind of surface
  3160. HRESULT ddRVal; // return value
  3161. LPDDHAL_GETAVAILDRIVERMEMORY GetAvailDriverMemory; // PRIVATE: ptr to callback
  3162. DDSCAPSEX ddsCapsEx; // Added in V6. Driver should check DDVERSION info
  3163. // to see if this field is present.
  3164. } DDHAL_GETAVAILDRIVERMEMORYDATA;
  3165. /*
  3166. * structure for passing information to DDHEL UpdateNonLocalHeap
  3167. */
  3168. typedef struct _DDHAL_UPDATENONLOCALHEAPDATA
  3169. {
  3170. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3171. DWORD dwHeap; // heap index
  3172. FLATPTR fpGARTLin; // linear GART address of start of heap
  3173. FLATPTR fpGARTDev; // high physical GART address of start of heap
  3174. ULONG_PTR ulPolicyMaxBytes; // maximum amount of AGP memory to use
  3175. HRESULT ddRVal; // return value
  3176. LPDDHAL_UPDATENONLOCALHEAP UpdateNonLocalHeap; // PRIVATE: ptr to callback
  3177. } DDHAL_UPDATENONLOCALHEAPDATA;
  3178. /*
  3179. * Heap Alignment Data Structures
  3180. */
  3181. typedef struct _DDHAL_GETHEAPALIGNMENTDATA
  3182. {
  3183. ULONG_PTR dwInstance; // driver context as returned from 32-bit driver init routine
  3184. DWORD dwHeap; // heap index passed by DirectDraw
  3185. HRESULT ddRVal; // return value
  3186. LPDDHAL_GETHEAPALIGNMENT GetHeapAlignment; // PRIVATE: ptr to callback.
  3187. HEAPALIGNMENT Alignment; // Filled in by driver. Defined in dmemmgr.h
  3188. } DDHAL_GETHEAPALIGNMENTDATA;
  3189. /*
  3190. * These are the only caps you can set in DDHAL_GETHEAPALIGNMENTDATA.Alignment.ddsCaps.
  3191. * Any other caps will be rejected by DirectDraw.
  3192. */
  3193. #define DDHAL_ALIGNVALIDCAPS (DDSCAPS_OFFSCREENPLAIN | \
  3194. DDSCAPS_EXECUTEBUFFER | \
  3195. DDSCAPS_OVERLAY | \
  3196. DDSCAPS_TEXTURE | \
  3197. DDSCAPS_ZBUFFER | \
  3198. DDSCAPS_ALPHA | \
  3199. DDSCAPS_FLIP )
  3200. /*
  3201. * Note that GetSysmemBltStatus uses the same parameter block as GetBltStatus,
  3202. * namely DDHAL_GETBLTSTATUSDATA
  3203. */
  3204. //@@BEGIN_MSINTERNAL
  3205. #ifdef POSTPONED2
  3206. /****************************************************************************
  3207. *
  3208. * DDHAL structures for Miscellaneous2 callbacks
  3209. *
  3210. ***************************************************************************/
  3211. /*
  3212. * Structure that contains the information describing a sprite in the
  3213. * display list that is passed to SetSpriteDisplayList(). This is
  3214. * similar to the DDSPRITE structure used by applications, except
  3215. * that the ddckDestKey, ddckSrcKey, dwRectCnt, and lpRect members
  3216. * below are "reserved" in the DDSPRITE structure.
  3217. */
  3218. typedef struct _DDSPRITEI {
  3219. RECT rcDest; // destination rectangle
  3220. LPDIRECTDRAWSURFACE lpDDSSrc; // source surface
  3221. RECT rcSrc; // source rectangle
  3222. DWORD dwFlags; // DDSPRITE_ flags
  3223. DWORD dwRectCnt; // no. of rects in clip region
  3224. LPRECT lpRect; // array of clip rects
  3225. DDSPRITEFX ddSpriteFX; // sprite special FX
  3226. } DDSPRITEI, *LPDDSPRITEI;
  3227. /*
  3228. * Structure for passing information to DDHAL SetSpriteDisplayList function
  3229. */
  3230. typedef struct _DDHAL_SETSPRITEDISPLAYLISTDATA {
  3231. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3232. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // dest surface struct
  3233. LPDDSPRITEI *lplpDDSprite; // sprite display list
  3234. DWORD dwCount; // number of sprites in list
  3235. DWORD dwSize; // size of each struct in list
  3236. DWORD dwFlags; // flags
  3237. LPDDRAWI_DDRAWSURFACE_LCL lpDDTargetSurface; // target surface (to flip to)
  3238. DWORD dwRectCnt; // no. of rects in clip region
  3239. LPRECT lpRect; // array of clip rects
  3240. HRESULT ddRVal; // return value
  3241. //LPDDHAL_SETSPRITEDISPLAYLIST SetSpriteDisplayList; // PRIVATE: ptr to callback
  3242. } DDHAL_SETSPRITEDISPLAYLISTDATA;
  3243. /*
  3244. * Structure for passing information to DDHAL Resize function
  3245. */
  3246. typedef struct _DDHAL_RESIZEDATA {
  3247. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3248. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // target surface struct
  3249. DWORD dwFlags; // flags
  3250. DWORD dwWidth; // new width of surface
  3251. DWORD dwHeight; // new height of surface
  3252. HRESULT ddRVal; // return value
  3253. //LPDDHAL_RESIZE Resize; // PRIVATE: ptr to callback
  3254. } DDHAL_RESIZEDATA;
  3255. /*
  3256. * Structure for passing information to DDHAL CaptureComposionBuffer function
  3257. */
  3258. typedef struct _DDHAL_CAPTURECOMPOSITIONBUFFERDATA {
  3259. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3260. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // dest surface struct
  3261. DWORD dwFlags; // flags
  3262. HRESULT ddRVal; // return value
  3263. //LPDDHAL_CAPTURECOMPOSITIONBUFFER CaptureCompostionBuffer; // PRIVATE: ptr to callback
  3264. } DDHAL_CAPTURECOMPOSITIONBUFFERDATA;
  3265. #endif //POSTPONED2
  3266. //@@END_MSINTERNAL
  3267. typedef struct _DDHAL_CREATESURFACEEXDATA {
  3268. DWORD dwFlags; // Currently always 0 and not used
  3269. LPDDRAWI_DIRECTDRAW_LCL lpDDLcl; // driver struct
  3270. LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl; // list of created surface objects
  3271. HRESULT ddRVal; // return value
  3272. } DDHAL_CREATESURFACEEXDATA;
  3273. typedef struct _DDHAL_GETDRIVERSTATEDATA {
  3274. DWORD dwFlags; // Flags to indicate the data
  3275. // required
  3276. union
  3277. {
  3278. // LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  3279. DWORD dwhContext; // d3d context
  3280. };
  3281. LPDWORD lpdwStates; // ptr to the state data
  3282. // to be filled in by the
  3283. // driver
  3284. DWORD dwLength;
  3285. HRESULT ddRVal; // return value
  3286. } DDHAL_GETDRIVERSTATEDATA;
  3287. typedef struct _DDHAL_DESTROYDDLOCALDATA
  3288. {
  3289. DWORD dwFlags;
  3290. LPDDRAWI_DIRECTDRAW_LCL pDDLcl;
  3291. HRESULT ddRVal;
  3292. } DDHAL_DESTROYDDLOCALDATA;
  3293. /****************************************************************************
  3294. *
  3295. * DDHAL structure for kernel callbacks
  3296. *
  3297. ***************************************************************************/
  3298. /*
  3299. * structure for passing information to DDHAL SyncSurfaceData fn
  3300. */
  3301. typedef struct _DDHAL_SYNCSURFACEDATA
  3302. {
  3303. DWORD dwSize; // Size of this structure
  3304. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3305. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // Surface to sync with
  3306. DWORD dwSurfaceOffset; // Offset in frame buffer of surface
  3307. ULONG_PTR fpLockPtr; // Surface lock ptr
  3308. LONG lPitch; // Surface pitch
  3309. DWORD dwOverlayOffset; // Added to dwSurfaceOffset for origin, clipping, etc.
  3310. DWORD dwOverlaySrcWidth; // Src width of overlay
  3311. DWORD dwOverlaySrcHeight; // Src height of overlay
  3312. DWORD dwOverlayDestWidth; // Dest width of overlay
  3313. DWORD dwOverlayDestHeight; // Dest height of overlay
  3314. ULONG_PTR dwDriverReserved1; // Reserved for the HAL
  3315. ULONG_PTR dwDriverReserved2; // Reserved for the HAL
  3316. ULONG_PTR dwDriverReserved3; // Reserved for the HAL
  3317. HRESULT ddRVal;
  3318. } DDHAL_SYNCSURFACEDATA;
  3319. /*
  3320. * structure for passing information to DDHAL SyncVideoPortData fn
  3321. */
  3322. typedef struct _DDHAL_SYNCVIDEOPORTDATA
  3323. {
  3324. DWORD dwSize; // Size of this structure
  3325. LPDDRAWI_DIRECTDRAW_LCL lpDD; // driver struct
  3326. LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort; // Video port object
  3327. DWORD dwOriginOffset; // Start address relative to surface
  3328. DWORD dwHeight; // Height of total video region (per field)
  3329. DWORD dwVBIHeight; // Height of VBI region (per field)
  3330. ULONG_PTR dwDriverReserved1; // Reserved for the HAL
  3331. ULONG_PTR dwDriverReserved2; // Reserved for the HAL
  3332. ULONG_PTR dwDriverReserved3; // Reserved for the HAL
  3333. HRESULT ddRVal;
  3334. } DDHAL_SYNCVIDEOPORTDATA;
  3335. //@@BEGIN_MSINTERNAL
  3336. #ifdef POSTPONED
  3337. /****************************************************************************
  3338. *
  3339. * DDHAL structures for Optimized Surface callbacks
  3340. *
  3341. ***************************************************************************/
  3342. typedef struct _DDHAL_CANOPTIMIZESURFACEDATA
  3343. {
  3344. DWORD dwFlags; //in: Not used
  3345. DWORD dwSize; //in: For future expansion
  3346. LPDDRAWI_DIRECTDRAW_LCL lpDD; //in: Driver Struct
  3347. DDOPTSURFACEDESC ddOptSurfDesc; //in: OptSurf description
  3348. DDSURFACEDESC2 ddSurfaceDesc; //in: Surface Description
  3349. DWORD bCanOptimize; //out: Can optimize or not
  3350. ULONG_PTR dwReserved1; //in: Not used
  3351. HRESULT ddRVal; //out: Returned value
  3352. } DDHAL_CANOPTIMIZESURFACEDATA;
  3353. typedef struct _DDHAL_OPTIMIZESURFACEDATA
  3354. {
  3355. DWORD dwFlags; //in: Not used
  3356. DWORD dwSize; //in: For future expansion
  3357. LPDDRAWI_DIRECTDRAW_LCL lpDD; //in: Driver Struct
  3358. DDOPTSURFACEDESC ddOptSurfDesc; //in-out: OptSurf description
  3359. LPDDRAWI_DDRAWSURFACE_LCL lpDDSSrc; //in: Source surface
  3360. LPDDRAWI_DDRAWSURFACE_LCL lpDDSDest; //in: Destination surface
  3361. ULONG_PTR dwReserved1; //in: Not used
  3362. HRESULT ddRVal; //out: Returned value
  3363. } DDHAL_OPTIMIZESURFACEDATA;
  3364. typedef struct _DDHAL_UNOPTIMIZESURFACEDATA
  3365. {
  3366. DWORD dwFlags; //in: Not used
  3367. DWORD dwSize; //in: For future expansion
  3368. LPDDRAWI_DIRECTDRAW_LCL lpDD; //in: Driver Struct
  3369. LPDDRAWI_DDRAWSURFACE_LCL lpDDSSrc; //in: Source surface
  3370. LPDDRAWI_DDRAWSURFACE_LCL lpDDSDest; //in: Destination surface
  3371. ULONG_PTR dwReserved1; //in: Not used
  3372. HRESULT ddRVal; //out: Returned value
  3373. } DDHAL_UNOPTIMIZESURFACEDATA;
  3374. typedef struct _DDHAL_COPYOPTSURFACEDATA
  3375. {
  3376. DWORD dwFlags; //in: Not used
  3377. DWORD dwSize; //in: For future expansion
  3378. LPDDRAWI_DIRECTDRAW_LCL lpDD; //in: Driver Struct
  3379. LPDDRAWI_DDRAWSURFACE_LCL lpDDSSrc; //in: Source surface
  3380. LPDDRAWI_DDRAWSURFACE_LCL lpDDSDest; //in: Destination surface
  3381. ULONG_PTR dwReserved1; //in: Not used
  3382. HRESULT ddRVal; //out: Returned value
  3383. } DDHAL_COPYOPTSURFACEDATA;
  3384. typedef struct _DDHAL_KMODESVCDATA
  3385. {
  3386. DWORD dwFlags; //in-out:
  3387. DWORD dwSize; //in: For future expansion
  3388. LPDDRAWI_DIRECTDRAW_LCL lpDD; //in: Driver Struct
  3389. DWORD dwNumBytes; //in-out: Number of bytes
  3390. // communicated
  3391. LPVOID lpData; //in-out: The actual data
  3392. // communicated
  3393. ULONG_PTR dwReserved1; //in: Not used
  3394. HRESULT ddRVal; //out: Returned value
  3395. } DDHAL_OPTSURFKMODESVCDATA;
  3396. #endif //POSTPONED
  3397. //@@END_MSINTERNAL
  3398. /****************************************************************************
  3399. *
  3400. * DDHAL structure for motion comp callbacks
  3401. *
  3402. ***************************************************************************/
  3403. /*
  3404. * structure for passing information to DDHAL GetMoCompGuids
  3405. */
  3406. typedef struct _DDHAL_GETMOCOMPGUIDSDATA
  3407. {
  3408. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3409. DWORD dwNumGuids;
  3410. LPGUID lpGuids;
  3411. HRESULT ddRVal;
  3412. LPDDHALMOCOMPCB_GETGUIDS GetMoCompGuids;
  3413. } DDHAL_GETMOCOMPGUIDSDATA;
  3414. /*
  3415. * structure for passing information to DDHAL GetMoCompFormats
  3416. */
  3417. typedef struct _DDHAL_GETMOCOMPFORMATSDATA
  3418. {
  3419. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3420. LPGUID lpGuid;
  3421. DWORD dwNumFormats;
  3422. LPDDPIXELFORMAT lpFormats;
  3423. HRESULT ddRVal;
  3424. LPDDHALMOCOMPCB_GETFORMATS GetMoCompFormats;
  3425. } DDHAL_GETMOCOMPFORMATSDATA;
  3426. /*
  3427. * structure for passing information to DDHAL CreateMoComp
  3428. */
  3429. typedef struct _DDHAL_CREATEMOCOMPDATA
  3430. {
  3431. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3432. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3433. LPGUID lpGuid;
  3434. DWORD dwUncompWidth;
  3435. DWORD dwUncompHeight;
  3436. DDPIXELFORMAT ddUncompPixelFormat;
  3437. LPVOID lpData;
  3438. DWORD dwDataSize;
  3439. HRESULT ddRVal;
  3440. LPDDHALMOCOMPCB_CREATE CreateMoComp;
  3441. } DDHAL_CREATEMOCOMPDATA;
  3442. /*
  3443. * structure for passing information to DDHAL GetMoCompBuffInfo
  3444. */
  3445. typedef struct _DDMCCOMPBUFFERINFO
  3446. {
  3447. DWORD dwSize; // [in] size of the struct
  3448. DWORD dwNumCompBuffers; // [out] number of buffers required for compressed data
  3449. DWORD dwWidthToCreate; // [out] Width of surface to create
  3450. DWORD dwHeightToCreate; // [out] Height of surface to create
  3451. DWORD dwBytesToAllocate; // [out] Total number of bytes used by each surface
  3452. DDSCAPS2 ddCompCaps; // [out] caps to create surfaces to store compressed data
  3453. DDPIXELFORMAT ddPixelFormat; // [out] format to create surfaces to store compressed data
  3454. } DDMCCOMPBUFFERINFO, *LPDDMCCOMPBUFFERINFO;
  3455. typedef struct _DDHAL_GETMOCOMPCOMPBUFFDATA
  3456. {
  3457. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3458. LPGUID lpGuid;
  3459. DWORD dwWidth; // [in] width of uncompressed data
  3460. DWORD dwHeight; // [in] height of uncompressed data
  3461. DDPIXELFORMAT ddPixelFormat; // [in] pixel-format of uncompressed data
  3462. DWORD dwNumTypesCompBuffs;// [in/out] number of memory types required for comp buffers
  3463. LPDDMCCOMPBUFFERINFO lpCompBuffInfo; // [in] driver supplied info regarding comp buffers (allocated by client)
  3464. HRESULT ddRVal; // [out]
  3465. LPDDHALMOCOMPCB_GETCOMPBUFFINFO GetMoCompBuffInfo;
  3466. } DDHAL_GETMOCOMPCOMPBUFFDATA;
  3467. /*
  3468. * structure for passing information to DDHAL GetMoCompBuffInfo
  3469. */
  3470. typedef struct _DDHAL_GETINTERNALMOCOMPDATA
  3471. {
  3472. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3473. LPGUID lpGuid;
  3474. DWORD dwWidth; // [in] width of uncompressed data
  3475. DWORD dwHeight; // [in] height of uncompressed data
  3476. DDPIXELFORMAT ddPixelFormat; // [in] pixel-format of uncompressed data
  3477. DWORD dwScratchMemAlloc; // [out] amount of scratch memory will the hal allocate for its private use
  3478. HRESULT ddRVal; // [out]
  3479. LPDDHALMOCOMPCB_GETINTERNALINFO GetInternalMoCompInfo;
  3480. } DDHAL_GETINTERNALMOCOMPDATA;
  3481. /*
  3482. * structure for passing information to DDHAL BeginMoCompFrame
  3483. */
  3484. typedef struct _DDHAL_BEGINMOCOMPFRAMEDATA
  3485. {
  3486. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3487. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3488. LPDDRAWI_DDRAWSURFACE_LCL lpDestSurface; // [in] destination buffer in which to decoding this frame
  3489. DWORD dwInputDataSize; // [in] size of other misc input data to begin frame
  3490. LPVOID lpInputData; // [in] pointer to misc input data
  3491. DWORD dwOutputDataSize; // [in] size of other misc output data to begin frame
  3492. LPVOID lpOutputData; // [in] pointer to output misc data (allocated by client)
  3493. HRESULT ddRVal; // [out]
  3494. LPDDHALMOCOMPCB_BEGINFRAME BeginMoCompFrame;
  3495. } DDHAL_BEGINMOCOMPFRAMEDATA;
  3496. /*
  3497. * structure for passing information to DDHAL EndMoCompFrame
  3498. */
  3499. typedef struct _DDHAL_ENDMOCOMPFRAMEDATA
  3500. {
  3501. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3502. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3503. LPVOID lpInputData;
  3504. DWORD dwInputDataSize;
  3505. HRESULT ddRVal;
  3506. LPDDHALMOCOMPCB_ENDFRAME EndMoCompFrame;
  3507. } DDHAL_ENDMOCOMPFRAMEDATA;
  3508. /*
  3509. * structure for passing information to DDHAL RenderMoComp
  3510. */
  3511. typedef struct _DDMCBUFFERINFO
  3512. {
  3513. DWORD dwSize; // [in] size of the struct
  3514. LPDDRAWI_DDRAWSURFACE_LCL lpCompSurface; // [in] pointer to buffer containing compressed data
  3515. DWORD dwDataOffset; // [in] offset of relevant data from the beginning of buffer
  3516. DWORD dwDataSize; // [in] size of relevant data
  3517. LPVOID lpPrivate; // Reserved for DirectDraw;
  3518. } DDMCBUFFERINFO, *LPDDMCBUFFERINFO;
  3519. typedef struct _DDHAL_RENDERMOCOMPDATA
  3520. {
  3521. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3522. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3523. DWORD dwNumBuffers; // [in] Number of entries in the lpMacroBlockInfo array
  3524. LPDDMCBUFFERINFO lpBufferInfo; // [in] Surfaces containing macro block info
  3525. DWORD dwFunction; // [in] Function
  3526. LPVOID lpInputData;
  3527. DWORD dwInputDataSize;
  3528. LPVOID lpOutputData;
  3529. DWORD dwOutputDataSize;
  3530. HRESULT ddRVal; // [out]
  3531. LPDDHALMOCOMPCB_RENDER RenderMoComp;
  3532. } DDHAL_RENDERMOCOMPDATA;
  3533. /*
  3534. * structure for passing information to DDHAL QueryMoCompStatus
  3535. */
  3536. typedef struct _DDHAL_QUERYMOCOMPSTATUSDATA
  3537. {
  3538. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3539. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3540. LPDDRAWI_DDRAWSURFACE_LCL lpSurface; // [in] Surface being queried
  3541. DWORD dwFlags; // [in] DDMCQUERY_XXX falgs
  3542. HRESULT ddRVal; // [out]
  3543. LPDDHALMOCOMPCB_QUERYSTATUS QueryMoCompStatus;
  3544. } DDHAL_QUERYMOCOMPSTATUSDATA;
  3545. #define DDMCQUERY_READ 0x00000001
  3546. //@@BEGIN_MSINTERNAL
  3547. #define DDMCQUERY_VALID 0x00000001
  3548. //@@END_MSINTERNAL
  3549. /*
  3550. * structure for passing information to DDHAL DestroyVideo
  3551. */
  3552. typedef struct _DDHAL_DESTROYMOCOMPDATA
  3553. {
  3554. LPDDRAWI_DIRECTDRAW_LCL lpDD;
  3555. LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
  3556. HRESULT ddRVal;
  3557. LPDDHALMOCOMPCB_DESTROY DestroyMoComp;
  3558. } DDHAL_DESTROYMOCOMPDATA;
  3559. #ifdef __cplusplus
  3560. };
  3561. #endif
  3562. #endif