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

5181 lines
146 KiB

  1. /*************************************************************************\
  2. * Module Name: mfrec.hxx
  3. *
  4. * This file contains the definitions for the metafile record classes.
  5. *
  6. * Note that we do not use constructors in the record classes because they
  7. * do not have return codes.
  8. *
  9. * Every record class has an init function which initializes the data
  10. * structure. The commit function emits the record to the metafile.
  11. *
  12. * Created: 12-June-1991 13:46:00
  13. * Author: Hock San Lee [hockl]
  14. *
  15. * Copyright (c) 1991-1999 Microsoft Corporation
  16. \*************************************************************************/
  17. #include "nt.h"
  18. #include "ntrtl.h"
  19. #include "nturtl.h"
  20. #define STRSAFE_NO_DEPRECATE
  21. #include "strsafe.h"
  22. extern RECTL rclNull; // METAFILE.CXX
  23. extern "C" int GetDeviceCapsP(HDC hdc,int iCap);
  24. // Size of a padded character element in structure.
  25. #define PADCHAR_SIZE 4
  26. /*********************************Class************************************\
  27. * class MR
  28. *
  29. * Header for metafile records.
  30. *
  31. * History:
  32. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  33. * Wrote it.
  34. \**************************************************************************/
  35. class MR /* mr */
  36. {
  37. protected:
  38. DWORD iType; // Record type EMR_.
  39. DWORD nSize; // Record size in bytes. Set in MDC::pvNewRecord.
  40. public:
  41. // vInit -- Initializer.
  42. VOID vInit(DWORD iType1) { iType = iType1; }
  43. // vCommit -- Commit the record to metafile.
  44. VOID vCommit(PMDC pmdc)
  45. {
  46. pmdc->vCommit(*(PENHMETARECORD) this);
  47. }
  48. // bPlay -- Play the record.
  49. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht)
  50. {
  51. USE(hdc);
  52. USE(pht);
  53. USE(cht);
  54. #if DBG
  55. DbgPrint("MR::bPlay: don't know how to play record 0x%lx : Size 0x%lx\n",iType,nSize);
  56. DbgBreakPoint();
  57. #endif
  58. return(FALSE);
  59. };
  60. // bValidOff -- Check if the offset passed is within the metafile bounds.
  61. BOOL bValidOff(PHANDLETABLE pht, DWORD Off)
  62. {
  63. PMF pmf;
  64. if (Off >= nSize)
  65. return(FALSE);
  66. if (!(pmf = GET_PMF((HENHMETAFILE)pht->objectHandle[0])))
  67. return(FALSE);
  68. if (!pmf->bValidBoundedSize((PVOID)this,Off))
  69. return(FALSE);
  70. return TRUE;
  71. }
  72. //
  73. // bValidSize -- Check if the size (which is converted to an offset) is valid
  74. // within the meta file bounds.
  75. BOOL bValidSize(PHANDLETABLE pht, DWORD Size)
  76. {
  77. if (Size & 3)
  78. {
  79. EMFVALFAIL(("MR::bValidSize failed %08x (misaligned)\n", Size));
  80. return(FALSE);
  81. }
  82. if (Size - 1 < Size)
  83. return bValidOff(pht,Size-1);
  84. EMFVALFAIL(("MR::bValidSize failed %08x\n", Size));
  85. return(FALSE);
  86. }
  87. //
  88. // bValidOffExt -- Check if the offset and extent following the offset is
  89. // within the metafile bounds.
  90. BOOL bValidOffExt(PHANDLETABLE pht, DWORD Off, DWORD Ext)
  91. {
  92. if (bValidOff(pht, Off))
  93. {
  94. if (Ext == 0)
  95. return(TRUE);
  96. // Make sure no arithmetic over/underflows happen.
  97. if ((Ext - 1 < Ext) && (Off + Ext > Off))
  98. {
  99. DWORD OffExt = Off + Ext - 1;
  100. if (bValidOff(pht, OffExt))
  101. return(TRUE);
  102. }
  103. }
  104. EMFVALFAIL(("MR::bValidOffExt (%08x, %08x) failed\n", Off, Ext));
  105. return(FALSE);
  106. }
  107. // bCheckRecord -- Check and make sure record is fine.
  108. BOOL bCheckRecord(PHANDLETABLE pht);
  109. // vMarkFoundBad -- Mark the metafile that there are bad/malformed records.
  110. void vMarkFoundBad(PHANDLETABLE pht)
  111. {
  112. PMF pmf;
  113. if (pmf = GET_PMF((HENHMETAFILE)pht->objectHandle[0]))
  114. {
  115. pmf->fl |= MF_FOUNDBAD;
  116. }
  117. else
  118. {
  119. EMFVALFAIL(("MR::vMarkFoundBad PMF is null for pht (%p)\n", pht));
  120. }
  121. }
  122. };
  123. typedef MR *PMR;
  124. #define SIZEOF_MR (sizeof(MR))
  125. inline BOOL MR::bCheckRecord(PHANDLETABLE pht)
  126. {
  127. if (SIZEOF_MR == nSize && bValidSize(pht, nSize))
  128. return(TRUE);
  129. vMarkFoundBad(pht);
  130. EMFVALFAIL(("MR::bCheckRecord() failed\n"));
  131. return(FALSE);
  132. }
  133. /*********************************Class************************************\
  134. * class MRB : public MR
  135. *
  136. * Header with bounds for metafile records.
  137. *
  138. * History:
  139. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  140. * Wrote it.
  141. \**************************************************************************/
  142. class MRB : public MR /* mrb */
  143. {
  144. protected:
  145. ERECTL erclBounds; // Inclusive-inclusive bounds in device units
  146. public:
  147. // Initializer -- Initialize the bounded record.
  148. // Flush previous bounds to prepare for bounds accumulation for this record.
  149. VOID vInit(DWORD iType, PMDC pmdc)
  150. {
  151. pmdc->vFlushBounds();
  152. MR::vInit(iType);
  153. }
  154. // vCommit -- Commit the record to metafile.
  155. // Postpone the commitment to the next pvNewRecord
  156. // since we do not have the bounds before the call is made. Note that
  157. // if this is the last record, it will be committed by the MREOF record.
  158. // It works both inside and outside a path bracket.
  159. VOID vCommit(PMDC pmdc)
  160. {
  161. pmdc->vDelayCommit();
  162. }
  163. BOOL bCheckRecord(PHANDLETABLE pht);
  164. };
  165. typedef MRB *PMRB;
  166. #define SIZEOF_MRB (sizeof(MRB))
  167. inline BOOL MRB::bCheckRecord(PHANDLETABLE pht)
  168. {
  169. if (SIZEOF_MRB == nSize && bValidSize(pht,nSize))
  170. return(TRUE);
  171. vMarkFoundBad(pht);
  172. EMFVALFAIL(("MRB::bCheckRecord() failed\n"));
  173. return(FALSE);
  174. }
  175. /*********************************Class************************************\
  176. * class MRD : public MR
  177. *
  178. * Metafile record with one DWORD.
  179. *
  180. * History:
  181. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  182. * Wrote it.
  183. \**************************************************************************/
  184. class MRD : public MR /* mrd */
  185. {
  186. protected:
  187. DWORD d1;
  188. public:
  189. // Initializer -- Initialize the metafile record.
  190. VOID vInit(DWORD iType_, DWORD d1_)
  191. {
  192. MR::vInit(iType_);
  193. d1 = d1_;
  194. }
  195. BOOL bCheckRecord(PHANDLETABLE pht);
  196. };
  197. typedef MRD *PMRD;
  198. #define SIZEOF_MRD (sizeof(MRD))
  199. inline BOOL MRD::bCheckRecord(PHANDLETABLE pht)
  200. {
  201. if (SIZEOF_MRD == nSize && bValidSize(pht, nSize))
  202. return(TRUE);
  203. vMarkFoundBad(pht);
  204. EMFVALFAIL(("MRD::bCheckRecord() failed\n"));
  205. return(FALSE);
  206. }
  207. /*********************************Class************************************\
  208. * class MRDD : public MR
  209. *
  210. * Metafile record with two DWORDs.
  211. *
  212. * History:
  213. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  214. * Wrote it.
  215. \**************************************************************************/
  216. class MRDD : public MR /* mrdd */
  217. {
  218. protected:
  219. DWORD d1;
  220. DWORD d2;
  221. public:
  222. // Initializer -- Initialize the metafile record.
  223. VOID vInit(DWORD iType_, DWORD d1_, DWORD d2_)
  224. {
  225. MR::vInit(iType_);
  226. d1 = d1_;
  227. d2 = d2_;
  228. }
  229. BOOL bCheckRecord(PHANDLETABLE pht);
  230. };
  231. typedef MRDD *PMRDD;
  232. #define SIZEOF_MRDD (sizeof(MRDD))
  233. inline BOOL MRDD::bCheckRecord(PHANDLETABLE pht)
  234. {
  235. if (SIZEOF_MRDD == nSize && bValidSize(pht, nSize))
  236. return(TRUE);
  237. vMarkFoundBad(pht);
  238. EMFVALFAIL(("MRDD::bCheckRecord() failed\n"));
  239. return(FALSE);
  240. }
  241. /*********************************Class************************************\
  242. * class MRDDDD : public MR
  243. *
  244. * Metafile record with four DWORDs.
  245. *
  246. * History:
  247. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  248. * Wrote it.
  249. \**************************************************************************/
  250. class MRDDDD : public MR /* mrdddd */
  251. {
  252. protected:
  253. DWORD d1;
  254. DWORD d2;
  255. DWORD d3;
  256. DWORD d4;
  257. public:
  258. // Initializer -- Initialize the metafile record.
  259. VOID vInit(DWORD iType_, DWORD d1_, DWORD d2_, DWORD d3_, DWORD d4_)
  260. {
  261. MR::vInit(iType_);
  262. d1 = d1_;
  263. d2 = d2_;
  264. d3 = d3_;
  265. d4 = d4_;
  266. }
  267. BOOL bCheckRecord(PHANDLETABLE pht);
  268. };
  269. typedef MRDDDD *PMRDDDD;
  270. #define SIZEOF_MRDDDD (sizeof(MRDDDD))
  271. inline BOOL MRDDDD::bCheckRecord(PHANDLETABLE pht)
  272. {
  273. if (SIZEOF_MRDDDD == nSize && bValidSize(pht, nSize))
  274. return(TRUE);
  275. vMarkFoundBad(pht);
  276. EMFVALFAIL(("MRDDDD::bCheckRecord() failed\n"));
  277. return(FALSE);
  278. }
  279. /*********************************Class************************************\
  280. * class MRX : public MR
  281. *
  282. * Metafile record with a XFORM.
  283. *
  284. * History:
  285. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  286. * Wrote it.
  287. \**************************************************************************/
  288. class MRX : public MR /* mrx */
  289. {
  290. protected:
  291. XFORM xform;
  292. public:
  293. // Initializer -- Initialize the metafile record.
  294. VOID vInit(DWORD iType_, CONST XFORM& xform_)
  295. {
  296. MR::vInit(iType_);
  297. xform = xform_;
  298. }
  299. BOOL bCheckRecord(PHANDLETABLE pht);
  300. };
  301. typedef MRX *PMRX;
  302. #define SIZEOF_MRX (sizeof(MRX))
  303. inline BOOL MRX::bCheckRecord(PHANDLETABLE pht)
  304. {
  305. if (SIZEOF_MRX == nSize && bValidSize(pht, nSize))
  306. return(TRUE);
  307. vMarkFoundBad(pht);
  308. EMFVALFAIL(("MRX::bCheckRecord() failed\n"));
  309. return(FALSE);
  310. }
  311. /*********************************Class************************************\
  312. * class MRXD : public MRX
  313. *
  314. * Metafile record with a XFORM followed by a DWORD.
  315. *
  316. * History:
  317. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  318. * Wrote it.
  319. \**************************************************************************/
  320. class MRXD : public MRX /* mrxd */
  321. {
  322. protected:
  323. DWORD d1;
  324. public:
  325. // Initializer -- Initialize the metafile record.
  326. VOID vInit(DWORD iType_, CONST XFORM& xform_, DWORD d1_)
  327. {
  328. MRX::vInit(iType_, xform_);
  329. d1 = d1_;
  330. }
  331. BOOL bCheckRecord(PHANDLETABLE pht);
  332. };
  333. typedef MRXD *PMRXD;
  334. #define SIZEOF_MRXD (sizeof(MRXD))
  335. inline BOOL MRXD::bCheckRecord(PHANDLETABLE pht)
  336. {
  337. if (SIZEOF_MRXD == nSize && bValidSize(pht, nSize))
  338. return(TRUE);
  339. vMarkFoundBad(pht);
  340. EMFVALFAIL(("MRXD::bCheckRecord() failed\n"));
  341. return(FALSE);
  342. }
  343. /*********************************Class************************************\
  344. * class MRBP : public MRB
  345. *
  346. * Metafile record with Bounds and Polys.
  347. *
  348. * History:
  349. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  350. * Wrote it.
  351. \**************************************************************************/
  352. class MRBP : public MRB /* mrbp */
  353. {
  354. protected:
  355. DWORD cptl; // Number of points in the array.
  356. POINTL aptl[1]; // Array of POINTL structures.
  357. public:
  358. // Initializer -- Initialize the metafile Poly(To) record.
  359. VOID vInit(DWORD iType1, DWORD cptl1, CONST POINTL *aptl1, PMDC pmdc); // MFREC.CXX
  360. BOOL bCheckRecord(PHANDLETABLE pht);
  361. };
  362. typedef MRBP *PMRBP;
  363. #define SIZEOF_MRBP(cptl) (sizeof(MRBP)-sizeof(POINTL)+(cptl)*sizeof(POINTL))
  364. inline BOOL MRBP::bCheckRecord(PHANDLETABLE pht)
  365. {
  366. if (SIZEOF_MRBP(cptl) == nSize && bValidSize(pht, nSize))
  367. return(TRUE);
  368. vMarkFoundBad(pht);
  369. EMFVALFAIL(("MRBP::bCheckRecord(%08x) failed\n", cptl));
  370. return(FALSE);
  371. }
  372. /*********************************Class************************************\
  373. * class MRBP16 : public MRB
  374. *
  375. * Metafile record with Bounds and 16-bit Polys.
  376. *
  377. * History:
  378. * Sat Mar 07 15:06:16 1992 -by- Hock San Lee [hockl]
  379. * Wrote it.
  380. \**************************************************************************/
  381. class MRBP16 : public MRB /* mrbp16 */
  382. {
  383. protected:
  384. DWORD cpts; // Number of points in the array.
  385. POINTS apts[1]; // Array of POINTS structures.
  386. public:
  387. // Initializer -- Initialize the metafile Poly(To)16 record.
  388. VOID vInit(DWORD iType1, DWORD cptl1, CONST POINTL *aptl1, PMDC pmdc); // MFREC.CXX
  389. // bPlay -- Play the records PolyBezier, Polygon, Polyline, PolyBezierTo and
  390. // PolylineTo.
  391. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  392. BOOL bCheckRecord(PHANDLETABLE pht);
  393. };
  394. typedef MRBP16 *PMRBP16;
  395. #define SIZEOF_MRBP16(cpts) \
  396. (sizeof(MRBP16)-sizeof(POINTS)+(cpts)*sizeof(POINTS))
  397. inline BOOL MRBP16::bCheckRecord(PHANDLETABLE pht)
  398. {
  399. if (SIZEOF_MRBP16(cpts) == nSize && bValidSize(pht, nSize))
  400. return(TRUE);
  401. vMarkFoundBad(pht);
  402. EMFVALFAIL(("MRBP16::bCheckRecord(%08x) failed\n", cpts));
  403. return(FALSE);
  404. }
  405. /*********************************Class************************************\
  406. * class MRBPP : public MRB
  407. *
  408. * Metafile record with Bounds and PolyPolys.
  409. *
  410. * History:
  411. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  412. * Wrote it.
  413. \**************************************************************************/
  414. class MRBPP : public MRB /* mrbpp */
  415. {
  416. protected:
  417. DWORD cPoly; // Number of entries in the ac array.
  418. DWORD cptl; // Number of points in the aptl array.
  419. DWORD ac[1]; // Array of number of points for each poly in aptl.
  420. POINTL aptl[1]; // Array of POINTL for vertices in all polys.
  421. public:
  422. // Initializer -- Initialize the metafile PolyPoly record.
  423. VOID vInit
  424. (
  425. DWORD iType1,
  426. DWORD cPoly1,
  427. DWORD cptl1,
  428. CONST DWORD *ac1,
  429. CONST POINTL *aptl1,
  430. PMDC pmdc
  431. ); // MFREC.CXX
  432. BOOL bCheckRecord(PHANDLETABLE pht);
  433. };
  434. typedef MRBPP *PMRBPP;
  435. #define SIZEOF_MRBPP(cptl,cPoly) \
  436. (sizeof(MRBPP)-sizeof(POINTL)-sizeof(DWORD) \
  437. +(cptl)*sizeof(POINTL)+(cPoly)*sizeof(DWORD))
  438. inline BOOL MRBPP::bCheckRecord(PHANDLETABLE pht)
  439. {
  440. if (SIZEOF_MRBPP(cptl,cPoly) == nSize && bValidSize(pht, nSize))
  441. return(TRUE);
  442. vMarkFoundBad(pht);
  443. EMFVALFAIL(("MRBPP::bCheckRecord(%08x,%08x) failed\n", cptl,cPoly));
  444. return(FALSE);
  445. }
  446. /*********************************Class************************************\
  447. * class MRBPP16 : public MRB
  448. *
  449. * Metafile record with Bounds and 16-bit PolyPolys.
  450. *
  451. * History:
  452. * Sat Mar 07 15:06:16 1992 -by- Hock San Lee [hockl]
  453. * Wrote it.
  454. \**************************************************************************/
  455. class MRBPP16 : public MRB /* mrbpp16 */
  456. {
  457. protected:
  458. DWORD cPoly; // Number of entries in the ac array.
  459. DWORD cpts; // Number of points in the apts array.
  460. DWORD ac[1]; // Array of number of points for each poly in apts.
  461. POINTS apts[1]; // Array of POINTS for vertices in all polys.
  462. public:
  463. // Initializer -- Initialize the metafile PolyPoly16 record.
  464. VOID vInit
  465. (
  466. DWORD iType1,
  467. DWORD cPoly1,
  468. DWORD cptl1,
  469. CONST DWORD *ac1,
  470. CONST POINTL *aptl1,
  471. PMDC pmdc
  472. ); // MFREC.CXX
  473. // bPlay -- Play the records PolyPolyline, PolyPolygon.
  474. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  475. BOOL bCheckRecord(PHANDLETABLE pht);
  476. };
  477. typedef MRBPP16 *PMRBPP16;
  478. #define SIZEOF_MRBPP16(cpts,cPoly) \
  479. (sizeof(MRBPP16)-sizeof(POINTS)-sizeof(DWORD) \
  480. +(cpts)*sizeof(POINTS)+(cPoly)*sizeof(DWORD))
  481. inline BOOL MRBPP16::bCheckRecord(PHANDLETABLE pht)
  482. {
  483. if (SIZEOF_MRBPP16(cpts,cPoly) == nSize && bValidSize(pht, nSize))
  484. return(TRUE);
  485. vMarkFoundBad(pht);
  486. EMFVALFAIL(("MRBPP16::bCheckRecord(%08x,%08x) failed\n",cpts,cPoly));
  487. return(FALSE);
  488. }
  489. /*********************************Class************************************\
  490. * class MRPOLYDRAW : public MRB
  491. *
  492. * POLYDRAW record.
  493. *
  494. * History:
  495. * Thu Oct 17 13:47:39 1991 -by- Hock San Lee [hockl]
  496. * Wrote it.
  497. \**************************************************************************/
  498. class MRPOLYDRAW : public MRB /* mrpd */
  499. {
  500. protected:
  501. DWORD cptl; // Number of points in the array.
  502. POINTL aptl[1]; // Array of POINTL structures.
  503. BYTE ab[1]; // Array of point types.
  504. public:
  505. // Initializer -- Initialize the metafile record.
  506. VOID vInit(PMDC pmdc, CONST POINTL *aptl1, CONST BYTE *ab1, DWORD cptl1); // MFREC.CXX
  507. // bPlay -- Play the record.
  508. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  509. BOOL bCheckRecord(PHANDLETABLE pht);
  510. };
  511. typedef MRPOLYDRAW *PMRPOLYDRAW;
  512. #define SIZEOF_MRPOLYDRAW(cptl) \
  513. ((sizeof(MRPOLYDRAW)-sizeof(POINTL)-PADCHAR_SIZE \
  514. +(cptl)*(sizeof(POINTL)+sizeof(BYTE)) \
  515. +3) / 4 * 4)
  516. inline BOOL MRPOLYDRAW::bCheckRecord(PHANDLETABLE pht)
  517. {
  518. if (SIZEOF_MRPOLYDRAW(cptl) == nSize && bValidSize(pht, nSize))
  519. return(TRUE);
  520. vMarkFoundBad(pht);
  521. EMFVALFAIL(("MRPOLYDRAW::bCheckRecord(%08x) failed\n", cptl));
  522. return(FALSE);
  523. }
  524. /*********************************Class************************************\
  525. * class MRPOLYDRAW16 : public MRB
  526. *
  527. * POLYDRAW16 record.
  528. *
  529. * History:
  530. * Sat Mar 07 15:06:16 1992 -by- Hock San Lee [hockl]
  531. * Wrote it.
  532. \**************************************************************************/
  533. class MRPOLYDRAW16 : public MRB /* mrpd16 */
  534. {
  535. protected:
  536. DWORD cpts; // Number of points in the array.
  537. POINTS apts[1]; // Array of POINTS structures.
  538. BYTE ab[1]; // Array of point types.
  539. public:
  540. // Initializer -- Initialize the metafile record.
  541. VOID vInit(PMDC pmdc, CONST POINTL *aptl1, CONST BYTE *ab1, DWORD cptl1); // MFREC.CXX
  542. // bPlay -- Play the record.
  543. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  544. BOOL bCheckRecord(PHANDLETABLE pht);
  545. };
  546. typedef MRPOLYDRAW16 *PMRPOLYDRAW16;
  547. #define SIZEOF_MRPOLYDRAW16(cpts) \
  548. ((sizeof(MRPOLYDRAW16)-sizeof(POINTS)-PADCHAR_SIZE \
  549. +(cpts)*(sizeof(POINTS)+sizeof(BYTE)) \
  550. +3) / 4 * 4)
  551. inline BOOL MRPOLYDRAW16::bCheckRecord(PHANDLETABLE pht)
  552. {
  553. if(SIZEOF_MRPOLYDRAW16(cpts) == nSize && bValidSize(pht, nSize))
  554. return(TRUE);
  555. vMarkFoundBad(pht);
  556. EMFVALFAIL(("MRPOLYDRAW16::bCheckRecord(%08x) failed\n", cpts));
  557. return(FALSE);
  558. }
  559. /*********************************Class************************************\
  560. * class MRE : public MR
  561. *
  562. * Metafile record for ellipses and rectangles.
  563. *
  564. * History:
  565. * Fri Sep 27 15:55:57 1991 -by- Hock San Lee [hockl]
  566. * Wrote it.
  567. \**************************************************************************/
  568. class MRE : public MR /* mre */
  569. {
  570. protected:
  571. ERECTL erclBox; // Inclusive-inclusive box in world units
  572. public:
  573. // Initializer -- Initialize the metafile record.
  574. // Returns MRI_OK if successful, MRI_ERROR if error and MRI_NULLBOX if
  575. // the box is empty in device space. We don't record if there is an error
  576. // or the box is empty in device space.
  577. LONG iInit(DWORD iType, HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
  578. {
  579. MR::vInit(iType);
  580. erclBox.vInit(x1, y1, x2, y2);
  581. LONG lRet = MRI_OK;
  582. // Make inclusive-exclusive box inclusive-inclusive if necessary.
  583. // Record it only if the box is not empty.
  584. if (GetGraphicsMode(hdc) == GM_COMPATIBLE)
  585. {
  586. lRet = NtGdiConvertMetafileRect(hdc, &erclBox);
  587. }
  588. return(lRet);
  589. }
  590. BOOL bCheckRecord(PHANDLETABLE pht);
  591. };
  592. typedef MRE *PMRE;
  593. #define SIZEOF_MRE (sizeof(MRE))
  594. inline BOOL MRE::bCheckRecord(PHANDLETABLE pht)
  595. {
  596. if (SIZEOF_MRE == nSize && bValidSize(pht, nSize))
  597. return(TRUE);
  598. vMarkFoundBad(pht);
  599. EMFVALFAIL(("MRE::bCheckRecord() failed\n"));
  600. return(FALSE);
  601. }
  602. /*********************************Class************************************\
  603. * class MREPP : public MRE
  604. *
  605. * Metafile record for arcs, chords and pies.
  606. *
  607. * History:
  608. * Fri Sep 27 15:55:57 1991 -by- Hock San Lee [hockl]
  609. * Wrote it.
  610. \**************************************************************************/
  611. class MREPP : public MRE /* mrepp */
  612. {
  613. protected:
  614. EPOINTL eptlStart;
  615. EPOINTL eptlEnd;
  616. public:
  617. // Initializer -- Initialize the metafile record.
  618. // Returns MRI_OK if successful, MRI_ERROR if error and MRI_NULLBOX if
  619. // the box is empty in device space. We don't record if there is an error
  620. // or the box is empty in device space.
  621. LONG iInit
  622. (
  623. DWORD iType,
  624. HDC hdc,
  625. LONG x1,
  626. LONG y1,
  627. LONG x2,
  628. LONG y2,
  629. LONG x3,
  630. LONG y3,
  631. LONG x4,
  632. LONG y4
  633. )
  634. {
  635. eptlStart.vInit(x3,y3);
  636. eptlEnd.vInit(x4,y4);
  637. return(MRE::iInit(iType, hdc, x1, y1, x2, y2));
  638. }
  639. BOOL bCheckRecord(PHANDLETABLE pht);
  640. };
  641. typedef MREPP *PMREPP;
  642. #define SIZEOF_MREPP (sizeof(MREPP))
  643. inline BOOL MREPP::bCheckRecord(PHANDLETABLE pht)
  644. {
  645. if (SIZEOF_MREPP == nSize && bValidSize(pht, nSize))
  646. return(TRUE);
  647. vMarkFoundBad(pht);
  648. EMFVALFAIL(("MREPP::bCheckRecord() failed\n"));
  649. return(FALSE);
  650. }
  651. /*********************************Class************************************\
  652. * class MRBR : public MRB
  653. *
  654. * Metafile record with a region. The region data starts at offRgnData
  655. * from the beginning of the record.
  656. *
  657. * History:
  658. * Tue Oct 29 10:43:25 1991 -by- Hock San Lee [hockl]
  659. * Wrote it.
  660. \**************************************************************************/
  661. class MRBR : public MRB /* mrbr */
  662. {
  663. protected:
  664. DWORD cRgnData; // Size of region data in bytes.
  665. public:
  666. // Initializer -- Initialize the metafile record.
  667. BOOL bInit
  668. (
  669. DWORD iType,
  670. PMDC pmdc,
  671. HRGN hrgn,
  672. DWORD cRgnData_,
  673. DWORD offRgnData_
  674. )
  675. {
  676. PUTS("MRBR::bInit\n");
  677. ASSERTGDI(cRgnData_, "MRBR::bInit: cRgnData_ is zero");
  678. ASSERTGDI(offRgnData_ % 4 == 0,
  679. "MRBR::bInit: offRgnData_ is not dword aligned");
  680. MRB::vInit(iType, pmdc);
  681. cRgnData = cRgnData_;
  682. return
  683. (
  684. GetRegionData
  685. (
  686. hrgn,
  687. cRgnData_,
  688. (LPRGNDATA) &((PBYTE) this)[offRgnData_]
  689. ) == cRgnData_
  690. );
  691. }
  692. BOOL bCheckRecord(PHANDLETABLE pht);
  693. };
  694. typedef MRBR *PMRBR;
  695. #define SIZEOF_MRBR(cRgnData) (sizeof(MRBR) + ((cRgnData) + 3) / 4 * 4)
  696. inline BOOL MRBR::bCheckRecord(PHANDLETABLE pht)
  697. {
  698. if (SIZEOF_MRBR(cRgnData) == nSize && bValidSize(pht, nSize))
  699. return(TRUE);
  700. vMarkFoundBad(pht);
  701. EMFVALFAIL(("MRBR::bCheckRecord(%08x) failed\n", cRgnData));
  702. return(FALSE);
  703. }
  704. class MRINVERTRGN : public MRBR /* mrir */
  705. {
  706. public:
  707. // bPlay -- Play the record.
  708. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  709. };
  710. typedef MRINVERTRGN *PMRINVERTRGN;
  711. class MRPAINTRGN : public MRBR /* mrpr */
  712. {
  713. public:
  714. // bPlay -- Play the record.
  715. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  716. };
  717. typedef MRPAINTRGN *PMRPAINTRGN;
  718. /*********************************Class************************************\
  719. * class MRFILLRGN : public MRBR
  720. *
  721. * FILLRGN record.
  722. *
  723. * History:
  724. * Tue Oct 29 10:43:25 1991 -by- Hock San Lee [hockl]
  725. * Wrote it.
  726. \**************************************************************************/
  727. class MRFILLRGN : public MRBR /* mrfr */
  728. {
  729. protected:
  730. DWORD imheBrush; // Brush index in Metafile Handle Table.
  731. public:
  732. // Initializer -- Initialize the metafile record.
  733. BOOL bInit(PMDC pmdc, HRGN hrgn, DWORD cRgnData, DWORD imheBrush_)
  734. {
  735. PUTS("MRFILLRGN::bInit\n");
  736. ASSERTGDI(imheBrush_, "MRFILLRGN::bInit: imheBrush_ is zero");
  737. imheBrush = imheBrush_;
  738. return(MRBR::bInit(EMR_FILLRGN, pmdc, hrgn, cRgnData, sizeof(MRFILLRGN)));
  739. }
  740. // bPlay -- Play the record.
  741. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  742. BOOL bCheckRecord(PHANDLETABLE pht);
  743. };
  744. typedef MRFILLRGN *PMRFILLRGN;
  745. #define SIZEOF_MRFILLRGN(cRgnData) \
  746. (SIZEOF_MRBR(cRgnData) + sizeof(MRFILLRGN) - sizeof(MRBR))
  747. inline BOOL MRFILLRGN::bCheckRecord(PHANDLETABLE pht)
  748. {
  749. if (SIZEOF_MRFILLRGN(cRgnData) == nSize && bValidSize(pht, nSize))
  750. return(TRUE);
  751. vMarkFoundBad(pht);
  752. EMFVALFAIL(("MRFILLRGN::bCheckRecord(%08x) failed\n", cRgnData));
  753. return(FALSE);
  754. }
  755. /*********************************Class************************************\
  756. * class MRFRAMERGN : public MRBR
  757. *
  758. * FRAMERGN record.
  759. *
  760. * History:
  761. * Tue Oct 29 10:43:25 1991 -by- Hock San Lee [hockl]
  762. * Wrote it.
  763. \**************************************************************************/
  764. class MRFRAMERGN : public MRBR /* mrfr */
  765. {
  766. protected:
  767. DWORD imheBrush; // Brush index in Metafile Handle Table.
  768. LONG nWidth; // Width of vert brush stroke in logical units.
  769. LONG nHeight; // Height of horz brush stroke in logical units.
  770. public:
  771. // Initializer -- Initialize the metafile record.
  772. BOOL bInit
  773. (
  774. PMDC pmdc,
  775. HRGN hrgn,
  776. DWORD cRgnData,
  777. DWORD imheBrush_,
  778. LONG nWidth_,
  779. LONG nHeight_
  780. )
  781. {
  782. PUTS("MRFRAMERGN::bInit\n");
  783. ASSERTGDI(imheBrush_, "MRFRAMERGN::bInit: imheBrush_ is zero");
  784. imheBrush = imheBrush_;
  785. nWidth = nWidth_;
  786. nHeight = nHeight_;
  787. return(MRBR::bInit(EMR_FRAMERGN, pmdc, hrgn, cRgnData, sizeof(MRFRAMERGN)));
  788. }
  789. // bPlay -- Play the record.
  790. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  791. BOOL bCheckRecord(PHANDLETABLE pht);
  792. };
  793. typedef MRFRAMERGN *PMRFRAMERGN;
  794. #define SIZEOF_MRFRAMERGN(cRgnData) \
  795. (SIZEOF_MRBR(cRgnData) + sizeof(MRFRAMERGN) - sizeof(MRBR))
  796. inline BOOL MRFRAMERGN::bCheckRecord(PHANDLETABLE pht)
  797. {
  798. if (SIZEOF_MRFRAMERGN(cRgnData) == nSize && bValidSize(pht, nSize))
  799. return(TRUE);
  800. vMarkFoundBad(pht);
  801. EMFVALFAIL(("MRFRAMERGN::bCheckRecord(%08x) failed\n",cRgnData));
  802. return(FALSE);
  803. }
  804. /*********************************Class************************************\
  805. * class MREXTSELECTCLIPRGN : public MR
  806. *
  807. * EXTSELECTCLIPRGN record. The region data follows iMode immediately.
  808. *
  809. * History:
  810. * Tue Oct 29 10:43:25 1991 -by- Hock San Lee [hockl]
  811. * Wrote it.
  812. \**************************************************************************/
  813. class MREXTSELECTCLIPRGN : public MR /* mrescr */
  814. {
  815. protected:
  816. DWORD cRgnData; // Size of region data in bytes.
  817. DWORD iMode; // Region combine mode.
  818. public:
  819. // Initializer -- Initialize the metafile record.
  820. BOOL bInit(HRGN hrgn, DWORD cRgnData_, DWORD iMode_)
  821. {
  822. PUTS("MREXTSELECTCLIPRGN::bInit\n");
  823. MR::vInit(EMR_EXTSELECTCLIPRGN);
  824. cRgnData = cRgnData_;
  825. iMode = iMode_;
  826. // There is no region data if hrgn == 0 && iMode == RGNCOPY.
  827. if (!cRgnData_)
  828. {
  829. ASSERTGDI(iMode_ == RGN_COPY,
  830. "MREXTSELECTCLIPRGN::bInit: cRgnData_ is zero");
  831. return(TRUE);
  832. }
  833. else
  834. {
  835. return
  836. (
  837. GetRegionData
  838. (
  839. hrgn,
  840. cRgnData_,
  841. (LPRGNDATA) &((PBYTE) this)[sizeof(MREXTSELECTCLIPRGN)]
  842. ) == cRgnData_
  843. );
  844. }
  845. }
  846. // bPlay -- Play the record.
  847. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  848. BOOL bCheckRecord(PHANDLETABLE pht);
  849. };
  850. typedef MREXTSELECTCLIPRGN *PMREXTSELECTCLIPRGN;
  851. #define SIZEOF_MREXTSELECTCLIPRGN(cRgnData) \
  852. (sizeof(MREXTSELECTCLIPRGN) + ((cRgnData) + 3) / 4 * 4)
  853. inline BOOL MREXTSELECTCLIPRGN::bCheckRecord(PHANDLETABLE pht)
  854. {
  855. if (SIZEOF_MREXTSELECTCLIPRGN(cRgnData) == nSize && bValidSize(pht, nSize))
  856. return(TRUE);
  857. vMarkFoundBad(pht);
  858. EMFVALFAIL(("MREXTSELECTCLIPRGN::bCheckRecord(%08x) failed\n", cRgnData));
  859. return(FALSE);
  860. }
  861. /*********************************Class************************************\
  862. * class MRTM : public MRB
  863. *
  864. * Metafile record with verticies and triangle mesh
  865. *
  866. * History:
  867. *
  868. * 12/3/1996 Mark Enstrom [marke]
  869. *
  870. \**************************************************************************/
  871. class MRGRADIENTFILL : public MRB /* mrbp */
  872. {
  873. protected:
  874. DWORD nVer; // Number of points in vertex array
  875. DWORD nTri; // number of tri triples
  876. ULONG ulMode; // Draw Mode
  877. TRIVERTEX Ver[1]; // Array of TRIVERTEX structures +
  878. // array of (GRADIENT_TRIANGLE or GRADIENT_RECT)
  879. public:
  880. // Initializer -- Initialize the metafile Poly(To) record.
  881. VOID vInit(DWORD nVer1, CONST TRIVERTEX *pVer1, DWORD nTri1,CONST PVOID pTri1,ULONG ulMode,PMDC pmdc); // MFREC.CXX
  882. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  883. BOOL bCheckRecord(PHANDLETABLE pht);
  884. };
  885. typedef MRGRADIENTFILL *PMRGRADIENTFILL;
  886. #define SIZEOF_MRGRADIENTFILL(nVer,nTri) ( \
  887. sizeof(MRGRADIENTFILL) \
  888. - sizeof(TRIVERTEX) + (nVer)*sizeof(TRIVERTEX) \
  889. + ((((sizeof(GRADIENT_TRIANGLE) * nTri) + 3)/4)*4) \
  890. )
  891. inline BOOL MRGRADIENTFILL::bCheckRecord(PHANDLETABLE pht)
  892. {
  893. if (SIZEOF_MRGRADIENTFILL(nVer,nTri) == nSize && bValidSize(pht, nSize))
  894. return(TRUE);
  895. vMarkFoundBad(pht);
  896. EMFVALFAIL(("MRGRADIENTFILL::bCheckRecord(%08x,%08x) failed\n", nVer,nTri));
  897. return(FALSE);
  898. }
  899. /*********************************Class************************************\
  900. * class MRMETAFILE : public MR
  901. *
  902. * METAFILE record. This is the first record in any metafile.
  903. *
  904. * History:
  905. * Wed Jul 17 17:10:28 1991 -by- Hock San Lee [hockl]
  906. * Wrote it.
  907. \**************************************************************************/
  908. class MRMETAFILE : public MR /* mrmf */
  909. {
  910. protected:
  911. ERECTL erclBounds; // Inclusive-inclusive bounds in device units
  912. RECTL rclFrame; // Inclusive-inclusive Picture Frame of metafile in .01 mm units
  913. DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE.
  914. ULONG nVersion; // Version number
  915. DWORD nBytes; // Size of the metafile in bytes
  916. DWORD nRecords; // Number of records in the metafile
  917. WORD nHandles; // Number of handles in the handle table
  918. // Handle index zero is reserved.
  919. WORD sReserved; // Reserved. Must be zero.
  920. DWORD nDescription; // Number of chars in the unicode description string
  921. // This is 0 if there is no description string
  922. DWORD offDescription; // Offset to the metafile description record.
  923. // This is 0 if there is no description string
  924. DWORD nPalEntries; // Number of entries in the metafile palette.
  925. SIZEL szlDevice; // Size of the reference device in pels
  926. SIZEL szlMillimeters; // Size of the reference device in millimeters
  927. DWORD cbPixelFormat; // Size of PIXELFORMATDESCRIPTOR information
  928. // This is 0 if no pixel format is set
  929. DWORD offPixelFormat; // Offset to PIXELFORMATDESCRIPTOR
  930. // This is 0 if no pixel format is set
  931. DWORD bOpenGL; // TRUE if OpenGL commands are present in
  932. // the metafile, otherwise FALSE
  933. SIZEL szlMicrometers; // size of the reference device in micrometers
  934. public:
  935. // Initializer -- Initialize the metafile record.
  936. VOID vInit(HDC hdcRef, LPCWSTR pwszDescription1, UINT cwszDescription1)
  937. {
  938. PUTS("MRMETAFILE::vInit\n");
  939. MR::vInit(EMR_HEADER);
  940. erclBounds.vInit(rclNull); // Bounds is updated in recording.
  941. rclFrame = rclNull; // Frame is set at the end if not set by caller
  942. dSignature = ENHMETA_SIGNATURE;
  943. nVersion = META_FORMAT_ENHANCED;
  944. nBytes = 0; // Update in recording.
  945. nRecords = 0; // Update in recording.
  946. nHandles = 1; // Update in recording.
  947. // Handle index zero is reserved.
  948. sReserved = 0;
  949. if (pwszDescription1 != (LPWSTR) NULL)
  950. {
  951. offDescription = sizeof(MRMETAFILE);
  952. nDescription = cwszDescription1;
  953. RtlCopyMemory
  954. (
  955. (PBYTE) this + offDescription,
  956. (PBYTE) pwszDescription1,
  957. cwszDescription1 * sizeof(WCHAR)
  958. );
  959. }
  960. else
  961. {
  962. offDescription = 0;
  963. nDescription = 0;
  964. }
  965. nPalEntries = 0; // Update in CloseEnhMetaFile.
  966. szlDevice.cx = GetDeviceCaps(hdcRef, DESKTOPHORZRES);
  967. szlDevice.cy = GetDeviceCaps(hdcRef, DESKTOPVERTRES);
  968. szlMillimeters.cx = GetDeviceCaps(hdcRef, HORZSIZE);
  969. szlMillimeters.cy = GetDeviceCaps(hdcRef, VERTSIZE);
  970. // If there's a pixel format in the reference device then
  971. // it will be picked up and added later
  972. cbPixelFormat = 0;
  973. offPixelFormat = 0;
  974. bOpenGL = FALSE;
  975. szlMicrometers.cx = GetDeviceCapsP(hdcRef, HORZSIZEP);
  976. szlMicrometers.cy = GetDeviceCapsP(hdcRef, VERTSIZEP);
  977. }
  978. // bValid -- Is this a valid record?
  979. BOOL bValid();
  980. // bPlay -- Play the record.
  981. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  982. BOOL bCheckRecord(PHANDLETABLE pht);
  983. };
  984. typedef MRMETAFILE *PMRMETAFILE;
  985. #define SIZEOF_MRMETAFILE(cwszDescription) \
  986. (sizeof(MRMETAFILE) + (((cwszDescription) * 2) + 3) / 4 * 4)
  987. inline BOOL MRMETAFILE::bCheckRecord(PHANDLETABLE pht)
  988. {
  989. // Note we need to allow for WINVER less than 0x500 and 0x400 generated metafiles.
  990. if (((SIZEOF_MRMETAFILE(nDescription) == nSize) ||
  991. ((SIZEOF_MRMETAFILE(nDescription) - (sizeof(MRMETAFILE) - offsetof(MRMETAFILE,szlMicrometers))) == nSize) ||
  992. ((SIZEOF_MRMETAFILE(nDescription) - (sizeof(MRMETAFILE) - offsetof(MRMETAFILE,cbPixelFormat))) == nSize))
  993. && bValidSize(pht, nSize))
  994. return(TRUE);
  995. vMarkFoundBad(pht);
  996. EMFVALFAIL(("MRMETAFILE::bCheckRecord(%08x) failed\n", nDescription));
  997. return(FALSE);
  998. }
  999. /*********************************Class************************************\
  1000. * class MRSETPIXELV : public MR
  1001. *
  1002. * SETPIXELV record.
  1003. *
  1004. * History:
  1005. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  1006. * Wrote it.
  1007. \**************************************************************************/
  1008. class MRSETPIXELV : public MR /* mrspv */
  1009. {
  1010. protected:
  1011. EPOINTL eptl;
  1012. COLORREF crColor;
  1013. public:
  1014. // Initializer -- Initialize the metafile record.
  1015. VOID vInit(DWORD x1, DWORD y1, COLORREF crColor1)
  1016. {
  1017. PUTS("MRSETPIXELV::vInit\n");
  1018. MR::vInit(EMR_SETPIXELV);
  1019. eptl.vInit(x1,y1);
  1020. crColor = crColor1;
  1021. }
  1022. // bPlay -- Play the record.
  1023. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1024. BOOL bCheckRecord(PHANDLETABLE pht);
  1025. };
  1026. typedef MRSETPIXELV *PMRSETPIXELV;
  1027. #define SIZEOF_MRSETPIXELV (sizeof(MRSETPIXELV))
  1028. inline BOOL MRSETPIXELV::bCheckRecord(PHANDLETABLE pht)
  1029. {
  1030. if(SIZEOF_MRSETPIXELV == nSize && bValidSize(pht, nSize))
  1031. return(TRUE);
  1032. vMarkFoundBad(pht);
  1033. EMFVALFAIL(("MRSETPIXELV::bCheckRecord() failed\n"));
  1034. return(FALSE);
  1035. }
  1036. /*********************************Class************************************\
  1037. * class MRANGLEARC : public MR
  1038. *
  1039. * ANGLEARC record.
  1040. *
  1041. * History:
  1042. * Fri Sep 13 17:46:41 1991 -by- Hock San Lee [hockl]
  1043. * Wrote it.
  1044. \**************************************************************************/
  1045. class MRANGLEARC : public MR /* mraa */
  1046. {
  1047. protected:
  1048. EPOINTL eptl;
  1049. DWORD nRadius;
  1050. FLOAT eStartAngle;
  1051. FLOAT eSweepAngle;
  1052. public:
  1053. // Initializer -- Initialize the metafile record.
  1054. VOID vInit
  1055. (
  1056. LONG x,
  1057. LONG y,
  1058. DWORD nRadius_,
  1059. FLOAT eStartAngle_,
  1060. FLOAT eSweepAngle_
  1061. )
  1062. {
  1063. PUTS("MRANGLEARC::vInit\n");
  1064. MR::vInit(EMR_ANGLEARC);
  1065. eptl.vInit(x,y);
  1066. nRadius = nRadius_;
  1067. eStartAngle = eStartAngle_;
  1068. eSweepAngle = eSweepAngle_;
  1069. }
  1070. // bPlay -- Play the record.
  1071. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1072. BOOL bCheckRecord(PHANDLETABLE pht);
  1073. };
  1074. typedef MRANGLEARC *PMRANGLEARC;
  1075. #define SIZEOF_MRANGLEARC (sizeof(MRANGLEARC))
  1076. inline BOOL MRANGLEARC::bCheckRecord(PHANDLETABLE pht)
  1077. {
  1078. if (SIZEOF_MRANGLEARC == nSize && bValidSize(pht, nSize))
  1079. return(TRUE);
  1080. vMarkFoundBad(pht);
  1081. EMFVALFAIL(("MRANGLEARC::bCheckRecord() failed\n"));
  1082. return(FALSE);
  1083. }
  1084. class MRELLIPSE : public MRE /* mre */
  1085. {
  1086. public:
  1087. // bPlay -- Play the record.
  1088. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1089. };
  1090. typedef MRELLIPSE *PMRELLIPSE;
  1091. class MRRECTANGLE : public MRE /* mrr */
  1092. {
  1093. public:
  1094. // bPlay -- Play the record.
  1095. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1096. };
  1097. typedef MRRECTANGLE *PMRRECTANGLE;
  1098. /*********************************Class************************************\
  1099. * class MRROUNDRECT : public MRE
  1100. *
  1101. * ROUNDRECT record.
  1102. *
  1103. * History:
  1104. * Fri Sep 27 15:55:57 1991 -by- Hock San Lee [hockl]
  1105. * Wrote it.
  1106. \**************************************************************************/
  1107. class MRROUNDRECT : public MRE /* mrrr */
  1108. {
  1109. protected:
  1110. SIZEL szlEllipse;
  1111. public:
  1112. // Initializer -- Initialize the metafile record.
  1113. // Returns MRI_OK if successful, MRI_ERROR if error and MRI_NULLBOX if
  1114. // the box is empty in device space. We don't record if there is an error
  1115. // or the box is empty in device space.
  1116. LONG iInit(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, LONG x3, LONG y3)
  1117. {
  1118. PUTS("MRROUNDRECT::iInit\n");
  1119. szlEllipse.cx = x3;
  1120. szlEllipse.cy = y3;
  1121. return(MRE::iInit(EMR_ROUNDRECT, hdc, x1, y1, x2, y2));
  1122. }
  1123. // bPlay -- Play the record.
  1124. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1125. BOOL bCheckRecord(PHANDLETABLE pht);
  1126. };
  1127. typedef MRROUNDRECT *PMRROUNDRECT;
  1128. #define SIZEOF_MRROUNDRECT (sizeof(MRROUNDRECT))
  1129. inline BOOL MRROUNDRECT::bCheckRecord(PHANDLETABLE pht)
  1130. {
  1131. if (SIZEOF_MRROUNDRECT == nSize && bValidSize(pht, nSize))
  1132. return(TRUE);
  1133. vMarkFoundBad(pht);
  1134. EMFVALFAIL(("MRROUNDRECT::bCheckRecord() failed\n"));
  1135. return(FALSE);
  1136. }
  1137. class MRARC : public MREPP /* mra */
  1138. {
  1139. public:
  1140. // bPlay -- Play the record.
  1141. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1142. };
  1143. typedef MRARC *PMRARC;
  1144. class MRARCTO : public MREPP /* mrat */
  1145. {
  1146. public:
  1147. // bPlay -- Play the record.
  1148. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1149. };
  1150. typedef MRARCTO *PMRARCTO;
  1151. class MRCHORD : public MREPP /* mrc */
  1152. {
  1153. public:
  1154. // bPlay -- Play the record.
  1155. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1156. };
  1157. typedef MRCHORD *PMRCHORD;
  1158. class MRPIE : public MREPP /* mrp */
  1159. {
  1160. public:
  1161. // bPlay -- Play the record.
  1162. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1163. };
  1164. typedef MRPIE *PMRPIE;
  1165. /*********************************Class************************************\
  1166. * class MRCREATEPEN: public MR
  1167. *
  1168. * CREATEPEN record.
  1169. *
  1170. * History:
  1171. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  1172. * Wrote it.
  1173. \**************************************************************************/
  1174. class MRCREATEPEN : public MR /* mrcp */
  1175. {
  1176. protected:
  1177. DWORD imhe; // Pen index in Metafile Handle Table.
  1178. LOGPEN logpen; // Logical Pen.
  1179. public:
  1180. // Initializer -- Initialize the metafile record.
  1181. BOOL bInit(HANDLE hpen_, ULONG imhe_)
  1182. {
  1183. PUTS("MRCREATEPEN::bInit\n");
  1184. MR::vInit(EMR_CREATEPEN);
  1185. imhe = imhe_;
  1186. return
  1187. (
  1188. GetObjectA(hpen_, (int) sizeof(LOGPEN), (LPVOID) &logpen)
  1189. == (int) sizeof(LOGPEN)
  1190. );
  1191. }
  1192. // bPlay -- Play the record.
  1193. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1194. // GetPenColor -- return the color
  1195. COLORREF GetPenColor()
  1196. {
  1197. return logpen.lopnColor;
  1198. }
  1199. BOOL bCheckRecord(PHANDLETABLE pht);
  1200. };
  1201. typedef MRCREATEPEN *PMRCREATEPEN;
  1202. #define SIZEOF_MRCREATEPEN (sizeof(MRCREATEPEN))
  1203. inline BOOL MRCREATEPEN::bCheckRecord(PHANDLETABLE pht)
  1204. {
  1205. if (SIZEOF_MRCREATEPEN == nSize && bValidSize(pht, nSize))
  1206. return(TRUE);
  1207. vMarkFoundBad(pht);
  1208. EMFVALFAIL(("MRCREATEPEN::bCheckRecord() failed\n"));
  1209. return(FALSE);
  1210. }
  1211. /*********************************Class************************************\
  1212. * class MREXTCREATEPEN: public MR
  1213. *
  1214. * EXTCREATEPEN record.
  1215. *
  1216. * History:
  1217. * Mon Mar 16 18:20:11 1992 -by- Hock San Lee [hockl]
  1218. * Wrote it.
  1219. \**************************************************************************/
  1220. typedef struct tagEXTLOGPEN32 {
  1221. DWORD elpPenStyle;
  1222. DWORD elpWidth;
  1223. UINT elpBrushStyle;
  1224. COLORREF elpColor;
  1225. ULONG elpHatch;
  1226. DWORD elpNumEntries;
  1227. DWORD elpStyleEntry[1];
  1228. } EXTLOGPEN32, *PEXTLOGPEN32;
  1229. class MREXTCREATEPEN : public MR /* mrecp */
  1230. {
  1231. protected:
  1232. DWORD imhe; // Ext pen index in Metafile Handle Table.
  1233. DWORD offBitsInfo; // offset to brush bitmap info if any
  1234. DWORD cbBitsInfo; // size of brush bitmap info if any
  1235. DWORD offBits; // offset to brush bits if any
  1236. DWORD cbBits; // size of brush bits buffer if any
  1237. EXTLOGPEN32 elp; // The extended pen with the style array.
  1238. // If elpBrushStyle specifies BS_PATTERN,
  1239. // it contains a monochrome brush. If it
  1240. // is BS_DIBPATTERNPT, it is a DIB brush.
  1241. // The elpColor field for a monochrome brush
  1242. // is DIB_PAL_INDICES.
  1243. public:
  1244. // Initializer -- Initialize the metafile MREXTCREATEPEN record.
  1245. // This is similiar to the brush initialization code.
  1246. BOOL bInit
  1247. (
  1248. HDC hdc1,
  1249. ULONG imhe1,
  1250. int cbelp1,
  1251. PEXTLOGPEN32 pelp1,
  1252. HBITMAP hbmRemote1,
  1253. BMIH& bmih1,
  1254. DWORD cbBitsInfo1,
  1255. DWORD cbBits1
  1256. )
  1257. {
  1258. PUTS("MREXTCREATEPEN::bInit\n");
  1259. MR::vInit(EMR_EXTCREATEPEN);
  1260. imhe = imhe1;
  1261. offBitsInfo = sizeof(MREXTCREATEPEN) - sizeof(EXTLOGPEN32) + cbelp1;
  1262. cbBitsInfo = cbBitsInfo1;
  1263. offBits = offBitsInfo + (cbBitsInfo1 + 3) / 4 * 4;
  1264. cbBits = cbBits1;
  1265. // Copy the extended pen.
  1266. RtlCopyMemory((PBYTE) &elp, (PBYTE) pelp1, cbelp1);
  1267. // Record the brush bitmap if any.
  1268. if (hbmRemote1)
  1269. {
  1270. // Initialize the bitmap info header first.
  1271. *(PBMIH) ((PBYTE) this + offBitsInfo) = bmih1;
  1272. // Get bitmap info and bits.
  1273. BOOL bRet = GetBrushBits(hdc1,
  1274. hbmRemote1,
  1275. *(PUINT) &pelp1->elpColor,
  1276. cbBitsInfo1,
  1277. (LPVOID) ((PBYTE) this + offBits),
  1278. (LPBITMAPINFO) ((PBYTE) this + offBitsInfo));
  1279. // for optimized printing we want to determine if this
  1280. // is a monochrome only brush
  1281. fColor = LDC_COLOR_PAGE;
  1282. if (bmih1.biBitCount == 1 && pelp1->elpColor == DIB_RGB_COLORS)
  1283. {
  1284. COLORREF *pColor = (COLORREF *)((PBYTE) this + offBitsInfo + bmih1.biSize);
  1285. if (IS_COLOR_MONO(pColor[0]) && IS_COLOR_MONO(pColor[1]))
  1286. {
  1287. fColor = 0;
  1288. }
  1289. }
  1290. return (bRet);
  1291. }
  1292. else
  1293. {
  1294. return(TRUE);
  1295. }
  1296. }
  1297. ULONG fColor;
  1298. // bPlay -- Play the record.
  1299. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1300. BOOL bCheckRecord(PHANDLETABLE pht);
  1301. };
  1302. typedef MREXTCREATEPEN *PMREXTCREATEPEN;
  1303. #define SIZEOF_MREXTCREATEPEN(cbelp,cbBitsInfo,cbBits) \
  1304. (sizeof(MREXTCREATEPEN) - sizeof(EXTLOGPEN32) \
  1305. + (cbelp) \
  1306. + ((cbBitsInfo) + 3) / 4 * 4 \
  1307. + ((cbBits) + 3) / 4 * 4)
  1308. inline BOOL MREXTCREATEPEN::bCheckRecord(PHANDLETABLE pht)
  1309. {
  1310. DWORD cbelp = sizeof(EXTLOGPEN32) - sizeof(DWORD);
  1311. if ((elp.elpPenStyle & PS_STYLE_MASK) == PS_USERSTYLE)
  1312. cbelp += sizeof(DWORD) * elp.elpNumEntries;
  1313. if (((nSize == SIZEOF_MREXTCREATEPEN(cbelp,cbBitsInfo,cbBits)) ||
  1314. (nSize == SIZEOF_MREXTCREATEPEN(cbelp,cbBitsInfo,cbBits) - sizeof(fColor))) &&
  1315. bValidSize(pht, nSize))
  1316. return(TRUE);
  1317. vMarkFoundBad(pht);
  1318. EMFVALFAIL(("MREXTCREATEPEN::bCheckRecord(%08x,%08x,%08x) failed\n",cbelp,cbBitsInfo,cbBits));
  1319. return(FALSE);
  1320. }
  1321. /*********************************Class************************************\
  1322. * class MRCREATEPALETTE: public MR
  1323. *
  1324. * CREATEPALETTE record.
  1325. *
  1326. * History:
  1327. * Sun Sep 22 14:40:40 1991 -by- Hock San Lee [hockl]
  1328. * Wrote it.
  1329. \**************************************************************************/
  1330. class MRCREATEPALETTE : public MR /* mrcp */
  1331. {
  1332. protected:
  1333. DWORD imhe; // LogPalette index in Metafile Handle Table.
  1334. LOGPALETTE logpal; // Logical Palette.
  1335. public:
  1336. // Initializer -- Initialize the metafile MRCREATEPALETTE record.
  1337. // It sets the peFlags in the palette entries to zeroes.
  1338. BOOL bInit(HPALETTE hpal_, ULONG imhe_, USHORT cEntries_); // MFREC.CXX
  1339. // bCommit -- Commit the record to metafile.
  1340. // It updates the metafile palette.
  1341. BOOL bCommit(PMDC pmdc)
  1342. {
  1343. return
  1344. (
  1345. pmdc->bCommit
  1346. (
  1347. *(PENHMETARECORD) this,
  1348. (UINT) logpal.palNumEntries,
  1349. logpal.palPalEntry
  1350. )
  1351. );
  1352. }
  1353. // vCommit -- use bCommit!
  1354. VOID vCommit(PMDC pmdc)
  1355. {
  1356. USE(pmdc);
  1357. ASSERTGDI(FALSE, "MRCREATEPALETTE::vCommit: use bCommit!");
  1358. }
  1359. // bPlay -- Play the record.
  1360. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1361. BOOL bCheckRecord(PHANDLETABLE pht);
  1362. };
  1363. typedef MRCREATEPALETTE *PMRCREATEPALETTE;
  1364. #define SIZEOF_MRCREATEPALETTE(cEntries) \
  1365. (sizeof(MRCREATEPALETTE)-sizeof(PALETTEENTRY)+(cEntries)*sizeof(PALETTEENTRY))
  1366. inline BOOL MRCREATEPALETTE::bCheckRecord(PHANDLETABLE pht)
  1367. {
  1368. DWORD cEntries = logpal.palNumEntries;
  1369. if (nSize == SIZEOF_MRCREATEPALETTE(cEntries) && bValidSize(pht, nSize))
  1370. return(TRUE);
  1371. vMarkFoundBad(pht);
  1372. EMFVALFAIL(("MRCREATEPALETTE::bCheckRecord(%08x) failed\n", cEntries));
  1373. return(FALSE);
  1374. }
  1375. /*********************************Class************************************\
  1376. * class MRCREATECOLORSPACE: public MR
  1377. *
  1378. * CREATECOLORSPACE record. (Windows 98 ansi record)
  1379. *
  1380. * History:
  1381. \**************************************************************************/
  1382. class MRCREATECOLORSPACE : public MR /* mrcp */
  1383. {
  1384. protected:
  1385. DWORD imhe; // LogColorSpace index in Metafile Handle Table.
  1386. LOGCOLORSPACEA lcsp; // Logical Color Space.
  1387. public:
  1388. // Initializer -- Initialize the metafile MRCREATECOLORSPACE record.
  1389. VOID vInit(ULONG imhe_, LOGCOLORSPACEA& lcsp_)
  1390. {
  1391. PUTS("MRCREATECOLORSPACE::vInit\n");
  1392. MR::vInit(EMR_CREATECOLORSPACE);
  1393. imhe = imhe_;
  1394. lcsp = lcsp_;
  1395. }
  1396. // bPlay -- Play the record.
  1397. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1398. BOOL bCheckRecord(PHANDLETABLE pht);
  1399. };
  1400. typedef MRCREATECOLORSPACE *PMRCREATECOLORSPACE;
  1401. #define SIZEOF_MRCREATECOLORSPACE (sizeof(MRCREATECOLORSPACE))
  1402. inline BOOL MRCREATECOLORSPACE::bCheckRecord(PHANDLETABLE pht)
  1403. {
  1404. if (SIZEOF_MRCREATECOLORSPACE == nSize && bValidSize(pht, nSize))
  1405. return(TRUE);
  1406. vMarkFoundBad(pht);
  1407. EMFVALFAIL(("MRCREATECOLORSPACE::bCheckRecord() failed\n"));
  1408. return(FALSE);
  1409. }
  1410. /*********************************Class************************************\
  1411. * class MRCREATECOLORSPACEW: public MR
  1412. *
  1413. * CREATECOLORSPACE record. (Windows NT unicode record)
  1414. *
  1415. * History:
  1416. \**************************************************************************/
  1417. class MRCREATECOLORSPACEW : public MR /* mrcpw */
  1418. {
  1419. protected:
  1420. DWORD imhe; // LogColorSpace index in Metafile Handle Table.
  1421. LOGCOLORSPACEW lcsp; // Logical Color Space.
  1422. DWORD dwFlags; // flags
  1423. DWORD cbData; // size of raw source profile data if attached
  1424. BYTE Data[1]; // Array size is cbData
  1425. public:
  1426. // Initializer -- Initialize the metafile MRCREATECOLORSPACEW record.
  1427. VOID vInit(ULONG imhe_, LOGCOLORSPACEW& lcsp_,
  1428. DWORD dwFlags_, DWORD cbData_, BYTE *Data_)
  1429. {
  1430. PUTS("MRCREATECOLORSPACEW::vInit\n");
  1431. MR::vInit(EMR_CREATECOLORSPACEW);
  1432. imhe = imhe_;
  1433. lcsp = lcsp_;
  1434. dwFlags = dwFlags_;
  1435. cbData = cbData_;
  1436. RtlCopyMemory(Data,Data_,cbData_);
  1437. }
  1438. // bPlay -- Play the record.
  1439. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1440. BOOL bCheckRecord(PHANDLETABLE pht);
  1441. };
  1442. typedef MRCREATECOLORSPACEW *PMRCREATECOLORSPACEW;
  1443. #define SIZEOF_MRCREATECOLORSPACEW(cb) \
  1444. ((sizeof(MRCREATECOLORSPACEW)-PADCHAR_SIZE+(cb)+3)& ~3)
  1445. inline BOOL MRCREATECOLORSPACEW::bCheckRecord(PHANDLETABLE pht)
  1446. {
  1447. if (nSize == SIZEOF_MRCREATECOLORSPACEW(cbData) && bValidSize(pht, nSize))
  1448. return(TRUE);
  1449. vMarkFoundBad(pht);
  1450. EMFVALFAIL(("MRCREATECOLORSPACEW::bCheckRecord(%08x) failed\n", cbData));
  1451. return(FALSE);
  1452. }
  1453. /*********************************Class************************************\
  1454. * class MRDELETECOLORSPACE: public MR
  1455. *
  1456. * CREATECOLORSPACE record.
  1457. *
  1458. * History:
  1459. \**************************************************************************/
  1460. class MRDELETECOLORSPACE : public MR /* mrcp */
  1461. {
  1462. DWORD imhe; // LogColorSpace index in Metafile Handle Table.
  1463. public:
  1464. // Initializer -- Initialize the metafile MRCREATEPALETTE record.
  1465. // It sets the peFlags in the palette entries to zeroes.
  1466. VOID vInit(ULONG imhe_, LOGCOLORSPACEW& lcsp_);
  1467. // bPlay -- Play the record.
  1468. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1469. BOOL bCheckRecord(PHANDLETABLE pht);
  1470. };
  1471. typedef MRDELETECOLORSPACE *PMRDELETECOLORSPACE;
  1472. #define SIZEOF_MRDELETECOLORSPACE (sizeof(MRDELETECOLORSPACE))
  1473. inline BOOL MRDELETECOLORSPACE::bCheckRecord(PHANDLETABLE pht)
  1474. {
  1475. if (SIZEOF_MRDELETECOLORSPACE == nSize && bValidSize(pht, nSize))
  1476. return(TRUE);
  1477. vMarkFoundBad(pht);
  1478. EMFVALFAIL(("MRDELETECOLORSPACE::bCheckRecord() failed\n"));
  1479. return(FALSE);
  1480. }
  1481. /*********************************Class************************************\
  1482. * class MRCREATEBRUSHINDIRECT: public MR
  1483. *
  1484. * CREATEBRUSHINDIRECT record.
  1485. *
  1486. * History:
  1487. * Wed Jul 31 21:09:28 1991 -by- Hock San Lee [hockl]
  1488. * Wrote it.
  1489. \**************************************************************************/
  1490. class MRCREATEBRUSHINDIRECT : public MR /* mrcbi */
  1491. {
  1492. protected:
  1493. DWORD imhe; // Brush index in Metafile Handle Table.
  1494. LOGBRUSH32 lb; // Logical brush.
  1495. public:
  1496. // Initializer -- Initialize the metafile record.
  1497. VOID vInit(ULONG imhe_, LOGBRUSH& lb_)
  1498. {
  1499. PUTS("MRCREATEBRUSHINDIRECT::vInit\n");
  1500. MR::vInit(EMR_CREATEBRUSHINDIRECT);
  1501. imhe = imhe_;
  1502. lb.lbStyle = lb_.lbStyle;
  1503. lb.lbColor = lb_.lbColor;
  1504. lb.lbHatch = (ULONG)lb_.lbHatch;
  1505. }
  1506. // bPlay -- Play the record.
  1507. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1508. BOOL bCheckRecord(PHANDLETABLE pht);
  1509. };
  1510. typedef MRCREATEBRUSHINDIRECT *PMRCREATEBRUSHINDIRECT;
  1511. #define SIZEOF_MRCREATEBRUSHINDIRECT (sizeof(MRCREATEBRUSHINDIRECT))
  1512. inline BOOL MRCREATEBRUSHINDIRECT::bCheckRecord(PHANDLETABLE pht)
  1513. {
  1514. if (SIZEOF_MRCREATEBRUSHINDIRECT == nSize && bValidSize(pht, nSize))
  1515. return(TRUE);
  1516. vMarkFoundBad(pht);
  1517. EMFVALFAIL(("MRCREATEBRUSHINDIRECT::bCheckRecord() failed\n"));
  1518. return(FALSE);
  1519. }
  1520. /*********************************Class************************************\
  1521. * class MRBRUSH: public MR
  1522. *
  1523. * Metafile record for mono and dib pattern brushes.
  1524. *
  1525. * History:
  1526. * Thu Mar 12 16:20:15 1992 -by- Hock San Lee [hockl]
  1527. * Wrote it.
  1528. \**************************************************************************/
  1529. class MRBRUSH : public MR /* mrbr */
  1530. {
  1531. protected:
  1532. DWORD imhe; // Brush index in Metafile Handle Table.
  1533. DWORD iUsage; // color table usage in bitmap info.
  1534. // For mono brush, it is DIB_PAL_INDICES.
  1535. DWORD offBitsInfo; // offset to bitmap info
  1536. DWORD cbBitsInfo; // size of bitmap info
  1537. DWORD offBits; // offset to bits
  1538. DWORD cbBits; // size of bits buffer
  1539. public:
  1540. // Initializer -- Initialize the metafile record.
  1541. // See also extcreatepen initialization code.
  1542. BOOL bInit
  1543. (
  1544. DWORD iType1,
  1545. HDC hdc1,
  1546. ULONG imhe1,
  1547. HBITMAP hbmRemote1,
  1548. BMIH& bmih1,
  1549. DWORD iUsage1,
  1550. DWORD cbBitsInfo1,
  1551. DWORD cbBits1
  1552. )
  1553. {
  1554. PUTS("MRBRUSH::bInit\n");
  1555. MR::vInit(iType1);
  1556. imhe = imhe1;
  1557. iUsage = iUsage1;
  1558. offBitsInfo = sizeof(MRBRUSH);
  1559. cbBitsInfo = cbBitsInfo1;
  1560. offBits = sizeof(MRBRUSH) + (cbBitsInfo1 + 3) / 4 * 4;
  1561. cbBits = cbBits1;
  1562. // Initialize the bitmap info header first.
  1563. *(PBMIH) ((PBYTE) this + offBitsInfo) = bmih1;
  1564. // Get bitmap info and bits.
  1565. // We could have called InternalGetDIBits directly if not for
  1566. // the gdisrv brush hack.
  1567. BOOL bRet = GetBrushBits(hdc1,
  1568. hbmRemote1,
  1569. (UINT) iUsage1,
  1570. cbBitsInfo1,
  1571. (LPVOID) ((PBYTE) this + offBits),
  1572. (LPBITMAPINFO) ((PBYTE) this + offBitsInfo));
  1573. // for optimized printing we want to determine if this
  1574. // is a monochrome only brush
  1575. fColor = LDC_COLOR_PAGE;
  1576. if (bmih1.biBitCount == 1 && iUsage == DIB_RGB_COLORS)
  1577. {
  1578. COLORREF *pColor = (COLORREF *)((PBYTE) this + offBitsInfo + bmih1.biSize);
  1579. if (IS_COLOR_MONO(pColor[0]) && IS_COLOR_MONO(pColor[1]))
  1580. {
  1581. fColor = 0;
  1582. }
  1583. }
  1584. return (bRet);
  1585. }
  1586. // flag specifying whether the color table for this dib is
  1587. // known to only contain black or white
  1588. ULONG fColor;
  1589. BOOL bCheckRecord(PHANDLETABLE pht);
  1590. };
  1591. typedef MRBRUSH *PMRBRUSH;
  1592. #define SIZEOF_MRBRUSH(cbBitsInfo,cbBits) \
  1593. (sizeof(MRBRUSH) \
  1594. + ((cbBitsInfo) + 3) / 4 * 4 \
  1595. + ((cbBits) + 3) / 4 * 4)
  1596. inline BOOL MRBRUSH::bCheckRecord(PHANDLETABLE pht)
  1597. {
  1598. if ((SIZEOF_MRBRUSH(cbBitsInfo,cbBits) == nSize ||
  1599. (SIZEOF_MRBRUSH(cbBitsInfo,cbBits) - sizeof(fColor)) == nSize) &&
  1600. bValidSize(pht, nSize))
  1601. return(TRUE);
  1602. vMarkFoundBad(pht);
  1603. EMFVALFAIL(("MRBRUSH::bCheckRecord(%08x,%08x) failed\n", cbBitsInfo,cbBits));
  1604. return(FALSE);
  1605. }
  1606. class MRCREATEMONOBRUSH : public MRBRUSH /* mrcmb */
  1607. {
  1608. public:
  1609. // bPlay -- Play the record.
  1610. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1611. };
  1612. typedef MRCREATEMONOBRUSH *PMRCREATEMONOBRUSH;
  1613. class MRCREATEDIBPATTERNBRUSHPT : public MRBRUSH /* mrcdpb */
  1614. {
  1615. public:
  1616. // bPlay -- Play the record.
  1617. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1618. };
  1619. typedef MRCREATEDIBPATTERNBRUSHPT *PMRCREATEDIBPATTERNBRUSHPT;
  1620. /*********************************Class************************************\
  1621. * class MREXTCREATEFONTINDIRECTW: public MR
  1622. *
  1623. * EXTCREATEFONTINDIRECTW record.
  1624. *
  1625. * Thu 19-Dec-1996 -by- Bodin Dresevic [BodinD]
  1626. * update: changed initializer to take into account new 5.0 ENUMLOGFONTEXDVW
  1627. * structure
  1628. *
  1629. * History:
  1630. * Tue Jan 14 13:52:35 1992 -by- Hock San Lee [hockl]
  1631. * Wrote it.
  1632. \**************************************************************************/
  1633. class MREXTCREATEFONTINDIRECTW : public MR /* mrecfiw */
  1634. {
  1635. protected:
  1636. DWORD imhe; // Font index in Metafile Handle Table.
  1637. EXTLOGFONTW elfw; // Logical font.
  1638. public:
  1639. // In 5.0 we always record ENUMLOGFONTEXDVW.
  1640. // However, we bPlay can play both ENUMLOGFONTEXDVW records as well as
  1641. // EXTLOGFONTW records (in case the file is recored on <= 4.0 or win 9x system)
  1642. // We differentiate between old and new style records based on the size of
  1643. // record.
  1644. VOID vInit(HANDLE hfont_, ULONG imhe_, ENUMLOGFONTEXDVW *pelfw)
  1645. {
  1646. PUTS("MREXTCREATEFONTINDIRECTW::bInit\n");
  1647. MR::vInit(EMR_EXTCREATEFONTINDIRECTW);
  1648. imhe = imhe_;
  1649. RtlMoveMemory(&this->elfw,
  1650. pelfw,
  1651. offsetof(ENUMLOGFONTEXDVW,elfDesignVector) + SIZEOFDV(pelfw->elfDesignVector.dvNumAxes));
  1652. }
  1653. // bPlay -- Play the record.
  1654. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1655. BOOL bCheckRecord(PHANDLETABLE pht)
  1656. {
  1657. // Review by Mleonov.
  1658. if (((nSize == sizeof(MREXTCREATEFONTINDIRECTW)) ||
  1659. ((nSize == offsetof(EMREXTCREATEFONTINDIRECTW,elfw) +
  1660. offsetof(ENUMLOGFONTEXDVW,elfDesignVector)+
  1661. SIZEOFDV((*(ENUMLOGFONTEXDVW*)&elfw).elfDesignVector.dvNumAxes)) && ((*(ENUMLOGFONTEXDVW*)&elfw).elfDesignVector.dvNumAxes <= MM_MAX_NUMAXES))) &&
  1662. bValidSize(pht, nSize))
  1663. {
  1664. return(TRUE);
  1665. }
  1666. vMarkFoundBad(pht);
  1667. EMFVALFAIL(("MREXTCREATEFONTINDIRECTW::bCheckRecord failed\n"));
  1668. return(FALSE);
  1669. }
  1670. };
  1671. typedef MREXTCREATEFONTINDIRECTW *PMREXTCREATEFONTINDIRECTW;
  1672. // sizeof old EXTLOGFONT records
  1673. #define SIZEOF_MREXTCREATEFONTINDIRECTW (sizeof(MREXTCREATEFONTINDIRECTW))
  1674. // sizeof new ENUMLOGFONTEXDVW records
  1675. #define SIZEOF_MRCREATEFONTINDIRECTEXW(iSize) (offsetof(EMREXTCREATEFONTINDIRECTW,elfw)+(DWORD)(iSize))
  1676. /*********************************Class************************************\
  1677. * class MRSETPALETTEENTRIES: public MR
  1678. *
  1679. * SETPALETTEENTRIES record.
  1680. *
  1681. * History:
  1682. * Sun Sep 22 14:40:40 1991 -by- Hock San Lee [hockl]
  1683. * Wrote it.
  1684. \**************************************************************************/
  1685. class MRSETPALETTEENTRIES : public MR /* mrspe */
  1686. {
  1687. protected:
  1688. DWORD imhe; // LogPalette index in Metafile Handle Table.
  1689. DWORD iStart; // First entry to be set.
  1690. DWORD cEntries; // Number of entries to be set.
  1691. PALETTEENTRY aPalEntry[1]; // Palette entries.
  1692. public:
  1693. // Initializer -- Initialize the metafile MRSETPALETTEENTRIES record.
  1694. // It sets the peFlags in the palette entries to zeroes.
  1695. VOID vInit
  1696. (
  1697. ULONG imhe_,
  1698. UINT iStart_,
  1699. UINT cEntries_,
  1700. CONST PALETTEENTRY *pPalEntries_
  1701. ); // MFREC.CXX
  1702. // bCommit -- Commit the record to metafile.
  1703. // It updates the metafile palette.
  1704. BOOL bCommit(PMDC pmdc)
  1705. {
  1706. return
  1707. (
  1708. pmdc->bCommit(*(PENHMETARECORD) this, (UINT) cEntries, aPalEntry)
  1709. );
  1710. }
  1711. // vCommit -- use bCommit!
  1712. VOID vCommit(PMDC pmdc)
  1713. {
  1714. USE(pmdc);
  1715. ASSERTGDI(FALSE, "MRSETPALETTEENTRIES::vCommit: use bCommit!");
  1716. }
  1717. // bPlay -- Play the record.
  1718. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1719. BOOL bCheckRecord(PHANDLETABLE pht);
  1720. };
  1721. typedef MRSETPALETTEENTRIES *PMRSETPALETTEENTRIES;
  1722. #define SIZEOF_MRSETPALETTEENTRIES(cEntries) \
  1723. (sizeof(MRSETPALETTEENTRIES)-sizeof(PALETTEENTRY)+(cEntries)*sizeof(PALETTEENTRY))
  1724. inline BOOL MRSETPALETTEENTRIES::bCheckRecord(PHANDLETABLE pht)
  1725. {
  1726. if (SIZEOF_MRSETPALETTEENTRIES(cEntries) == nSize && bValidSize(pht, nSize))
  1727. return(TRUE);
  1728. vMarkFoundBad(pht);
  1729. EMFVALFAIL(("MRSETPALETTEENTRIES::bCheckRecord(%08x) failed\n", cEntries));
  1730. return(FALSE);
  1731. }
  1732. class MRRESIZEPALETTE : public MRDD /* mrrp */
  1733. {
  1734. public:
  1735. // bPlay -- Play the record.
  1736. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1737. };
  1738. typedef MRRESIZEPALETTE *PMRRESIZEPALETTE;
  1739. /*********************************Class************************************\
  1740. * class MREXTFLOODFILL : public MR
  1741. *
  1742. * EXTFLOODFILL record.
  1743. *
  1744. * History:
  1745. * Tue Apr 14 14:45:41 1992 -by- Hock San Lee [hockl]
  1746. * Wrote it.
  1747. \**************************************************************************/
  1748. class MREXTFLOODFILL : public MR /* mreff */
  1749. {
  1750. protected:
  1751. EPOINTL eptl;
  1752. COLORREF clrRef;
  1753. DWORD iMode;
  1754. public:
  1755. // Initializer -- Initialize the metafile record.
  1756. VOID vInit(int x1, int y1, COLORREF clrRef1, DWORD iMode1)
  1757. {
  1758. PUTS("MREXTFLOODFILL::vInit\n");
  1759. MR::vInit(EMR_EXTFLOODFILL);
  1760. eptl.vInit(x1,y1);
  1761. clrRef = clrRef1;
  1762. iMode = iMode1;
  1763. }
  1764. // bPlay -- Play the record.
  1765. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1766. BOOL bCheckRecord(PHANDLETABLE pht);
  1767. };
  1768. typedef MREXTFLOODFILL *PMREXTFLOODFILL;
  1769. #define SIZEOF_MREXTFLOODFILL (sizeof(MREXTFLOODFILL))
  1770. inline BOOL MREXTFLOODFILL::bCheckRecord(PHANDLETABLE pht)
  1771. {
  1772. if (SIZEOF_MREXTFLOODFILL == nSize && bValidSize(pht, nSize))
  1773. return(TRUE);
  1774. vMarkFoundBad(pht);
  1775. EMFVALFAIL(("MREXTFLOODFILL::bCheckRecord() failed\n"));
  1776. return(FALSE);
  1777. }
  1778. /*********************************Class************************************\
  1779. * class MREOF: public MR
  1780. *
  1781. * EOF record.
  1782. *
  1783. * History:
  1784. * Fri Mar 20 09:37:47 1992 -by- Hock San Lee [hockl]
  1785. * Wrote it.
  1786. \**************************************************************************/
  1787. class MREOF : public MR /* mreof */
  1788. {
  1789. public:
  1790. DWORD nPalEntries; // Number of palette entries.
  1791. DWORD offPalEntries; // Offset to the palette entries. For now,
  1792. // it points to the address immediately
  1793. // following this field (i.e. &cbEOF)!
  1794. DWORD cbEOF; // Size of the record. This field does not
  1795. // follows offPalEntries! It is always at
  1796. // the end of the EOF record to allow us to
  1797. // scan back to the beginning of the EOF
  1798. // record to find the metafile palette.
  1799. public:
  1800. // Initializer -- Initialize the metafile MREOF record.
  1801. VOID vInit(DWORD cPalEntries_, PPALETTEENTRY pPalEntries_, DWORD cbEOF_)
  1802. {
  1803. ASSERTGDI(cbEOF_ == (sizeof(MREOF)+cPalEntries_*sizeof(PALETTEENTRY)),
  1804. "MREOF::vInit: bad cbEOF_");
  1805. MR::vInit(EMR_EOF);
  1806. nPalEntries = cPalEntries_;
  1807. offPalEntries = sizeof(MR) + sizeof(nPalEntries) + sizeof(offPalEntries);
  1808. // Initialize cbEOF at the end of the EOF record!
  1809. ((PDWORD) ((PBYTE) this + cbEOF_))[-1] = cbEOF_;
  1810. RtlCopyMemory
  1811. (
  1812. (PBYTE) this + offPalEntries,
  1813. (PBYTE) pPalEntries_,
  1814. cPalEntries_ * sizeof(PALETTEENTRY)
  1815. );
  1816. }
  1817. // bPlay -- Play the record.
  1818. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1819. BOOL bCheckRecord(PHANDLETABLE pht);
  1820. };
  1821. typedef MREOF *PMREOF;
  1822. #define SIZEOF_MREOF(cPalEntries) \
  1823. (sizeof(MREOF)+(cPalEntries)*sizeof(PALETTEENTRY))
  1824. inline BOOL MREOF::bCheckRecord(PHANDLETABLE pht)
  1825. {
  1826. if (SIZEOF_MREOF(nPalEntries) == nSize && bValidSize(pht, nSize))
  1827. return(TRUE);
  1828. vMarkFoundBad(pht);
  1829. EMFVALFAIL(("MREOF::bCheckRecord(%08x) failed\n", nPalEntries));
  1830. return(FALSE);
  1831. }
  1832. /*********************************Class************************************\
  1833. * class MRGDICOMMENT: public MR
  1834. *
  1835. * GDICOMMENT record.
  1836. *
  1837. * History:
  1838. * Wed Apr 28 10:43:12 1993 -by- Hock San Lee [hockl]
  1839. * Added public comments.
  1840. * 17-Oct-1991 -by- John Colleran [johnc]
  1841. * Wrote it.
  1842. \**************************************************************************/
  1843. //REVISIT
  1844. typedef struct _COMMENTDATABUF {
  1845. UINT size;
  1846. PVOID data;
  1847. } COMMENTDATABUF;
  1848. class MRGDICOMMENT : public MR /* mrmd */
  1849. {
  1850. public:
  1851. DWORD cb; // Number of BYTES in the comment
  1852. BYTE abComment[1]; // the comment
  1853. public:
  1854. // Initializer -- Initialize the metafile MRGDICOMMENT record.
  1855. VOID vInit(DWORD cb_, CONST BYTE *abComment_)
  1856. {
  1857. MR::vInit(EMR_GDICOMMENT);
  1858. cb = cb_;
  1859. RtlCopyMemory
  1860. (
  1861. (PBYTE) abComment,
  1862. (PBYTE) abComment_,
  1863. cb
  1864. );
  1865. }
  1866. // Initialize MRGDICOMMENT record using scattered input buffers
  1867. VOID vInit(INT bufcnt, CONST COMMENTDATABUF *databuf)
  1868. {
  1869. MR::vInit(EMR_GDICOMMENT);
  1870. cb = 0;
  1871. for (INT i=0; i<bufcnt; i++)
  1872. {
  1873. UINT n;
  1874. if (n = databuf[i].size)
  1875. {
  1876. RtlCopyMemory(&abComment[cb], databuf[i].data, n);
  1877. cb += n;
  1878. }
  1879. }
  1880. }
  1881. // Initializer -- Initialize the metafile comment record for windows metafile.
  1882. VOID vInitWindowsMetaFile(DWORD cbWinMetaFile_, CONST BYTE *pbWinMetaFile_)
  1883. {
  1884. PEMRGDICOMMENT_WINDOWS_METAFILE pemrWinMF;
  1885. MR::vInit(EMR_GDICOMMENT);
  1886. pemrWinMF = (PEMRGDICOMMENT_WINDOWS_METAFILE) this;
  1887. pemrWinMF->cbData = cbWinMetaFile_
  1888. + sizeof(EMRGDICOMMENT_WINDOWS_METAFILE)
  1889. - sizeof(EMR)
  1890. - sizeof(DWORD);
  1891. pemrWinMF->ident = GDICOMMENT_IDENTIFIER;
  1892. pemrWinMF->iComment = GDICOMMENT_WINDOWS_METAFILE;
  1893. pemrWinMF->nVersion = (DWORD) ((PMETAHEADER) pbWinMetaFile_)->mtVersion;
  1894. pemrWinMF->nChecksum = 0; // to be filled in later
  1895. pemrWinMF->fFlags = 0; // no compression
  1896. pemrWinMF->cbWinMetaFile = cbWinMetaFile_;
  1897. RtlCopyMemory((PBYTE) &pemrWinMF[1], pbWinMetaFile_, cbWinMetaFile_);
  1898. }
  1899. // Initializer -- Initialize the metafile comment record for begin group for
  1900. // the embedded enhanced metafile.
  1901. VOID vInitBeginGroupEMF(PENHMETAHEADER pemfHeader)
  1902. {
  1903. PEMRGDICOMMENT_BEGINGROUP pemrBeginGroup;
  1904. MR::vInit(EMR_GDICOMMENT);
  1905. pemrBeginGroup = (PEMRGDICOMMENT_BEGINGROUP) this;
  1906. pemrBeginGroup->cbData = sizeof(WCHAR) * pemfHeader->nDescription
  1907. + sizeof(EMRGDICOMMENT_BEGINGROUP)
  1908. - sizeof(EMR)
  1909. - sizeof(DWORD);
  1910. pemrBeginGroup->ident = GDICOMMENT_IDENTIFIER;
  1911. pemrBeginGroup->iComment = GDICOMMENT_BEGINGROUP;
  1912. pemrBeginGroup->nDescription = pemfHeader->nDescription;
  1913. if (pemfHeader->nDescription)
  1914. RtlCopyMemory
  1915. (
  1916. (PBYTE) &pemrBeginGroup[1],
  1917. (PBYTE) pemfHeader + pemfHeader->offDescription,
  1918. pemfHeader->nDescription * sizeof(WCHAR)
  1919. );
  1920. // Get logical output rectangle from the frame rectangle.
  1921. // The logical coordinates is actually in source device coordinates
  1922. // at this time. This is set up by PlayEnhMetaFile.
  1923. pemrBeginGroup->rclOutput.left
  1924. = (LONG) MulDiv((int) pemfHeader->rclFrame.left,
  1925. (int) pemfHeader->szlDevice.cx,
  1926. (int) (100 * pemfHeader->szlMillimeters.cx));
  1927. pemrBeginGroup->rclOutput.right
  1928. = (LONG) MulDiv((int) pemfHeader->rclFrame.right,
  1929. (int) pemfHeader->szlDevice.cx,
  1930. (int) (100 * pemfHeader->szlMillimeters.cx));
  1931. pemrBeginGroup->rclOutput.top
  1932. = (LONG) MulDiv((int) pemfHeader->rclFrame.top,
  1933. (int) pemfHeader->szlDevice.cy,
  1934. (int) (100 * pemfHeader->szlMillimeters.cy));
  1935. pemrBeginGroup->rclOutput.bottom
  1936. = (LONG) MulDiv((int) pemfHeader->rclFrame.bottom,
  1937. (int) pemfHeader->szlDevice.cy,
  1938. (int) (100 * pemfHeader->szlMillimeters.cy));
  1939. }
  1940. // bIsPublicComment -- Is this the public metafile comment?
  1941. BOOL bIsPublicComment()
  1942. {
  1943. PEMRGDICOMMENT_PUBLIC pemrc = (PEMRGDICOMMENT_PUBLIC) this;
  1944. return
  1945. (
  1946. pemrc->emr.iType == EMR_GDICOMMENT
  1947. && pemrc->emr.nSize >= sizeof(EMRGDICOMMENT_PUBLIC)
  1948. && pemrc->ident == GDICOMMENT_IDENTIFIER
  1949. );
  1950. }
  1951. // bIsWindowsMetaFile -- Is this the Windows metafile comment?
  1952. BOOL bIsWindowsMetaFile()
  1953. {
  1954. PEMRGDICOMMENT_WINDOWS_METAFILE pemrWinMF;
  1955. pemrWinMF = (PEMRGDICOMMENT_WINDOWS_METAFILE) this;
  1956. return
  1957. (
  1958. bIsPublicComment()
  1959. && pemrWinMF->iComment == GDICOMMENT_WINDOWS_METAFILE
  1960. );
  1961. }
  1962. // bIsCommentBeginGroup -- Is this the windows Comment Begin Group
  1963. BOOL bIsCommentBeginGroup()
  1964. {
  1965. PEMRGDICOMMENT_BEGINGROUP pemrBeginGroup;
  1966. pemrBeginGroup = (PEMRGDICOMMENT_BEGINGROUP) this;
  1967. return
  1968. (
  1969. bIsPublicComment()
  1970. && pemrBeginGroup->iComment == GDICOMMENT_BEGINGROUP
  1971. );
  1972. }
  1973. // bPlay -- Play the record.
  1974. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  1975. BOOL bCheckRecord(PHANDLETABLE pht);
  1976. };
  1977. typedef MRGDICOMMENT *PMRGDICOMMENT;
  1978. #define SIZEOF_MRGDICOMMENT(cb) \
  1979. ((sizeof(MRGDICOMMENT)-PADCHAR_SIZE+(cb)+3)& ~3)
  1980. #define SIZEOF_MRGDICOMMENT_WINDOWS_METAFILE(cb) \
  1981. ((sizeof(EMRGDICOMMENT_WINDOWS_METAFILE)+(cb)+3) & ~3)
  1982. #define SIZEOF_MRGDICOMMENT_BEGINGROUP(cb) \
  1983. ((sizeof(EMRGDICOMMENT_BEGINGROUP)+sizeof(WCHAR)*(cb)+3) & ~3)
  1984. inline BOOL MRGDICOMMENT::bCheckRecord(PHANDLETABLE pht)
  1985. {
  1986. //Review by someone else/Mleonov:
  1987. // Problem is we have the same METARECORD i.e MRGDICOMMENT for different
  1988. // types of comments with different size. So what we do is to make sure
  1989. // nSize matches each of these specific comments.
  1990. /*
  1991. if (bIsWindowsMetaFile())
  1992. {
  1993. if (nSize == SIZEOF_MRGDICOMMENT_WINDOWS_METAFILE(cb))
  1994. {
  1995. if (bValidSize(pht, nSize))
  1996. return(TRUE);
  1997. }
  1998. }
  1999. else if (bIsCommentBeginGroup())
  2000. {
  2001. if (nSize == SIZEOF_MRGDICOMMENT_BEGINGROUP(cb))
  2002. {
  2003. if (bValidSize(pht, nSize))
  2004. return(TRUE);
  2005. }
  2006. }
  2007. else
  2008. */
  2009. {
  2010. if (bValidSize(pht, nSize))
  2011. return(TRUE);
  2012. }
  2013. vMarkFoundBad(pht);
  2014. EMFVALFAIL(("MRGDICOMMENT::bCheckRecord(%08x) failed\n", cb));
  2015. return(FALSE);
  2016. }
  2017. /*********************************Class************************************\
  2018. * class MRBB : public MRB
  2019. *
  2020. * Metafile record with Bounds and BitBlts.
  2021. *
  2022. * History:
  2023. * Fri Nov 22 17:17:02 1991 -by- Hock San Lee [hockl]
  2024. * Wrote it.
  2025. \**************************************************************************/
  2026. class MRBB : public MRB /* mrbb */
  2027. {
  2028. protected:
  2029. LONG xDst; // destination x origin
  2030. LONG yDst; // destination y origin
  2031. LONG cxDst; // width
  2032. LONG cyDst; // height
  2033. DWORD rop; // raster operation code.
  2034. // For MaskBlt, this is rop3!
  2035. LONG xSrc; // source x origin
  2036. LONG ySrc; // source y origin
  2037. XFORM xformSrc; // source DC transform
  2038. COLORREF clrBkSrc; // source DC BkColor. This must be a RGB value.
  2039. // The following are zeros if source does not contain a bitmap.
  2040. // The bitmap info, if exists, contains literal RGB values in the color table.
  2041. DWORD iUsageSrc; // color table usage in bitmap info.
  2042. // This contains DIB_RGB_COLORS.
  2043. DWORD offBitsInfoSrc; // offset to bitmap info
  2044. DWORD cbBitsInfoSrc; // size of bitmap info
  2045. DWORD offBitsSrc; // offset to bits
  2046. DWORD cbBitsSrc; // size of bits buffer
  2047. public:
  2048. // Initializer -- Initialize the metafile record.
  2049. BOOL bInit
  2050. (
  2051. DWORD iType1,
  2052. PMDC pmdc1,
  2053. LONG xDst1,
  2054. LONG yDst1,
  2055. LONG cxDst1,
  2056. LONG cyDst1,
  2057. DWORD rop1,
  2058. LONG xSrc1,
  2059. LONG ySrc1,
  2060. PXFORM pxformSrc1,
  2061. COLORREF clrBkSrc1,
  2062. PBMIH pbmihSrc1,
  2063. HBITMAP hbmSrc1,
  2064. DWORD offBitsInfoSrc1,
  2065. DWORD cbBitsInfoSrc1,
  2066. DWORD offBitsSrc1,
  2067. DWORD cbBitsSrc1
  2068. )
  2069. {
  2070. PUTS("MRBB::bInit\n");
  2071. ASSERTGDI(offBitsInfoSrc1 % 4 == 0,
  2072. "MRBB::bInit: offBitsInfoSrc1 is not dword aligned");
  2073. ASSERTGDI(cbBitsInfoSrc1 % 4 == 0,
  2074. "MRBB::bInit: cbBitsInfoSrc1 is not dword aligned");
  2075. ASSERTGDI(offBitsSrc1 % 4 == 0,
  2076. "MRBB::bInit: offBitsSrc1 is not dword aligned");
  2077. ASSERTGDI(cbBitsSrc1 % 4 == 0,
  2078. "MRBB::bInit: cbBitsSrc1 is not dword aligned");
  2079. ASSERTGDI((clrBkSrc1 & 0xFF000000) == 0,
  2080. "MRBB::bInit: bad cbBitsSrc1");
  2081. MRB::vInit(iType1, pmdc1);
  2082. xDst = xDst1;
  2083. yDst = yDst1;
  2084. cxDst = cxDst1;
  2085. cyDst = cyDst1;
  2086. rop = rop1;
  2087. xSrc = xSrc1;
  2088. ySrc = ySrc1;
  2089. xformSrc = *pxformSrc1;
  2090. clrBkSrc = clrBkSrc1;
  2091. iUsageSrc = DIB_RGB_COLORS;
  2092. offBitsInfoSrc = offBitsInfoSrc1;
  2093. cbBitsInfoSrc = cbBitsInfoSrc1;
  2094. offBitsSrc = offBitsSrc1;
  2095. cbBitsSrc = cbBitsSrc1;
  2096. // Get the bits if it has a bitmap.
  2097. if (hbmSrc1)
  2098. {
  2099. // Initialize the bitmap info header first.
  2100. *(PBMIH) ((PBYTE) this + offBitsInfoSrc1) = *pbmihSrc1;
  2101. // Get bitmap info and bits.
  2102. if (!GetDIBits(pmdc1->hdcSrc,
  2103. hbmSrc1,
  2104. 0,
  2105. (UINT) pbmihSrc1->biHeight,
  2106. (LPBYTE) ((PBYTE) this + offBitsSrc1),
  2107. (LPBITMAPINFO) ((PBYTE) this + offBitsInfoSrc1),
  2108. DIB_RGB_COLORS))
  2109. {
  2110. return(FALSE);
  2111. }
  2112. // If it is a monochrome bitmap, we will overwrite the color
  2113. // table with the current text color and background color.
  2114. // We create only dib bitmaps at playback time so that we get
  2115. // the same output on both monochrome and color playback devices.
  2116. // We should probably record the correct colors (black/white or
  2117. // text/background) depending on the recording device. However,
  2118. // we are only given a reference device that can be color or
  2119. // monochrome if it is a memory DC. For now, we assume color
  2120. // conversion always occurs for monochrome bitmap
  2121. // See also MRPLGBLT::bInit().
  2122. if (MonoBitmap((HBITMAP)hbmSrc1))
  2123. {
  2124. RGBQUAD *prgbq;
  2125. DWORD rgb;
  2126. prgbq = (RGBQUAD *) ((PBYTE) this
  2127. + offBitsInfoSrc1
  2128. + cbBitsInfoSrc1
  2129. - 2 * sizeof(RGBQUAD));
  2130. rgb = (DWORD) GetNearestColor(pmdc1->hdcRef,
  2131. GetTextColor(pmdc1->hdcRef));
  2132. prgbq[0].rgbBlue = GetBValue(rgb);
  2133. prgbq[0].rgbGreen = GetGValue(rgb);
  2134. prgbq[0].rgbRed = GetRValue(rgb);
  2135. prgbq[0].rgbReserved = 0;
  2136. rgb = (DWORD) GetNearestColor(pmdc1->hdcRef,
  2137. GetBkColor(pmdc1->hdcRef));
  2138. prgbq[1].rgbBlue = GetBValue(rgb);
  2139. prgbq[1].rgbGreen = GetGValue(rgb);
  2140. prgbq[1].rgbRed = GetRValue(rgb);
  2141. prgbq[1].rgbReserved = 0;
  2142. }
  2143. }
  2144. return(TRUE);
  2145. }
  2146. BOOL bCheckRecord(PHANDLETABLE pht);
  2147. };
  2148. typedef MRBB *PMRBB;
  2149. #define SIZEOF_MRBB(cbBitsInfoSrc,cbBitsSrc) \
  2150. (sizeof(MRBB) + (cbBitsInfoSrc) + (cbBitsSrc))
  2151. inline BOOL MRBB::bCheckRecord(PHANDLETABLE pht)
  2152. {
  2153. if (SIZEOF_MRBB(cbBitsInfoSrc,cbBitsSrc) == nSize && bValidSize(pht, nSize))
  2154. return(TRUE);
  2155. vMarkFoundBad(pht);
  2156. EMFVALFAIL(("MRBB::bCheckRecord(%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc));
  2157. return(FALSE);
  2158. }
  2159. class MRBITBLT : public MRBB /* mrbb */
  2160. {
  2161. public:
  2162. // bPlay -- Play the record.
  2163. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2164. };
  2165. typedef MRBITBLT *PMRBITBLT;
  2166. /*********************************Class************************************\
  2167. * class MRSTRETCHBLT : public MRBB
  2168. *
  2169. * STRETCHBLT record.
  2170. *
  2171. * History:
  2172. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2173. * Wrote it.
  2174. \**************************************************************************/
  2175. class MRSTRETCHBLT : public MRBB /* mrsb */
  2176. {
  2177. protected:
  2178. LONG cxSrc; // source width
  2179. LONG cySrc; // source height
  2180. public:
  2181. // Initializer -- Initialize the metafile record.
  2182. BOOL bInit
  2183. (
  2184. PMDC pmdc1,
  2185. LONG xDst1,
  2186. LONG yDst1,
  2187. LONG cxDst1,
  2188. LONG cyDst1,
  2189. DWORD rop1,
  2190. LONG xSrc1,
  2191. LONG ySrc1,
  2192. LONG cxSrc1,
  2193. LONG cySrc1,
  2194. PXFORM pxformSrc1,
  2195. COLORREF clrBkSrc1,
  2196. PBMIH pbmihSrc1,
  2197. HBITMAP hbmSrc1,
  2198. DWORD offBitsInfoSrc1,
  2199. DWORD cbBitsInfoSrc1,
  2200. DWORD offBitsSrc1,
  2201. DWORD cbBitsSrc1
  2202. )
  2203. {
  2204. PUTS("MRSTRETCHBLT::bInit\n");
  2205. cxSrc = cxSrc1;
  2206. cySrc = cySrc1;
  2207. return
  2208. (
  2209. MRBB::bInit
  2210. (
  2211. EMR_STRETCHBLT,
  2212. pmdc1,
  2213. xDst1,
  2214. yDst1,
  2215. cxDst1,
  2216. cyDst1,
  2217. rop1,
  2218. xSrc1,
  2219. ySrc1,
  2220. pxformSrc1,
  2221. clrBkSrc1,
  2222. pbmihSrc1,
  2223. hbmSrc1,
  2224. offBitsInfoSrc1,
  2225. cbBitsInfoSrc1,
  2226. offBitsSrc1,
  2227. cbBitsSrc1
  2228. )
  2229. );
  2230. }
  2231. // bPlay -- Play the record.
  2232. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2233. BOOL bCheckRecord(PHANDLETABLE pht);
  2234. };
  2235. typedef MRSTRETCHBLT *PMRSTRETCHBLT;
  2236. #define SIZEOF_MRSTRETCHBLT(cbBitsInfoSrc,cbBitsSrc) \
  2237. (SIZEOF_MRBB((cbBitsInfoSrc),(cbBitsSrc)) \
  2238. + sizeof(MRSTRETCHBLT) \
  2239. - sizeof(MRBB))
  2240. inline BOOL MRSTRETCHBLT::bCheckRecord(PHANDLETABLE pht)
  2241. {
  2242. if (SIZEOF_MRSTRETCHBLT(cbBitsInfoSrc,cbBitsSrc) == nSize && bValidSize(pht, nSize))
  2243. return(TRUE);
  2244. vMarkFoundBad(pht);
  2245. EMFVALFAIL(("MRSTRETCHBLT::bCheckRecord(%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc));
  2246. return(FALSE);
  2247. }
  2248. /*********************************Class************************************\
  2249. * class MRMASKBLT : public MRBB
  2250. *
  2251. * MASKBLT record.
  2252. *
  2253. * History:
  2254. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2255. * Wrote it.
  2256. \**************************************************************************/
  2257. class MRMASKBLT : public MRBB /* mrsb */
  2258. {
  2259. protected:
  2260. LONG xMask; // mask x origin
  2261. LONG yMask; // mask y origin
  2262. DWORD iUsageMask; // color table usage in mask's bitmap info.
  2263. // This contains DIB_PAL_INDICES.
  2264. DWORD offBitsInfoMask;// offset to mask bitmap info
  2265. DWORD cbBitsInfoMask; // size of mask bitmap info
  2266. DWORD offBitsMask; // offset to mask bits
  2267. DWORD cbBitsMask; // size of mask bits buffer
  2268. public:
  2269. // Initializer -- Initialize the metafile record.
  2270. BOOL bInit
  2271. (
  2272. PMDC pmdc1,
  2273. LONG xDst1,
  2274. LONG yDst1,
  2275. LONG cxDst1,
  2276. LONG cyDst1,
  2277. DWORD rop1, // this is rop3!
  2278. LONG xSrc1,
  2279. LONG ySrc1,
  2280. PXFORM pxformSrc1,
  2281. COLORREF clrBkSrc1,
  2282. PBMIH pbmihSrc1,
  2283. HBITMAP hbmSrc1,
  2284. DWORD offBitsInfoSrc1,
  2285. DWORD cbBitsInfoSrc1,
  2286. DWORD offBitsSrc1,
  2287. DWORD cbBitsSrc1,
  2288. LONG xMask1,
  2289. LONG yMask1,
  2290. PBMIH pbmihMask1,
  2291. HBITMAP hbmMask1,
  2292. DWORD offBitsInfoMask1,
  2293. DWORD cbBitsInfoMask1,
  2294. DWORD offBitsMask1,
  2295. DWORD cbBitsMask1
  2296. )
  2297. {
  2298. PUTS("MRMASKBLT::bInit\n");
  2299. ASSERTGDI(offBitsInfoMask1 % 4 == 0,
  2300. "MRMASKBLT::bInit: offBitsInfoMask1 is not dword aligned");
  2301. ASSERTGDI(cbBitsInfoMask1 % 4 == 0,
  2302. "MRMASKBLT::bInit: cbBitsInfoMask1 is not dword aligned");
  2303. ASSERTGDI(offBitsMask1 % 4 == 0,
  2304. "MRMASKBLT::bInit: offBitsMask1 is not dword aligned");
  2305. ASSERTGDI(cbBitsMask1 % 4 == 0,
  2306. "MRMASKBLT::bInit: cbBitsMask1 is not dword aligned");
  2307. xMask = xMask1;
  2308. yMask = yMask1;
  2309. iUsageMask = DIB_PAL_INDICES;
  2310. offBitsInfoMask = offBitsInfoMask1;
  2311. cbBitsInfoMask = cbBitsInfoMask1;
  2312. offBitsMask = offBitsMask1;
  2313. cbBitsMask = cbBitsMask1;
  2314. // Get the mask bits if it has a mask.
  2315. if (hbmMask1)
  2316. {
  2317. // Initialize the mask bitmap info header first.
  2318. *(PBMIH) ((PBYTE) this + offBitsInfoMask1) = *pbmihMask1;
  2319. // Get mask bitmap info and bits.
  2320. if (!GetDIBits(pmdc1->hdcRef,
  2321. hbmMask1,
  2322. 0,
  2323. (UINT) pbmihMask1->biHeight,
  2324. (LPBYTE) ((PBYTE) this + offBitsMask1),
  2325. (LPBITMAPINFO) ((PBYTE) this + offBitsInfoMask1),
  2326. DIB_PAL_INDICES))
  2327. return(FALSE);
  2328. }
  2329. return
  2330. (
  2331. MRBB::bInit
  2332. (
  2333. EMR_MASKBLT,
  2334. pmdc1,
  2335. xDst1,
  2336. yDst1,
  2337. cxDst1,
  2338. cyDst1,
  2339. rop1,
  2340. xSrc1,
  2341. ySrc1,
  2342. pxformSrc1,
  2343. clrBkSrc1,
  2344. pbmihSrc1,
  2345. hbmSrc1,
  2346. offBitsInfoSrc1,
  2347. cbBitsInfoSrc1,
  2348. offBitsSrc1,
  2349. cbBitsSrc1
  2350. )
  2351. );
  2352. }
  2353. // bPlay -- Play the record.
  2354. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2355. BOOL bCheckRecord(PHANDLETABLE pht);
  2356. };
  2357. typedef MRMASKBLT *PMRMASKBLT;
  2358. #define SIZEOF_MRMASKBLT(cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask) \
  2359. (SIZEOF_MRBB((cbBitsInfoSrc),(cbBitsSrc)) \
  2360. + sizeof(MRMASKBLT) \
  2361. - sizeof(MRBB) \
  2362. + (cbBitsInfoMask) + (cbBitsMask))
  2363. inline BOOL MRMASKBLT::bCheckRecord(PHANDLETABLE pht)
  2364. {
  2365. if (SIZEOF_MRMASKBLT(cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask) == nSize && bValidSize(pht, nSize))
  2366. return(TRUE);
  2367. vMarkFoundBad(pht);
  2368. EMFVALFAIL(("MRMASKBLT::bCheckRecord(%08x,%08x,%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask));
  2369. return(FALSE);
  2370. }
  2371. /*********************************Class************************************\
  2372. * class MRPLGBLT : public MRB
  2373. *
  2374. * PLGBLT record.
  2375. *
  2376. * History:
  2377. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2378. * Wrote it.
  2379. \**************************************************************************/
  2380. class MRPLGBLT : public MRB /* mrpb */
  2381. {
  2382. protected:
  2383. POINTL aptlDst[3]; // destination parallelogram
  2384. LONG xSrc; // source x origin
  2385. LONG ySrc; // source y origin
  2386. LONG cxSrc; // source width
  2387. LONG cySrc; // source height
  2388. XFORM xformSrc; // source DC transform
  2389. COLORREF clrBkSrc; // source DC BkColor. This must be a RGB value.
  2390. // The bitmap info contains literal RGB values in the color table.
  2391. DWORD iUsageSrc; // color table usage in bitmap info.
  2392. // This contains DIB_RGB_COLORS.
  2393. DWORD offBitsInfoSrc; // offset to bitmap info
  2394. DWORD cbBitsInfoSrc; // size of bitmap info
  2395. DWORD offBitsSrc; // offset to bits
  2396. DWORD cbBitsSrc; // size of bits buffer
  2397. LONG xMask; // mask x origin
  2398. LONG yMask; // mask y origin
  2399. DWORD iUsageMask; // color table usage in mask's bitmap info.
  2400. // This contains DIB_PAL_INDICES.
  2401. DWORD offBitsInfoMask;// offset to mask bitmap info
  2402. DWORD cbBitsInfoMask; // size of mask bitmap info
  2403. DWORD offBitsMask; // offset to mask bits
  2404. DWORD cbBitsMask; // size of mask bits buffer
  2405. public:
  2406. // Initializer -- Initialize the metafile record.
  2407. BOOL bInit
  2408. (
  2409. PMDC pmdc1,
  2410. CONST POINT *pptDst1,
  2411. LONG xSrc1,
  2412. LONG ySrc1,
  2413. LONG cxSrc1,
  2414. LONG cySrc1,
  2415. PXFORM pxformSrc1,
  2416. COLORREF clrBkSrc1,
  2417. PBMIH pbmihSrc1,
  2418. HBITMAP hbmSrc1,
  2419. DWORD offBitsInfoSrc1,
  2420. DWORD cbBitsInfoSrc1,
  2421. DWORD offBitsSrc1,
  2422. DWORD cbBitsSrc1,
  2423. LONG xMask1,
  2424. LONG yMask1,
  2425. PBMIH pbmihMask1,
  2426. HBITMAP hbmMask1,
  2427. DWORD offBitsInfoMask1,
  2428. DWORD cbBitsInfoMask1,
  2429. DWORD offBitsMask1,
  2430. DWORD cbBitsMask1
  2431. )
  2432. {
  2433. PUTS("MRPLGBLT::bInit\n");
  2434. ASSERTGDI(offBitsInfoSrc1 % 4 == 0,
  2435. "MRPLGBLT::bInit: offBitsInfoSrc1 is not dword aligned");
  2436. ASSERTGDI(cbBitsInfoSrc1 % 4 == 0,
  2437. "MRPLGBLT::bInit: cbBitsInfoSrc1 is not dword aligned");
  2438. ASSERTGDI(offBitsSrc1 % 4 == 0,
  2439. "MRPLGBLT::bInit: offBitsSrc1 is not dword aligned");
  2440. ASSERTGDI(cbBitsSrc1 % 4 == 0,
  2441. "MRPLGBLT::bInit: cbBitsSrc1 is not dword aligned");
  2442. ASSERTGDI(offBitsInfoMask1 % 4 == 0,
  2443. "MRPLGBLT::bInit: offBitsInfoMask1 is not dword aligned");
  2444. ASSERTGDI(cbBitsInfoMask1 % 4 == 0,
  2445. "MRPLGBLT::bInit: cbBitsInfoMask1 is not dword aligned");
  2446. ASSERTGDI(offBitsMask1 % 4 == 0,
  2447. "MRPLGBLT::bInit: offBitsMask1 is not dword aligned");
  2448. ASSERTGDI(cbBitsMask1 % 4 == 0,
  2449. "MRPLGBLT::bInit: cbBitsMask1 is not dword aligned");
  2450. ASSERTGDI(pxformSrc1 != (PXFORM) NULL,
  2451. "MRPLGBLT::bInit: pxformSrc1 is NULL");
  2452. ASSERTGDI((clrBkSrc1 & 0xFF000000) == 0,
  2453. "MRPLGBLT::bInit: bad cbBitsSrc1");
  2454. MRB::vInit(EMR_PLGBLT, pmdc1);
  2455. aptlDst[0] = *(PPOINTL) &pptDst1[0];
  2456. aptlDst[1] = *(PPOINTL) &pptDst1[1];
  2457. aptlDst[2] = *(PPOINTL) &pptDst1[2];
  2458. xSrc = xSrc1;
  2459. ySrc = ySrc1;
  2460. cxSrc = cxSrc1;
  2461. cySrc = cySrc1;
  2462. xformSrc = *pxformSrc1;
  2463. clrBkSrc = clrBkSrc1;
  2464. iUsageSrc = DIB_RGB_COLORS;
  2465. offBitsInfoSrc = offBitsInfoSrc1;
  2466. cbBitsInfoSrc = cbBitsInfoSrc1;
  2467. offBitsSrc = offBitsSrc1;
  2468. cbBitsSrc = cbBitsSrc1;
  2469. xMask = xMask1;
  2470. yMask = yMask1;
  2471. iUsageMask = DIB_PAL_INDICES;
  2472. offBitsInfoMask = offBitsInfoMask1;
  2473. cbBitsInfoMask = cbBitsInfoMask1;
  2474. offBitsMask = offBitsMask1;
  2475. cbBitsMask = cbBitsMask1;
  2476. // Get the bits from the source bitmap.
  2477. // Initialize the bitmap info header first.
  2478. *(PBMIH) ((PBYTE) this + offBitsInfoSrc1) = *pbmihSrc1;
  2479. // Get bitmap info and bits.
  2480. if (!GetDIBits(pmdc1->hdcRef,
  2481. hbmSrc1,
  2482. 0,
  2483. (UINT) pbmihSrc1->biHeight,
  2484. (LPBYTE) ((PBYTE) this + offBitsSrc1),
  2485. (LPBITMAPINFO) ((PBYTE) this + offBitsInfoSrc1),
  2486. DIB_RGB_COLORS))
  2487. return(FALSE);
  2488. // If it is a monochrome bitmap, we will overwrite the color
  2489. // table with the current text color and background color.
  2490. // We create only dib bitmaps at playback time so that we get
  2491. // the same output on both monochrome and color playback devices.
  2492. // We should probably record the correct colors (black/white or
  2493. // text/background) depending on the recording device. However,
  2494. // we are only given a reference device that can be color or
  2495. // monochrome if it is a memory DC. For now, we assume color
  2496. // conversion always occurs for monochrome bitmap!!!
  2497. // See also MRBB::bInit().
  2498. if (MonoBitmap((HBITMAP)hbmSrc1))
  2499. {
  2500. RGBQUAD *prgbq;
  2501. DWORD rgb;
  2502. prgbq = (RGBQUAD *) ((PBYTE) this
  2503. + offBitsInfoSrc1
  2504. + cbBitsInfoSrc1
  2505. - 2 * sizeof(RGBQUAD));
  2506. rgb = (DWORD) GetNearestColor(pmdc1->hdcRef,
  2507. GetTextColor(pmdc1->hdcRef));
  2508. prgbq[0].rgbBlue = GetBValue(rgb);
  2509. prgbq[0].rgbGreen = GetGValue(rgb);
  2510. prgbq[0].rgbRed = GetRValue(rgb);
  2511. prgbq[0].rgbReserved = 0;
  2512. rgb = (DWORD) GetNearestColor(pmdc1->hdcRef,
  2513. GetBkColor(pmdc1->hdcRef));
  2514. prgbq[1].rgbBlue = GetBValue(rgb);
  2515. prgbq[1].rgbGreen = GetGValue(rgb);
  2516. prgbq[1].rgbRed = GetRValue(rgb);
  2517. prgbq[1].rgbReserved = 0;
  2518. }
  2519. // Get the mask bits if it has a mask.
  2520. if (hbmMask1)
  2521. {
  2522. // Initialize the mask bitmap info header first.
  2523. *(PBMIH) ((PBYTE) this + offBitsInfoMask1) = *pbmihMask1;
  2524. // Get mask bitmap info and bits.
  2525. if (!GetDIBits(pmdc1->hdcRef,
  2526. hbmMask1,
  2527. 0,
  2528. (UINT) pbmihMask1->biHeight,
  2529. (LPBYTE) ((PBYTE) this + offBitsMask1),
  2530. (LPBITMAPINFO) ((PBYTE) this + offBitsInfoMask1),
  2531. DIB_PAL_INDICES))
  2532. return(FALSE);
  2533. }
  2534. return(TRUE);
  2535. }
  2536. // bPlay -- Play the record.
  2537. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2538. BOOL bCheckRecord(PHANDLETABLE pht);
  2539. };
  2540. typedef MRPLGBLT *PMRPLGBLT;
  2541. #define SIZEOF_MRPLGBLT(cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask) \
  2542. (sizeof(MRPLGBLT) + (cbBitsInfoSrc) + (cbBitsSrc) + (cbBitsInfoMask) + (cbBitsMask))
  2543. inline BOOL MRPLGBLT::bCheckRecord(PHANDLETABLE pht)
  2544. {
  2545. if (SIZEOF_MRPLGBLT(cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask) == nSize && bValidSize(pht, nSize))
  2546. return(TRUE);
  2547. vMarkFoundBad(pht);
  2548. EMFVALFAIL(("MRPLGBLT::bCheckRecord(%08x,%08x,%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc,cbBitsInfoMask,cbBitsMask));
  2549. return(FALSE);
  2550. }
  2551. /*********************************Class************************************\
  2552. * class MRALPHABLEND : public MRBB
  2553. *
  2554. * STRETCHBLT record.
  2555. *
  2556. * History:
  2557. *
  2558. * 12/3/1996 Mark Enstrom [marke]
  2559. *
  2560. \**************************************************************************/
  2561. class MRALPHABLEND : public MRBB /* mrsb */
  2562. {
  2563. protected:
  2564. LONG cxSrc; // source width
  2565. LONG cySrc; // source height
  2566. public:
  2567. // Initializer -- Initialize the metafile record.
  2568. BOOL bInit
  2569. (
  2570. PMDC pmdc1,
  2571. LONG xDst1,
  2572. LONG yDst1,
  2573. LONG cxDst1,
  2574. LONG cyDst1,
  2575. DWORD rop1,
  2576. LONG xSrc1,
  2577. LONG ySrc1,
  2578. LONG cxSrc1,
  2579. LONG cySrc1,
  2580. PXFORM pxformSrc1,
  2581. COLORREF clrBkSrc1,
  2582. PBMIH pbmihSrc1,
  2583. HBITMAP hbmSrc1,
  2584. DWORD offBitsInfoSrc1,
  2585. DWORD cbBitsInfoSrc1,
  2586. DWORD offBitsSrc1,
  2587. DWORD cbBitsSrc1
  2588. )
  2589. {
  2590. PUTS("MRALPHABLEND::bInit\n");
  2591. cxSrc = cxSrc1;
  2592. cySrc = cySrc1;
  2593. return
  2594. (
  2595. MRBB::bInit
  2596. (
  2597. EMR_ALPHABLEND,
  2598. pmdc1,
  2599. xDst1,
  2600. yDst1,
  2601. cxDst1,
  2602. cyDst1,
  2603. rop1,
  2604. xSrc1,
  2605. ySrc1,
  2606. pxformSrc1,
  2607. clrBkSrc1,
  2608. pbmihSrc1,
  2609. hbmSrc1,
  2610. offBitsInfoSrc1,
  2611. cbBitsInfoSrc1,
  2612. offBitsSrc1,
  2613. cbBitsSrc1
  2614. )
  2615. );
  2616. }
  2617. // bPlay -- Play the record.
  2618. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2619. BOOL bCheckRecord(PHANDLETABLE pht);
  2620. };
  2621. typedef MRALPHABLEND *PMRALPHABLEND;
  2622. #define SIZEOF_MRALPHABLEND(cbBitsInfoSrc,cbBitsSrc) \
  2623. (SIZEOF_MRBB((cbBitsInfoSrc),(cbBitsSrc)) \
  2624. + sizeof(MRALPHABLEND) \
  2625. - sizeof(MRBB))
  2626. inline BOOL MRALPHABLEND::bCheckRecord(PHANDLETABLE pht)
  2627. {
  2628. if (SIZEOF_MRALPHABLEND(cbBitsInfoSrc,cbBitsSrc) == nSize && bValidSize(pht, nSize))
  2629. return(TRUE);
  2630. vMarkFoundBad(pht);
  2631. EMFVALFAIL(("MRALPHABLEND::bCheckRecord(%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc));
  2632. return(FALSE);
  2633. }
  2634. /*********************************Class************************************\
  2635. * class MRTRANSPARENTBLT : public MRBB
  2636. *
  2637. * STRETCHBLT record.
  2638. *
  2639. * History:
  2640. *
  2641. * 12/3/1996 Mark Enstrom [marke]
  2642. *
  2643. \**************************************************************************/
  2644. class MRTRANSPARENTBLT : public MRBB /* mrsb */
  2645. {
  2646. protected:
  2647. LONG cxSrc; // source width
  2648. LONG cySrc; // source height
  2649. public:
  2650. // Initializer -- Initialize the metafile record.
  2651. BOOL bInit
  2652. (
  2653. PMDC pmdc1,
  2654. LONG xDst1,
  2655. LONG yDst1,
  2656. LONG cxDst1,
  2657. LONG cyDst1,
  2658. DWORD rop1,
  2659. LONG xSrc1,
  2660. LONG ySrc1,
  2661. LONG cxSrc1,
  2662. LONG cySrc1,
  2663. PXFORM pxformSrc1,
  2664. COLORREF clrBkSrc1,
  2665. PBMIH pbmihSrc1,
  2666. HBITMAP hbmSrc1,
  2667. DWORD offBitsInfoSrc1,
  2668. DWORD cbBitsInfoSrc1,
  2669. DWORD offBitsSrc1,
  2670. DWORD cbBitsSrc1
  2671. )
  2672. {
  2673. PUTS("MRTRANSPARENTBLT::bInit\n");
  2674. cxSrc = cxSrc1;
  2675. cySrc = cySrc1;
  2676. return
  2677. (
  2678. MRBB::bInit
  2679. (
  2680. EMR_TRANSPARENTBLT,
  2681. pmdc1,
  2682. xDst1,
  2683. yDst1,
  2684. cxDst1,
  2685. cyDst1,
  2686. rop1,
  2687. xSrc1,
  2688. ySrc1,
  2689. pxformSrc1,
  2690. clrBkSrc1,
  2691. pbmihSrc1,
  2692. hbmSrc1,
  2693. offBitsInfoSrc1,
  2694. cbBitsInfoSrc1,
  2695. offBitsSrc1,
  2696. cbBitsSrc1
  2697. )
  2698. );
  2699. }
  2700. // bPlay -- Play the record.
  2701. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2702. BOOL bCheckRecord(PHANDLETABLE pht);
  2703. };
  2704. typedef MRTRANSPARENTBLT *PMRTRANSPARENTBLT;
  2705. #define SIZEOF_MRTRANSPARENTBLT(cbBitsInfoSrc,cbBitsSrc) \
  2706. (SIZEOF_MRBB((cbBitsInfoSrc),(cbBitsSrc)) \
  2707. + sizeof(MRTRANSPARENTBLT) \
  2708. - sizeof(MRBB))
  2709. inline BOOL MRTRANSPARENTBLT::bCheckRecord(PHANDLETABLE pht)
  2710. {
  2711. if(SIZEOF_MRTRANSPARENTBLT(cbBitsInfoSrc,cbBitsSrc) == nSize && bValidSize(pht, nSize))
  2712. return(TRUE);
  2713. vMarkFoundBad(pht);
  2714. EMFVALFAIL(("MRTRANSPARENTBLT::bCheckRecord(%08x,%08x) failed\n", cbBitsInfoSrc,cbBitsSrc));
  2715. return(FALSE);
  2716. }
  2717. /*********************************Class************************************\
  2718. * class MRBDIB : public MRB
  2719. *
  2720. * Metafile record with Bounds and Dib.
  2721. *
  2722. * History:
  2723. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2724. * Wrote it.
  2725. \**************************************************************************/
  2726. class MRBDIB : public MRB /* mrsdb */
  2727. {
  2728. protected:
  2729. LONG xDst; // destination x origin
  2730. LONG yDst; // destination y origin
  2731. LONG xDib; // dib x origin
  2732. LONG yDib; // dib y origin
  2733. LONG cxDib; // dib width
  2734. LONG cyDib; // dib height
  2735. DWORD offBitsInfoDib; // offset to dib info, we don't store core info.
  2736. DWORD cbBitsInfoDib; // size of dib info
  2737. DWORD offBitsDib; // offset to dib bits
  2738. DWORD cbBitsDib; // size of dib bits buffer
  2739. DWORD iUsageDib; // color table usage in bitmap info.
  2740. public:
  2741. // Initializer -- Initialize the metafile record.
  2742. VOID vInit
  2743. (
  2744. DWORD iType1,
  2745. PMDC pmdc1,
  2746. LONG xDst1,
  2747. LONG yDst1,
  2748. LONG xDib1,
  2749. LONG yDib1,
  2750. LONG cxDib1,
  2751. LONG cyDib1,
  2752. DWORD offBitsInfoDib1,
  2753. DWORD cbBitsInfoDib1,
  2754. CONST BITMAPINFO *pBitsInfoDib1,
  2755. DWORD offBitsDib1,
  2756. DWORD cbBitsDib1,
  2757. CONST VOID * pBitsDib1,
  2758. DWORD iUsageDib1,
  2759. DWORD cbProfData1 = 0, // Only used with BITMAPV5
  2760. CONST VOID * pProfData1 = NULL // Only used with BITMAPV5
  2761. )
  2762. {
  2763. PUTS("MRBDIB::vInit\n");
  2764. // cbBitsInfoDib1 and cbBitsDib1 may not be dword sized!
  2765. ASSERTGDI(offBitsDib1 % 4 == 0,
  2766. "MRBDIB::vInit: offBitsDib1 is not dword aligned");
  2767. ASSERTGDI(offBitsInfoDib1 % 4 == 0,
  2768. "MRBDIB::vInit: offBitsInfoDib1 is not dword aligned");
  2769. // +---------------------+ <--- offBitsInfoDib1
  2770. // | Bitmap Info header | |
  2771. // +- - - - - - - - - - -+ +- cbBitsInfoDib1
  2772. // | Color Table | |
  2773. // +- - - - - - - - - - -+ ---
  2774. // | | |
  2775. // | Color Profile Data | +- cbProfData1
  2776. // | (BITMAPV5 only) | |
  2777. // +---------------------+ <--- offBitsDib1
  2778. // | | |
  2779. // | Bitmap Bits | +- cbBitsDib1
  2780. // | | |
  2781. // +---------------------+ ---
  2782. MRB::vInit(iType1, pmdc1);
  2783. xDst = xDst1;
  2784. yDst = yDst1;
  2785. xDib = xDib1;
  2786. yDib = yDib1;
  2787. cxDib = cxDib1;
  2788. cyDib = cyDib1;
  2789. offBitsInfoDib = offBitsInfoDib1;
  2790. cbBitsInfoDib = cbBitsInfoDib1 + cbProfData1;
  2791. offBitsDib = offBitsDib1;
  2792. cbBitsDib = cbBitsDib1;
  2793. iUsageDib = iUsageDib1;
  2794. // Copy dib info if given.
  2795. if (cbBitsInfoDib1)
  2796. {
  2797. if (pBitsInfoDib1->bmiHeader.biSize == sizeof(BMCH))
  2798. {
  2799. CopyCoreToInfoHeader
  2800. (
  2801. (LPBITMAPINFOHEADER) ((PBYTE) this + offBitsInfoDib1),
  2802. (LPBITMAPCOREHEADER) pBitsInfoDib1
  2803. );
  2804. if (iUsageDib1 == DIB_RGB_COLORS)
  2805. {
  2806. RGBQUAD *prgbq;
  2807. RGBTRIPLE *prgbt;
  2808. UINT ui;
  2809. prgbq = ((PBMI) ((PBYTE) this + offBitsInfoDib1))->bmiColors;
  2810. prgbt = ((PBMC) pBitsInfoDib1)->bmciColors;
  2811. ASSERTGDI(cbBitsInfoDib1 >= sizeof(BMIH),
  2812. "MRBDIB::vInit: Bad cbBitsInfoDib1 size");
  2813. for
  2814. (
  2815. ui = (UINT) (cbBitsInfoDib1 - sizeof(BMIH))
  2816. / sizeof(RGBQUAD);
  2817. ui;
  2818. ui--
  2819. )
  2820. {
  2821. prgbq->rgbBlue = prgbt->rgbtBlue;
  2822. prgbq->rgbGreen = prgbt->rgbtGreen;
  2823. prgbq->rgbRed = prgbt->rgbtRed;
  2824. prgbq->rgbReserved = 0;
  2825. prgbq++; prgbt++;
  2826. }
  2827. }
  2828. else
  2829. {
  2830. RtlCopyMemory
  2831. (
  2832. (PBYTE) this + offBitsInfoDib1 + sizeof(BMIH),
  2833. (PBYTE) pBitsInfoDib1 + sizeof(BMCH),
  2834. cbBitsInfoDib1 - sizeof(BMIH)
  2835. );
  2836. }
  2837. }
  2838. else
  2839. {
  2840. // Copy BitmapInfoHeader and color table
  2841. RtlCopyMemory
  2842. (
  2843. (PBYTE) this + offBitsInfoDib1,
  2844. (PBYTE) pBitsInfoDib1,
  2845. cbBitsInfoDib1
  2846. );
  2847. // Copy color profile (if nessesary)
  2848. if (pProfData1 && cbProfData1)
  2849. {
  2850. // This is BITMAPV5, get the pointer to the BITMAPV5 structure in metafile.
  2851. PBITMAPV5HEADER pBmih5 = (PBITMAPV5HEADER)((PBYTE)this + offBitsInfoDib1);
  2852. ASSERTGDI(pBmih5->bV5Size == sizeof(BITMAPV5HEADER),
  2853. "MRBDIB::vInit():Not Bitmap V5, but color profile\n");
  2854. // Copy color profile data right after the color table
  2855. DWORD offProfData = (cbBitsInfoDib1 + 3) / 4 * 4;
  2856. RtlCopyMemory
  2857. (
  2858. (PBYTE) this + offBitsInfoDib1 + offProfData,
  2859. (PBYTE) pProfData1,
  2860. cbProfData1
  2861. );
  2862. // Fix up the profile offset in BITMAPV5 header.
  2863. pBmih5->bV5ProfileData = offProfData;
  2864. }
  2865. }
  2866. }
  2867. // Copy dib bits.
  2868. if (cbBitsDib1 >= MMAPCOPY_THRESHOLD && pmdc1->bIsEMFSpool())
  2869. {
  2870. CopyMemoryToMemoryMappedFile(
  2871. (PBYTE) this + offBitsDib1,
  2872. pBitsDib1,
  2873. cbBitsDib1);
  2874. }
  2875. else
  2876. {
  2877. RtlCopyMemory((PBYTE) this + offBitsDib1, pBitsDib1, cbBitsDib1);
  2878. }
  2879. }
  2880. };
  2881. /*********************************Class************************************\
  2882. * class MRSETDIBITSTODEVICE : public MRBDIB
  2883. *
  2884. * SETDIBITSTODEVICE record.
  2885. *
  2886. * History:
  2887. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2888. * Wrote it.
  2889. \**************************************************************************/
  2890. class MRSETDIBITSTODEVICE : public MRBDIB /* mrsdb */
  2891. {
  2892. protected:
  2893. DWORD iStartScan; // start scan
  2894. DWORD cScans; // number of scans
  2895. public:
  2896. // Initializer -- Initialize the metafile record.
  2897. VOID vInit
  2898. (
  2899. PMDC pmdc1,
  2900. LONG xDst1,
  2901. LONG yDst1,
  2902. LONG xDib1,
  2903. LONG yDib1,
  2904. DWORD cxDib1,
  2905. DWORD cyDib1,
  2906. DWORD iStartScan1,
  2907. DWORD cScans1,
  2908. DWORD cbBitsDib1,
  2909. CONST VOID * pBitsDib1,
  2910. DWORD cbBitsInfoDib1,
  2911. CONST BITMAPINFO *pBitsInfoDib1,
  2912. DWORD cbProfData1,
  2913. CONST VOID * pProfData1,
  2914. DWORD iUsageDib1
  2915. )
  2916. {
  2917. PUTS("MRSETDIBITSTODEVICE::vInit\n");
  2918. iStartScan = iStartScan1;
  2919. cScans = cScans1;
  2920. // cbBitsInfoDib1 and cbBitsDib1 may not be dword sized!
  2921. MRBDIB::vInit
  2922. (
  2923. EMR_SETDIBITSTODEVICE,
  2924. pmdc1,
  2925. xDst1,
  2926. yDst1,
  2927. xDib1,
  2928. yDib1,
  2929. (LONG) cxDib1,
  2930. (LONG) cyDib1,
  2931. sizeof(MRSETDIBITSTODEVICE),
  2932. cbBitsInfoDib1,
  2933. pBitsInfoDib1,
  2934. sizeof(MRSETDIBITSTODEVICE) // Bitmap Bits will be located at
  2935. + ((cbBitsInfoDib1 + 3) / 4 * 4) // ater bitmap info header and
  2936. + ((cbProfData1 + 3) / 4 * 4), // color profile data.
  2937. cbBitsDib1,
  2938. pBitsDib1,
  2939. iUsageDib1,
  2940. cbProfData1,
  2941. pProfData1
  2942. );
  2943. }
  2944. // bPlay -- Play the record.
  2945. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  2946. BOOL bCheckRecord(PHANDLETABLE pht);
  2947. };
  2948. typedef MRSETDIBITSTODEVICE *PMRSETDIBITSTODEVICE;
  2949. #define SIZEOF_MRSETDIBITSTODEVICE(cbBitsInfoDib,cbBitsDib,cbProfData) \
  2950. (sizeof(MRSETDIBITSTODEVICE) \
  2951. + (((cbBitsInfoDib) + 3) / 4 * 4) \
  2952. + (((cbProfData) + 3) / 4 * 4) \
  2953. + (((cbBitsDib) + 3) / 4 * 4))
  2954. inline BOOL MRSETDIBITSTODEVICE::bCheckRecord(PHANDLETABLE pht)
  2955. {
  2956. // Note we pass 0 as cbProfData as cbBitsInfoDib is store as the sum of
  2957. // the rounded up original cbProfData and rounded up original cbBitsInfoDib
  2958. if (SIZEOF_MRSETDIBITSTODEVICE(cbBitsInfoDib,cbBitsDib,0) == nSize && bValidSize(pht, nSize))
  2959. return(TRUE);
  2960. vMarkFoundBad(pht);
  2961. EMFVALFAIL(("MRSETDIBITSTODEVICE::bCheckRecord(%08x,%08x,%08x) failed\n", cbBitsInfoDib,cbBitsDib,0));
  2962. return(FALSE);
  2963. }
  2964. /*********************************Class************************************\
  2965. * class MRSTRETCHDIBITS : public MRBDIB
  2966. *
  2967. * STRETCHDIBITS record.
  2968. *
  2969. * History:
  2970. * Wed Nov 27 12:00:33 1991 -by- Hock San Lee [hockl]
  2971. * Wrote it.
  2972. \**************************************************************************/
  2973. class MRSTRETCHDIBITS : public MRBDIB /* mrstrdb */
  2974. {
  2975. protected:
  2976. DWORD rop; // raster operation code.
  2977. LONG cxDst; // destination width
  2978. LONG cyDst; // destination height
  2979. public:
  2980. // Initializer -- Initialize the metafile record.
  2981. VOID vInit
  2982. (
  2983. PMDC pmdc1,
  2984. LONG xDst1,
  2985. LONG yDst1,
  2986. LONG cxDst1,
  2987. LONG cyDst1,
  2988. LONG xDib1,
  2989. LONG yDib1,
  2990. LONG cxDib1,
  2991. LONG cyDib1,
  2992. DWORD cScans1,
  2993. DWORD cbBitsDib1,
  2994. CONST VOID * pBitsDib1,
  2995. DWORD cbBitsInfoDib1,
  2996. CONST BITMAPINFO *pBitsInfoDib1,
  2997. DWORD iUsageDib1,
  2998. DWORD cbProfData1,
  2999. CONST VOID * pProfData1,
  3000. DWORD rop1
  3001. )
  3002. {
  3003. PUTS("MRSTRETCHDIBITS::vInit\n");
  3004. rop = rop1;
  3005. cxDst = cxDst1;
  3006. cyDst = cyDst1;
  3007. // cbBitsInfoDib1 and cbBitsDib1 may not be dword sized!
  3008. MRBDIB::vInit
  3009. (
  3010. EMR_STRETCHDIBITS,
  3011. pmdc1,
  3012. xDst1,
  3013. yDst1,
  3014. xDib1,
  3015. yDib1,
  3016. cxDib1,
  3017. cyDib1,
  3018. sizeof(MRSTRETCHDIBITS),
  3019. cbBitsInfoDib1,
  3020. pBitsInfoDib1,
  3021. sizeof(MRSTRETCHDIBITS) // Bitmap bits will be located at
  3022. + ((cbBitsInfoDib1 + 3) / 4 * 4) // after bitmap info header and
  3023. + ((cbProfData1 + 3) / 4 * 4), // color profile data.
  3024. cbBitsDib1,
  3025. pBitsDib1,
  3026. iUsageDib1,
  3027. cbProfData1,
  3028. pProfData1
  3029. );
  3030. // set cScans1 in
  3031. if (cScans1 && cbBitsInfoDib1)
  3032. {
  3033. PBITMAPINFO pBitInfoTemp = (PBITMAPINFO)((PBYTE)this + sizeof(MRSTRETCHDIBITS));
  3034. pBitInfoTemp->bmiHeader.biHeight = cScans1;
  3035. pBitInfoTemp->bmiHeader.biSizeImage = cbBitsDib1;
  3036. }
  3037. }
  3038. // bPlay -- Play the record.
  3039. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3040. BOOL bCheckRecord(PHANDLETABLE pht);
  3041. };
  3042. typedef MRSTRETCHDIBITS *PMRSTRETCHDIBITS;
  3043. #define SIZEOF_MRSTRETCHDIBITS(cbBitsInfoDib,cbBitsDib,cbProfData)\
  3044. (sizeof(MRSTRETCHDIBITS) \
  3045. + (((cbBitsInfoDib) + 3) / 4 * 4) \
  3046. + (((cbProfData) + 3) / 4 * 4) \
  3047. + (((cbBitsDib) + 3) / 4 * 4))
  3048. inline BOOL MRSTRETCHDIBITS::bCheckRecord(PHANDLETABLE pht)
  3049. {
  3050. // Note we pass 0 as cbProfData as cbBitsInfoDib is stored as the sum
  3051. // of the rounded up original cbProfData and rounded up original
  3052. // cbBitsInfoDib
  3053. if (nSize == SIZEOF_MRSTRETCHDIBITS(cbBitsInfoDib,cbBitsDib,0) && bValidSize(pht, nSize))
  3054. return(TRUE);
  3055. vMarkFoundBad(pht);
  3056. EMFVALFAIL(("MRSTRETCHDIBITS::bCheckRecord(%08x,%08x,%08x) failed\n", cbBitsInfoDib,cbBitsDib,0));
  3057. return(FALSE);
  3058. }
  3059. /*********************************Class************************************\
  3060. * class MTEXT
  3061. *
  3062. * Base record for all textout metafile records.
  3063. *
  3064. * History:
  3065. * Thu Aug 24 15:20:33 1992 -by- Hock San Lee [hockl]
  3066. * Wrote it.
  3067. \**************************************************************************/
  3068. //NTFONT
  3069. class MTEXT
  3070. {
  3071. public:
  3072. EPOINTL eptlRef; // Logical coordinates of the reference point
  3073. DWORD cchString; // Number of chars in the string.
  3074. DWORD offString; // (Dword-aligned) offset to the string.
  3075. DWORD fOptions; // Flags for rectangle usage.
  3076. ERECTL ercl; // Opaque of clip rectangle if exists.
  3077. DWORD offaDx; // (Dword-aligned) offset to the distance array.
  3078. // If the distance array does not exist, it
  3079. // will be queried and recorded!
  3080. public:
  3081. // Initializer -- Initialize the metafile record.
  3082. BOOL bInit
  3083. (
  3084. HDC hdc1,
  3085. int x1,
  3086. int y1,
  3087. UINT fl1,
  3088. CONST RECT *prc1,
  3089. LPCSTR pString1,
  3090. int cchString1,
  3091. CONST INT *pdx1,
  3092. PMR pMR1,
  3093. DWORD offString1, // dword-aligned aDx follows the string
  3094. int cjCh1 // size of a character in bytes
  3095. );
  3096. };
  3097. /*********************************Class************************************\
  3098. * class MREXTTEXTOUT
  3099. *
  3100. * Metafile record for TextOutA, TextOutW, ExtTextOutA and ExtTextOutW.
  3101. *
  3102. * History:
  3103. * Thu Aug 24 15:20:33 1992 -by- Hock San Lee [hockl]
  3104. * Wrote it.
  3105. \**************************************************************************/
  3106. class MREXTTEXTOUT : public MRB /* mreto */
  3107. {
  3108. protected:
  3109. DWORD iGraphicsMode; // Advanced or compatible graphics mode
  3110. FLOAT exScale; // X and Y scales from Page units to .01mm units
  3111. FLOAT eyScale; // if graphics mode is GM_COMPATIBLE.
  3112. MTEXT mtext; // Base record for textout.
  3113. public:
  3114. // Initializer -- Initialize the metafile record.
  3115. BOOL bInit
  3116. (
  3117. DWORD iType1,
  3118. PMDC pmdc1,
  3119. HDC hdc1,
  3120. int x1,
  3121. int y1,
  3122. UINT fl1,
  3123. CONST RECT *prc1,
  3124. LPCSTR pString1,
  3125. int cchString1,
  3126. CONST INT *pdx1,
  3127. int cjCh1 // size of a character in bytes
  3128. )
  3129. {
  3130. PUTS("MREXTTEXTOUT::bInit\n");
  3131. ASSERTGDI(iType1 == EMR_EXTTEXTOUTA || iType1 == EMR_EXTTEXTOUTW,
  3132. "MREXTTEXTOUT::bInit: Bad iType1");
  3133. MRB::vInit(iType1, pmdc1);
  3134. iGraphicsMode = GetGraphicsMode(hdc1);
  3135. if(iGraphicsMode != GM_COMPATIBLE)
  3136. {
  3137. exScale = 0.0f; // not used in advanced mode
  3138. eyScale = 0.0f;
  3139. }
  3140. else if (pmdc1->exFontScale() != 0.0f && pmdc1->eyFontScale() != 0.0f)
  3141. {
  3142. exScale = pmdc1->exFontScale(); // use recorded scales in the
  3143. eyScale = pmdc1->eyFontScale(); // original metafile
  3144. }
  3145. else
  3146. {
  3147. // Compute P . S . See metafile.cxx for definitions of S .
  3148. // r (m,n) (m,n)
  3149. XFORM xform;
  3150. if (!GetTransform(hdc1, XFORM_PAGE_TO_DEVICE, &xform))
  3151. return(FALSE);
  3152. exScale = xform.eM11
  3153. * 100.0f
  3154. * (FLOAT) (pmdc1->cxMillimeters())
  3155. / (FLOAT) (pmdc1->cxDevice)();
  3156. eyScale = xform.eM22
  3157. * 100.0f
  3158. * (FLOAT) (pmdc1->cyMillimeters())
  3159. / (FLOAT) (pmdc1->cyDevice());
  3160. }
  3161. return
  3162. (
  3163. mtext.bInit
  3164. (
  3165. hdc1,
  3166. x1,
  3167. y1,
  3168. fl1,
  3169. prc1,
  3170. pString1,
  3171. cchString1,
  3172. pdx1,
  3173. this, // pMR
  3174. sizeof(MREXTTEXTOUT), // offString
  3175. cjCh1
  3176. )
  3177. );
  3178. }
  3179. // bPlay -- Play the record.
  3180. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3181. BOOL bCheckRecord(PHANDLETABLE pht);
  3182. };
  3183. typedef MREXTTEXTOUT *PMREXTTEXTOUT;
  3184. #define SIZEOF_MREXTTEXTOUT(cchString, cjCh, bPdy) \
  3185. ((sizeof(MREXTTEXTOUT) \
  3186. +(cchString)*((cjCh) + sizeof(LONG)*((bPdy) ? 2 : 1)) \
  3187. +3) / 4 * 4)
  3188. inline BOOL MREXTTEXTOUT::bCheckRecord(PHANDLETABLE pht)
  3189. {
  3190. // Review by Mleonov:
  3191. // Seems like cjCh is always set to sizeof(WCHAR). See metarec.cxx
  3192. if (nSize > mtext.cchString &&
  3193. nSize >= SIZEOF_MREXTTEXTOUT(mtext.cchString,
  3194. iType == EMR_EXTTEXTOUTW ?
  3195. sizeof(WCHAR) : sizeof(CHAR),
  3196. (mtext.fOptions & ETO_PDY))
  3197. && bValidSize(pht, nSize))
  3198. return(TRUE);
  3199. vMarkFoundBad(pht);
  3200. EMFVALFAIL(("MREXTTEXTOUT::bCheckRecord(%08x,%08x,%08x) failed\n", mtext.cchString, sizeof(WCHAR),(mtext.fOptions & ETO_PDY)));
  3201. return(FALSE);
  3202. }
  3203. /*********************************Class************************************\
  3204. * class MRPOLYTEXTOUT
  3205. *
  3206. * Metafile record for PolyTextOutA and PolyTextOutW.
  3207. *
  3208. * History:
  3209. * Tue 19-Apr-1994 11:32:44 by Kirk Olynyk [kirko]
  3210. * Removed bInit(...)
  3211. * Thu Aug 24 15:20:33 1992 -by- Hock San Lee [hockl]
  3212. * Wrote it.
  3213. \**************************************************************************/
  3214. class MRPOLYTEXTOUT : public MRB /* mrbpto */
  3215. {
  3216. protected:
  3217. DWORD iGraphicsMode; // Advanced or compatible graphics mode
  3218. FLOAT exScale; // X and Y scales from Page units to .01mm units
  3219. FLOAT eyScale; // if graphics mode is GM_COMPATIBLE.
  3220. LONG cmtext; // Number of MTEXT structures
  3221. MTEXT amtext[1]; // Array of MTEXT structures
  3222. // This is followed by the strings and dx's
  3223. public:
  3224. // bPlay -- Play the record.
  3225. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3226. BOOL bCheckRecord(PHANDLETABLE pht);
  3227. };
  3228. typedef MRPOLYTEXTOUT *PMRPOLYTEXTOUT;
  3229. #define SIZEOF_MRPOLYTEXTOUT(cpt,cjTotal) \
  3230. (sizeof(MRPOLYTEXTOUT) - sizeof(MTEXT) \
  3231. + (cpt)*sizeof(MTEXT) + (cjTotal))
  3232. inline BOOL MRPOLYTEXTOUT::bCheckRecord(PHANDLETABLE pht)
  3233. {
  3234. //Review by Mleonov: Looks like we never record a PolyTextOut record. Moreover this GDI api is not supported on the 9X platform. See comments in MF_PolyTextOut in metarec.cxx
  3235. // But we need to support it. As we dont know exactly how many cjTotal was when we called SIZEOF_MTPOLYTEXTOUT we just check the nSize to be >= that value and in bPlay validate the mtext.offsets.
  3236. if (nSize >= SIZEOF_MRPOLYTEXTOUT(cmtext,0) && bValidSize(pht, nSize))
  3237. return(TRUE);
  3238. vMarkFoundBad(pht);
  3239. EMFVALFAIL(("MRPOLYTEXTOUT::bCheckRecord(%08x) failed\n", cmtext));
  3240. return(FALSE);
  3241. }
  3242. /*********************************Class************************************\
  3243. * class MRSETCOLORADJUSTMENT : public MR
  3244. *
  3245. * SETCOLORADJUSTMENT record.
  3246. *
  3247. * History:
  3248. * Tue Oct 27 09:59:28 1992 -by- Hock San Lee [hockl]
  3249. * Wrote it.
  3250. \**************************************************************************/
  3251. class MRSETCOLORADJUSTMENT : public MR /* mrsca */
  3252. {
  3253. protected:
  3254. COLORADJUSTMENT ColorAdjustment;
  3255. public:
  3256. // Initializer -- Initialize the metafile record.
  3257. VOID vInit(CONST COLORADJUSTMENT *pca)
  3258. {
  3259. PUTS("MRSETCOLORADJUSTMENT::vInit\n");
  3260. MR::vInit(EMR_SETCOLORADJUSTMENT);
  3261. RtlCopyMemory((PBYTE) &ColorAdjustment, (PBYTE) pca, pca->caSize);
  3262. }
  3263. // bPlay -- Play the record.
  3264. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3265. BOOL bCheckRecord(PHANDLETABLE pht);
  3266. };
  3267. typedef MRSETCOLORADJUSTMENT *PMRSETCOLORADJUSTMENT;
  3268. #define SIZEOF_MRSETCOLORADJUSTMENT(pca) \
  3269. (sizeof(MRSETCOLORADJUSTMENT) - sizeof(COLORADJUSTMENT) + (pca)->caSize)
  3270. inline BOOL MRSETCOLORADJUSTMENT::bCheckRecord(PHANDLETABLE pht)
  3271. {
  3272. if (nSize == SIZEOF_MRSETCOLORADJUSTMENT(&ColorAdjustment) && bValidSize(pht, nSize))
  3273. return(TRUE);
  3274. vMarkFoundBad(pht);
  3275. EMFVALFAIL(("MRSETCOLORADJUSTMENT::bCheckRecord(%p) failed\n",&ColorAdjustment));
  3276. return(FALSE);
  3277. }
  3278. /*********************************Class************************************\
  3279. * class MRGLSRECORD: public MR
  3280. *
  3281. * GLS record for OpenGL metafile support
  3282. *
  3283. * History:
  3284. * Thu Feb 23 14:33:00 1995 -by- Drew Bliss [drewb]
  3285. * Wrote it.
  3286. \**************************************************************************/
  3287. class MRGLSRECORD : public MR /* mrgr */
  3288. {
  3289. public:
  3290. DWORD cb; // Number of BYTES in the record
  3291. BYTE abRecord[1]; // The record
  3292. public:
  3293. // Initializer -- Initialize the metafile MRGLSRECORD record.
  3294. VOID vInit(DWORD cb_, CONST BYTE *abRecord_)
  3295. {
  3296. MR::vInit(EMR_GLSRECORD);
  3297. cb = cb_;
  3298. RtlCopyMemory
  3299. (
  3300. (PBYTE) abRecord,
  3301. (PBYTE) abRecord_,
  3302. cb
  3303. );
  3304. }
  3305. // bPlay -- Play the record.
  3306. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3307. BOOL bCheckRecord(PHANDLETABLE pht);
  3308. };
  3309. typedef MRGLSRECORD *PMRGLSRECORD;
  3310. #define SIZEOF_MRGLSRECORD(cb) \
  3311. ((sizeof(MRGLSRECORD)-PADCHAR_SIZE+(cb)+3)& ~3)
  3312. inline BOOL MRGLSRECORD::bCheckRecord(PHANDLETABLE pht)
  3313. {
  3314. if (SIZEOF_MRGLSRECORD(cb) == nSize && bValidSize(pht, nSize))
  3315. return(TRUE);
  3316. vMarkFoundBad(pht);
  3317. EMFVALFAIL(("MRGLSRECORD::bCheckRecord(%08x) failed\n", cb));
  3318. return(FALSE);
  3319. }
  3320. /*********************************Class************************************\
  3321. * class MRGLSBOUNDEDRECORD: public MR
  3322. *
  3323. * GLS record with bounds for OpenGL metafile support
  3324. *
  3325. * History:
  3326. * Thu Feb 23 14:33:00 1995 -by- Drew Bliss [drewb]
  3327. * Wrote it.
  3328. \**************************************************************************/
  3329. class MRGLSBOUNDEDRECORD : public MR /* mrgbr */
  3330. {
  3331. public:
  3332. RECTL rclBounds; // Bounds, must be first
  3333. DWORD cb; // Number of BYTES in the record
  3334. BYTE abRecord[1]; // The record
  3335. public:
  3336. // Initializer -- Initialize the metafile MRGLSRECORD record.
  3337. VOID vInit(DWORD cb_, CONST BYTE *abRecord_, LPRECTL prclBounds)
  3338. {
  3339. MR::vInit(EMR_GLSBOUNDEDRECORD);
  3340. cb = cb_;
  3341. RtlCopyMemory
  3342. (
  3343. (PBYTE) abRecord,
  3344. (PBYTE) abRecord_,
  3345. cb
  3346. );
  3347. rclBounds = *prclBounds;
  3348. }
  3349. // bPlay -- Play the record.
  3350. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3351. BOOL bCheckRecord(PHANDLETABLE pht);
  3352. };
  3353. typedef MRGLSBOUNDEDRECORD *PMRGLSBOUNDEDRECORD;
  3354. #define SIZEOF_MRGLSBOUNDEDRECORD(cb) \
  3355. ((sizeof(MRGLSBOUNDEDRECORD)-PADCHAR_SIZE+(cb)+3)& ~3)
  3356. inline BOOL MRGLSBOUNDEDRECORD::bCheckRecord(PHANDLETABLE pht)
  3357. {
  3358. if (SIZEOF_MRGLSBOUNDEDRECORD(cb) == nSize && bValidSize(pht, nSize))
  3359. return(TRUE);
  3360. vMarkFoundBad(pht);
  3361. EMFVALFAIL(("MRGLSBOUNDEDRECORD::bCheckRecord(%08x) failed\n", cb));
  3362. return(FALSE);
  3363. }
  3364. /*********************************Class************************************\
  3365. * class MRPIXELFORMAT: public MR
  3366. *
  3367. * PIXELFORMATDESCRIPTOR record
  3368. *
  3369. * History:
  3370. * Thu Mar 27 14:33:00 1995 -by- Drew Bliss [drewb]
  3371. * Wrote it.
  3372. \**************************************************************************/
  3373. class MRPIXELFORMAT : public MR /* mrpf */
  3374. {
  3375. public:
  3376. PIXELFORMATDESCRIPTOR pfd;
  3377. public:
  3378. // Initializer -- Initialize the metafile MRPIXELFORMAT record.
  3379. VOID vInit(CONST PIXELFORMATDESCRIPTOR *ppfd)
  3380. {
  3381. MR::vInit(EMR_PIXELFORMAT);
  3382. RtlCopyMemory
  3383. (
  3384. (PBYTE) &pfd,
  3385. (PBYTE) ppfd,
  3386. sizeof(PIXELFORMATDESCRIPTOR)
  3387. );
  3388. }
  3389. // bPlay -- Play the record.
  3390. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3391. BOOL bCheckRecord(PHANDLETABLE pht);
  3392. };
  3393. typedef MRPIXELFORMAT *PMRPIXELFORMAT;
  3394. #define SIZEOF_MRPIXELFORMAT (sizeof(MRPIXELFORMAT))
  3395. inline BOOL MRPIXELFORMAT::bCheckRecord(PHANDLETABLE pht)
  3396. {
  3397. if (SIZEOF_MRPIXELFORMAT == nSize && bValidSize(pht, nSize))
  3398. return(TRUE);
  3399. vMarkFoundBad(pht);
  3400. EMFVALFAIL(("MRPIXELFORMAT::bCheckRecord() failed\n"));
  3401. return(FALSE);
  3402. }
  3403. /*********************************Class************************************\
  3404. * class MRSETICMPROFILE: public MR
  3405. *
  3406. * History:
  3407. * Mon May 05 19:07:00 1997 -by- Hideyuki Nagase [hideyukn]
  3408. * Wrote it.
  3409. \**************************************************************************/
  3410. class MRSETICMPROFILE : public MR /* mrsip */
  3411. {
  3412. public:
  3413. DWORD dwFlags; // Flags
  3414. DWORD cbName; // Size of desired profile name
  3415. DWORD cbData; // Size of raw profile data if attached
  3416. BYTE Data[1]; // Array size is cbName and cbData
  3417. public:
  3418. // vInit -- Initialize the record.
  3419. VOID vInit(DWORD RecordType_,DWORD dwFlags_,
  3420. DWORD cbName_,BYTE *Name_,
  3421. DWORD cbData_,BYTE *Data_)
  3422. {
  3423. PUTS("MRSETICMPROFILE::bInit\n");
  3424. ASSERTGDI(RecordType_ == EMR_SETICMPROFILEA ||
  3425. RecordType_ == EMR_SETICMPROFILEW, "Bad record type");
  3426. MR::vInit(RecordType_);
  3427. dwFlags = dwFlags_;
  3428. cbName = cbName_;
  3429. cbData = cbData_;
  3430. RtlCopyMemory(Data,Name_,cbName_);
  3431. RtlCopyMemory(Data+cbName_,Data_,cbData_);
  3432. }
  3433. // bPlay -- Play the record.
  3434. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3435. BOOL bCheckRecord(PHANDLETABLE pht);
  3436. };
  3437. typedef MRSETICMPROFILE *PMRSETICMPROFILE;
  3438. #define SIZEOF_MRSETICMPROFILE(cb) \
  3439. ((sizeof(MRSETICMPROFILE)-PADCHAR_SIZE+(cb)+3)& ~3)
  3440. inline BOOL MRSETICMPROFILE::bCheckRecord(PHANDLETABLE pht)
  3441. {
  3442. if (nSize == SIZEOF_MRSETICMPROFILE(cbName+cbData) && bValidSize(pht, nSize))
  3443. return(TRUE);
  3444. vMarkFoundBad(pht);
  3445. EMFVALFAIL(("MRSETICMPROFILE::bCheckRecord(%08x) failed\n", cbName+cbData));
  3446. return(FALSE);
  3447. }
  3448. /*********************************Class************************************\
  3449. * class MRCOLORMATCHTOTARGET: public MR
  3450. *
  3451. * History:
  3452. * Mon Jun 22 17:22:00 1998 -by- Hideyuki Nagase [hideyukn]
  3453. * Wrote it.
  3454. \**************************************************************************/
  3455. class MRCOLORMATCHTOTARGET : public MR /* mrsip */
  3456. {
  3457. public:
  3458. DWORD dwAction; // CS_ENABLE, CS_DISABLE or CS_DELETETRANSFORM
  3459. DWORD dwFlags; // Flags
  3460. DWORD cbName; // Size of desired profile name
  3461. DWORD cbData; // Size of raw profile data if attached
  3462. BYTE Data[1]; // Array size is cbName and cbData
  3463. public:
  3464. // vInit -- Initialize the record.
  3465. VOID vInit(DWORD RecordType_,
  3466. DWORD dwAction_,DWORD dwFlags_,
  3467. DWORD cbName_,BYTE *Name_,
  3468. DWORD cbData_,BYTE *Data_)
  3469. {
  3470. PUTS("MRCOLORMATCHTOTARGET::bInit\n");
  3471. ASSERTGDI(RecordType_ == EMR_COLORMATCHTOTARGETW,"Bad record type");
  3472. MR::vInit(RecordType_);
  3473. dwAction = dwAction_;
  3474. dwFlags = dwFlags_;
  3475. cbName = cbName_;
  3476. cbData = cbData_;
  3477. RtlCopyMemory(Data,Name_,cbName_);
  3478. RtlCopyMemory(Data+cbName_,Data_,cbData_);
  3479. }
  3480. // bPlay -- Play the record.
  3481. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3482. BOOL bCheckRecord(PHANDLETABLE pht);
  3483. };
  3484. typedef MRCOLORMATCHTOTARGET *PMRCOLORMATCHTOTARGET;
  3485. #define SIZEOF_MRCOLORMATCHTOTARGET(cb) \
  3486. ((sizeof(MRCOLORMATCHTOTARGET)-PADCHAR_SIZE+(cb)+3)& ~3)
  3487. inline BOOL MRCOLORMATCHTOTARGET::bCheckRecord(PHANDLETABLE pht)
  3488. {
  3489. if (nSize == SIZEOF_MRCOLORMATCHTOTARGET(cbName+cbData) && bValidSize(pht, nSize))
  3490. return(TRUE);
  3491. vMarkFoundBad(pht);
  3492. EMFVALFAIL(("MRCOLORMATCHTOTARGET::bCheckRecord(%08x) failed\n", cbName+cbData));
  3493. return(FALSE);
  3494. }
  3495. class MRPOLYBEZIER : public MRBP /* mrpb */
  3496. {
  3497. public:
  3498. // bPlay -- Play the record.
  3499. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3500. };
  3501. typedef MRPOLYBEZIER *PMRPOLYBEZIER;
  3502. class MRPOLYGON : public MRBP /* mrpg */
  3503. {
  3504. public:
  3505. // bPlay -- Play the record.
  3506. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3507. };
  3508. typedef MRPOLYGON *PMRPOLYGON;
  3509. class MRPOLYLINE : public MRBP /* mrpl */
  3510. {
  3511. public:
  3512. // bPlay -- Play the record.
  3513. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3514. };
  3515. typedef MRPOLYLINE *PMRPOLYLINE;
  3516. class MRPOLYBEZIERTO : public MRBP /* mrpbt */
  3517. {
  3518. public:
  3519. // bPlay -- Play the record.
  3520. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3521. };
  3522. typedef MRPOLYBEZIERTO *PMRPOLYBEZIERTO;
  3523. class MRPOLYLINETO : public MRBP /* mrplt */
  3524. {
  3525. public:
  3526. // bPlay -- Play the record.
  3527. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3528. };
  3529. typedef MRPOLYLINETO *PMRPOLYLINETO;
  3530. class MRPOLYPOLYLINE : public MRBPP /* mrppl */
  3531. {
  3532. public:
  3533. // bPlay -- Play the record.
  3534. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3535. };
  3536. typedef MRPOLYPOLYLINE *PMRPOLYPOLYLINE;
  3537. class MRPOLYPOLYGON : public MRBPP /* mrppg */
  3538. {
  3539. public:
  3540. // bPlay -- Play the record.
  3541. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3542. };
  3543. typedef MRPOLYPOLYGON *PMRPOLYPOLYGON;
  3544. class MRSETWINDOWEXTEX : public MRDD /* mrswee */
  3545. {
  3546. public:
  3547. // bPlay -- Play the record.
  3548. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3549. };
  3550. typedef MRSETWINDOWEXTEX *PMRSETWINDOWEXTEX;
  3551. class MRSETWINDOWORGEX : public MRDD /* mrswoe */
  3552. {
  3553. public:
  3554. // bPlay -- Play the record.
  3555. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3556. };
  3557. typedef MRSETWINDOWORGEX *PMRSETWINDOWORGEX;
  3558. class MRSETVIEWPORTEXTEX : public MRDD /* mrsvee */
  3559. {
  3560. public:
  3561. // bPlay -- Play the record.
  3562. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3563. };
  3564. typedef MRSETVIEWPORTEXTEX *PMRSETVIEWPORTEXTEX;
  3565. class MRSETVIEWPORTORGEX : public MRDD /* mrsvoe */
  3566. {
  3567. public:
  3568. // bPlay -- Play the record.
  3569. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3570. };
  3571. typedef MRSETVIEWPORTORGEX *PMRSETVIEWPORTORGEX;
  3572. class MRSETBRUSHORGEX : public MRDD /* mrsboe */
  3573. {
  3574. public:
  3575. // bPlay -- Play the record.
  3576. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3577. };
  3578. typedef MRSETBRUSHORGEX *PMRSETBRUSHORGEX;
  3579. class MRSETMAPPERFLAGS : public MRD /* mrsmf */
  3580. {
  3581. public:
  3582. // bPlay -- Play the record.
  3583. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3584. };
  3585. typedef MRSETMAPPERFLAGS *PMRSETMAPPERFLAGS;
  3586. class MRSETMAPMODE : public MRD /* mrsmm */
  3587. {
  3588. public:
  3589. // bPlay -- Play the record.
  3590. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3591. };
  3592. typedef MRSETMAPMODE *PMRSETMAPMODE;
  3593. class MRSETLAYOUT : public MRD /* mrslo */
  3594. {
  3595. public:
  3596. // bPlay -- Play the record.
  3597. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3598. };
  3599. typedef MRSETLAYOUT *PMRSETLAYOUT;
  3600. class MRSETBKMODE : public MRD /* mrsbm */
  3601. {
  3602. public:
  3603. // bPlay -- Play the record.
  3604. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3605. };
  3606. class MRSETICMMODE : public MRD /* mrsbm */
  3607. {
  3608. public:
  3609. // bPlay -- Play the record.
  3610. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3611. };
  3612. class MRSETCOLORSPACE : public MRD /* mrsbm */
  3613. {
  3614. public:
  3615. // bPlay -- Play the record.
  3616. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3617. };
  3618. typedef MRSETBKMODE *PMRSETBKMODE;
  3619. class MRSETPOLYFILLMODE : public MRD /* mrspfm */
  3620. {
  3621. public:
  3622. // bPlay -- Play the record.
  3623. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3624. };
  3625. typedef MRSETPOLYFILLMODE *PMRSETPOLYFILLMODE;
  3626. class MRSETROP2 : public MRD /* mrsr2 */
  3627. {
  3628. public:
  3629. // bPlay -- Play the record.
  3630. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3631. };
  3632. typedef MRSETROP2 *PMRSETROP2;
  3633. class MRSETSTRETCHBLTMODE : public MRD /* mrssbm */
  3634. {
  3635. public:
  3636. // bPlay -- Play the record.
  3637. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3638. };
  3639. typedef MRSETSTRETCHBLTMODE *PMRSETSTRETCHBLTMODE;
  3640. class MRSETTEXTALIGN : public MRD /* mrsta */
  3641. {
  3642. public:
  3643. // bPlay -- Play the record.
  3644. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3645. };
  3646. typedef MRSETTEXTALIGN *PMRSETTEXTALIGN;
  3647. class MRSETTEXTCOLOR : public MRD /* mrstc */
  3648. {
  3649. public:
  3650. // bPlay -- Play the record.
  3651. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3652. };
  3653. typedef MRSETTEXTCOLOR *PMRSETTEXTCOLOR;
  3654. class MRSETBKCOLOR : public MRD /* mrsbc */
  3655. {
  3656. public:
  3657. // bPlay -- Play the record.
  3658. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3659. };
  3660. typedef MRSETBKCOLOR *PMRSETBKCOLOR;
  3661. class MRSETARCDIRECTION : public MRD /* mrsad */
  3662. {
  3663. public:
  3664. // bPlay -- Play the record.
  3665. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3666. };
  3667. typedef MRSETARCDIRECTION *PMRSETARCDIRECTION;
  3668. class MRSETMITERLIMIT : public MRD /* mrsml */
  3669. {
  3670. public:
  3671. // bPlay -- Play the record.
  3672. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3673. };
  3674. typedef MRSETMITERLIMIT *PMRSETMITERLIMIT;
  3675. class MROFFSETCLIPRGN : public MRDD /* mrocr */
  3676. {
  3677. public:
  3678. // bPlay -- Play the record.
  3679. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3680. };
  3681. typedef MROFFSETCLIPRGN *PMROFFSETCLIPRGN;
  3682. class MRMOVETOEX : public MRDD /* mrmte */
  3683. {
  3684. public:
  3685. // bPlay -- Play the record.
  3686. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3687. };
  3688. typedef MRMOVETOEX *PMRMOVETOEX;
  3689. class MRLINETO : public MRDD /* mrlt */
  3690. {
  3691. public:
  3692. // bPlay -- Play the record.
  3693. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3694. };
  3695. typedef MRLINETO *PMRLINETO;
  3696. class MRSETTEXTJUSTIFICATION : public MRDD
  3697. {
  3698. public:
  3699. // bPlay -- Play the record.
  3700. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3701. };
  3702. typedef MRSETTEXTJUSTIFICATION *PMRSETTEXTJUST;
  3703. class MREXCLUDECLIPRECT : public MRDDDD /* mrecr */
  3704. {
  3705. public:
  3706. // bPlay -- Play the record.
  3707. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3708. };
  3709. typedef MREXCLUDECLIPRECT *PMREXCLUDECLIPRECT;
  3710. class MRINTERSECTCLIPRECT : public MRDDDD /* mricr */
  3711. {
  3712. public:
  3713. // bPlay -- Play the record.
  3714. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3715. };
  3716. typedef MRINTERSECTCLIPRECT *PMRINTERSECTCLIPRECT;
  3717. class MRSCALEVIEWPORTEXTEX : public MRDDDD /* mrsvee */
  3718. {
  3719. public:
  3720. // bPlay -- Play the record.
  3721. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3722. };
  3723. typedef MRSCALEVIEWPORTEXTEX *PMRSCALEVIEWPORTEXTEX;
  3724. class MRSCALEWINDOWEXTEX : public MRDDDD /* mrswee */
  3725. {
  3726. public:
  3727. // bPlay -- Play the record.
  3728. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3729. };
  3730. typedef MRSCALEWINDOWEXTEX *PMRSCALEWINDOWEXTEX;
  3731. class MRSAVEDC : public MR /* mrsdc */
  3732. {
  3733. public:
  3734. // bPlay -- Play the record.
  3735. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3736. };
  3737. typedef MRSAVEDC *PMRSAVEDC;
  3738. class MRRESTOREDC : public MRD /* mrrdc */
  3739. {
  3740. public:
  3741. // bPlay -- Play the record.
  3742. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3743. };
  3744. typedef MRRESTOREDC *PMRRESTOREDC;
  3745. class MRSETWORLDTRANSFORM : public MRX /* mrswt */
  3746. {
  3747. public:
  3748. // bPlay -- Play the record.
  3749. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3750. };
  3751. typedef MRSETWORLDTRANSFORM *PMRSETWORLDTRANSFORM;
  3752. class MRMODIFYWORLDTRANSFORM : public MRXD /* mrmwt */
  3753. {
  3754. public:
  3755. // bPlay -- Play the record.
  3756. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3757. };
  3758. typedef MRMODIFYWORLDTRANSFORM *PMRMODIFYWORLDTRANSFORM;
  3759. class MRSELECTPALETTE : public MRD /* mrsp */
  3760. {
  3761. public:
  3762. // bPlay -- Play the record.
  3763. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3764. };
  3765. typedef MRSELECTPALETTE *PMRSELECTPALETTE;
  3766. class MRCOLORCORRECTPALETTE : public MRDDDD /* mrsp */
  3767. {
  3768. public:
  3769. // bPlay -- Play the record.
  3770. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3771. };
  3772. typedef MRCOLORCORRECTPALETTE *PMRCOLORCORRECTPALETTE;
  3773. class MRREALIZEPALETTE : public MR /* mrrp */
  3774. {
  3775. public:
  3776. // bPlay -- Play the record.
  3777. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3778. };
  3779. typedef MRREALIZEPALETTE *PMRREALIZEPALETTE;
  3780. class MRSELECTOBJECT : public MRD /* mrso */
  3781. {
  3782. public:
  3783. // bPlay -- Play the record.
  3784. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3785. };
  3786. typedef MRSELECTOBJECT *PMRSELECTOBJECT;
  3787. class MRDELETEOBJECT : public MRD /* mrdo */
  3788. {
  3789. public:
  3790. // bPlay -- Play the record.
  3791. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3792. };
  3793. typedef MRDELETEOBJECT *PMRDELETEOBJECT;
  3794. class MRBEGINPATH : public MR /* mrbp */
  3795. {
  3796. public:
  3797. // bPlay -- Play the record.
  3798. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3799. };
  3800. typedef MRBEGINPATH *PMRBEGINPATH;
  3801. class MRENDPATH : public MR /* mrep */
  3802. {
  3803. public:
  3804. // bPlay -- Play the record.
  3805. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3806. };
  3807. typedef MRENDPATH *PMRENDPATH;
  3808. class MRCLOSEFIGURE : public MR /* mrcf */
  3809. {
  3810. public:
  3811. // bPlay -- Play the record.
  3812. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3813. };
  3814. typedef MRCLOSEFIGURE *PMRCLOSEFIGURE;
  3815. class MRFLATTENPATH : public MR /* mrfp */
  3816. {
  3817. public:
  3818. // bPlay -- Play the record.
  3819. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3820. };
  3821. typedef MRFLATTENPATH *PMRFLATTENPATH;
  3822. class MRWIDENPATH : public MR /* mrwp */
  3823. {
  3824. public:
  3825. // bPlay -- Play the record.
  3826. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3827. };
  3828. typedef MRWIDENPATH *PMRWIDENPATH;
  3829. class MRFILLPATH : public MRB /* mrfp */
  3830. {
  3831. public:
  3832. // bPlay -- Play the record.
  3833. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3834. };
  3835. typedef MRFILLPATH *PMRFILLPATH;
  3836. class MRSTROKEANDFILLPATH : public MRB /* mrsafp */
  3837. {
  3838. public:
  3839. // bPlay -- Play the record.
  3840. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3841. };
  3842. typedef MRSTROKEANDFILLPATH *PMRSTROKEANDFILLPATH;
  3843. class MRSTROKEPATH : public MRB /* mrsp */
  3844. {
  3845. public:
  3846. // bPlay -- Play the record.
  3847. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3848. };
  3849. typedef MRSTROKEPATH *PMRSTROKEPATH;
  3850. class MRSELECTCLIPPATH : public MRD /* mrscp */
  3851. {
  3852. public:
  3853. // bPlay -- Play the record.
  3854. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3855. };
  3856. typedef MRSELECTCLIPPATH *PMRSELECTCLIPPATH;
  3857. class MRABORTPATH : public MR /* mrap */
  3858. {
  3859. public:
  3860. // bPlay -- Play the record.
  3861. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3862. };
  3863. typedef MRABORTPATH *PMRABORTPATH;
  3864. class MRSETMETARGN : public MR /* mrsmr */
  3865. {
  3866. public:
  3867. // bPlay -- Play the record.
  3868. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3869. };
  3870. typedef MRSETMETARGN *PMRSETMETARGN;
  3871. class MRESCAPE : public MR /* mrescape */
  3872. {
  3873. protected:
  3874. INT iEscape;
  3875. INT cjIn;
  3876. public:
  3877. // Initializer -- Initialize the metafile record.
  3878. VOID vInit
  3879. (
  3880. DWORD iType1,
  3881. INT iEscape1,
  3882. INT cjIn1,
  3883. LPCSTR pvIn
  3884. )
  3885. {
  3886. MFD1("MRESCAPE::vInit\n");
  3887. MR::vInit(iType1);
  3888. RtlCopyMemory((PBYTE)this+sizeof(MRESCAPE), (PBYTE) pvIn, cjIn1 );
  3889. iEscape = iEscape1;
  3890. cjIn = cjIn1;
  3891. }
  3892. // bPlay -- Play the record.
  3893. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3894. BOOL bCheckRecord(PHANDLETABLE pht)
  3895. {
  3896. // Cant use the cjIn for app compat reasons. Some records out there
  3897. // put garbage for cjIn and if we check this with the record size
  3898. // we will fail a once valid metafile.
  3899. if (/*nSize == ((sizeof(*this)+cjIn+3)&~3) && */bValidSize(pht, nSize))
  3900. return(TRUE);
  3901. vMarkFoundBad(pht);
  3902. EMFVALFAIL(("MRESCAPE::bCheckRecord(%08x) failed\n", cjIn));
  3903. return(FALSE);
  3904. }
  3905. };
  3906. typedef MRESCAPE *PMRESCAPE;
  3907. class MRNAMEDESCAPE : public MR /* mrescape */
  3908. {
  3909. protected:
  3910. INT iEscape;
  3911. INT cjDriver;
  3912. INT cjIn;
  3913. public:
  3914. // Initializer -- Initialize the metafile record.
  3915. VOID vInit
  3916. (
  3917. DWORD iType1,
  3918. INT iEscape1,
  3919. LPWSTR pwszDriver,
  3920. LPCSTR pvIn,
  3921. INT cjIn1
  3922. )
  3923. {
  3924. MFD1("MRNAMEDESCAPE::vInit\n");
  3925. MR::vInit(iType1);
  3926. cjDriver = (wcslen(pwszDriver)+1) * sizeof(WCHAR);
  3927. RtlCopyMemory((PBYTE)this+sizeof(MRNAMEDESCAPE),(PBYTE)pwszDriver, cjDriver);
  3928. RtlCopyMemory((PBYTE)this+sizeof(MRNAMEDESCAPE)+cjDriver,(PBYTE) pvIn, cjIn1);
  3929. iEscape = iEscape1;
  3930. cjIn = cjIn1;
  3931. }
  3932. // bPlay -- Play the record.
  3933. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3934. BOOL bCheckRecord(PHANDLETABLE pht)
  3935. {
  3936. if (nSize == ((sizeof(*this) + cjIn + cjDriver + 3)&~3) && bValidSize(pht, nSize))
  3937. return(TRUE);
  3938. vMarkFoundBad(pht);
  3939. EMFVALFAIL(("MRNAMEDESCAPE::bCheckRecord(%08x,%08x) failed\n", cjIn, cjDriver));
  3940. return(FALSE);
  3941. }
  3942. };
  3943. typedef MRNAMEDESCAPE *PMRNAMEDESCAPE;
  3944. class MRSTARTDOC : public MR /* mrstartdoc */
  3945. {
  3946. protected:
  3947. DOCINFOW doi;
  3948. public:
  3949. VOID vInit
  3950. (
  3951. DWORD iType1,
  3952. CONST DOCINFOW *pdoi
  3953. )
  3954. {
  3955. PUTS("MRSTARTDOC::vInit\n");
  3956. PBYTE pj;
  3957. #if DBG
  3958. DbgPrint("MR::vInit\n");
  3959. #endif
  3960. MR::vInit(iType1);
  3961. *((DOCINFOW*)&doi) = *pdoi;
  3962. pj = (PBYTE) this + sizeof(MRSTARTDOC);
  3963. if( pdoi->lpszDocName != NULL )
  3964. {
  3965. lstrcpyW( (LPWSTR) pj, pdoi->lpszDocName );
  3966. pj += ( ((lstrlenW( pdoi->lpszDocName )+1) * sizeof(WCHAR) ) + 4 ) & ~(0x3);
  3967. }
  3968. if( pdoi->lpszOutput != NULL )
  3969. {
  3970. lstrcpyW( (LPWSTR) pj, pdoi->lpszOutput );
  3971. }
  3972. }
  3973. // bPlay -- Play the record.
  3974. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3975. BOOL bCheckRecord(PHANDLETABLE pht)
  3976. {
  3977. if (nSize >= sizeof(*this) && bValidSize(pht, nSize))
  3978. return(TRUE);
  3979. vMarkFoundBad(pht);
  3980. EMFVALFAIL(("MRSTARTDOC::bCheckRecord() failed \n"));
  3981. return(FALSE);
  3982. }
  3983. };
  3984. typedef MRSTARTDOC *PMRSTARTDOC;
  3985. class MRSTARTPAGE : public MR /* mrstartpage */
  3986. {
  3987. protected:
  3988. public:
  3989. // bPlay -- Play the record.
  3990. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3991. };
  3992. typedef MRSTARTPAGE *PMRSTARTPAGE;
  3993. class MRENDPAGE : public MR /* mrendpage */
  3994. {
  3995. protected:
  3996. public:
  3997. // bPlay -- Play the record.
  3998. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  3999. };
  4000. typedef MRENDPAGE *PMRENDPAGE;
  4001. #define ETO_NO_RECT 0x0100
  4002. #define ETO_SMALL_CHARS 0x0200
  4003. class MRSMALLTEXTOUT : public MR /* mrescape */
  4004. {
  4005. private:
  4006. INT x;
  4007. INT y;
  4008. UINT cChars;
  4009. UINT fuOptions;
  4010. DWORD iGraphicsMode;
  4011. FLOAT exScale;
  4012. FLOAT eyScale;
  4013. public:
  4014. // Initializer -- Initialize the metafile record.
  4015. VOID vInit
  4016. (
  4017. HDC hdc1,
  4018. PMDC pmdc1,
  4019. DWORD iType1,
  4020. int x1,
  4021. int y1,
  4022. UINT fuOptions1,
  4023. RECT *pRect,
  4024. UINT cChars1,
  4025. WCHAR *pwc,
  4026. BOOL bSmallChars
  4027. )
  4028. {
  4029. MFD1("MRSMALLTEXTOUT::vInit\n");
  4030. MR::vInit(iType1);
  4031. iGraphicsMode = GetGraphicsMode(hdc1);
  4032. exScale = 0.0f;
  4033. eyScale = 0.0f;
  4034. if(iGraphicsMode == GM_COMPATIBLE)
  4035. {
  4036. XFORM xform;
  4037. if(GetTransform(hdc1, XFORM_PAGE_TO_DEVICE, &xform))
  4038. {
  4039. exScale = xform.eM11 * 100.0f * (FLOAT) (pmdc1->cxMillimeters()) /
  4040. (FLOAT) (pmdc1->cxDevice)();
  4041. eyScale = xform.eM22 * 100.0f * (FLOAT) (pmdc1->cyMillimeters()) /
  4042. (FLOAT) (pmdc1->cyDevice());
  4043. }
  4044. else
  4045. {
  4046. WARNING("GDI32:MRSMALLTEXTOUT: GetTransform failed");
  4047. }
  4048. }
  4049. #if DBG
  4050. if( fuOptions1 & ( ETO_NO_RECT | ETO_SMALL_CHARS ) )
  4051. {
  4052. DbgPrint("MRSMALLTEXTOUT:vInit: warning fuOptions conflict\n");
  4053. }
  4054. #endif
  4055. fuOptions = fuOptions1 & ~(ETO_NO_RECT | ETO_SMALL_CHARS);
  4056. fuOptions |= ( bSmallChars ) ? ETO_SMALL_CHARS : 0;
  4057. fuOptions |= ( pRect == NULL ) ? ETO_NO_RECT : 0;
  4058. x = x1;
  4059. y = y1;
  4060. cChars = cChars1;
  4061. BYTE *pjThis = (PBYTE) this + sizeof(MRSMALLTEXTOUT);
  4062. if( pRect )
  4063. {
  4064. RtlCopyMemory( pjThis, (PBYTE) pRect, sizeof(RECT) );
  4065. pjThis += sizeof(RECT);
  4066. }
  4067. if( bSmallChars )
  4068. {
  4069. while(cChars1 --)
  4070. {
  4071. *pjThis++ = (BYTE) *pwc++;
  4072. }
  4073. }
  4074. else
  4075. {
  4076. RtlCopyMemory( pjThis, pwc, cChars * sizeof(WCHAR) );
  4077. }
  4078. }
  4079. // bPlay -- Play the record.
  4080. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  4081. BOOL bCheckRecord(PHANDLETABLE pht)
  4082. {
  4083. //Review by Mleonov
  4084. BOOL bNoRect = fuOptions & ETO_NO_RECT;
  4085. BOOL bSmallChar = fuOptions & ETO_SMALL_CHARS;
  4086. DWORD sizeMustBe = sizeof(*this);
  4087. sizeMustBe += bNoRect ? 0 : sizeof(RECT);
  4088. sizeMustBe += bSmallChar ? cChars * sizeof(char) : cChars * sizeof(WCHAR);
  4089. sizeMustBe = (sizeMustBe + 3) & ~3;
  4090. if (nSize == sizeMustBe && bValidSize(pht, nSize))
  4091. return(TRUE);
  4092. vMarkFoundBad(pht);
  4093. EMFVALFAIL(("MRSMALLTEXTOUT::bCheckRecord failed\n"));
  4094. return(FALSE);
  4095. }
  4096. };
  4097. typedef MRSMALLTEXTOUT *PMRSMALLTEXTOUT;
  4098. class MRFORCEUFIMAPPING : public MR /* mrescape */
  4099. {
  4100. private:
  4101. UNIVERSAL_FONT_ID ufi;
  4102. public:
  4103. // Initializer -- Initialize the metafile record.
  4104. VOID vInit
  4105. (
  4106. DWORD iType1,
  4107. PUNIVERSAL_FONT_ID pufi
  4108. )
  4109. {
  4110. MFD1("MRFORCEUFIMAPPING::vInit\n");
  4111. MR::vInit(iType1);
  4112. *(&ufi) = *pufi;
  4113. }
  4114. // bPlay -- Play the record.
  4115. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  4116. BOOL bCheckRecord(PHANDLETABLE pht)
  4117. {
  4118. //Review by Mleonov
  4119. if (nSize == sizeof(MRFORCEUFIMAPPING) && bValidSize(pht, nSize))
  4120. return(TRUE);
  4121. vMarkFoundBad(pht);
  4122. EMFVALFAIL(("MRFORCEUFIMAPPING::bCheckRecord failed\n"));
  4123. return(FALSE);
  4124. }
  4125. };
  4126. typedef MRFORCEUFIMAPPING *PMRFORCEUFIMAPPING;
  4127. class MRSETLINKEDUFIS : public MR
  4128. {
  4129. private:
  4130. UINT uNumLinkedUFIs;
  4131. UNIVERSAL_FONT_ID pufiList[1];
  4132. public:
  4133. // Initializer -- Initialize the metafile record.
  4134. VOID vInit
  4135. (
  4136. UINT _uNumLinkedUFIs,
  4137. PUNIVERSAL_FONT_ID pufis
  4138. )
  4139. {
  4140. MFD1("MRSETLINKEDUFIS::vInit\n");
  4141. MR::vInit(EMR_SETLINKEDUFIS);
  4142. uNumLinkedUFIs = _uNumLinkedUFIs;
  4143. RtlCopyMemory(pufiList, pufis, sizeof(UNIVERSAL_FONT_ID) * uNumLinkedUFIs);
  4144. }
  4145. // bPlay -- Play the record.
  4146. BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
  4147. BOOL bCheckRecord(PHANDLETABLE pht)
  4148. {
  4149. //Review by Mleonov
  4150. if ((nSize == sizeof(MRSETLINKEDUFIS) + sizeof(UNIVERSAL_FONT_ID)*uNumLinkedUFIs) && bValidSize(pht, nSize))
  4151. return(TRUE);
  4152. vMarkFoundBad(pht);
  4153. EMFVALFAIL(("MRSETLINKEDUFIS::bCheckRecord failed\n"));
  4154. return(FALSE);
  4155. }
  4156. };
  4157. typedef MRSETLINKEDUFIS *PMRSETLINKEDUFIS;
  4158. // typedef BOOL (MR::*FNBMRPLAY)(HDC, PHANDLETABLE, UINT);
  4159. // extern FNBMRPLAY afnbMRPlay[EMR_MAX-EMR_MIN+1];
  4160. extern BOOL (MR::*afnbMRPlay[EMR_MAX-EMR_MIN+1])(HDC, PHANDLETABLE, UINT);
  4161. // typedef BOOL (MR::*FNBMRCHK)(PHANDLETABLE);
  4162. // extern FNBMRCHECK afnbMRCheck[EMR_MAX-EMR_MIN+1];
  4163. extern BOOL (MR::*afnbMRCheck[EMR_MAX-EMR_MIN+1])(PHANDLETABLE);