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.

349 lines
16 KiB

  1. /*++
  2. Copyright (c) 1996-1997 Microsoft Corporation
  3. Module Name:
  4. utils.h
  5. Abstract:
  6. header file for utility functions
  7. Environment:
  8. user-mode only
  9. Revision History:
  10. 10/17/96 -zhanw-
  11. Created it.
  12. --*/
  13. //
  14. // define bit flags for command conversion mode
  15. //
  16. #define MODE_STRING 0x0001 // within double quotes "...". Writing out the
  17. // openning double quote causes this bit be set
  18. // and the closing double quote causes it be reset.
  19. #define MODE_HEX 0x0002 // within angle brackets <...>. Writing out the
  20. // left angle bracket causes this bit be set and
  21. // the right angle bracket causes it be reset.
  22. // To set MODE_HEX, MODE_STRING must be set first.
  23. #define MODE_PARAM 0x0004 // within a parameter segment. It's mutual
  24. // exclusive with MODE_STRING and MODE_HEX.
  25. #define IS_CHAR_READABLE(ch) ((ch) >= 0x20 && (ch) <= 0x7E)
  26. extern BYTE gbHexChar[16];
  27. #define CMD_LINE_LENGTH_MAX 63
  28. #define EOR 0xFFFFFFFF
  29. extern PSTR gpstrSVNames[SV_MAX];
  30. extern DWORD gdwSVLists[];
  31. extern WORD gawCmdtoSVOffset[MAXCMD+MAXECMD];
  32. typedef enum _FEATUREID {
  33. FID_PAPERDEST,
  34. FID_IMAGECONTROL,
  35. FID_PRINTDENSITY,
  36. FID_MAX
  37. } FEATUREID;
  38. extern PSTR gpstrFeatureName[FID_MAX];
  39. extern PSTR gpstrFeatureDisplayName[FID_MAX];
  40. extern PSTR gpstrFeatureDisplayNameMacro[FID_MAX];
  41. extern INT gintFeatureDisplayNameID[FID_MAX];
  42. extern WORD gwFeatureMDOI[FID_MAX];
  43. extern WORD gwFeatureOCDWordOffset[FID_MAX];
  44. extern WORD gwFeatureHE[FID_MAX];
  45. extern WORD gwFeatureORD[FID_MAX];
  46. extern WORD gwFeatureCMD[FID_MAX];
  47. #define STD_PS_DISPLAY_NAME_ID_BASE 10000
  48. #define STD_IB_DISPLAY_NAME_ID_BASE 10256
  49. #define STD_MT_DISPLAY_NAME_ID_BASE 10512
  50. #define STD_TQ_DISPLAY_NAME_ID_BASE 10768
  51. //
  52. // standard paper size id's. Copied from Win95 source
  53. //
  54. #define DMPAPER_FIRST DMPAPER_LETTER
  55. #define DMPAPER_LETTER 1 /* Letter 8 1/2 x 11 in */
  56. #define DMPAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */
  57. #define DMPAPER_TABLOID 3 /* Tabloid 11 x 17 in */
  58. #define DMPAPER_LEDGER 4 /* Ledger 17 x 11 in */
  59. #define DMPAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */
  60. #define DMPAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */
  61. #define DMPAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */
  62. #define DMPAPER_A3 8 /* A3 297 x 420 mm */
  63. #define DMPAPER_A4 9 /* A4 210 x 297 mm */
  64. #define DMPAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */
  65. #define DMPAPER_A5 11 /* A5 148 x 210 mm */
  66. #define DMPAPER_B4 12 /* B4 (JIS) 257 x 364 mm */
  67. #define DMPAPER_B5 13 /* B5 (JIS) 182 x 257 mm */
  68. #define DMPAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */
  69. #define DMPAPER_QUARTO 15 /* Quarto 215 x 275 mm */
  70. #define DMPAPER_10X14 16 /* 10 x 14 in */
  71. #define DMPAPER_11X17 17 /* 11 x 17 in */
  72. #define DMPAPER_NOTE 18 /* Note 8 1/2 x 11 in */
  73. #define DMPAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 in */
  74. #define DMPAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 in */
  75. #define DMPAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 in */
  76. #define DMPAPER_ENV_12 22 /* Envelope #12 4 3/4 x 11 in */
  77. #define DMPAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 in */
  78. #define DMPAPER_CSHEET 24 /* C size sheet */
  79. #define DMPAPER_DSHEET 25 /* D size sheet */
  80. #define DMPAPER_ESHEET 26 /* E size sheet */
  81. #define DMPAPER_ENV_DL 27 /* Envelope DL 110 x 220 mm */
  82. #define DMPAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */
  83. #define DMPAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */
  84. #define DMPAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */
  85. #define DMPAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */
  86. #define DMPAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */
  87. #define DMPAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */
  88. #define DMPAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */
  89. #define DMPAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */
  90. #define DMPAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */
  91. #define DMPAPER_ENV_MONARCH 37 /* Envelope Monarch 3 7/8 x 7 1/2 in */
  92. #define DMPAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */
  93. #define DMPAPER_FANFOLD_US 39 /* US Standard Fanfold 14 7/8 x 11 in */
  94. #define DMPAPER_FANFOLD_STD_GERMAN 40 /* German Standard Fanfold 8 1/2 x 12 in */
  95. #define DMPAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */
  96. /*
  97. ** the following sizes are new in Windows 95
  98. */
  99. #define DMPAPER_ISO_B4 42 /* B4 (ISO) 250 x 353 mm */
  100. #define DMPAPER_JAPANESE_POSTCARD 43 /* Japanese Postcard 100 x 148 mm */
  101. #define DMPAPER_9X11 44 /* 9 x 11 in */
  102. #define DMPAPER_10X11 45 /* 10 x 11 in */
  103. #define DMPAPER_15X11 46 /* 15 x 11 in */
  104. #define DMPAPER_ENV_INVITE 47 /* Envelope Invite 220 x 220 mm */
  105. #define DMPAPER_RESERVED_48 48 /* RESERVED--DO NOT USE */
  106. #define DMPAPER_RESERVED_49 49 /* RESERVED--DO NOT USE */
  107. /*
  108. ** the following sizes were used in Windows 3.1 WDL PostScript driver
  109. ** and are retained here for compatibility with the old driver.
  110. ** Tranverse is used as in the PostScript language, and indicates that
  111. ** the physical page is rotated, but that the logical page is not.
  112. */
  113. #define DMPAPER_LETTER_EXTRA 50 /* Letter Extra 9 1/2 x 12 in */
  114. #define DMPAPER_LEGAL_EXTRA 51 /* Legal Extra 9 1/2 x 15 in */
  115. #define DMPAPER_TABLOID_EXTRA 52 /* Tabloid Extra 11.69 x 18 in */
  116. #define DMPAPER_A4_EXTRA 53 /* A4 Extra 9.27 x 12.69 in */
  117. #define DMPAPER_LETTER_TRANSVERSE 54 /* Letter Transverse 8 1/2 x 11 in */
  118. #define DMPAPER_A4_TRANSVERSE 55 /* A4 Transverse 210 x 297 mm */
  119. #define DMPAPER_LETTER_EXTRA_TRANSVERSE 56/* Letter Extra Transverse 9 1/2 x 12 in */
  120. #define DMPAPER_A_PLUS 57 /* SuperA/SuperA/A4 227 x 356 mm */
  121. #define DMPAPER_B_PLUS 58 /* SuperB/SuperB/A3 305 x 487 mm */
  122. #define DMPAPER_LETTER_PLUS 59 /* Letter Plus 8.5 x 12.69 in */
  123. #define DMPAPER_A4_PLUS 60 /* A4 Plus 210 x 330 mm */
  124. #define DMPAPER_A5_TRANSVERSE 61 /* A5 Transverse 148 x 210 mm */
  125. #define DMPAPER_B5_TRANSVERSE 62 /* B5 (JIS) Transverse 182 x 257 mm */
  126. #define DMPAPER_A3_EXTRA 63 /* A3 Extra 322 x 445 mm */
  127. #define DMPAPER_A5_EXTRA 64 /* A5 Extra 174 x 235 mm */
  128. #define DMPAPER_B5_EXTRA 65 /* B5 (ISO) Extra 201 x 276 mm */
  129. #define DMPAPER_A2 66 /* A2 420 x 594 mm */
  130. #define DMPAPER_A3_TRANSVERSE 67 /* A3 Transverse 297 x 420 mm */
  131. #define DMPAPER_A3_EXTRA_TRANSVERSE 68 /* A3 Extra Transverse 322 x 445 mm */
  132. /*
  133. ** the following sizes are reserved for the Far East version of Win95.
  134. ** Rotated papers rotate the physical page but not the logical page.
  135. */
  136. #define DMPAPER_DBL_JAPANESE_POSTCARD 69/* Japanese Double Postcard 200 x 148 mm */
  137. #define DMPAPER_A6 70 /* A6 105 x 148 mm */
  138. #define DMPAPER_JENV_KAKU2 71 /* Japanese Envelope Kaku #2 */
  139. #define DMPAPER_JENV_KAKU3 72 /* Japanese Envelope Kaku #3 */
  140. #define DMPAPER_JENV_CHOU3 73 /* Japanese Envelope Chou #3 */
  141. #define DMPAPER_JENV_CHOU4 74 /* Japanese Envelope Chou #4 */
  142. #define DMPAPER_LETTER_ROTATED 75 /* Letter Rotated 11 x 8 1/2 11 in */
  143. #define DMPAPER_A3_ROTATED 76 /* A3 Rotated 420 x 297 mm */
  144. #define DMPAPER_A4_ROTATED 77 /* A4 Rotated 297 x 210 mm */
  145. #define DMPAPER_A5_ROTATED 78 /* A5 Rotated 210 x 148 mm */
  146. #define DMPAPER_B4_JIS_ROTATED 79 /* B4 (JIS) Rotated 364 x 257 mm */
  147. #define DMPAPER_B5_JIS_ROTATED 80 /* B5 (JIS) Rotated 257 x 182 mm */
  148. #define DMPAPER_JAPANESE_POSTCARD_ROTATED 81 /* Japanese Postcard Rotated 148 x 100 mm */
  149. #define DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED 82 /* Double Japanese Postcard Rotated 148 x 200 mm */
  150. #define DMPAPER_A6_ROTATED 83 /* A6 Rotated 148 x 105 mm */
  151. #define DMPAPER_JENV_KAKU2_ROTATED 84 /* Japanese Envelope Kaku #2 Rotated*/
  152. #define DMPAPER_JENV_KAKU3_ROTATED 85 /* Japanese Envelope Kaku #3 Rotated*/
  153. #define DMPAPER_JENV_CHOU3_ROTATED 86 /* Japanese Envelope Chou #3 Rotated*/
  154. #define DMPAPER_JENV_CHOU4_ROTATED 87 /* Japanese Envelope Chou #4 Rotated*/
  155. #define DMPAPER_B6_JIS 88 /* B6 (JIS) 128 x 182 mm */
  156. #define DMPAPER_B6_JIS_ROTATED 89 /* B6 (JIS) Rotated 182 x 128 mm */
  157. #define DMPAPER_12X11 90 /* 12 x 11 in */
  158. #define DMPAPER_JENV_YOU4 91 /* Japanese Envelope You #4 */
  159. #define DMPAPER_JENV_YOU4_ROTATED 92 /* Japanese Envelope You #4 Rotated*/
  160. #define DMPAPER_P16K 93 /* PRC 16K 146 x 215 mm */
  161. #define DMPAPER_P32K 94 /* PRC 32K 97 x 151 mm */
  162. #define DMPAPER_P32KBIG 95 /* PRC 32K(Big) 97 x 151 mm */
  163. #define DMPAPER_PENV_1 96 /* PRC Envelope #1 102 x 165 mm */
  164. #define DMPAPER_PENV_2 97 /* PRC Envelope #2 102 x 176 mm */
  165. #define DMPAPER_PENV_3 98 /* PRC Envelope #3 125 x 176 mm */
  166. #define DMPAPER_PENV_4 99 /* PRC Envelope #4 110 x 208 mm */
  167. #define DMPAPER_PENV_5 100 /* PRC Envelope #5 110 x 220 mm */
  168. #define DMPAPER_PENV_6 101 /* PRC Envelope #6 120 x 230 mm */
  169. #define DMPAPER_PENV_7 102 /* PRC Envelope #7 160 x 230 mm */
  170. #define DMPAPER_PENV_8 103 /* PRC Envelope #8 120 x 309 mm */
  171. #define DMPAPER_PENV_9 104 /* PRC Envelope #9 229 x 324 mm */
  172. #define DMPAPER_PENV_10 105 /* PRC Envelope #10 324 x 458 mm */
  173. #define DMPAPER_P16K_ROTATED 106 /* PRC 16K Rotated */
  174. #define DMPAPER_P32K_ROTATED 107 /* PRC 32K Rotated */
  175. #define DMPAPER_P32KBIG_ROTATED 108 /* PRC 32K(Big) Rotated */
  176. #define DMPAPER_PENV_1_ROTATED 109 /* PRC Envelope #1 Rotated 165 x 102 mm*/
  177. #define DMPAPER_PENV_2_ROTATED 110 /* PRC Envelope #2 Rotated 176 x 102 mm*/
  178. #define DMPAPER_PENV_3_ROTATED 111 /* PRC Envelope #3 Rotated 176 x 125 mm*/
  179. #define DMPAPER_PENV_4_ROTATED 112 /* PRC Envelope #4 Rotated 208 x 110 mm*/
  180. #define DMPAPER_PENV_5_ROTATED 113 /* PRC Envelope #5 Rotated 220 x 110 mm*/
  181. #define DMPAPER_PENV_6_ROTATED 114 /* PRC Envelope #6 Rotated 230 x 120 mm*/
  182. #define DMPAPER_PENV_7_ROTATED 115 /* PRC Envelope #7 Rotated 230 x 160 mm*/
  183. #define DMPAPER_PENV_8_ROTATED 116 /* PRC Envelope #8 Rotated 309 x 120 mm*/
  184. #define DMPAPER_PENV_9_ROTATED 117 /* PRC Envelope #9 Rotated 324 x 229 mm*/
  185. #define DMPAPER_PENV_10_ROTATED 118 /* PRC Envelope #10 Rotated 458 x 324 mm */
  186. #define DMPAPER_COUNT DMPAPER_PENV_10_ROTATED
  187. #define DMPAPER_USER 256
  188. //
  189. // define the mapping between standard paper size id to the standard
  190. // PaperSize option name
  191. //
  192. extern PSTR gpstrStdPSName[DMPAPER_COUNT];
  193. extern PSTR gpstrStdPSDisplayName[DMPAPER_COUNT];
  194. extern PSTR gpstrStdPSDisplayNameMacro[DMPAPER_COUNT];
  195. //
  196. // standard input bin id's. Copied from Win95 source
  197. //
  198. #define DMBIN_FIRST DMBIN_UPPER
  199. #define DMBIN_UPPER 1
  200. #define DMBIN_ONLYONE 1
  201. #define DMBIN_LOWER 2
  202. #define DMBIN_MIDDLE 3
  203. #define DMBIN_MANUAL 4
  204. #define DMBIN_ENVELOPE 5
  205. #define DMBIN_ENVMANUAL 6
  206. #define DMBIN_AUTO 7
  207. #define DMBIN_TRACTOR 8
  208. #define DMBIN_SMALLFMT 9
  209. #define DMBIN_LARGEFMT 10
  210. #define DMBIN_LARGECAPACITY 11
  211. #define DMBIN_CASSETTE 14
  212. #define DMBIN_FORMSOURCE 15 /* not supported under windows 95 */
  213. #define DMBIN_LAST DMBIN_FORMSOURCE
  214. #define DMBIN_USER 256 /* device specific bins start here */
  215. extern PSTR gpstrStdIBName[DMBIN_LAST];
  216. extern PSTR gpstrStdIBDisplayName[DMBIN_LAST];
  217. extern PSTR gpstrStdIBDisplayNameMacro[DMBIN_LAST];
  218. //
  219. // standard MediaType id's. Copied from Win95 source.
  220. //
  221. #define DMMEDIA_STANDARD 1 /* Standard paper */
  222. #define DMMEDIA_TRANSPARENCY 2 /* Transparency */
  223. #define DMMEDIA_GLOSSY 3 /* Glossy paper */
  224. #define DMMEDIA_LAST DMMEDIA_GLOSSY
  225. #define DMMEDIA_USER 256 /* Device-specific media start here */
  226. extern PSTR gpstrStdMTName[DMMEDIA_LAST];
  227. extern PSTR gpstrStdMTDisplayName[DMMEDIA_LAST];
  228. extern PSTR gpstrStdMTDisplayNameMacro[DMMEDIA_LAST];
  229. //
  230. // standard TextQuality id's. Copies from minidriv.h
  231. //
  232. #define DMTEXT_LQ 1
  233. #define DMTEXT_NLQ 2
  234. #define DMTEXT_MEMO 3
  235. #define DMTEXT_DRAFT 4
  236. #define DMTEXT_TEXT 5
  237. #define DMTEXT_LAST DMTEXT_TEXT
  238. #define DMTEXT_USER 256
  239. extern PSTR gpstrStdTQName[DMTEXT_LAST];
  240. extern PSTR gpstrStdTQDisplayName[DMTEXT_LAST];
  241. extern PSTR gpstrStdTQDisplayNameMacro[DMTEXT_LAST];
  242. typedef enum _BAPOS {
  243. NONE,
  244. CENTER,
  245. LEFT,
  246. RIGHT,
  247. BAPOS_MAX
  248. } BAPOS;
  249. typedef enum _FACEDIR {
  250. UP,
  251. DOWN,
  252. FD_MAX
  253. } FACEDIR;
  254. extern PSTR gpstrPositionName[BAPOS_MAX];
  255. extern PSTR gpstrFaceDirName[FD_MAX];
  256. extern PSTR gpstrColorName[8];
  257. extern WORD gwColorPlaneCmdID[4];
  258. extern PSTR gpstrColorPlaneCmdName[8];
  259. extern PSTR gpstrSectionName[7];
  260. //
  261. // function prototypes
  262. //
  263. //
  264. void *
  265. GetTableInfo(
  266. IN PDH pdh, /* Base address of GPC data */
  267. IN int iResType, /* Resource type - HE_... values */
  268. IN int iIndex); /* Desired index for this entry */
  269. void _cdecl
  270. VOut(
  271. PCONVINFO,
  272. PSTR,
  273. ...);
  274. BOOL
  275. BBuildCmdStr(
  276. IN OUT PCONVINFO pci,
  277. IN WORD wCmdID,
  278. IN WORD ocd);
  279. void
  280. VOutputSelectionCmd(
  281. IN OUT PCONVINFO pci,// contain info about the cmd to output
  282. IN BOOL bDocSetup, // whether in DOC_SETUP or PAGE_SETUP section
  283. IN WORD wOrder); // order number within the section
  284. void
  285. VOutputConfigCmd(
  286. IN OUT PCONVINFO pci,// contain info about the cmd to output
  287. IN PSTR pstrCmdName, // command name
  288. IN SEQSECTION ss, // sequence section id
  289. IN WORD wOrder); // order number within the section
  290. void
  291. VOutputCmd(
  292. IN OUT PCONVINFO pci, // contain info about the cmd to output
  293. IN PSTR pstrCmdName);
  294. void
  295. VOutputExternCmd(
  296. IN OUT PCONVINFO pci,
  297. IN PSTR pstrCmdName);
  298. void
  299. VOutputCmd2(
  300. IN OUT PCONVINFO pci,
  301. IN PSTR pstrCmdName);
  302. BOOL
  303. BInDocSetup(
  304. IN PCONVINFO pci,
  305. IN WORD pc_ord, // PC_ORD_xxx id
  306. OUT PWORD pwOrder); // to store the order number as in GPC