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.

208 lines
11 KiB

  1. /*****************************************************************************/
  2. /* CODE.H */
  3. /* */
  4. /* Copyright (C) 1997- Advanced Peripherals Technologies, Inc. */
  5. /* */
  6. /* <HISTORY> */
  7. /* */
  8. /*****************************************************************************/
  9. /*--------------------------------------------------------------------------*/
  10. /* D E F I N E V A L U E */
  11. /*--------------------------------------------------------------------------*/
  12. #define PAPER_SRC_FTRAY 20
  13. #define PAPER_SRC_CAS1 21
  14. #define PAPER_SRC_CAS2 22
  15. #define PAPER_SRC_CAS3 23
  16. #define PAPER_SRC_AUTO 24 //Not use by NT driver
  17. #define PAPER_DEST_SCALETOFIT_ON 25
  18. #define PAPER_DEST_SCALETOFIT_OFF 26
  19. #define PAGECONTROL_BEGIN_DOC 30
  20. #define PAGECONTROL_BEGIN_PAGE 31
  21. #define PAGECONTROL_END_DOC 32
  22. #define PAGECONTROL_END_PAGE 33
  23. #define PAGECONTROL_DUPLEX_OFF 34
  24. #define PAGECONTROL_ABORT_DOC 35
  25. #define PAGECONTROL_POTRAIT 36
  26. #define PAGECONTROL_LANDSCAPE 37
  27. #define PAGECONTROL_MULTI_COPIES 38
  28. #define PAGECONTROL_DUPLEX_UPDOWN 39
  29. #define PAGECONTROL_DUPLEX_RIGHTUP 40
  30. #define PAPERSIZE_MAGIC 50 // this ID - 50 = Actual ID of A/PDL
  31. #define PHYS_PAPER_A3 50
  32. #define PHYS_PAPER_A4 51
  33. #define PHYS_PAPER_A5 52
  34. #define PHYS_PAPER_A6 53 // Reserved
  35. #define PHYS_PAPER_B4 54
  36. #define PHYS_PAPER_B5 55
  37. #define PHYS_PAPER_B6 56 // Reserved
  38. #define PHYS_PAPER_LETTER 57
  39. #define PHYS_PAPER_LEGAL 58
  40. #define PHYS_PAPER_POSTCARD 59
  41. #define PHYS_PAPER_EXECUTIVE 60 // Reserved
  42. #define PHYS_PAPER_UNFIXED 61
  43. #define X_ABS_MOVE 70
  44. #define Y_ABS_MOVE 71
  45. #define XY_ABS_MOVE 78
  46. #define CR_EMULATION 79
  47. #define BOLD_ON 72
  48. #define BOLD_OFF 73
  49. #define ITALIC_ON 74
  50. #define ITALIC_OFF 75
  51. #define RESOLUTION_300 76
  52. #define RESOLUTION_600 77
  53. #define TONER_SAVE_OFF 100
  54. #define TONER_SAVE_DARK 101
  55. #define TONER_SAVE_LIGHT 102
  56. #define MASTER_UNIT 600
  57. #define LINE_PER_BAND 32
  58. #define CCHMAXCMDLEN 128
  59. #define MAXIMGSIZE 0xF000
  60. #define NRPEAK 0x7F
  61. #define RPEAK 0x80
  62. /*--------------------------------------------------------------------------*/
  63. /* S T R U C T U R E D E F I N E */
  64. /*--------------------------------------------------------------------------*/
  65. typedef struct tagAPDL {
  66. ULONG ulHorzRes; // width of the physical surface
  67. ULONG ulVertRes; // height of the physical surface
  68. SIZEL szlPhysSize; // size of unwriteable margin
  69. POINTL ptlPhysOffset; // size of entire surface with unwriteable margin
  70. LPSTR lpCompBuf; // buffer for compressed data
  71. LPSTR lpTempBuf; // temp buffer for compression
  72. BOOL fBold; // TRUE = device font is bold
  73. BOOL fItalic; // TRUE = device font is italic
  74. BOOL fSendSetPhysPaper; // flag for sending set physical paper command
  75. WORD wPageCount; // for send Eject & Print physical paper command
  76. BOOL fDuplex; // TRUE = duplex mode is selected
  77. BOOL fScaleToFit; // for set auto tray mode in Set Physical Paper
  78. BOOL fOrientation; // for set media origin in Define Drawing Area
  79. WORD wWidths; // move current position afer print device font
  80. } APDL, FAR * LPAPDL;
  81. typedef struct tagPAPER {
  82. WORD wWidth;
  83. WORD wHeight;
  84. } PHYSIZE, FAR * LPPHYSIZE;
  85. //+---------------------------------------------------------------------------+
  86. //| F U N C T I O N P R O T O T Y P E |
  87. //+---------------------------------------------------------------------------+
  88. BOOL PASCAL MiniDrvEnablePDEV(LPDV, PGDIINFO);
  89. BOOL PASCAL MiniDrvDisablePDEV(LPDV);
  90. WORD PASCAL CBFilterGraphics(LPDV, LPSTR, WORD);
  91. VOID PASCAL OEMOutputCmd(PVOID, WORD, PDWORD);
  92. BOOL PASCAL OEMGetFontCmd(PVOID, WORD, PVOID, BOOL, PBYTE, PWORD);
  93. SHORT PASCAL OEMScaleWidth(SHORT, SHORT, SHORT, SHORT, SHORT);
  94. VOID PASCAL OEMSendScalableFontCmd(PVOID, LPCD, LPFONTINFO);
  95. BYTE PASCAL IsDBCSLeadBytePAGES(BYTE);
  96. VOID PASCAL OEMOutputChar(PVOID, PVOID, WORD, SHORT);
  97. BYTE PASCAL SetDrawArea(LPDV, WORD);
  98. WORD PASCAL BRL_ECmd(LPBYTE, LPBYTE, LPBYTE, WORD);
  99. /*--------------------------------------------------------------------------*/
  100. /* G L O B A L V A L U E */
  101. /*--------------------------------------------------------------------------*/
  102. /*======================= P A P E R S I Z E T A B L E =====================*/
  103. PHYSIZE phySize[12] = {
  104. // Width Height Physical paper size for 600dpi
  105. (0x1AAC),(0x2604), // A3 1B66 x 26C4
  106. (0x12A5),(0x1AAC), // A4 1362 x 1B66
  107. (0x0CEC),(0x12A4), // A5
  108. (0x0000),(0x0000), // A6 (Reserved)
  109. (0x16FA),(0x20DA), // B4 17B8 x 2196
  110. (0x100F),(0x16FA), // B5 10CE x 17B8
  111. (0x0000),(0x0000), // B6 (Reserved)
  112. (0x087E),(0x0CEC), // Post Card 93C x DAA (Origin is EE)
  113. (0x1330),(0x190C), // Letter 13CE x 19C8
  114. (0x1330),(0x2014), // Legal
  115. (0x0000),(0x0000), // Executive (Reserved)
  116. (0x0000),(0x0000) // Unfixed
  117. };
  118. /*==================== A / P D L C O M M A N D S T R I N G ===============*/
  119. BYTE CmdInAPDLMode[] = {0x1B,0x7E,0x12,0x00,0x01,0x07};
  120. BYTE CmdAPDLStart[] = {0x1C,0x01}; // A/PDL start
  121. BYTE CmdAPDLEnd[] = {0x1C,0x02}; // A/PDL end
  122. BYTE CmdBeginPhysPage[] = {0x1C,0x03}; // Begin Physical Page
  123. BYTE CmdEndPhysPage[] = {0x1C,0x04}; // End Physical Page
  124. BYTE CmdBeginLogPage[] = {0x1C,0x05}; // Begin Logical page
  125. BYTE CmdEndLogPage[] = {0x1C,0x06}; // End Logical Page
  126. BYTE CmdEjectPhysPaper[]= {0x1C,0x0F}; // Print&Eject Phys Paper
  127. BYTE CmdMoveHoriPos[] = {0x1C,0x21,0x00,0x00}; // Horizontal Relative
  128. BYTE CmdGivenHoriPos[] = {0x1C,0x23,0x00,0x00}; // Horizontal Absolute
  129. BYTE CmdGivenVerPos[] = {0x1C,0x24,0x00,0x00}; // Vertical Absolute
  130. BYTE CmdSetGivenPos[] = {0x1C,0x40,0x00,0x00,0x00,0x00};
  131. BYTE CmdPrnStrCurrent[] = {0x1C,0xC3,0x00,0x00,0x03}; // Print String
  132. BYTE CmdBoldItalicOn[] = {0x1C,0xA5,0x08,0x04,0x06,0x02,0x30,0x00,0x00,0x00,0x00};
  133. BYTE CmdBoldOn[] = {0x1C,0xA5,0x04,0x04,0x02,0x02,0x20};
  134. BYTE CmdItalicOn[] = {0x1c,0xa5,0x08,0x04,0x06,0x02,0x10,0x00,0x00,0x00,0x00};
  135. BYTE CmdBoldItalicOff[] = {0x1c,0xa5,0x04,0x04,0x02,0x02,0x00};
  136. BYTE CmdSetPhysPaper[] = {0x1C,0xA0, // Set Physical Paper
  137. 0x10, // length
  138. 0x01, // SubCmd Basic Characteristics
  139. 0x05, // SubCmdLength
  140. 0x01, // Paper Size
  141. 0x01, // PaperTray
  142. 0x00, // AutoTrayMode
  143. 00, // Duplex Mode
  144. 0x01, // Copy Count
  145. 0x02, // SubCmd Set Unfixed Paper Size
  146. 0x07, // SubCmdLength
  147. 00, // UnitBase
  148. 00,00, // Logical Unit
  149. 00,00, // Width
  150. 00,00}; // Height
  151. BYTE CmdSetPhysPage[] = {0x1C,0xA1, // Set Physical Page
  152. 0x0D, // Length
  153. 0x01, // SubCmd Resolution
  154. 0x03, // SubCmdLength
  155. 00, // Unit Base of 10
  156. 0x0B,0xB8, // and Logical Unit Res of 3000
  157. 0x02, // SubCmd Toner Save
  158. 0x01, // SubCmdLength
  159. 00, // Toner Save OFF
  160. 0x03, // SubCmd N-Up
  161. 0x03, // SubCmdLength
  162. 00,00,00}; // N-Up off
  163. BYTE CmdDefDrawArea[] = {0x1C,0xA2, // Define Drawing Area
  164. 0x0D, // length
  165. 0x01, // SubCmd origin width,height
  166. 0x08, // SubCmdLength
  167. 0x00,0x77, // origin X
  168. 0x00,0x77, // origin Y
  169. 00,00, // width
  170. 00,00, // height
  171. 0x02, // SubCmd Media Origin
  172. 0x01, // SubCmdLength
  173. 00}; // Portrait
  174. BYTE CmdDrawImgCurrent[]= {0x1C,0xE1, // Draw Image at current position
  175. 00,00,00,00, // length
  176. 01, // Compress method : 0x01 = BRL
  177. 00,00, // actual width of image
  178. 00,LINE_PER_BAND, // actual height of image
  179. 00,00,00,00}; // length of raw image
  180. UNIDRVFN_WRITESPOOLBUF WriteSpoolBuf;
  181. UNIDRVFN_ALLOCMEM AllocMem;
  182. UNIDRVFN_FREEMEM FreeMem;
  183. DRVFN MiniDrvFnTab[] =
  184. {
  185. {INDEX_MiniDrvEnablePDEV, (PFN)MiniDrvEnablePDEV},
  186. {INDEX_MiniDrvDisablePDEV, (PFN)MiniDrvDisablePDEV},
  187. {INDEX_OEMWriteSpoolBuf, (PFN)CBFilterGraphics},
  188. {INDEX_OEMOutputCmd, (PFN)OEMOutputCmd},
  189. {INDEX_OEMGetFontCmd, (PFN)OEMGetFontCmd},
  190. {INDEX_OEMOutputChar, (PFN)OEMOutputChar},
  191. {INDEX_OEMSendScalableFontCmd, (PFN)OEMSendScalableFontCmd},
  192. {INDEX_OEMScaleWidth1, (PFN)OEMScaleWidth}
  193. };