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.

1618 lines
62 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1996 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. *@@END_MSINTERNAL
  110. *
  111. ***************************************************************************/
  112. #ifndef __DDRAWI_INCLUDED__
  113. #define __DDRAWI_INCLUDED__
  114. /*
  115. * METAQUESTION: Why are Windows handles stored as DWORDs instead of
  116. * their proper types?
  117. * METAANSWER: To make the thunk to the 16-bit side completely painless.
  118. */
  119. #define OBJECT_ISROOT 0x80000000l // object is root object
  120. /*
  121. * stuff for drivers
  122. */
  123. #ifndef _WIN32
  124. typedef long HRESULT;
  125. typedef LPVOID REFIID;
  126. typedef void GUID;
  127. #define MAKE_HRESULT(sev,fac,code) \
  128. ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  129. #endif
  130. //@@BEGIN_MSINTERNAL
  131. // Include ddrawp.h for DirectDraw and D3D builds. DDK includes ddraw.h
  132. #ifdef MSBUILD
  133. #include "ddrawp.h"
  134. #else
  135. //@@END_MSINTERNAL
  136. #include "ddraw.h"
  137. //@@BEGIN_MSINTERNAL
  138. #endif
  139. //@@END_MSINTERNAL
  140. #include "dmemmgr.h"
  141. #ifndef _WIN32
  142. /*
  143. * these error codes are DIFFERENT in Win32 and Win16!!!!
  144. */
  145. #undef E_NOTIMPL
  146. #undef E_OUTOFMEMORY
  147. #undef E_INVALIDARG
  148. #undef E_FAIL
  149. #define E_NOTIMPL 0x80004001L
  150. #define E_OUTOFMEMORY 0x8007000EL
  151. #define E_INVALIDARG 0x80070057L
  152. #define E_FAIL 0x80004005L
  153. #endif
  154. #define DDUNSUPPORTEDMODE ((DWORD) -1)
  155. #define VALID_ALIGNMENT( align ) (!((align == 0) || (align % 2) != 0 ))
  156. /*
  157. * List of processes attached to a DirectDraw object
  158. */
  159. typedef struct _PROCESS_LIST
  160. {
  161. struct _PROCESS_LIST FAR *lpLink;
  162. DWORD dwProcessId;
  163. DWORD dwRefCnt;
  164. DWORD dwAlphaDepth;
  165. DWORD dwZDepth;
  166. } PROCESS_LIST;
  167. typedef PROCESS_LIST FAR *LPPROCESS_LIST;
  168. /*
  169. * DeleteFromActiveProcessList return codes
  170. */
  171. #define DELETED_OK 0
  172. #define DELETED_LASTONE 1
  173. #define DELETED_NOTFOUND 2
  174. #define DDBLT_ANYALPHA \
  175. (DDBLT_ALPHASRCSURFACEOVERRIDE | \
  176. DDBLT_ALPHASRCCONSTOVERRIDE | \
  177. DDBLT_ALPHASRC | \
  178. DDBLT_ALPHADESTSURFACEOVERRIDE | \
  179. DDBLT_ALPHADESTCONSTOVERRIDE | \
  180. DDBLT_ALPHADEST)
  181. #define DDOVER_ANYALPHA \
  182. (DDOVER_ALPHASRCSURFACEOVERRIDE | \
  183. DDOVER_ALPHASRCCONSTOVERRIDE | \
  184. DDOVER_ALPHASRC | \
  185. DDOVER_ALPHADESTSURFACEOVERRIDE | \
  186. DDOVER_ALPHADESTCONSTOVERRIDE | \
  187. DDOVER_ALPHADEST)
  188. typedef struct IDirectDrawClipperVtbl DIRECTDRAWCLIPPERCALLBACKS;
  189. typedef struct IDirectDrawPaletteVtbl DIRECTDRAWPALETTECALLBACKS;
  190. typedef struct IDirectDrawSurfaceVtbl DIRECTDRAWSURFACECALLBACKS;
  191. typedef struct IDirectDrawSurface2Vtbl DIRECTDRAWSURFACE2CALLBACKS;
  192. //@@BEGIN_MSINTERNAL
  193. #ifdef STREAMING
  194. typedef struct IDirectDrawSurfaceStreamingVtbl DIRECTDRAWSURFACESTREAMINGCALLBACKS;
  195. #endif
  196. #ifdef COMPOSITION
  197. typedef struct IDirectDrawSurfaceCompositionVtbl DIRECTDRAWSURFACECOMPOSITIONCALLBACKS;
  198. #endif
  199. //@@END_MSINTERNAL
  200. typedef struct IDirectDrawVtbl DIRECTDRAWCALLBACKS;
  201. typedef struct IDirectDraw2Vtbl DIRECTDRAW2CALLBACKS;
  202. typedef DIRECTDRAWCLIPPERCALLBACKS FAR *LPDIRECTDRAWCLIPPERCALLBACKS;
  203. typedef DIRECTDRAWPALETTECALLBACKS FAR *LPDIRECTDRAWPALETTECALLBACKS;
  204. typedef DIRECTDRAWSURFACECALLBACKS FAR *LPDIRECTDRAWSURFACECALLBACKS;
  205. //@@BEGIN_MSINTERNAL
  206. #ifdef STREAMING
  207. typedef DIRECTDRAWSURFACESTREAMINGCALLBACKS FAR *LPDIRECTDRAWSURFACESTREAMINGCALLBACKS;
  208. #endif
  209. #ifdef COMPOSITION
  210. typedef DIRECTDRAWSURFACECOMPOSITIONCALLBACKS FAR *LPDIRECTDRAWSURFACECOMPOSITIONCALLBACKS;
  211. #endif
  212. //@@END_MSINTERNAL
  213. typedef DIRECTDRAWCALLBACKS FAR *LPDIRECTDRAWCALLBACKS;
  214. #ifdef __cplusplus
  215. extern "C" {
  216. #endif
  217. #if defined( IS_32 ) || defined( WIN32 ) || defined( _WIN32 )
  218. #undef IS_32
  219. #define IS_32
  220. #define DDAPI WINAPI
  221. #define EXTERN_DDAPI WINAPI
  222. #else
  223. #define DDAPI __loadds WINAPI
  224. #define EXTERN_DDAPI __export WINAPI
  225. #endif
  226. /*
  227. * DCI escape
  228. */
  229. #ifndef DCICOMMAND
  230. #define DCICOMMAND 3075 // escape value
  231. #endif
  232. /*
  233. * this is the DirectDraw version
  234. * passed to the driver in DCICMD.dwVersion
  235. */
  236. #define DD_VERSION 0x00000200l
  237. /*
  238. * this is the HAL version.
  239. * the driver returns this number from QUERYESCSUPPORT/DCICOMMAND
  240. */
  241. #define DD_HAL_VERSION 0x0100
  242. //@@BEGIN_MSINTERNAL
  243. #define DD_HAL_VERSION_EXTERNAL 0x0100
  244. #undef DD_HAL_VERSION
  245. #define DD_HAL_VERSION 0x00ff // special internal version
  246. //@@END_MSINTERNAL
  247. #ifndef _INC_DCIDDI
  248. /*
  249. * Used by DirectDraw to provide input parameters for the DCICOMMAND escape
  250. * This matches the structure in the obsolete DCI 1.0
  251. */
  252. typedef struct _DCICMD
  253. {
  254. DWORD dwCommand; // command
  255. DWORD dwParam1;
  256. DWORD dwParam2;
  257. DWORD dwVersion; // DirectDraw version
  258. DWORD dwReserved;
  259. } DCICMD;
  260. typedef DCICMD FAR *LPDCICMD;
  261. #endif
  262. #define DDCREATEDRIVEROBJECT 10 // create an object
  263. #define DDGET32BITDRIVERNAME 11 // get a 32-bit driver name
  264. #define DDNEWCALLBACKFNS 12 // new callback fns coming
  265. typedef struct
  266. {
  267. char szName[260]; // 32-bit driver name
  268. char szEntryPoint[64]; // entry point
  269. DWORD dwContext; // context to pass to entry point
  270. } DD32BITDRIVERDATA, FAR *LPDD32BITDRIVERDATA;
  271. typedef DWORD (FAR PASCAL *LPDD32BITDRIVERINIT)(DWORD dwContext);
  272. /*
  273. * pointer to video meory
  274. */
  275. typedef unsigned long FLATPTR;
  276. /*
  277. * indicates that DDRAW.DLL has been unloaded...
  278. */
  279. #define DDRAW_DLL_UNLOADED (LPVOID) 1
  280. /*
  281. * critical section types
  282. */
  283. typedef LPVOID CSECT_HANDLE;
  284. #ifdef NOUSE_CRITSECTS
  285. typedef xxx CSECT; // generate an error for now
  286. #else
  287. #if defined( IS_32 ) && !defined( _NOCSECT_TYPE )
  288. typedef CRITICAL_SECTION CSECT;
  289. typedef CSECT *LPCSECT;
  290. #else
  291. typedef struct
  292. {
  293. DWORD vals[6];
  294. } CSECT;
  295. typedef void FAR *LPCSECT;
  296. #endif
  297. #endif
  298. /*
  299. * DLL names
  300. */
  301. #define DDHAL_DRIVER_DLLNAME "DDRAW16.DLL"
  302. #define DDHAL_APP_DLLNAME "DDRAW.DLL"
  303. /*
  304. * maximum size of a driver name
  305. */
  306. #define MAX_DRIVER_NAME 12
  307. /*
  308. * largest palette supported
  309. */
  310. #define MAX_PALETTE_SIZE 256
  311. /*
  312. * pre-declare pointers to structs containing data for DDHAL fns
  313. */
  314. typedef struct _DDHAL_CREATEPALETTEDATA FAR *LPDDHAL_CREATEPALETTEDATA;
  315. typedef struct _DDHAL_CREATESURFACEDATA FAR *LPDDHAL_CREATESURFACEDATA;
  316. typedef struct _DDHAL_CANCREATESURFACEDATA FAR *LPDDHAL_CANCREATESURFACEDATA;
  317. typedef struct _DDHAL_WAITFORVERTICALBLANKDATA FAR *LPDDHAL_WAITFORVERTICALBLANKDATA;
  318. typedef struct _DDHAL_DESTROYDRIVERDATA FAR *LPDDHAL_DESTROYDRIVERDATA;
  319. typedef struct _DDHAL_SETMODEDATA FAR *LPDDHAL_SETMODEDATA;
  320. typedef struct _DDHAL_DRVSETCOLORKEYDATA FAR *LPDDHAL_DRVSETCOLORKEYDATA;
  321. typedef struct _DDHAL_GETSCANLINEDATA FAR *LPDDHAL_GETSCANLINEDATA;
  322. typedef struct _DDHAL_DESTROYPALETTEDATA FAR *LPDDHAL_DESTROYPALETTEDATA;
  323. typedef struct _DDHAL_SETENTRIESDATA FAR *LPDDHAL_SETENTRIESDATA;
  324. typedef struct _DDHAL_BLTDATA FAR *LPDDHAL_BLTDATA;
  325. typedef struct _DDHAL_LOCKDATA FAR *LPDDHAL_LOCKDATA;
  326. typedef struct _DDHAL_UNLOCKDATA FAR *LPDDHAL_UNLOCKDATA;
  327. typedef struct _DDHAL_UPDATEOVERLAYDATA FAR *LPDDHAL_UPDATEOVERLAYDATA;
  328. typedef struct _DDHAL_SETOVERLAYPOSITIONDATA FAR *LPDDHAL_SETOVERLAYPOSITIONDATA;
  329. typedef struct _DDHAL_SETPALETTEDATA FAR *LPDDHAL_SETPALETTEDATA;
  330. typedef struct _DDHAL_FLIPDATA FAR *LPDDHAL_FLIPDATA;
  331. typedef struct _DDHAL_DESTROYSURFACEDATA FAR *LPDDHAL_DESTROYSURFACEDATA;
  332. typedef struct _DDHAL_SETCLIPLISTDATA FAR *LPDDHAL_SETCLIPLISTDATA;
  333. typedef struct _DDHAL_ADDATTACHEDSURFACEDATA FAR *LPDDHAL_ADDATTACHEDSURFACEDATA;
  334. typedef struct _DDHAL_SETCOLORKEYDATA FAR *LPDDHAL_SETCOLORKEYDATA;
  335. typedef struct _DDHAL_GETBLTSTATUSDATA FAR *LPDDHAL_GETBLTSTATUSDATA;
  336. typedef struct _DDHAL_GETFLIPSTATUSDATA FAR *LPDDHAL_GETFLIPSTATUSDATA;
  337. typedef struct _DDHAL_SETEXCLUSIVEMODEDATA FAR *LPDDHAL_SETEXCLUSIVEMODEDATA;
  338. typedef struct _DDHAL_FLIPTOGDISURFACEDATA FAR *LPDDHAL_FLIPTOGDISURFACEDATA;
  339. /*
  340. * value in the fpVidMem; indicates dwBlockSize is valid (surface object)
  341. */
  342. #define DDHAL_PLEASEALLOC_BLOCKSIZE 0x00000002l
  343. /*
  344. * video memory data structures (passed in DDHALINFO)
  345. */
  346. typedef struct _VIDMEM
  347. {
  348. DWORD dwFlags; // flags
  349. FLATPTR fpStart; // start of memory chunk
  350. union
  351. {
  352. FLATPTR fpEnd; // end of memory chunk
  353. DWORD dwWidth; // width of chunk (rectanglar memory)
  354. };
  355. DDSCAPS ddsCaps; // what this memory CANNOT be used for
  356. DDSCAPS ddsCapsAlt; // what this memory CANNOT be used for if it must
  357. union
  358. {
  359. LPVMEMHEAP lpHeap; // heap pointer, used by DDRAW
  360. DWORD dwHeight; // height of chunk (rectanguler memory)
  361. };
  362. } VIDMEM;
  363. typedef VIDMEM FAR *LPVIDMEM;
  364. /*
  365. * flags for vidmem struct
  366. */
  367. #define VIDMEM_ISLINEAR 0x00000001l
  368. #define VIDMEM_ISRECTANGULAR 0x00000002l
  369. #define VIDMEM_ISHEAP 0x00000004l
  370. typedef struct _VIDMEMINFO
  371. {
  372. FLATPTR fpPrimary; // pointer to primary surface
  373. DWORD dwFlags; // flags
  374. DWORD dwDisplayWidth; // current display width
  375. DWORD dwDisplayHeight; // current display height
  376. LONG lDisplayPitch; // current display pitch
  377. DDPIXELFORMAT ddpfDisplay; // pixel format of display
  378. DWORD dwOffscreenAlign; // byte alignment for offscreen surfaces
  379. DWORD dwOverlayAlign; // byte alignment for overlays
  380. DWORD dwTextureAlign; // byte alignment for textures
  381. DWORD dwZBufferAlign; // byte alignment for z buffers
  382. DWORD dwAlphaAlign; // byte alignment for alpha
  383. DWORD dwNumHeaps; // number of memory heaps in vmList
  384. LPVIDMEM pvmList; // array of heaps
  385. } VIDMEMINFO;
  386. typedef VIDMEMINFO FAR *LPVIDMEMINFO;
  387. /*
  388. * These structures contain the entry points in the display driver that
  389. * DDRAW will call. Entries that the display driver does not care about
  390. * should be NULL. Passed to DDRAW in DDHALINFO.
  391. */
  392. typedef struct _DDRAWI_DIRECTDRAW_INT FAR *LPDDRAWI_DIRECTDRAW_INT;
  393. typedef struct _DDRAWI_DIRECTDRAW_LCL FAR *LPDDRAWI_DIRECTDRAW_LCL;
  394. typedef struct _DDRAWI_DIRECTDRAW_GBL FAR *LPDDRAWI_DIRECTDRAW_GBL;
  395. typedef struct _DDRAWI_DDRAWSURFACE_GBL FAR *LPDDRAWI_DDRAWSURFACE_GBL;
  396. typedef struct _DDRAWI_DDRAWPALETTE_GBL FAR *LPDDRAWI_DDRAWPALETTE_GBL;
  397. typedef struct _DDRAWI_DDRAWPALETTE_INT FAR *LPDDRAWI_DDRAWPALETTE_INT;
  398. typedef struct _DDRAWI_DDRAWCLIPPER_INT FAR *LPDDRAWI_DDRAWCLIPPER_INT;
  399. typedef struct _DDRAWI_DDRAWCLIPPER_GBL FAR *LPDDRAWI_DDRAWCLIPPER_GBL;
  400. typedef struct _DDRAWI_DDRAWSURFACE_MORE FAR *LPDDRAWI_DDRAWSURFACE_MORE;
  401. typedef struct _DDRAWI_DDRAWSURFACE_LCL FAR *LPDDRAWI_DDRAWSURFACE_LCL;
  402. typedef struct _DDRAWI_DDRAWSURFACE_INT FAR *LPDDRAWI_DDRAWSURFACE_INT;
  403. //@@BEGIN_MSINTERNAL
  404. #ifdef STREAMING
  405. typedef struct _DDRAWI_DIRECTDRAWSURFACESTREAMING FAR *LPDDRAWI_DDRAWSURFACE_GBLSTREAMING;
  406. #endif
  407. //@@END_MSINTERNAL
  408. typedef struct _DDRAWI_DDRAWPALETTE_LCL FAR *LPDDRAWI_DDRAWPALETTE_LCL;
  409. typedef struct _DDRAWI_DDRAWCLIPPER_LCL FAR *LPDDRAWI_DDRAWCLIPPER_LCL;
  410. //@@BEGIN_MSINTERNAL
  411. #ifdef CLIPPER_NOTIFY
  412. /*
  413. * WINWATCH structure
  414. */
  415. typedef struct _WINWATCH
  416. {
  417. LPDDRAWI_DDRAWCLIPPER_LCL lpDDClipper;
  418. struct _WINWATCH FAR *next; // next
  419. struct _WINWATCH FAR *next16; // next (16-bit)
  420. struct _WINWATCH FAR *self32; // self ptr
  421. struct _WINWATCH FAR *self16; // self ptr (16-bit)
  422. DWORD hWnd; // window handle
  423. LPCLIPPERCALLBACK lpCallback; // callback to call
  424. LPVOID lpContext; // context for callback
  425. WORD fNotify; // need notify
  426. WORD fDirty; // changed
  427. DWORD dwRDSize; // size of rgn data
  428. /*
  429. * STUFF AFTER THIS ONLY FOR 16-BIT SIDE, SIZES ARE DIFFERENT
  430. */
  431. RECT rect; // intersection rect
  432. RGNDATA NEAR *prd16; // 16-bit pointer to region data
  433. } WINWATCH, FAR *LPWINWATCH;
  434. #endif
  435. //@@END_MSINTERNAL
  436. /*
  437. * List of IUnknowns aggregated by a DirectDraw surface.
  438. */
  439. typedef struct _IUNKNOWN_LIST
  440. {
  441. struct _IUNKNOWN_LIST FAR *lpLink;
  442. GUID FAR *lpGuid;
  443. IUnknown FAR *lpIUnknown;
  444. } IUNKNOWN_LIST;
  445. typedef IUNKNOWN_LIST FAR *LPIUNKNOWN_LIST;
  446. /*
  447. * hardware emulation layer stuff
  448. */
  449. typedef BOOL (FAR PASCAL *LPDDHEL_INIT)(LPDDRAWI_DIRECTDRAW_GBL,BOOL);
  450. /*
  451. * DIRECTDRAW object callbacks
  452. */
  453. typedef DWORD (FAR PASCAL *LPDDHAL_SETCOLORKEY)(LPDDHAL_DRVSETCOLORKEYDATA );
  454. typedef DWORD (FAR PASCAL *LPDDHAL_CANCREATESURFACE)(LPDDHAL_CANCREATESURFACEDATA );
  455. typedef DWORD (FAR PASCAL *LPDDHAL_WAITFORVERTICALBLANK)(LPDDHAL_WAITFORVERTICALBLANKDATA );
  456. typedef DWORD (FAR PASCAL *LPDDHAL_CREATESURFACE)(LPDDHAL_CREATESURFACEDATA);
  457. typedef DWORD (FAR PASCAL *LPDDHAL_DESTROYDRIVER)(LPDDHAL_DESTROYDRIVERDATA);
  458. typedef DWORD (FAR PASCAL *LPDDHAL_SETMODE)(LPDDHAL_SETMODEDATA);
  459. typedef DWORD (FAR PASCAL *LPDDHAL_CREATEPALETTE)(LPDDHAL_CREATEPALETTEDATA);
  460. typedef DWORD (FAR PASCAL *LPDDHAL_GETSCANLINE)(LPDDHAL_GETSCANLINEDATA);
  461. typedef DWORD (FAR PASCAL *LPDDHAL_SETEXCLUSIVEMODE)(LPDDHAL_SETEXCLUSIVEMODEDATA);
  462. typedef DWORD (FAR PASCAL *LPDDHAL_FLIPTOGDISURFACE)(LPDDHAL_FLIPTOGDISURFACEDATA);
  463. typedef struct _DDHAL_DDCALLBACKS
  464. {
  465. DWORD dwSize;
  466. DWORD dwFlags;
  467. LPDDHAL_DESTROYDRIVER DestroyDriver;
  468. LPDDHAL_CREATESURFACE CreateSurface;
  469. LPDDHAL_SETCOLORKEY SetColorKey;
  470. LPDDHAL_SETMODE SetMode;
  471. LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
  472. LPDDHAL_CANCREATESURFACE CanCreateSurface;
  473. LPDDHAL_CREATEPALETTE CreatePalette;
  474. LPDDHAL_GETSCANLINE GetScanLine;
  475. LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode;
  476. LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface;
  477. } DDHAL_DDCALLBACKS;
  478. typedef DDHAL_DDCALLBACKS FAR *LPDDHAL_DDCALLBACKS;
  479. #define DDHAL_CB32_DESTROYDRIVER 0x00000001l
  480. #define DDHAL_CB32_CREATESURFACE 0x00000002l
  481. #define DDHAL_CB32_SETCOLORKEY 0x00000004l
  482. #define DDHAL_CB32_SETMODE 0x00000008l
  483. #define DDHAL_CB32_WAITFORVERTICALBLANK 0x00000010l
  484. #define DDHAL_CB32_CANCREATESURFACE 0x00000020l
  485. #define DDHAL_CB32_CREATEPALETTE 0x00000040l
  486. #define DDHAL_CB32_GETSCANLINE 0x00000080l
  487. #define DDHAL_CB32_SETEXCLUSIVEMODE 0x00000100l
  488. #define DDHAL_CB32_FLIPTOGDISURFACE 0x00000200l
  489. /*
  490. * DIRECTDRAWPALETTE object callbacks
  491. */
  492. typedef DWORD (FAR PASCAL *LPDDHALPALCB_DESTROYPALETTE)(LPDDHAL_DESTROYPALETTEDATA );
  493. typedef DWORD (FAR PASCAL *LPDDHALPALCB_SETENTRIES)(LPDDHAL_SETENTRIESDATA );
  494. typedef struct _DDHAL_DDPALETTECALLBACKS
  495. {
  496. DWORD dwSize;
  497. DWORD dwFlags;
  498. LPDDHALPALCB_DESTROYPALETTE DestroyPalette;
  499. LPDDHALPALCB_SETENTRIES SetEntries;
  500. } DDHAL_DDPALETTECALLBACKS;
  501. typedef DDHAL_DDPALETTECALLBACKS FAR *LPDDHAL_DDPALETTECALLBACKS;
  502. #define DDHAL_PALCB32_DESTROYPALETTE 0x00000001l
  503. #define DDHAL_PALCB32_SETENTRIES 0x00000002l
  504. /*
  505. * DIRECTDRAWSURFACE object callbacks
  506. */
  507. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_LOCK)(LPDDHAL_LOCKDATA);
  508. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_UNLOCK)(LPDDHAL_UNLOCKDATA);
  509. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_BLT)(LPDDHAL_BLTDATA);
  510. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_UPDATEOVERLAY)(LPDDHAL_UPDATEOVERLAYDATA);
  511. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETOVERLAYPOSITION)(LPDDHAL_SETOVERLAYPOSITIONDATA);
  512. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETPALETTE)(LPDDHAL_SETPALETTEDATA);
  513. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_FLIP)(LPDDHAL_FLIPDATA);
  514. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_DESTROYSURFACE)(LPDDHAL_DESTROYSURFACEDATA);
  515. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETCLIPLIST)(LPDDHAL_SETCLIPLISTDATA);
  516. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_ADDATTACHEDSURFACE)(LPDDHAL_ADDATTACHEDSURFACEDATA);
  517. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_SETCOLORKEY)(LPDDHAL_SETCOLORKEYDATA);
  518. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_GETBLTSTATUS)(LPDDHAL_GETBLTSTATUSDATA);
  519. typedef DWORD (FAR PASCAL *LPDDHALSURFCB_GETFLIPSTATUS)(LPDDHAL_GETFLIPSTATUSDATA);
  520. typedef struct _DDHAL_DDSURFACECALLBACKS
  521. {
  522. DWORD dwSize;
  523. DWORD dwFlags;
  524. LPDDHALSURFCB_DESTROYSURFACE DestroySurface;
  525. LPDDHALSURFCB_FLIP Flip;
  526. LPDDHALSURFCB_SETCLIPLIST SetClipList;
  527. LPDDHALSURFCB_LOCK Lock;
  528. LPDDHALSURFCB_UNLOCK Unlock;
  529. LPDDHALSURFCB_BLT Blt;
  530. LPDDHALSURFCB_SETCOLORKEY SetColorKey;
  531. LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface;
  532. LPDDHALSURFCB_GETBLTSTATUS GetBltStatus;
  533. LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus;
  534. LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay;
  535. LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition;
  536. LPVOID reserved4;
  537. LPDDHALSURFCB_SETPALETTE SetPalette;
  538. } DDHAL_DDSURFACECALLBACKS;
  539. typedef DDHAL_DDSURFACECALLBACKS FAR *LPDDHAL_DDSURFACECALLBACKS;
  540. #define DDHAL_SURFCB32_DESTROYSURFACE 0x00000001l
  541. #define DDHAL_SURFCB32_FLIP 0x00000002l
  542. #define DDHAL_SURFCB32_SETCLIPLIST 0x00000004l
  543. #define DDHAL_SURFCB32_LOCK 0x00000008l
  544. #define DDHAL_SURFCB32_UNLOCK 0x00000010l
  545. #define DDHAL_SURFCB32_BLT 0x00000020l
  546. #define DDHAL_SURFCB32_SETCOLORKEY 0x00000040l
  547. #define DDHAL_SURFCB32_ADDATTACHEDSURFACE 0x00000080l
  548. #define DDHAL_SURFCB32_GETBLTSTATUS 0x00000100l
  549. #define DDHAL_SURFCB32_GETFLIPSTATUS 0x00000200l
  550. #define DDHAL_SURFCB32_UPDATEOVERLAY 0x00000400l
  551. #define DDHAL_SURFCB32_SETOVERLAYPOSITION 0x00000800l
  552. #define DDHAL_SURFCB32_RESERVED4 0x00001000l
  553. #define DDHAL_SURFCB32_SETPALETTE 0x00002000l
  554. /*
  555. * DIRECTDRAWEXEBUF pseudo object callbacks
  556. *
  557. * NOTE: Execute buffers are not a distinct object type, they piggy back off
  558. * the surface data structures and high level API. However, they have their
  559. * own HAL callbacks as they may have different driver semantics from "normal"
  560. * surfaces. They also piggy back off the HAL data structures.
  561. *
  562. * !!! NOTE: Need to resolve whether we export execute buffer copying as a
  563. * blit or some other from of copy instruction.
  564. */
  565. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_CANCREATEEXEBUF)(LPDDHAL_CANCREATESURFACEDATA );
  566. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_CREATEEXEBUF)(LPDDHAL_CREATESURFACEDATA);
  567. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_DESTROYEXEBUF)(LPDDHAL_DESTROYSURFACEDATA);
  568. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_LOCKEXEBUF)(LPDDHAL_LOCKDATA);
  569. typedef DWORD (FAR PASCAL *LPDDHALEXEBUFCB_UNLOCKEXEBUF)(LPDDHAL_UNLOCKDATA);
  570. typedef struct _DDHAL_DDEXEBUFCALLBACKS
  571. {
  572. DWORD dwSize;
  573. DWORD dwFlags;
  574. LPDDHALEXEBUFCB_CANCREATEEXEBUF CanCreateExecuteBuffer;
  575. LPDDHALEXEBUFCB_CREATEEXEBUF CreateExecuteBuffer;
  576. LPDDHALEXEBUFCB_DESTROYEXEBUF DestroyExecuteBuffer;
  577. LPDDHALEXEBUFCB_LOCKEXEBUF LockExecuteBuffer;
  578. LPDDHALEXEBUFCB_UNLOCKEXEBUF UnlockExecuteBuffer;
  579. } DDHAL_DDEXEBUFCALLBACKS;
  580. typedef DDHAL_DDEXEBUFCALLBACKS FAR *LPDDHAL_DDEXEBUFCALLBACKS;
  581. #define DDHAL_EXEBUFCB32_CANCREATEEXEBUF 0x00000001l
  582. #define DDHAL_EXEBUFCB32_CREATEEXEBUF 0x00000002l
  583. #define DDHAL_EXEBUFCB32_DESTROYEXEBUF 0x00000004l
  584. #define DDHAL_EXEBUFCB32_LOCKEXEBUF 0x00000008l
  585. #define DDHAL_EXEBUFCB32_UNLOCKEXEBUF 0x00000010l
  586. /*
  587. * CALLBACK RETURN VALUES
  588. * * these are values returned by the driver from the above callback routines
  589. */
  590. /*
  591. * indicates that the display driver didn't do anything with the call
  592. */
  593. #define DDHAL_DRIVER_NOTHANDLED 0x00000000l
  594. /*
  595. * indicates that the display driver handled the call; HRESULT value is valid
  596. */
  597. #define DDHAL_DRIVER_HANDLED 0x00000001l
  598. /*
  599. * indicates that the display driver couldn't handle the call because it
  600. * ran out of color key hardware resources
  601. */
  602. #define DDHAL_DRIVER_NOCKEYHW 0x00000002l
  603. /*
  604. * DDRAW palette interface struct
  605. */
  606. typedef struct _DDRAWI_DDRAWPALETTE_INT
  607. {
  608. LPVOID lpVtbl; // pointer to array of interface methods
  609. LPDDRAWI_DDRAWPALETTE_LCL lpLcl; // pointer to interface data
  610. LPDDRAWI_DDRAWPALETTE_INT lpLink; // link to next interface
  611. DWORD dwIntRefCnt; // interface reference count
  612. } DDRAWI_DDRAWPALETTE_INT;
  613. /*
  614. * DDRAW internal version of DIRECTDRAWPALETTE object; it has data after the vtable
  615. */
  616. typedef struct _DDRAWI_DDRAWPALETTE_GBL
  617. {
  618. DWORD dwRefCnt; // reference count
  619. DWORD dwFlags; // flags
  620. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // PRIVATE: DIRECTDRAW object
  621. DWORD dwProcessId; // owning process
  622. LPPALETTEENTRY lpColorTable; // array of palette entries
  623. union
  624. {
  625. DWORD dwReserved1; // reserved for use by display driver
  626. HPALETTE hHELGDIPalette;
  627. };
  628. } DDRAWI_DDRAWPALETTE_GBL;
  629. /*
  630. * (CMcC) The palette no longer maintains a back pointer to the owning surface
  631. * (there may now be many owning surfaces). So the lpDDSurface is now dwReserved0
  632. * (this mod. assumes that sizeof(DWORD) == sizeof(LPDDRAWI_DDRAWSURFACE_LCL). A
  633. * fairly safe assumption I think.
  634. */
  635. typedef struct _DDRAWI_DDRAWPALETTE_LCL
  636. {
  637. DWORD lpPalMore; // pointer to additional local data
  638. LPDDRAWI_DDRAWPALETTE_GBL lpGbl; // pointer to data
  639. DWORD dwUnused0; // not currently used.
  640. DWORD dwLocalRefCnt; // local ref cnt
  641. IUnknown FAR *pUnkOuter; // outer IUnknown
  642. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // pointer to owning local driver object
  643. DWORD dwReserved1; // reserved for use by display driver
  644. } DDRAWI_DDRAWPALETTE_LCL;
  645. #define DDRAWIPAL_256 0x00000001l // 256 entry palette
  646. #define DDRAWIPAL_16 0x00000002l // 16 entry palette
  647. #define DDRAWIPAL_GDI 0x00000004l // palette allocated through GDI
  648. #define DDRAWIPAL_STORED_8 0x00000008l // palette stored as 8bpp/entry
  649. #define DDRAWIPAL_STORED_16 0x00000010l // palette stored as 16bpp/entry
  650. #define DDRAWIPAL_STORED_24 0x00000020l // palette stored as 24bpp/entry
  651. #define DDRAWIPAL_EXCLUSIVE 0x00000040l // palette being used in exclusive mode
  652. #define DDRAWIPAL_INHEL 0x00000080l // palette is done in the hel
  653. #define DDRAWIPAL_DIRTY 0x00000100l // gdi palette out 'o sync
  654. #define DDRAWIPAL_ALLOW256 0x00000200l // can fully update palette
  655. #define DDRAWIPAL_4 0x00000400l // 4 entry palette
  656. #define DDRAWIPAL_2 0x00000800l // 2 entry palette
  657. #define DDRAWIPAL_STORED_8INDEX 0x00001000l // palatte stored as 8-bit index into dst palette
  658. /*
  659. * DDRAW clipper interface struct
  660. */
  661. typedef struct _DDRAWI_DDRAWCLIPPER_INT
  662. {
  663. LPVOID lpVtbl; // pointer to array of interface methods
  664. LPDDRAWI_DDRAWCLIPPER_LCL lpLcl; // pointer to interface data
  665. LPDDRAWI_DDRAWCLIPPER_INT lpLink; // link to next interface
  666. DWORD dwIntRefCnt; // interface reference count
  667. } DDRAWI_DDRAWCLIPPER_INT;
  668. /*
  669. * DDRAW internal version of DIRECTDRAWCLIPPER object; it has data after the vtable
  670. */
  671. typedef struct _DDRAWI_DDRAWCLIPPER_GBL
  672. {
  673. DWORD dwRefCnt; // reference count
  674. DWORD dwFlags; // flags
  675. LPDDRAWI_DIRECTDRAW_GBL lpDD; // PRIVATE: DIRECTDRAW object
  676. DWORD dwProcessId; // owning process
  677. DWORD dwReserved1; // reserved for use by display driver
  678. DWORD hWnd; // window
  679. LPRGNDATA lpStaticClipList; // clip list set by app
  680. #ifdef CLIPPER_NOTIFY
  681. LPWINWATCH lpWW; // window watch data
  682. #endif
  683. } DDRAWI_DDRAWCLIPPER_GBL;
  684. /*
  685. * (CMcC) As with palettes, the clipper no longer maintains a back pointer to the
  686. * owning surface (there may now be many owning surfaces). So the lpDDSurface
  687. * is now dwReserved0 (this mod. assumes that sizeof(DWORD) ==
  688. * sizeof(LPDDRAWI_DDRAWSURFACE_LCL). A fairly safe assumption I think.
  689. */
  690. typedef struct _DDRAWI_DDRAWCLIPPER_LCL
  691. {
  692. DWORD lpClipMore; // pointer to additional local data
  693. LPDDRAWI_DDRAWCLIPPER_GBL lpGbl; // pointer to data
  694. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // pointer to owning local DD object
  695. DWORD dwLocalRefCnt; // local ref cnt
  696. IUnknown FAR *pUnkOuter; // outer IUnknown
  697. LPDDRAWI_DIRECTDRAW_INT lpDD_int; // pointer to owning DD object interface
  698. DWORD dwReserved1; // reserved for use by display driver
  699. } DDRAWI_DDRAWCLIPPER_LCL;
  700. #define DDRAWICLIP_WATCHWINDOW 0x00000001l
  701. #define DDRAWICLIP_ISINITIALIZED 0x00000002l
  702. /*
  703. * ATTACHLIST - internally used to maintain list of attached surfaces
  704. */
  705. typedef struct _ATTACHLIST
  706. {
  707. DWORD dwFlags;
  708. struct _ATTACHLIST FAR *lpLink; // link to next attached surface
  709. struct _DDRAWI_DDRAWSURFACE_LCL FAR *lpAttached; // attached surface local obj
  710. struct _DDRAWI_DDRAWSURFACE_INT FAR *lpIAttached; // attached surface interface
  711. } ATTACHLIST;
  712. typedef ATTACHLIST FAR *LPATTACHLIST;
  713. #define DDAL_IMPLICIT 0x00000001l
  714. /*
  715. * DBLNODE - a node in a doubly-linked list of surface interfaces
  716. */
  717. typedef struct _DBLNODE
  718. {
  719. struct _DBLNODE FAR *next; // link to next node
  720. struct _DBLNODE FAR *prev; // link to previous node
  721. LPDDRAWI_DDRAWSURFACE_LCL object; // link to object
  722. LPDDRAWI_DDRAWSURFACE_INT object_int; // object interface
  723. } DBLNODE;
  724. typedef DBLNODE FAR *LPDBLNODE;
  725. /*
  726. * ACCESSRECTLIST - internally used to all rectangles that are accessed on a surface
  727. */
  728. typedef struct _ACCESSRECTLIST
  729. {
  730. struct _ACCESSRECTLIST FAR *lpLink; // link to next attached surface
  731. RECT rDest; // rectangle being used
  732. LPDDRAWI_DIRECTDRAW_LCL lpOwner; // owning local object
  733. LPVOID lpSurfaceData; // associated screen ptr
  734. } ACCESSRECTLIST;
  735. typedef ACCESSRECTLIST FAR *LPACCESSRECTLIST;
  736. /*
  737. * DDRAW surface interface struct
  738. */
  739. typedef struct _DDRAWI_DDRAWSURFACE_INT
  740. {
  741. LPVOID lpVtbl; // pointer to array of interface methods
  742. LPDDRAWI_DDRAWSURFACE_LCL lpLcl; // pointer to interface data
  743. LPDDRAWI_DDRAWSURFACE_INT lpLink; // link to next interface
  744. DWORD dwIntRefCnt; // interface reference count
  745. } DDRAWI_DDRAWSURFACE_INT;
  746. /*
  747. * DDRAW internal version of DIRECTDRAWSURFACE struct
  748. *
  749. * the GBL structure is global data for all duplicate objects
  750. */
  751. typedef struct _DDRAWI_DDRAWSURFACE_GBL
  752. {
  753. DWORD dwRefCnt; // reference count
  754. DWORD dwGlobalFlags; // global flags
  755. union
  756. {
  757. LPACCESSRECTLIST lpRectList; // list of accesses
  758. DWORD dwBlockSizeY; // block size that display driver requested (return)
  759. };
  760. union
  761. {
  762. LPVMEMHEAP lpVidMemHeap; // heap vidmem was alloc'ed from
  763. DWORD dwBlockSizeX; // block size that display driver requested (return)
  764. };
  765. union
  766. {
  767. LPDDRAWI_DIRECTDRAW_GBL lpDD; // internal DIRECTDRAW object
  768. LPVOID lpDDHandle; // handle to internal DIRECTDRAW object
  769. // for use by display driver
  770. // when calling fns in DDRAW16.DLL
  771. };
  772. FLATPTR fpVidMem; // pointer to video memory
  773. union
  774. {
  775. LONG lPitch; // pitch of surface
  776. DWORD dwLinearSize; // linear size of non-rectangular surface
  777. };
  778. WORD wHeight; // height of surface
  779. WORD wWidth; // width of surface
  780. DWORD dwUsageCount; // number of access to this surface
  781. DWORD dwReserved1; // reserved for use by display driver
  782. //
  783. // NOTE: this part of the structure is ONLY allocated if the pixel
  784. // format differs from that of the primary display
  785. //
  786. DDPIXELFORMAT ddpfSurface; // pixel format of surface
  787. } DDRAWI_DDRAWSURFACE_GBL;
  788. /*
  789. * a structure holding additional LCL surface information (can't simply be appended
  790. * to the LCL structure as that structure is of variable size).
  791. */
  792. typedef struct _DDRAWI_DDRAWSURFACE_MORE
  793. {
  794. DWORD dwSize;
  795. IUNKNOWN_LIST FAR *lpIUnknowns; // IUnknowns aggregated by this surface
  796. LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; // Pointer to the DirectDraw local object
  797. DWORD dwPageLockCount; // count of pagelocks
  798. DWORD dwBytesAllocated; // size of sys mem allocated
  799. LPDDRAWI_DIRECTDRAW_INT lpDD_int; // Pointer to the DirectDraw interface
  800. DWORD dwMipMapCount; // Number of mip-map levels in the chain
  801. LPDDRAWI_DDRAWCLIPPER_INT lpDDIClipper; // Interface to attached clipper object
  802. } DDRAWI_DDRAWSURFACE_MORE;
  803. /*
  804. * the LCL structure is local data for each individual surface object
  805. */
  806. struct _DDRAWI_DDRAWSURFACE_LCL
  807. {
  808. LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore; // pointer to additional local data
  809. LPDDRAWI_DDRAWSURFACE_GBL lpGbl; // pointer to surface shared data
  810. DWORD hDDSurface; // NT Kernel-mode handle was dwUnused0
  811. LPATTACHLIST lpAttachList; // link to surfaces we attached to
  812. LPATTACHLIST lpAttachListFrom;// link to surfaces that attached to this one
  813. DWORD dwLocalRefCnt; // object refcnt
  814. DWORD dwProcessId; // owning process
  815. DWORD dwFlags; // flags
  816. DDSCAPS ddsCaps; // capabilities of surface
  817. union
  818. {
  819. LPDDRAWI_DDRAWPALETTE_INT lpDDPalette; // associated palette
  820. LPDDRAWI_DDRAWPALETTE_INT lp16DDPalette; // 16-bit ptr to associated palette
  821. };
  822. union
  823. {
  824. LPDDRAWI_DDRAWCLIPPER_LCL lpDDClipper; // associated clipper
  825. LPDDRAWI_DDRAWCLIPPER_INT lp16DDClipper; // 16-bit ptr to associated clipper
  826. };
  827. DWORD dwModeCreatedIn;
  828. DWORD dwBackBufferCount; // number of back buffers created
  829. DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
  830. DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
  831. // IUnknown FAR *pUnkOuter; // outer IUnknown
  832. DWORD hDC; // owned dc
  833. DWORD dwReserved1; // reserved for use by display driver
  834. /*
  835. * NOTE: this part of the structure is ONLY allocated if the surface
  836. * can be used for overlays. ddckCKSrcOverlay MUST NOT BE MOVED
  837. * from the start of this area.
  838. */
  839. DDCOLORKEY ddckCKSrcOverlay;// color key for source overlay use
  840. DDCOLORKEY ddckCKDestOverlay;// color key for destination overlay use
  841. LPDDRAWI_DDRAWSURFACE_INT lpSurfaceOverlaying; // surface we are overlaying
  842. DBLNODE dbnOverlayNode;
  843. /*
  844. * overlay rectangle, used by DDHEL
  845. */
  846. RECT rcOverlaySrc;
  847. RECT rcOverlayDest;
  848. /*
  849. * the below values are kept here for ddhel. they're set by UpdateOverlay,
  850. * they're used whenever the overlays are redrawn.
  851. */
  852. DWORD dwClrXparent; // the *actual* color key (override, colorkey, or CLR_INVALID)
  853. DWORD dwAlpha; // the per surface alpha
  854. /*
  855. * overlay position
  856. */
  857. LONG lOverlayX; // current x position
  858. LONG lOverlayY; // current y position
  859. };
  860. typedef struct _DDRAWI_DDRAWSURFACE_LCL DDRAWI_DDRAWSURFACE_LCL;
  861. //@@BEGIN_MSINTERNAL
  862. #ifdef STREAMING
  863. struct _DDRAWI_DIRECTDRAWSURFACESTREAMING
  864. {
  865. LPVOID lpVtbl; // pointer to array of callback fns
  866. LPDDRAWI_DDRAWSURFACE_GBL lpGbl; // pointer to surface data
  867. DWORD dwLocalRefCnt; // object refcnt
  868. DWORD dwProcessId; // owning process
  869. LPSURFACESTREAMINGCALLBACK lpCallback; // callback
  870. };
  871. typedef struct _DDRAWI_DIRECTDRAWSURFACESTREAMING DDRAWI_DIRECTDRAWSURFACESTREAMING;
  872. #endif
  873. //@@END_MSINTERNAL
  874. #define DDRAWISURFGBL_MEMFREE 0x00000001L // video memory has been freed
  875. #define DDRAWISURFGBL_SYSMEMREQUESTED 0x00000002L // surface is in system memory at request of user
  876. #define DDRAWISURFGBL_ISGDISURFACE 0x00000004L // This surface represents what GDI thinks is front buffer
  877. /*
  878. * NOTE: This flag was previously DDRAWISURFGBL_INVALID. This flags has been retired
  879. * and replaced by DDRAWISURF_INVALID in the local object.
  880. */
  881. #define DDRAWISURFGBL_RESERVED0 0x80000000L // Reserved flag
  882. #define DDRAWISURF_ATTACHED 0x00000001L // surface is attached to another
  883. #define DDRAWISURF_IMPLICITCREATE 0x00000002L // surface implicitly created
  884. #define DDRAWISURF_ISFREE 0x00000004L // surface already freed (temp flag)
  885. #define DDRAWISURF_ATTACHED_FROM 0x00000008L // surface has others attached to it
  886. #define DDRAWISURF_IMPLICITROOT 0x00000010L // surface root of implicit creation
  887. #define DDRAWISURF_PARTOFPRIMARYCHAIN 0x00000020L // surface is part of primary chain
  888. #define DDRAWISURF_DATAISALIASED 0x00000040L // used for thunking
  889. #define DDRAWISURF_HASDC 0x00000080L // has a DC
  890. #define DDRAWISURF_HASCKEYDESTOVERLAY 0x00000100L // surface has CKDestOverlay
  891. #define DDRAWISURF_HASCKEYDESTBLT 0x00000200L // surface has CKDestBlt
  892. #define DDRAWISURF_HASCKEYSRCOVERLAY 0x00000400L // surface has CKSrcOverlay
  893. #define DDRAWISURF_HASCKEYSRCBLT 0x00000800L // surface has CKSrcBlt
  894. #define DDRAWISURF_LOCKEXCLUDEDCURSOR 0x00001000L // surface was locked and excluded cursor
  895. #define DDRAWISURF_HASPIXELFORMAT 0x00002000L // surface structure has pixel format data
  896. #define DDRAWISURF_HASOVERLAYDATA 0x00004000L // surface structure has overlay data
  897. #define DDRAWISURF_xxxxxxxxxxx5 0x00008000L // spare bit
  898. #define DDRAWISURF_SW_CKEYDESTOVERLAY 0x00010000L // surface expects to process colorkey in software
  899. #define DDRAWISURF_SW_CKEYDESTBLT 0x00020000L // surface expects to process colorkey in software
  900. #define DDRAWISURF_SW_CKEYSRCOVERLAY 0x00040000L // surface expects to process colorkey in software
  901. #define DDRAWISURF_SW_CKEYSRCBLT 0x00080000L // surface expects to process colorkey in software
  902. #define DDRAWISURF_HW_CKEYDESTOVERLAY 0x00100000L // surface expects to process colorkey in hardware
  903. #define DDRAWISURF_HW_CKEYDESTBLT 0x00200000L // surface expects to process colorkey in hardware
  904. #define DDRAWISURF_HW_CKEYSRCOVERLAY 0x00400000L // surface expects to process colorkey in hardware
  905. #define DDRAWISURF_HW_CKEYSRCBLT 0x00800000L // surface expects to process colorkey in hardware
  906. #define DDRAWISURF_xxxxxxxxxxx6 0x01000000L // spare bit
  907. #define DDRAWISURF_HELCB 0x02000000L // surface is the ddhel cb. must call hel for lock/blt.
  908. #define DDRAWISURF_FRONTBUFFER 0x04000000L // surface was originally a front buffer
  909. #define DDRAWISURF_BACKBUFFER 0x08000000L // surface was originally backbuffer
  910. #define DDRAWISURF_INVALID 0x10000000L // surface has been invalidated by mode set
  911. #define DDRAWISURF_DCIBUSY 0x20000000L // HEL has turned off BUSY so DCI would work
  912. #define DDRAWISURF_GETDCNULL 0x40000000L // getdc could not lock and so returned GetDC(NULL)
  913. /*
  914. * rop stuff
  915. */
  916. #define ROP_HAS_SOURCE 0x00000001l
  917. #define ROP_HAS_PATTERN 0x00000002l
  918. #define ROP_HAS_SOURCEPATTERN ROP_HAS_SOURCE | ROP_HAS_PATTERN
  919. /*
  920. * mode information
  921. */
  922. typedef struct _DDHALMODEINFO
  923. {
  924. DWORD dwWidth; // width (in pixels) of mode
  925. DWORD dwHeight; // height (in pixels) of mode
  926. LONG lPitch; // pitch (in bytes) of mode
  927. DWORD dwBPP; // bits per pixel
  928. WORD wFlags; // flags
  929. WORD wRefreshRate; // refresh rate
  930. DWORD dwRBitMask; // red bit mask
  931. DWORD dwGBitMask; // green bit mask
  932. DWORD dwBBitMask; // blue bit mask
  933. DWORD dwAlphaBitMask; // alpha bit mask
  934. } DDHALMODEINFO;
  935. typedef DDHALMODEINFO FAR *LPDDHALMODEINFO;
  936. #define DDMODEINFO_PALETTIZED 0x0001 // mode is palettized
  937. #define DDMODEINFO_MODEX 0x0002 // mode is a modex mode
  938. #define DDMODEINFO_UNSUPPORTED 0x0004 // mode is not supported by driver
  939. //@@BEGIN_MSINTERNAL
  940. #define DDMODEINFO_VALID 0x0003 // valid
  941. //@@END_MSINTERNAL
  942. /*
  943. * DDRAW interface struct
  944. */
  945. typedef struct _DDRAWI_DIRECTDRAW_INT
  946. {
  947. LPVOID lpVtbl; // pointer to array of interface methods
  948. LPDDRAWI_DIRECTDRAW_LCL lpLcl; // pointer to interface data
  949. LPDDRAWI_DIRECTDRAW_INT lpLink; // link to next interface
  950. DWORD dwIntRefCnt; // interface reference count
  951. } DDRAWI_DIRECTDRAW_INT;
  952. /*
  953. * DDRAW version of DirectDraw object; it has data after the vtable
  954. *
  955. * all entries marked as PRIVATE are not for use by the display driver
  956. */
  957. typedef struct _DDHAL_CALLBACKS
  958. {
  959. DDHAL_DDCALLBACKS cbDDCallbacks; // addresses in display driver for DIRECTDRAW object HAL
  960. DDHAL_DDSURFACECALLBACKS cbDDSurfaceCallbacks; // addresses in display driver for DIRECTDRAWSURFACE object HAL
  961. DDHAL_DDPALETTECALLBACKS cbDDPaletteCallbacks; // addresses in display driver for DIRECTDRAWPALETTE object HAL
  962. DDHAL_DDCALLBACKS HALDD; // HAL for DIRECTDRAW object
  963. DDHAL_DDSURFACECALLBACKS HALDDSurface; // HAL for DIRECTDRAWSURFACE object
  964. DDHAL_DDPALETTECALLBACKS HALDDPalette; // HAL for DIRECTDRAWPALETTE object
  965. DDHAL_DDCALLBACKS HELDD; // HEL for DIRECTDRAW object
  966. DDHAL_DDSURFACECALLBACKS HELDDSurface; // HEL for DIRECTDRAWSURFACE object
  967. DDHAL_DDPALETTECALLBACKS HELDDPalette; // HEL for DIRECTDRAWPALETTE object
  968. DDHAL_DDEXEBUFCALLBACKS cbDDExeBufCallbacks; // addresses in display driver for DIRECTDRAWEXEBUF pseudo object HAL
  969. DDHAL_DDEXEBUFCALLBACKS HALDDExeBuf; // HAL for DIRECTDRAWEXEBUF pseudo object
  970. DDHAL_DDEXEBUFCALLBACKS HELDDExeBuf; // HEL for DIRECTDRAWEXEBUF preudo object
  971. } DDHAL_CALLBACKS, far *LPDDHAL_CALLBACKS;
  972. typedef struct _DDRAWI_DIRECTDRAW_GBL
  973. {
  974. DWORD dwRefCnt; // reference count
  975. DWORD dwFlags; // flags
  976. FLATPTR fpPrimaryOrig; // primary surf vid mem. ptr
  977. DDCAPS ddCaps; // driver caps
  978. DWORD dwUnused1[10]; // not currently used
  979. LPDDHAL_CALLBACKS lpDDCBtmp; // HAL callbacks
  980. LPDDRAWI_DDRAWSURFACE_INT dsList; // PRIVATE: list of all surfaces
  981. LPDDRAWI_DDRAWPALETTE_INT palList; // PRIVATE: list of all palettes
  982. LPDDRAWI_DDRAWCLIPPER_INT clipperList; // PRIVATE: list of all clippers
  983. LPDDRAWI_DIRECTDRAW_GBL lp16DD; // PRIVATE: 16-bit ptr to this struct
  984. DWORD dwMaxOverlays; // maximum number of overlays
  985. DWORD dwCurrOverlays; // current number of visible overlays
  986. DWORD dwMonitorFrequency; // monitor frequency in current mode
  987. DDCAPS ddHELCaps; // HEL capabilities
  988. DWORD dwUnused2[50]; // not currently used
  989. DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
  990. DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
  991. VIDMEMINFO vmiData; // info about vid memory
  992. LPVOID lpDriverHandle; // handle for use by display driver
  993. // to call fns in DDRAW16.DLL
  994. LPDDRAWI_DIRECTDRAW_LCL lpExclusiveOwner; // PRIVATE: exclusive local object
  995. DWORD dwModeIndex; // current mode index
  996. DWORD dwModeIndexOrig;// original mode index
  997. DWORD dwNumFourCC; // number of fourcc codes supported
  998. DWORD FAR *lpdwFourCC;// PRIVATE: fourcc codes supported
  999. DWORD dwNumModes; // number of modes supported
  1000. LPDDHALMODEINFO lpModeInfo; // PRIVATE: mode information
  1001. PROCESS_LIST plProcessList; // PRIVATE: list of processes using driver
  1002. DWORD dwSurfaceLockCount; // total number of outstanding locks
  1003. DWORD dwFree1; // PRIVATE: was system color table
  1004. DWORD dwFree2; // PRIVATE: was original palette
  1005. DWORD hDD; // PRIVATE: NT Kernel-mode handle (was dwFree3).
  1006. char cDriverName[MAX_DRIVER_NAME]; // Driver Name
  1007. DWORD dwReserved1; // reserved for use by display driver
  1008. DWORD dwReserved2; // reserved for use by display driver
  1009. DBLNODE dbnOverlayRoot; // The root node of the doubly-
  1010. // linked list of overlay z orders.
  1011. volatile LPWORD lpwPDeviceFlags;// driver physical device flags
  1012. DWORD dwPDevice; // driver physical device (16:16 pointer)
  1013. DWORD dwWin16LockCnt; // count on win16 holds
  1014. LPDDRAWI_DIRECTDRAW_LCL lpWin16LockOwner; // object owning Win16 Lock
  1015. DWORD hInstance; // instance handle of driver
  1016. DWORD dwEvent16; // 16-bit event
  1017. DWORD dwSaveNumModes; // saved number of modes supported
  1018. /* Version 2 fields */
  1019. DWORD lpD3DGlobalDriverData; // Global D3D Data
  1020. DWORD lpD3DHALCallbacks; // D3D HAL Callbacks
  1021. DDCAPS ddBothCaps; // logical AND of driver and HEL caps
  1022. } DDRAWI_DIRECTDRAW_GBL;
  1023. typedef struct _DDRAWI_DIRECTDRAW_LCL
  1024. {
  1025. DWORD lpDDMore; // pointer to additional local data
  1026. LPDDRAWI_DIRECTDRAW_GBL lpGbl; // pointer to data
  1027. DWORD dwUnused0; // not currently used
  1028. DWORD dwLocalFlags; // local flags (DDRAWILCL_)
  1029. DWORD dwLocalRefCnt; // local ref cnt
  1030. DWORD dwProcessId; // owning process id
  1031. IUnknown FAR *pUnkOuter; // outer IUnknown
  1032. DWORD dwObsolete1;
  1033. DWORD hWnd;
  1034. DWORD hDC;
  1035. DWORD dwErrorMode;
  1036. LPDDRAWI_DDRAWSURFACE_INT lpPrimary;
  1037. LPDDRAWI_DDRAWSURFACE_INT lpCB;
  1038. DWORD dwPreferredMode;
  1039. //------- Fields added in Version 2.0 -------
  1040. HINSTANCE hD3DInstance; // Handle of Direct3D's DLL.
  1041. IUnknown FAR *pD3DIUnknown; // Direct3D's aggregated IUnknown.
  1042. LPDDHAL_CALLBACKS lpDDCB; // HAL callbacks
  1043. #ifdef SHAREDZ
  1044. LPDDRAWI_DDRAWSURFACE_INT lpSharedZ; // Shared z-buffer (if any).
  1045. LPDDRAWI_DDRAWSURFACE_INT lpSharedBack; // Shared back-buffer (if any).
  1046. #endif
  1047. DWORD hDSVxd; // handle to dsound.vxd
  1048. } DDRAWI_DIRECTDRAW_LCL;
  1049. #define DDRAWILCL_HASEXCLUSIVEMODE 0x00000001l
  1050. #define DDRAWILCL_ISFULLSCREEN 0x00000002l
  1051. #define DDRAWILCL_SETCOOPCALLED 0x00000004l
  1052. #define DDRAWILCL_ACTIVEYES 0x00000008l
  1053. #define DDRAWILCL_ACTIVENO 0x00000010l
  1054. #define DDRAWILCL_HOOKEDHWND 0x00000020l
  1055. #define DDRAWILCL_ALLOWMODEX 0x00000040l
  1056. #define DDRAWILCL_V1SCLBEHAVIOUR 0x00000080l
  1057. #define DDRAWILCL_MODEHASBEENCHANGED 0x00000100l
  1058. #define DDRAWI_xxxxxxxxx1 0x00000001l // unused
  1059. #define DDRAWI_xxxxxxxxx2 0x00000002l // unused
  1060. #define DDRAWI_xxxxxxxxx3 0x00000004l // unused
  1061. #define DDRAWI_xxxxxxxxx4 0x00000008l // unused
  1062. #define DDRAWI_MODEX 0x00000010l // driver is using modex
  1063. #define DDRAWI_DISPLAYDRV 0x00000020l // driver is display driver
  1064. #define DDRAWI_FULLSCREEN 0x00000040l // driver in fullscreen mode
  1065. #define DDRAWI_MODECHANGED 0x00000080l // display mode has been changed
  1066. #define DDRAWI_NOHARDWARE 0x00000100l // no driver hardware at all
  1067. #define DDRAWI_PALETTEINIT 0x00000200l // GDI palette stuff has been initalized
  1068. #define DDRAWI_NOEMULATION 0x00000400l // no emulation at all
  1069. #define DDRAWI_HASCKEYDESTOVERLAY 0x00000800l // driver has CKDestOverlay
  1070. #define DDRAWI_HASCKEYSRCOVERLAY 0x00001000l // driver has CKSrcOverlay
  1071. #define DDRAWI_HASGDIPALETTE 0x00002000l // GDI palette exists on primary surface
  1072. #define DDRAWI_EMULATIONINITIALIZED 0x00004000l // emulation is initialized
  1073. #define DDRAWI_HASGDIPALETTE_EXCLUSIVE 0x00008000l // exclusive mode palette
  1074. #define DDRAWI_MODEXILLEGAL 0x00010000l // modex is not supported by this hardware
  1075. #define DDRAWI_FLIPPEDTOGDI 0x00020000l // driver has been flipped to show GDI surface
  1076. //@@BEGIN_MSINTERNAL
  1077. /*
  1078. * The following structure is equivalent to the DDHALINFO structure defined in DirectDraw 1.0.
  1079. * It is used by DirectDraw internally to interpret the DDHALINFO information passed from drivers written
  1080. * prior to DirectDraw 2.0. New applications and drivers should use the DDHALINFO structure defined after
  1081. * this one. DirectDraw distinguishes between the structures via the dwSize field.
  1082. */
  1083. typedef struct _DDHALINFO_V1
  1084. {
  1085. DWORD dwSize;
  1086. LPDDHAL_DDCALLBACKS lpDDCallbacks; // direct draw object callbacks
  1087. LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks; // surface object callbacks
  1088. LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks; // palette object callbacks
  1089. VIDMEMINFO vmiData; // video memory info
  1090. DDCAPS_V1 ddCaps; // hw specific caps
  1091. DWORD dwMonitorFrequency; // monitor frequency in current mode
  1092. DWORD hWndListBox; // list box for debug output
  1093. DWORD dwModeIndex; // current mode: index into array
  1094. LPDWORD lpdwFourCC; // fourcc codes supported
  1095. DWORD dwNumModes; // number of modes supported
  1096. LPDDHALMODEINFO lpModeInfo; // mode information
  1097. DWORD dwFlags; // create flags
  1098. LPVOID lpPDevice; // physical device ptr
  1099. DWORD hInstance; // instance handle of driver
  1100. } DDHALINFO_V1;
  1101. typedef DDHALINFO_V1 FAR *LPDDHALINFO_V1;
  1102. #define DDHALINFOSIZE_V1 sizeof( DDHALINFO_V1)
  1103. /*
  1104. * CAUTION: Size of the interm DDHALSTRUCTURE (post V1.0 pre V2.0)
  1105. * Here temporarily only. Added (03/02/96). Should be removed by
  1106. * (03/07/96). If not come and get me. colinmc
  1107. */
  1108. #define DDHALINFOSIZE_VINTERIM \
  1109. (DDHALINFOSIZE_V1 + \
  1110. (sizeof(DWORD) * 2UL) + \
  1111. (sizeof(LPDDHAL_DDEXEBUFCALLBACKS)))
  1112. //@@END_MSINTERNAL
  1113. /*
  1114. * structure for display driver to call DDHAL_Create with
  1115. */
  1116. typedef struct _DDHALINFO
  1117. {
  1118. DWORD dwSize;
  1119. LPDDHAL_DDCALLBACKS lpDDCallbacks; // direct draw object callbacks
  1120. LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks; // surface object callbacks
  1121. LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks; // palette object callbacks
  1122. VIDMEMINFO vmiData; // video memory info
  1123. DDCAPS ddCaps; // hw specific caps
  1124. DWORD dwMonitorFrequency; // monitor frequency in current mode
  1125. DWORD hWndListBox; // list box for debug output
  1126. DWORD dwModeIndex; // current mode: index into array
  1127. LPDWORD lpdwFourCC; // fourcc codes supported
  1128. DWORD dwNumModes; // number of modes supported
  1129. LPDDHALMODEINFO lpModeInfo; // mode information
  1130. DWORD dwFlags; // create flags
  1131. LPVOID lpPDevice; // physical device ptr
  1132. DWORD hInstance; // instance handle of driver
  1133. //------- Fields added in Version 2.0 -------
  1134. DWORD lpD3DGlobalDriverData; // D3D global Data
  1135. DWORD lpD3DHALCallbacks; // D3D callbacks
  1136. LPDDHAL_DDEXEBUFCALLBACKS lpDDExeBufCallbacks; // Execute buffer pseudo object callbacks
  1137. } DDHALINFO;
  1138. typedef DDHALINFO FAR *LPDDHALINFO;
  1139. #define DDHALINFOSIZE_V2 sizeof( DDHALINFO )
  1140. #define DDHALINFO_ISPRIMARYDISPLAY 0x00000001l // indicates driver is primary display driver
  1141. #define DDHALINFO_MODEXILLEGAL 0x00000002l // indicates this hardware does not support modex modes
  1142. /*
  1143. * DDRAW16.DLL entry points
  1144. */
  1145. typedef BOOL (DDAPI *LPDDHAL_SETINFO)( LPDDHALINFO lpDDHalInfo, BOOL reset );
  1146. typedef FLATPTR (DDAPI *LPDDHAL_VIDMEMALLOC)( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight );
  1147. typedef void (DDAPI *LPDDHAL_VIDMEMFREE)( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem );
  1148. extern BOOL DDAPI DDHAL_SetInfo( LPDDHALINFO lpDDHALInfo, BOOL reset );
  1149. extern FLATPTR DDAPI DDHAL_VidMemAlloc( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight );
  1150. extern void DDAPI DDHAL_VidMemFree( LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem );
  1151. typedef struct
  1152. {
  1153. DWORD dwSize;
  1154. LPDDHAL_SETINFO lpSetInfo;
  1155. LPDDHAL_VIDMEMALLOC lpVidMemAlloc;
  1156. LPDDHAL_VIDMEMFREE lpVidMemFree;
  1157. } DDHALDDRAWFNS;
  1158. typedef DDHALDDRAWFNS FAR *LPDDHALDDRAWFNS;
  1159. /****************************************************************************
  1160. *
  1161. * DDHAL structures for Surface Object callbacks
  1162. *
  1163. ***************************************************************************/
  1164. /*
  1165. * structure for passing information to DDHAL Blt fn
  1166. */
  1167. typedef struct _DDHAL_BLTDATA
  1168. {
  1169. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1170. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  1171. RECTL rDest; // dest rect
  1172. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  1173. RECTL rSrc; // src rect
  1174. DWORD dwFlags; // blt flags
  1175. DWORD dwROPFlags; // ROP flags (valid for ROPS only)
  1176. DDBLTFX bltFX; // blt FX
  1177. HRESULT ddRVal; // return value
  1178. LPDDHALSURFCB_BLT Blt; // PRIVATE: ptr to callback
  1179. BOOL IsClipped; // clipped blt?
  1180. RECTL rOrigDest; // unclipped dest rect
  1181. // (only valid if IsClipped)
  1182. RECTL rOrigSrc; // unclipped src rect
  1183. // (only valid if IsClipped)
  1184. DWORD dwRectCnt; // count of dest rects
  1185. // (only valid if IsClipped)
  1186. LPRECT prDestRects; // array of dest rects
  1187. // (only valid if IsClipped)
  1188. } DDHAL_BLTDATA;
  1189. /*
  1190. * structure for passing information to DDHAL Lock fn
  1191. */
  1192. typedef struct _DDHAL_LOCKDATA
  1193. {
  1194. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1195. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1196. DWORD bHasRect; // rArea is valid
  1197. RECTL rArea; // area being locked
  1198. LPVOID lpSurfData; // pointer to screen memory (return value)
  1199. HRESULT ddRVal; // return value
  1200. LPDDHALSURFCB_LOCK Lock; // PRIVATE: ptr to callback
  1201. DWORD dwFlags; // DDLOCK flags
  1202. } DDHAL_LOCKDATA;
  1203. /*
  1204. * structure for passing information to DDHAL Unlock fn
  1205. */
  1206. typedef struct _DDHAL_UNLOCKDATA
  1207. {
  1208. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1209. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1210. HRESULT ddRVal; // return value
  1211. LPDDHALSURFCB_UNLOCK Unlock; // PRIVATE: ptr to callback
  1212. } DDHAL_UNLOCKDATA;
  1213. /*
  1214. * structure for passing information to DDHAL UpdateOverlay fn
  1215. */
  1216. typedef struct _DDHAL_UPDATEOVERLAYDATA
  1217. {
  1218. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1219. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  1220. RECTL rDest; // dest rect
  1221. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  1222. RECTL rSrc; // src rect
  1223. DWORD dwFlags; // flags
  1224. DDOVERLAYFX overlayFX; // overlay FX
  1225. HRESULT ddRVal; // return value
  1226. LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay; // PRIVATE: ptr to callback
  1227. } DDHAL_UPDATEOVERLAYDATA;
  1228. /*
  1229. * structure for passing information to DDHAL UpdateOverlay fn
  1230. */
  1231. typedef struct _DDHAL_SETOVERLAYPOSITIONDATA
  1232. {
  1233. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1234. LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface; // src surface
  1235. LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;// dest surface
  1236. LONG lXPos; // x position
  1237. LONG lYPos; // y position
  1238. HRESULT ddRVal; // return value
  1239. LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition; // PRIVATE: ptr to callback
  1240. } DDHAL_SETOVERLAYPOSITIONDATA;
  1241. /*
  1242. * structure for passing information to DDHAL SetPalette fn
  1243. */
  1244. typedef struct _DDHAL_SETPALETTEDATA
  1245. {
  1246. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1247. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1248. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette to set to surface
  1249. HRESULT ddRVal; // return value
  1250. LPDDHALSURFCB_SETPALETTE SetPalette; // PRIVATE: ptr to callback
  1251. BOOL Attach; // attach this palette?
  1252. } DDHAL_SETPALETTEDATA;
  1253. /*
  1254. * structure for passing information to DDHAL Flip fn
  1255. */
  1256. typedef struct _DDHAL_FLIPDATA
  1257. {
  1258. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1259. LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurr; // current surface
  1260. LPDDRAWI_DDRAWSURFACE_LCL lpSurfTarg; // target surface (to flip to)
  1261. DWORD dwFlags; // flags
  1262. HRESULT ddRVal; // return value
  1263. LPDDHALSURFCB_FLIP Flip; // PRIVATE: ptr to callback
  1264. } DDHAL_FLIPDATA;
  1265. /*
  1266. * structure for passing information to DDHAL DestroySurface fn
  1267. */
  1268. typedef struct _DDHAL_DESTROYSURFACEDATA
  1269. {
  1270. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1271. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1272. HRESULT ddRVal; // return value
  1273. LPDDHALSURFCB_DESTROYSURFACE DestroySurface;// PRIVATE: ptr to callback
  1274. } DDHAL_DESTROYSURFACEDATA;
  1275. /*
  1276. * structure for passing information to DDHAL SetClipList fn
  1277. */
  1278. typedef struct _DDHAL_SETCLIPLISTDATA
  1279. {
  1280. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1281. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1282. HRESULT ddRVal; // return value
  1283. LPDDHALSURFCB_SETCLIPLIST SetClipList; // PRIVATE: ptr to callback
  1284. } DDHAL_SETCLIPLISTDATA;
  1285. /*
  1286. * structure for passing information to DDHAL AddAttachedSurface fn
  1287. */
  1288. typedef struct _DDHAL_ADDATTACHEDSURFACEDATA
  1289. {
  1290. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1291. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1292. LPDDRAWI_DDRAWSURFACE_LCL lpSurfAttached; // surface to attach
  1293. HRESULT ddRVal; // return value
  1294. LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface; // PRIVATE: ptr to callback
  1295. } DDHAL_ADDATTACHEDSURFACEDATA;
  1296. /*
  1297. * structure for passing information to DDHAL SetColorKey fn
  1298. */
  1299. typedef struct _DDHAL_SETCOLORKEYDATA
  1300. {
  1301. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1302. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1303. DWORD dwFlags; // flags
  1304. DDCOLORKEY ckNew; // new color key
  1305. HRESULT ddRVal; // return value
  1306. LPDDHALSURFCB_SETCOLORKEY SetColorKey; // PRIVATE: ptr to callback
  1307. } DDHAL_SETCOLORKEYDATA;
  1308. /*
  1309. * structure for passing information to DDHAL GetBltStatus fn
  1310. */
  1311. typedef struct _DDHAL_GETBLTSTATUSDATA
  1312. {
  1313. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1314. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1315. DWORD dwFlags; // flags
  1316. HRESULT ddRVal; // return value
  1317. LPDDHALSURFCB_GETBLTSTATUS GetBltStatus; // PRIVATE: ptr to callback
  1318. } DDHAL_GETBLTSTATUSDATA;
  1319. /*
  1320. * structure for passing information to DDHAL GetFlipStatus fn
  1321. */
  1322. typedef struct _DDHAL_GETFLIPSTATUSDATA
  1323. {
  1324. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1325. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1326. DWORD dwFlags; // flags
  1327. HRESULT ddRVal; // return value
  1328. LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus; // PRIVATE: ptr to callback
  1329. } DDHAL_GETFLIPSTATUSDATA;
  1330. /****************************************************************************
  1331. *
  1332. * DDHAL structures for Palette Object callbacks
  1333. *
  1334. ***************************************************************************/
  1335. /*
  1336. * structure for passing information to DDHAL DestroyPalette fn
  1337. */
  1338. typedef struct _DDHAL_DESTROYPALETTEDATA
  1339. {
  1340. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1341. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette struct
  1342. HRESULT ddRVal; // return value
  1343. LPDDHALPALCB_DESTROYPALETTE DestroyPalette; // PRIVATE: ptr to callback
  1344. } DDHAL_DESTROYPALETTEDATA;
  1345. /*
  1346. * structure for passing information to DDHAL SetEntries fn
  1347. */
  1348. typedef struct _DDHAL_SETENTRIESDATA
  1349. {
  1350. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1351. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // palette struct
  1352. DWORD dwBase; // base palette index
  1353. DWORD dwNumEntries; // number of palette entries
  1354. LPPALETTEENTRY lpEntries; // color table
  1355. HRESULT ddRVal; // return value
  1356. LPDDHALPALCB_SETENTRIES SetEntries; // PRIVATE: ptr to callback
  1357. } DDHAL_SETENTRIESDATA;
  1358. /****************************************************************************
  1359. *
  1360. * DDHAL structures for Driver Object callbacks
  1361. *
  1362. ***************************************************************************/
  1363. /*
  1364. * structure for passing information to DDHAL CreateSurface fn
  1365. */
  1366. typedef struct _DDHAL_CREATESURFACEDATA
  1367. {
  1368. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1369. LPDDSURFACEDESC lpDDSurfaceDesc;// description of surface being created
  1370. LPDDRAWI_DDRAWSURFACE_LCL FAR *lplpSList; // list of created surface objects
  1371. DWORD dwSCnt; // number of surfaces in SList
  1372. HRESULT ddRVal; // return value
  1373. LPDDHAL_CREATESURFACE CreateSurface; // PRIVATE: ptr to callback
  1374. } DDHAL_CREATESURFACEDATA;
  1375. /*
  1376. * structure for passing information to DDHAL CanCreateSurface fn
  1377. */
  1378. typedef struct _DDHAL_CANCREATESURFACEDATA
  1379. {
  1380. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1381. LPDDSURFACEDESC lpDDSurfaceDesc; // description of surface being created
  1382. DWORD bIsDifferentPixelFormat;// pixel format differs from primary surface
  1383. HRESULT ddRVal; // return value
  1384. LPDDHAL_CANCREATESURFACE CanCreateSurface; // PRIVATE: ptr to callback
  1385. } DDHAL_CANCREATESURFACEDATA;
  1386. /*
  1387. * structure for passing information to DDHAL CreatePalette fn
  1388. */
  1389. typedef struct _DDHAL_CREATEPALETTEDATA
  1390. {
  1391. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1392. LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette; // ddraw palette struct
  1393. LPPALETTEENTRY lpColorTable; // colors to go in palette
  1394. HRESULT ddRVal; // return value
  1395. LPDDHAL_CREATEPALETTE CreatePalette; // PRIVATE: ptr to callback
  1396. BOOL is_excl; // process has exclusive mode
  1397. } DDHAL_CREATEPALETTEDATA;
  1398. /*
  1399. * Return if the vertical blank is in progress
  1400. */
  1401. #define DDWAITVB_I_TESTVB 0x80000006l
  1402. /*
  1403. * structure for passing information to DDHAL WaitForVerticalBlank fn
  1404. */
  1405. typedef struct _DDHAL_WAITFORVERTICALBLANKDATA
  1406. {
  1407. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1408. DWORD dwFlags; // flags
  1409. DWORD bIsInVB; // is in vertical blank
  1410. DWORD hEvent; // event
  1411. HRESULT ddRVal; // return value
  1412. LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank; // PRIVATE: ptr to callback
  1413. } DDHAL_WAITFORVERTICALBLANKDATA;
  1414. /*
  1415. * structure for passing information to DDHAL DestroyDriver fn
  1416. */
  1417. typedef struct _DDHAL_DESTROYDRIVERDATA
  1418. {
  1419. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1420. HRESULT ddRVal; // return value
  1421. LPDDHAL_DESTROYDRIVER DestroyDriver; // PRIVATE: ptr to callback
  1422. } DDHAL_DESTROYDRIVERDATA;
  1423. /*
  1424. * structure for passing information to DDHAL SetMode fn
  1425. */
  1426. typedef struct _DDHAL_SETMODEDATA
  1427. {
  1428. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1429. DWORD dwModeIndex; // new mode
  1430. HRESULT ddRVal; // return value
  1431. LPDDHAL_SETMODE SetMode; // PRIVATE: ptr to callback
  1432. BOOL inexcl; // in exclusive mode
  1433. BOOL useRefreshRate; // use the refresh rate data in the mode info
  1434. } DDHAL_SETMODEDATA;
  1435. /*
  1436. * structure for passing information to DDHAL driver SetColorKey fn
  1437. */
  1438. typedef struct _DDHAL_DRVSETCOLORKEYDATA
  1439. {
  1440. LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface; // surface struct
  1441. DWORD dwFlags; // flags
  1442. DDCOLORKEY ckNew; // new color key
  1443. HRESULT ddRVal; // return value
  1444. LPDDHAL_SETCOLORKEY SetColorKey; // PRIVATE: ptr to callback
  1445. } DDHAL_DRVSETCOLORKEYDATA;
  1446. /*
  1447. * structure for passing information to DDHAL GetScanLine fn
  1448. */
  1449. typedef struct _DDHAL_GETSCANLINEDATA
  1450. {
  1451. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1452. DWORD dwScanLine; // returned scan line
  1453. HRESULT ddRVal; // return value
  1454. LPDDHAL_GETSCANLINE GetScanLine; // PRIVATE: ptr to callback
  1455. } DDHAL_GETSCANLINEDATA;
  1456. /*
  1457. * structure for passing information to DDHAL SetExclusiveMode fn
  1458. */
  1459. typedef struct _DDHAL_SETEXCLUSIVEMODEDATA
  1460. {
  1461. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1462. DWORD dwEnterExcl; // TRUE if entering exclusive mode, FALSE is leaving
  1463. DWORD dwReserved; // reserved for future use
  1464. HRESULT ddRVal; // return value
  1465. LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode; // PRIVATE: ptr to callback
  1466. } DDHAL_SETEXCLUSIVEMODEDATA;
  1467. /*
  1468. * structure for passing information to DDHAL FlipToGDISurface fn
  1469. */
  1470. typedef struct _DDHAL_FLIPTOGDISURFACEDATA
  1471. {
  1472. LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
  1473. DWORD dwToGDI; // TRUE if flipping to the GDI surface, FALSE if flipping away
  1474. DWORD dwReserved; // reserved for future use
  1475. HRESULT ddRVal; // return value
  1476. LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface; // PRIVATE: ptr to callback
  1477. } DDHAL_FLIPTOGDISURFACEDATA;
  1478. #ifdef __cplusplus
  1479. };
  1480. #endif
  1481. #endif