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.

168 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. fmoldrle.h
  5. Abstract:
  6. NT4.0 RASDD RLE resource header
  7. Environment:
  8. Windows NT printer drivers
  9. Revision History:
  10. 11/08/96 -eigos-
  11. Created it.
  12. --*/
  13. #ifndef _FMOLDRLE_H_
  14. #define _FMOLDRLE_H_
  15. //
  16. // The following structure represents the layout of this data in the
  17. // resource. References to addresses are actually stored as offsets.
  18. // Basically this is a small amount of header data coupled with the
  19. // standard GDI FD_GLYPHSET structures. These latter require a little
  20. // manipulation before being returned to GDISRV.
  21. //
  22. // POINTS OF INTEREST:
  23. // The first 4 bytes of this structure match the Win 3.1 CTT layout.
  24. // The reason for this is to allow us to verify that we have an NT
  25. // format structure, rather than a Win 3.1 layout. This is also helped
  26. // by using a different range for the wType field. As well, the
  27. // CTT chFirstChar and chLastChar fields are set to have chLastChar <
  28. // chFirstChar, which must not happen with Win 3.1.
  29. //
  30. // The FD_GLYPHSET structure contains POINTERS. These are stored in
  31. // the resource as offsets to the beginning of the resource, and will
  32. // need to be translated at run time. When this resource is passed
  33. // to GDISRV, the FD_GLYPHSET information will be allocated from the
  34. // heap, and all pointers will have the offsets converted to real
  35. // addresses. That way we manage to keep the resource data as a resource,
  36. // but we pass addresses to GDISRV.
  37. //
  38. #define RLE_MAGIC0 0xfe
  39. #define RLE_MAGIC1 0x78
  40. typedef struct
  41. {
  42. WORD wType; /* Format of data */
  43. BYTE bMagic0; /* chFirstChar in CTT data */
  44. BYTE bMagic1; /* chLastChar in CTT data */
  45. DWORD cjThis; /* Number of bytes in this resource */
  46. WORD wchFirst; /* First glyph index */
  47. WORD wchLast; /* Last glyph index */
  48. FD_GLYPHSET fdg; /* The actual GDI desired information */
  49. } NT_RLE;
  50. //
  51. //
  52. //
  53. typedef struct
  54. {
  55. WCHAR wcLow;
  56. USHORT cGlyphs;
  57. DWORD dwOffset_phg;
  58. } WCRUN_res;
  59. typedef struct
  60. {
  61. WORD wType;
  62. BYTE bMagic0;
  63. BYTE bMagic1;
  64. DWORD cjThis;
  65. WORD wchFirst;
  66. WORD wchLast;
  67. //
  68. // FD_GLYPHSET
  69. //
  70. ULONG fdg_cjThis;
  71. FLONG fdg_flAccel;
  72. ULONG fdg_cGlyphSupported;
  73. ULONG fdg_cRuns;
  74. WCRUN_res fdg_wcrun_awcrun[1];
  75. } NT_RLE_res;
  76. //
  77. // Values for the wType field above. These control the interpretation
  78. // of the contents of the HGLYPH fields in the FD_GLYPHSET structure.
  79. //
  80. // This is a data how many RLE file has each type of CTT.
  81. // Type Number
  82. // RLE_DIRECT 67
  83. // RLE_PAIRED 40
  84. // RLE_L_OFFSET 0
  85. // RLE_LI_OFFSET 73
  86. // RLE_OFFSET 0
  87. //
  88. #define RLE_DIRECT 10 /* Index + 1 or 2 data bytes */
  89. #define RLE_PAIRED 11 /* Index plus 2 bytes, overstruck */
  90. #define RLE_L_OFFSET 12 /* Length + 3 byte offset to data */
  91. #define RLE_LI_OFFSET 13 /* Length + Index + 2 byte Offset */
  92. #define RLE_OFFSET 14 /* Offset to (length; data) */
  93. //
  94. // Note that for RLE_DIRECT and RLE_PAIRED, each HGLYPH consists of
  95. // 2 WORDS: the low WORD is the byte/bytes to send to the printer, the
  96. // high WORD is the linear index of this glyph. Linear index starts at
  97. // 0 for the first, and increments by one for every glyph in the font.
  98. // It is used to access width tables.
  99. //
  100. // For RLE_L_OFFSET, the high byte is the length of data to send to
  101. // the printer, the low 24 bits are the offset (relative to start of
  102. // resource data) to the data, which is WORD aligned, and contains
  103. // a WORD with the index followed by the data. The length byte does NOT
  104. // include the index WORD.
  105. //
  106. // For RLE_LI_OFFSET, the high byte contains a length, the next
  107. // lower byte contains a length, and the bottom WORD contains the
  108. // offset to the actual data in the file.
  109. //
  110. typedef struct
  111. {
  112. BYTE b0; /* First (only) data byte to send to printer */
  113. BYTE b1; /* Second byte: may be null, may be overstruck */
  114. WORD wIndex; /* Index to width tables */
  115. } RD; /* Layout for RLE_DIRECT, RLE_PAIRED */
  116. typedef struct
  117. {
  118. WORD wOffset; /* Offset to (length, data) in resource */
  119. BYTE bIndex; /* Index to width tables */
  120. BYTE bLength; /* Length of data item */
  121. } RLI; /* Layout for RLE_LI_OFFSET */
  122. typedef struct
  123. {
  124. BYTE b0; /* First (only) data byte */
  125. BYTE b1; /* Optional second byte */
  126. BYTE bIndex; /* Index to width tables */
  127. BYTE bLength; /* Length byte */
  128. } RLIC; /* Compact format for RLI - no offset */
  129. typedef union
  130. {
  131. RD rd; /* Direct/overprint format */
  132. RLI rli; /* Short offset format: 3 byte offset + 1 byte length */
  133. RLIC rlic; /* The data format for 1 or 2 byte entries */
  134. HGLYPH hg; /* Data as an HGLYPH */
  135. } UHG;
  136. #endif // _FMOLDRLE_H_