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.

1499 lines
48 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. parser.h
  5. Abstract:
  6. Common header file for both PPD and GPD parsers
  7. Revision History:
  8. 12/03/96 -davidx-
  9. Check binary file date against all included source files.
  10. 10/14/96 -davidx-
  11. Add new interface function MapToDeviceOptIndex.
  12. 10/11/96 -davidx-
  13. Make CustomPageSize feature an option of PageSize.
  14. 09/25/96 -davidx-
  15. New helper function CheckFeatureOptionConflict.
  16. Overlow iMode parameter to ResolveUIConflicts.
  17. 08/30/96 -davidx-
  18. Coding style changes after code review.
  19. 8/15/96 -davidx-
  20. Define common parser interfaces.
  21. 7/22/96 -amandan-
  22. Modified it to include shared binary data structs and UI requirements
  23. 4/18/95 -davidx-
  24. Created it.
  25. --*/
  26. #ifndef _PARSER_H_
  27. #define _PARSER_H_
  28. //
  29. // Parser version number is a DWORD. High-order WORD is the version number shared
  30. // by PPD and GPD parsers. Low-order WORD is the private version number specific
  31. // to PPD or GPD parser.
  32. //
  33. // When you make a change that affects both parsers, increment the shared parser
  34. // version number below. If your change only affects one of the parsers, then
  35. // increment the private parser version number in ppd.h or parsers\gpd\gpdparse.h.
  36. // also increment the shared version whenever a new OS version is released
  37. // for example Whistler or Blackcomb.
  38. //
  39. #define SHARED_PARSER_VERSION 0x0010
  40. //
  41. // Printer feature selection information is stored in an array of OPTSELECT structures
  42. // (in DEVMODE as well as printer-sticky data in registry). Maximum number of entries
  43. // in the array is limited to MAX_PRINTER_OPTIONS. The parsers should make sure the
  44. // total number of printer features doesn't exceed this number.
  45. //
  46. // To accommodate PickMany printer features, the selected options for each feature form
  47. // a linked list. The selection list for printer feature N starts at the N'th element
  48. // of the array.
  49. //
  50. // For the last OPTSELECT structure in a list, ubNext field will be 0.
  51. //
  52. // If the option index in an OPTSELECT structure is 0xff, it means no option is
  53. // selected for the corresponding feature.
  54. //
  55. #define MAX_PRINTER_OPTIONS 256
  56. #define MAX_COMBINED_OPTIONS (MAX_PRINTER_OPTIONS * 2)
  57. #define OPTION_INDEX_ANY 0xff
  58. #define GET_RESOURCE_FROM_DLL 0x80000000
  59. #define USE_SYSTEM_NAME 0xFFFFFFFF
  60. #define KEYWORD_SIZE_EXTRA 32
  61. #define RESERVED_STRINGID_START 10000
  62. #define RESERVED_STRINGID_END 20000
  63. typedef DWORD LISTINDEX;
  64. typedef enum _QUALITYSETTING {
  65. QS_BEST,
  66. QS_BETTER,
  67. QS_DRAFT,
  68. } QUALITYSETTING;
  69. typedef struct _OPTSELECT {
  70. BYTE ubCurOptIndex; // option index for the current selection
  71. BYTE ubNext; // link pointer to the next selection
  72. } OPTSELECT, *POPTSELECT;
  73. #define NULL_OPTSELECT 0
  74. //
  75. // Macro for converting byte offsets to pointers.
  76. // NOTE: If the byte offset is zero, the resulting pointer is NULL.
  77. //
  78. #define OFFSET_TO_POINTER(pStart, offset) \
  79. ((PVOID) ((offset) ? (PBYTE) (pStart) + (offset) : NULL))
  80. #define POINTER_TO_OFFSET(pStart, pEnd) \
  81. ( ((pEnd) ? (PVOID)((PBYTE) (pEnd) - (PBYTE)(pStart)) : NULL) )
  82. //
  83. // Macro for getting the quality value, be it the resolution or the negative
  84. // quality value
  85. //
  86. #define GETQUALITY_X(pRes) \
  87. (((INT)pRes->dwResolutionID >= DMRES_HIGH && (INT)pRes->dwResolutionID <= DMRES_DRAFT) ? (INT)pRes->dwResolutionID : pRes->iXdpi)
  88. #define GETQUALITY_Y(pRes) \
  89. (((INT)pRes->dwResolutionID >= DMRES_HIGH && (INT)pRes->dwResolutionID <= DMRES_DRAFT) ? (INT)pRes->dwResolutionID : pRes->iYdpi)
  90. //
  91. // Pointers in the binary data are represented as byte offsets to the beginning
  92. // of the binary data.
  93. //
  94. typedef DWORD PTRREF;
  95. //
  96. // Resource reference type:
  97. // If the most significant bit is on, then it's a resource ID (without MSB)
  98. // otherwise, it's an offset from the beginning of the binary data
  99. //
  100. typedef DWORD RESREF;
  101. //
  102. // Data structure used to represent the format of loOffset when indicating resource Ids
  103. //
  104. typedef struct
  105. {
  106. WORD wResourceID ; // ResourceID
  107. BYTE bFeatureID ; // Feature index for the resource DLL feature.
  108. // If zero, we will use the name specified
  109. // in ResourceDLL
  110. BYTE bOptionID ; // Option index for the qualified resource dll name.
  111. } QUALNAMEEX, * PQUALNAMEEX ;
  112. //
  113. // Data structure used to represent an array in the binary data
  114. // It's also used to represent an invocation string in the binary data
  115. //
  116. // Note (Unidrv only): for all arrayrefs containing Strings the dwCount field
  117. // holds the number of bytes which the string contains. For Unicode strings
  118. // this is TWICE the number of Unicode characters.
  119. //
  120. typedef struct _ARRAYREF {
  121. DWORD dwCount; // number of elements in the array,
  122. // If using it as an INVOCATION, dwCount is
  123. // the number of bytes in the invocation string
  124. PTRREF loOffset; // byte-offset to the beginning of the array
  125. } ARRAYREF, *PARRAYREF, INVOCATION, *PINVOCATION;
  126. //
  127. // Data structure used to represent a job patch file in the binary data
  128. //
  129. typedef struct _JOBPATCHFILE {
  130. DWORD dwCount; // number of bytes in the patch string
  131. PTRREF loOffset; // byte-offset to the beginning of the string
  132. LONG lJobPatchNo; // number of the patch file as specified in the PPD-file
  133. } JOBPATCHFILE, *PJOBPATCHFILE;
  134. //
  135. // Data structure used to represent a conflict feature/option pair:
  136. // nFeatureIndex1/nOptionIndex1 specifies the higher priority feature/option pair
  137. // nFeatureIndex2/nOptionIndex2 specifies the lower priority feature/option pair
  138. //
  139. typedef struct _CONFLICTPAIR {
  140. DWORD dwFeatureIndex1;
  141. DWORD dwOptionIndex1;
  142. DWORD dwFeatureIndex2;
  143. DWORD dwOptionIndex2;
  144. } CONFLICTPAIR, *PCONFLICTPAIR;
  145. //
  146. // Raw binary printer description data
  147. //
  148. typedef struct _RAWBINARYDATA {
  149. DWORD dwFileSize; // size of binary data file
  150. DWORD dwParserSignature; // parser signature
  151. DWORD dwParserVersion; // parser version number
  152. DWORD dwChecksum32; // 32-bit CRC checksum of Feature/Option keywords
  153. DWORD dwSrcFileChecksum32; // 32-bit CRC checksum of printer description file
  154. DWORD dwDocumentFeatures; // number of doc-sticky features
  155. DWORD dwPrinterFeatures; // number of printer-sticky features
  156. ARRAYREF FileDateInfo; // date info about printer description files
  157. //
  158. // These fields are only filled out and used during runtime.
  159. // They should be zeroed out inside the binary data file.
  160. //
  161. PVOID pvReserved; // reserved, must be NULL for now
  162. PVOID pvPrivateData; // private data for parser use
  163. } RAWBINARYDATA, *PRAWBINARYDATA;
  164. //
  165. // Data structure for RAWBINARYDATA.FileDateInfo:
  166. // dwCount - number of source printer description files
  167. // loOffset - offset to an array of FILEDATEINFO structures, one per file
  168. // FILEDATEINFO.loFileName - offset to the filename (Unicode full pathname)
  169. // FILEDATEINFO.FileTime - timestamp on the file
  170. //
  171. typedef struct _FILEDATEINFO {
  172. PTRREF loFileName;
  173. FILETIME FileTime;
  174. } FILEDATEINFO, *PFILEDATEINFO;
  175. //
  176. // Instances of binary printer description data
  177. //
  178. typedef struct _INFOHEADER {
  179. RAWBINARYDATA RawData; // raw binary data header
  180. PTRREF loUIInfoOffset; // byte-offset to common UIINFO structure
  181. PTRREF loDriverOffset; // byte-offset to unique driver infoformation
  182. } INFOHEADER, *PINFOHEADER;
  183. //
  184. // Parser signatures for INFOHEADER.dwParserSignature field
  185. //
  186. #define PPD_PARSER_SIGNATURE 'PPD '
  187. #define GPD_PARSER_SIGNATURE 'GPD '
  188. //
  189. // Given a pointer to INFOHEADER, return a pointer to UIINFO or driver info structure
  190. //
  191. #define GET_UIINFO_FROM_INFOHEADER(pInfoHdr) \
  192. ((PUIINFO) OFFSET_TO_POINTER(pInfoHdr, (pInfoHdr)->loUIInfoOffset))
  193. #define GET_DRIVER_INFO_FROM_INFOHEADER(pInfoHdr) \
  194. OFFSET_TO_POINTER(pInfoHdr, (pInfoHdr)->loDriverOffset)
  195. //
  196. // IDs used to reference the predefined printer features
  197. //
  198. #define GID_RESOLUTION 0
  199. #define GID_PAGESIZE 1
  200. #define GID_PAGEREGION 2
  201. #define GID_DUPLEX 3
  202. #define GID_INPUTSLOT 4
  203. #define GID_MEDIATYPE 5
  204. #define GID_MEMOPTION 6
  205. #define GID_COLORMODE 7
  206. #define GID_ORIENTATION 8
  207. #define GID_PAGEPROTECTION 9
  208. #define GID_COLLATE 10
  209. #define GID_OUTPUTBIN 11
  210. #define GID_HALFTONING 12
  211. #define GID_LEADINGEDGE 13
  212. #define GID_USEHWMARGINS 14
  213. #define MAX_GID 15
  214. #define GID_UNKNOWN 0xffff
  215. //
  216. // Common information provided by both GPD and PPD parsers and
  217. // used by the user-interface DLL.
  218. //
  219. typedef struct _UIINFO {
  220. DWORD dwSize; // size of this structure
  221. PTRREF loResourceName; // name of the resource DLL
  222. PTRREF loPersonality ; // printer's PDL language
  223. PTRREF loNickName; // printer model name
  224. DWORD dwSpecVersion; // printer description file format version
  225. DWORD dwTechnology; // see TECHNOLOGY enumeration
  226. DWORD dwDocumentFeatures; // number of doc-sticky features
  227. DWORD dwPrinterFeatures; // number of printer-sticky features
  228. PTRREF loFeatureList; // byte-offset to array of FEATUREs
  229. RESREF loFontSubstTable; // default font substitution table - these fields
  230. DWORD dwFontSubCount; // have different meanings for PPD and GPD parsers
  231. ARRAYREF UIConstraints; // array of UICONSTRAINTs
  232. ARRAYREF UIGroups; // array of UIGROUPs
  233. DWORD dwMaxCopies; // maximum copies allowed
  234. DWORD dwMinScale; // mimimum scale factor (percent)
  235. DWORD dwMaxScale; // maximum scale factor (percent)
  236. DWORD dwLangEncoding; // translation string language encoding
  237. DWORD dwLangLevel; // page description langauge level
  238. INVOCATION Password; // password invocation string
  239. INVOCATION ExitServer; // exitserver invocation string
  240. DWORD dwProtocols; // supported comm protocols
  241. DWORD dwJobTimeout; // default job timeout value
  242. DWORD dwWaitTimeout; // default wait timeout value
  243. DWORD dwTTRasterizer; // TrueType rasterizer option
  244. DWORD dwFreeMem; // free memory - global default
  245. DWORD dwPrintRate; // print speed
  246. DWORD dwPrintRateUnit; // print speed unit
  247. DWORD dwPrintRatePPM; // print speed in PPM equivalents
  248. FIX_24_8 fxScreenAngle; // screen angle - global default
  249. FIX_24_8 fxScreenFreq; // screen angle - global default
  250. DWORD dwFlags; // misc. flag bits
  251. DWORD dwCustomSizeOptIndex; // custom size option index if supported
  252. RESREF loPrinterIcon; // MUST BE ID, not OFFSET. Icon ID for printer
  253. // MUST BE LESS than IDI_CPSUI_ICONID_FIRST
  254. DWORD dwCartridgeSlotCount; // number of font cartridge slot
  255. ARRAYREF CartridgeSlot; // array of font cartridges names
  256. PTRREF loFontInstallerName; //
  257. PTRREF loHelpFileName; // name of custom help file, if 0 -> no custom help
  258. POINT ptMasterUnits; // master units per inch
  259. BOOL bChangeColorModeOnDoc ; // is driver allowed to switch colormodes on a per page
  260. // basis - within a single document , but not within a page?
  261. // Don't confuse with bChangeColorModeOnPage which is stored
  262. // in bChangeColorMode in GLOBALS.
  263. // these fields hold settings for driver to assume whenever
  264. // the user presses the associated button.
  265. LISTINDEX liDraftQualitySettings; // "DraftQualitySettings"
  266. LISTINDEX liBetterQualitySettings; // "BetterQualitySettings"
  267. LISTINDEX liBestQualitySettings; // "BestQualitySettings"
  268. QUALITYSETTING defaultQuality ; // "DefaultQuality"
  269. //
  270. // Byte-offsets to predefined printer features.
  271. // If a predefined printer feature is not supported, its
  272. // corresponding entry in the array should be 0.
  273. //
  274. PTRREF aloPredefinedFeatures[MAX_GID];
  275. DWORD dwMaxDocKeywordSize;
  276. DWORD dwMaxPrnKeywordSize;
  277. DWORD dwReserved[6];
  278. //
  279. // Pointer to the beginning of resource data. This is only used during runtime
  280. // and should be set to 0 inside the binary data file.
  281. //
  282. PBYTE pubResourceData;
  283. //
  284. // Pointer back to the INFOHEADER structure for convenience.
  285. // This is only used during runtime and should be set to 0
  286. // inside the binary data file.
  287. //
  288. PINFOHEADER pInfoHeader;
  289. } UIINFO, *PUIINFO;
  290. //
  291. // Given a pointer to a UIINFO structure and a predefined feature ID,
  292. // return a pointer to the FEATURE structure corresponding to the specified
  293. // feature. If the specified feature is not supported on the printer,
  294. // a NULL is returned.
  295. //
  296. #define GET_PREDEFINED_FEATURE(pUIInfo, gid) \
  297. OFFSET_TO_POINTER((pUIInfo)->pInfoHeader, (pUIInfo)->aloPredefinedFeatures[gid])
  298. //
  299. // Given a pointer to UIINFO structure and a pointer to a FEATURE,
  300. // return the feature index of the specified feature.
  301. //
  302. #define GET_INDEX_FROM_FEATURE(pUIInfo, pFeature) \
  303. ((DWORD)((((PBYTE) (pFeature) - (PBYTE) (pUIInfo)->pInfoHeader) - \
  304. (pUIInfo)->loFeatureList) \
  305. / sizeof(FEATURE)))
  306. //
  307. // Bit constants for UIINFO.dwFlags field
  308. //
  309. #define FLAG_RULESABLE 0x00000001
  310. #define FLAG_FONT_DOWNLOADABLE 0x00000002
  311. #define FLAG_ROTATE90 0x00000004
  312. #define FLAG_COLOR_DEVICE 0x00000008
  313. #define FLAG_ORIENT_SUPPORT 0x00000010
  314. #define FLAG_CUSTOMSIZE_SUPPORT 0x00000020
  315. #define FLAG_FONT_DEVICE 0x00000040
  316. #define FLAG_STAPLE_SUPPORT 0x00000080
  317. #define FLAG_REVERSE_PRINT 0x00000100
  318. #define FLAG_LETTER_SIZE_EXISTS 0x00000200
  319. #define FLAG_A4_SIZE_EXISTS 0x00000400
  320. #define FLAG_ADD_EURO 0x00000800
  321. #define FLAG_TRUE_GRAY 0x00001000
  322. #define FLAG_REVERSE_BAND_ORDER 0x00002000
  323. //
  324. // Macros for checking various flags bit in UIINFO.dwFlags
  325. //
  326. #define IS_COLOR_DEVICE(pUIInfo) ((pUIInfo)->dwFlags & FLAG_COLOR_DEVICE)
  327. #define SUPPORT_CUSTOMSIZE(pUIInfo) ((pUIInfo)->dwFlags & FLAG_CUSTOMSIZE_SUPPORT)
  328. //
  329. // Conversion from master units to microns:
  330. // N = master units to be converted
  331. // u = number of master units per inch
  332. //
  333. #define MICRONS_PER_INCH 25400
  334. #define MASTER_UNIT_TO_MICRON(N, u) MulDiv(N, MICRONS_PER_INCH, u)
  335. //
  336. // Bit constants for UIINFO.dwProtocols field
  337. //
  338. #define PROTOCOL_ASCII 0x0000
  339. #define PROTOCOL_PJL 0x0001
  340. #define PROTOCOL_BCP 0x0002
  341. #define PROTOCOL_TBCP 0x0004
  342. #define PROTOCOL_SIC 0x0008
  343. #define PROTOCOL_BINARY 0x0010
  344. //
  345. // Constants for UIINFO.dwTTRasterizer field
  346. //
  347. #define TTRAS_NONE 0
  348. #define TTRAS_ACCEPT68K 1
  349. #define TTRAS_TYPE42 2
  350. #define TTRAS_TRUEIMAGE 3
  351. //
  352. // Constants for UIINFO.dwLangEncoding field
  353. //
  354. #define LANGENC_NONE 0
  355. #define LANGENC_ISOLATIN1 1
  356. #define LANGENC_UNICODE 2
  357. #define LANGENC_JIS83_RKSJ 3
  358. //
  359. // Data structure used to represent a constrained feature/option
  360. // For each feature and option, there is a linked-list of feature/options
  361. // that are constrained by this feature or option.
  362. //
  363. typedef struct _UICONSTRAINT {
  364. DWORD dwNextConstraint; // link pointer to the next constraint
  365. DWORD dwFeatureIndex; // index of the constrained feature
  366. DWORD dwOptionIndex; // index of the constrained option or OPTION_INDEX_ANY
  367. } UICONSTRAINT , *PUICONSTRAINT;
  368. //
  369. // Link pointer constant to indicate the end of the constraint list
  370. //
  371. #define NULL_CONSTRAINT 0xffffffff
  372. //
  373. // Data structure used to represent invalid feature/option combinations
  374. // the prefix tag shall be 'invc'
  375. // Note: both dwNextElement and dwNewCombo are terminated by END_OF_LIST.
  376. //
  377. typedef struct
  378. {
  379. DWORD dwFeature ; // the INVALIDCOMBO construct defines
  380. DWORD dwOption ; // a set of elements subject to the constraint
  381. DWORD dwNextElement ; // that all elements of the set cannot be
  382. DWORD dwNewCombo ; // selected at the same time.
  383. }
  384. INVALIDCOMBO , * PINVALIDCOMBO ;
  385. //
  386. // Data structure used to combine printer features into groups and subgroups
  387. //
  388. typedef struct _UIGROUP {
  389. PTRREF loKeywordName; // group keyword name
  390. RESREF loDisplayName; // display name
  391. DWORD dwFlags; // flag bits
  392. DWORD dwNextGroup; // index of the next group
  393. DWORD dwFirstSubGroup; // index of the first subgroup
  394. DWORD dwParentGroup; // index of the parent group
  395. DWORD dwFirstFeatureIndex; // index of the first feature belonging to the group
  396. DWORD dwFeatures; // number of features belonging to the group
  397. } UIGROUP, *PUIGROUP;
  398. //
  399. // Data structure used to present a printer feature
  400. //
  401. typedef struct _FEATURE {
  402. PTRREF loKeywordName; // feature keyword name
  403. RESREF loDisplayName; // display name
  404. DWORD dwFlags; // flag bits
  405. DWORD dwDefaultOptIndex; // default option index
  406. DWORD dwNoneFalseOptIndex; // None or False option index
  407. DWORD dwFeatureID; // predefined feature ID
  408. DWORD dwUIType; // UI type
  409. DWORD dwUIConstraintList; // index to the list of UIConstraints
  410. DWORD dwPriority; // priority used during conflict resolution
  411. DWORD dwFeatureType; // Type of feature, see FEATURETYPE defines
  412. DWORD dwOptionSize; // size of each option structure
  413. ARRAYREF Options; // array of option structures
  414. INVOCATION QueryInvocation; // query invocation string
  415. DWORD dwFirstOrderIndex; // Bidi
  416. DWORD dwEnumID; // Bidi
  417. DWORD dwEnumFormat; // Bidi
  418. DWORD dwCurrentID; // Bidi
  419. DWORD dwCurrentFormat; // Bidi
  420. RESREF loResourceIcon; //
  421. RESREF loHelpString; //
  422. RESREF loPromptMessage; //
  423. INT iHelpIndex; // Help Index for this feature, 0 for none
  424. // BOOL bConcealFromUI ; // don't display this feature in the UI.
  425. } FEATURE, *PFEATURE;
  426. //
  427. // Constants for FEATURE.uiType field - types of feature option list
  428. //
  429. #define UITYPE_PICKONE 0
  430. #define UITYPE_PICKMANY 1
  431. #define UITYPE_BOOLEAN 2
  432. //
  433. // Defines for FEATURE.dwFeatureType
  434. //
  435. #define FEATURETYPE_DOCPROPERTY 0
  436. #define FEATURETYPE_JOBPROPERTY 1
  437. #define FEATURETYPE_PRINTERPROPERTY 2
  438. //
  439. // Bit constants for FEATURE.dwFlags field
  440. //
  441. #define FEATURE_FLAG_NOUI 0x0001 // don't display in the UI
  442. #define FEATURE_FLAG_NOINVOCATION 0x0002 // don't emit invocation string
  443. #define FEATURE_FLAG_UPDATESNAPSHOT 0x0004 // Update the snapshot
  444. // whenever an option change has occurred for this feature.
  445. //
  446. // Constant to indicate that the help index is not available
  447. //
  448. #define HELP_INDEX_NONE 0
  449. //
  450. // Data structure used to represent a printer feature option
  451. //
  452. typedef struct _OPTION {
  453. PTRREF loKeywordName; // option keyword name
  454. RESREF loDisplayName; // display name
  455. union
  456. {
  457. INVOCATION Invocation; // invocation string
  458. DWORD dwCmdIndex ; // for Unidrv the index into the CommandArray.
  459. } ;
  460. DWORD dwUIConstraintList; // index to the list of UIConstraints
  461. RESREF loResourceIcon; //
  462. RESREF loHelpString; //
  463. RESREF loPromptMessage; //
  464. DWORD dwPromptTime;
  465. PTRREF loRenderOffset; //
  466. INT iHelpIndex; // Help Index for this option, 0 for none
  467. LISTINDEX liDisabledFeatures; // *DisabledFeatures
  468. } OPTION, *POPTION;
  469. //
  470. // Data structures used to represent PageProtect feature option
  471. //
  472. typedef struct _PAGEPROTECT {
  473. OPTION GenericOption;
  474. DWORD dwPageProtectID; // id values are defined in gpd.h (PAGEPRO)
  475. } PAGEPROTECT, *PPAGEPROTECT;
  476. //
  477. // Data structures used to represent Collation feature option
  478. //
  479. typedef struct _COLLATE {
  480. OPTION GenericOption; // generic option information
  481. DWORD dwCollateID; // DEVMODE.dmMediaType index
  482. } COLLATE, *PCOLLATE;
  483. //
  484. // Data structure used to represent Resolution feature options
  485. //
  486. typedef struct _RESOLUTION {
  487. OPTION GenericOption; // generic option information
  488. INT iXdpi; // horizontal resolution in dpi
  489. INT iYdpi; // vertical resolution
  490. FIX_24_8 fxScreenAngle; // default screen angle and frequency
  491. FIX_24_8 fxScreenFreq; // for this particular resolution
  492. DWORD dwResolutionID; // DEVMODE.dmPrintQuality index
  493. // set to RES_ID_IGNORE if not explicitly set in GPD.
  494. // only values between DMRES_DRAFT and DMRES_HIGH are valid.
  495. } RESOLUTION , *PRESOLUTION;
  496. #define RES_ID_IGNORE (DWORD)(-5L)
  497. //
  498. // Data structure used to represent ColorMode feature options
  499. // Note: Extra fields in COLORMODE structure has been moved to
  500. // a GPD parser private data structure. We should probably
  501. // remove this definition here.
  502. //
  503. typedef struct _COLORMODE {
  504. OPTION GenericOption; // generic option information
  505. } COLORMODE, *PCOLORMODE;
  506. //
  507. // Data structure used to represent Halftoning feature options
  508. //
  509. typedef struct _HALFTONING {
  510. OPTION GenericOption; // generic option information
  511. DWORD dwHTID; // Halftone pattern ID
  512. DWORD dwRCpatternID ; // resource ID of custom halftone pattern
  513. POINT HalftonePatternSize; // Halftone pattern size
  514. INT iLuminance; // Luminance
  515. DWORD dwHTNumPatterns; // number of patterns (if different
  516. // patterns are used for each color plane
  517. DWORD dwHTCallbackID; // ID of pattern generation/decryption
  518. // function
  519. } HALFTONING, *PHALFTONING;
  520. //
  521. // Data structure used to represent Duplex feature options
  522. //
  523. typedef struct _DUPLEX {
  524. OPTION GenericOption; // generic option information
  525. DWORD dwDuplexID; // DEVMODE.dmDuplex index
  526. } DUPLEX, *PDUPLEX;
  527. //
  528. // Data structure used to represent Orientation feature options (GPD only)
  529. //
  530. typedef struct _ORIENTATION {
  531. OPTION GenericOption;
  532. DWORD dwRotationAngle; // Should be one of the following
  533. // enumeration:
  534. // ROTATE_NONE, ROTATE_90, ROTATE_270
  535. } ORIENTATION, *PORIENTATION;
  536. enum {
  537. ROTATE_NONE = 0,
  538. ROTATE_90 = 90,
  539. ROTATE_270 = 270,
  540. };
  541. //
  542. // Data structure used to represent PageSize feature options
  543. //
  544. typedef struct _PAGESIZE {
  545. OPTION GenericOption; // generic option information
  546. SIZE szPaperSize; // paper dimension
  547. RECT rcImgArea; // imageable area for the page size
  548. DWORD dwPaperSizeID; // DEVMODE.dmPaperSize index
  549. DWORD dwFlags; // flag bits
  550. DWORD dwPageProtectionMemory; // Page protection memory in bytes
  551. // for this paper size
  552. } PAGESIZE, *PPAGESIZE;
  553. //
  554. // Driver defined paper sizes have IDs starting at DRIVER_PAPERSIZE_ID
  555. //
  556. #define DRIVER_PAPERSIZE_ID 0x7f00
  557. #define DMPAPER_CUSTOMSIZE 0x7fff
  558. //
  559. // Data structure used to represent InputSlot feature options
  560. //
  561. typedef struct _INPUTSLOT {
  562. OPTION GenericOption; // generic option information
  563. DWORD dwFlags; // flag bits
  564. DWORD dwPaperSourceID; // DEVMODE.dmDefaultSource index
  565. } INPUTSLOT, *PINPUTSLOT;
  566. #define INPUTSLOT_REQ_PAGERGN 0x0001 // requires PageRegion
  567. //
  568. // Data structure used to represent OutputBin feature options
  569. //
  570. typedef struct _OUTPUTBIN {
  571. OPTION GenericOption; // generic option information
  572. BOOL bOutputOrderReversed ; // when the document is finished printing do the
  573. // pages need to be sorted to order them first to last?
  574. } OUTPUTBIN, *POUTPUTBIN;
  575. //
  576. // Data structure used to represent MediaType feature options
  577. //
  578. typedef struct _MEDIATYPE {
  579. OPTION GenericOption; // generic option information
  580. DWORD dwMediaTypeID; // DEVMODE.dmMediaType index
  581. } MEDIATYPE, *PMEDIATYPE;
  582. //
  583. // Data structure used to represent InstalledMemory/VMOption options
  584. //
  585. // PS specific: dwInstalledMem field was never used by PPD parser/PS driver before,
  586. // since we don't care about the amount of installed memory, we only need to know
  587. // dwFreeMem and dwFreeFontMem. Now we are adding the support of new plugin helper
  588. // interface, whose function GetOptionAttribute() should return the original *VMOption
  589. // value specified in PPD. Because PPD parser may not store the original *VMOption
  590. // value into dwFreeMem (see function VPackPrinterFeatures(), case GID_MEMOPTION),
  591. // we now use field dwInstalledMem to store PPD's original *VMOption value.
  592. // (We don't add a new field since this strucutre is shared by GPD parser, and we
  593. // want to minimize the change.)
  594. //
  595. typedef struct _MEMOPTION {
  596. OPTION GenericOption; // generic option information
  597. DWORD dwInstalledMem; // amount of total installed memory
  598. DWORD dwFreeMem; // amount of usable memory
  599. DWORD dwFreeFontMem; // size of font cache memory
  600. } MEMOPTION, *PMEMOPTION;
  601. //
  602. // FONTCARTS
  603. // This structures contains the Font Cartridge information. This structure is
  604. // a same as that defined by the parser. The Parser will update the Portarit
  605. // and Landscape Font list so that they include common fonts. So each list
  606. // will be complete. Only applicable for GPD parser
  607. //
  608. typedef struct _FONTCART
  609. {
  610. DWORD dwRCCartNameID ;
  611. ARRAYREF strCartName ;
  612. DWORD dwFontLst ; // Index to list of Common FontIDs
  613. DWORD dwPortFontLst ; // List of Portrait Fons
  614. DWORD dwLandFontLst ; // List of Landscape Fonts.
  615. } FONTCART , * PFONTCART ; // the prefix tag shall be 'fc'
  616. //
  617. // struct to carry around parser information
  618. //
  619. typedef struct _PARSERINFO
  620. {
  621. PRAWBINARYDATA pRawData;
  622. PINFOHEADER pInfoHeader;
  623. } PARSERINFO, * PPARSERINFO;
  624. //
  625. // Filename suffix and magic header to differentiate between PPD and GPD files
  626. //
  627. #define PPD_FILENAME_EXT TEXT(".PPD")
  628. #define GPD_FILENAME_EXT TEXT(".GPD")
  629. //
  630. // Given a UIINFO structure and a feature index, return a pointer to
  631. // the FEATURE structure corresponding to the specified feature.
  632. //
  633. PFEATURE
  634. PGetIndexedFeature(
  635. PUIINFO pUIInfo,
  636. DWORD dwFeatureIndex
  637. );
  638. //
  639. // Find the option whose keyword string matches the specified name
  640. //
  641. POPTION
  642. PGetNamedOption(
  643. PUIINFO pUIInfo,
  644. PFEATURE pFeature,
  645. PCSTR pstrOptionName,
  646. PDWORD pdwOptionIndex
  647. );
  648. //
  649. // Find the feature whose keyword string matches the specified name
  650. //
  651. PFEATURE
  652. PGetNamedFeature(
  653. PUIINFO pUIInfo,
  654. PCSTR pstrFeatureName,
  655. PDWORD pdwFeatureIndex
  656. );
  657. //
  658. // Given UIINFO and FEATURE structures and an option index, return a pointer to
  659. // the OPTION structure corresponding to the specified feature option
  660. //
  661. PVOID
  662. PGetIndexedOption(
  663. PUIINFO pUIInfo,
  664. PFEATURE pFeature,
  665. DWORD dwOptionIndex
  666. );
  667. //
  668. // Given a UIINFO structure, a feature index, and an option index,
  669. // return a pointer to the OPTION structure corresponding to
  670. // the specified feature option
  671. //
  672. PVOID
  673. PGetIndexedFeatureOption(
  674. PUIINFO pUIInfo,
  675. DWORD dwFeatureIndex,
  676. DWORD dwOptionIndex
  677. );
  678. //
  679. // Return a pointer to the PAGESIZE option structure which
  680. // contains custom page size information (e.g. max width and height)
  681. //
  682. PPAGESIZE
  683. PGetCustomPageSizeOption(
  684. PUIINFO pUIInfo
  685. );
  686. //
  687. // Compute the 32-bit CRC checksum on a buffer of data
  688. //
  689. DWORD
  690. ComputeCrc32Checksum(
  691. IN PBYTE pbuf,
  692. IN DWORD dwCount,
  693. IN DWORD dwChecksum
  694. );
  695. //
  696. // Copy the current option selections for a single feature from
  697. // the source OPTSELECT array to the destination OPTSELECT array
  698. //
  699. VOID
  700. VCopyOptionSelections(
  701. OUT POPTSELECT pDestOptions,
  702. IN INT iDestIndex,
  703. IN POPTSELECT pSrcOptions,
  704. IN INT iSrcIndex,
  705. IN OUT PINT piNext,
  706. IN INT iMaxOptions
  707. );
  708. //
  709. // Check if the raw binary data is up-to-date
  710. // This function is only available in user-mode.
  711. // It always returns TRUE when called from kernel-mode.
  712. //
  713. BOOL
  714. BIsRawBinaryDataUpToDate(
  715. IN PRAWBINARYDATA pRawData
  716. );
  717. #if defined(PSCRIPT) && !defined(KERNEL_MODE)
  718. //
  719. // delete the raw binary data file. This is only needed for the PPD parser, since
  720. // the GPD parser does not store parser-localized stuff in it's .bud
  721. //
  722. void
  723. DeleteRawBinaryData(
  724. IN PTSTR ptstrDataFilename
  725. );
  726. #endif
  727. //
  728. // Common interface exported by both PPD and GPD parsers. Some of the complexity
  729. // here is not necessary for the PPD parser but it's needed by the GPD parser.
  730. //
  731. //
  732. // Routine Description: LoadRawBinaryData
  733. //
  734. // Load raw binary printer description data.
  735. //
  736. // Arguments:
  737. //
  738. // ptstrDataFilename - Specifies the name of the original printer description file
  739. //
  740. // Return Value:
  741. //
  742. // Pointer to raw binary printer description data
  743. // NULL if there is an error
  744. //
  745. PRAWBINARYDATA
  746. LoadRawBinaryData(
  747. IN PTSTR ptstrDataFilename
  748. );
  749. //
  750. // Routine Description: UnloadRawBinaryData
  751. //
  752. // Unload raw binary printer description data previously loaded using LoadRawBinaryData
  753. //
  754. // Arguments:
  755. //
  756. // pRawData - Points to raw binary printer description data
  757. //
  758. // Return Value:
  759. //
  760. // NONE
  761. //
  762. VOID
  763. UnloadRawBinaryData(
  764. IN PRAWBINARYDATA pRawData
  765. );
  766. //
  767. // Routine Description: InitBinaryData
  768. //
  769. // Initialize and return an instance of binary printer description data
  770. //
  771. // Arguments:
  772. //
  773. // pRawData - Points to raw binary printer description data
  774. // pInfoHdr - Points to an existing of binary data instance
  775. // pOptions - Specifies the options used to initialize the binary data instance
  776. //
  777. // Return Value:
  778. //
  779. // Pointer to an initialized binary data instance
  780. //
  781. // Note:
  782. //
  783. // If pInfoHdr parameter is NULL, the parser returns a new binary data instance
  784. // which should be freed by calling FreeBinaryData. If pInfoHdr parameter is not
  785. // NULL, the existing binary data instance is reinitialized.
  786. //
  787. // If pOption parameter is NULL, the parser should use the default option values
  788. // for generating the binary data instance. The parser may have special case
  789. // optimization to handle this case.
  790. //
  791. PINFOHEADER
  792. InitBinaryData(
  793. IN PRAWBINARYDATA pRawData,
  794. IN PINFOHEADER pInfoHdr,
  795. IN POPTSELECT pOptions
  796. );
  797. //
  798. // Routine Description: FreeBinaryData
  799. //
  800. // Free an instance of the binary printer description data
  801. //
  802. // Arguments:
  803. //
  804. // pInfoHdr - Points to a binary data instance previously returned from an
  805. // InitBinaryData(pRawData, NULL, pOptions) call
  806. //
  807. // Return Value:
  808. //
  809. // NONE
  810. //
  811. VOID
  812. FreeBinaryData(
  813. IN PINFOHEADER pInfoHdr
  814. );
  815. //
  816. // Routine Description: UpdateBinaryData
  817. //
  818. // Update an instance of binary printer description data
  819. //
  820. // Arguments:
  821. //
  822. // pRawData - Points to raw binary printer description data
  823. // pInfoHdr - Points to an existing of binary data instance
  824. // pOptions - Specifies the options used to update the binary data instance
  825. //
  826. // Return Value:
  827. //
  828. // Pointer to the updated binary data instance
  829. // NULL if there is an error
  830. //
  831. // Note:
  832. //
  833. // If this function fails for whatever reason, the parser should leave
  834. // the original instance of printer description data untouched and return NULL.
  835. //
  836. // Upon sucuessful return, it is assume that the parser has already disposed
  837. // of the original instance of printer description data.
  838. //
  839. PINFOHEADER
  840. UpdateBinaryData(
  841. IN PRAWBINARYDATA pRawData,
  842. IN PINFOHEADER pInfoHdr,
  843. IN POPTSELECT pOptions
  844. );
  845. //
  846. // Routine Description: InitDefaultOptions
  847. //
  848. // Initialize the option array with default settings from the printer description file
  849. //
  850. // Arguments:
  851. //
  852. // pRawData - Points to raw binary printer description data
  853. // pOptions - Points to an array of OPTSELECT structures for storing the default settings
  854. // iMaxOptions - Max number of entries in pOptions array
  855. // iMode - Specifies what the caller is interested in:
  856. // MODE_DOCUMENT_STICKY
  857. // MODE_PRINTER_STICKY
  858. // MODE_DOCANDPRINTER_STICKY
  859. //
  860. // Return Value:
  861. //
  862. // FALSE if the input option array is not large enough to hold
  863. // all default option values, TRUE otherwise.
  864. //
  865. BOOL
  866. InitDefaultOptions(
  867. IN PRAWBINARYDATA pRawData,
  868. OUT POPTSELECT pOptions,
  869. IN INT iMaxOptions,
  870. IN INT iMode
  871. );
  872. //
  873. // Routine Description: ValidateDocOptions
  874. //
  875. // Validate the devmode option array and correct any invalid option selections
  876. //
  877. // Arguments:
  878. //
  879. // pRawData - Points to raw binary printer description data
  880. // pOptions - Points to an array of OPTSELECT structures that need validation
  881. // iMaxOptions - Max number of entries in pOptions array
  882. //
  883. // Return Value:
  884. //
  885. // None
  886. //
  887. VOID
  888. ValidateDocOptions(
  889. IN PRAWBINARYDATA pRawData,
  890. IN OUT POPTSELECT pOptions,
  891. IN INT iMaxOptions
  892. );
  893. //
  894. // Mode constants passed as iMode parameter to
  895. // InitDefaultOptions and ResolveUIConflicts
  896. //
  897. #define MODE_DOCUMENT_STICKY 0
  898. #define MODE_PRINTER_STICKY 1
  899. #define MODE_DOCANDPRINTER_STICKY 2
  900. //
  901. // Routine Description: CheckFeatureOptionConflict
  902. //
  903. // Check if (dwFeature1, dwOption1) constrains (dwFeature2, dwOption2)
  904. //
  905. // Arguments:
  906. //
  907. // pRawData - Points to raw binary printer description data
  908. // dwFeature1, dwOption1 - Feature and option indices of the first feature/option pair
  909. // dwFeature2, dwOption2 - Feature and option indices of the second feature/option pair
  910. //
  911. // Return Value:
  912. //
  913. // TRUE if (dwFeature1, dwOption1) constrains (dwFeature2, dwOption2)
  914. // FALSE otherwise
  915. //
  916. BOOL
  917. CheckFeatureOptionConflict(
  918. IN PRAWBINARYDATA pRawData,
  919. IN DWORD dwFeature1,
  920. IN DWORD dwOption1,
  921. IN DWORD dwFeature2,
  922. IN DWORD dwOption2
  923. );
  924. //
  925. // Routine Description: ResolveUIConflicts
  926. //
  927. // Resolve any conflicts between printer feature option selections
  928. //
  929. // Arguments:
  930. //
  931. // pRawData - Points to raw binary printer description data
  932. // pOptions - Points to an array of OPTSELECT structures for storing the modified options
  933. // iMaxOptions - Max number of entries in pOptions array
  934. // iMode - Specifies how the conflicts should be resolved:
  935. // MODE_DOCUMENT_STICKY - only resolve conflicts between doc-sticky features
  936. // MODE_PRINTER_STICKY - only resolve conflicts between printer-sticky features
  937. // MODE_DOCANDPRINTER_STICKY - resolve conflicts all features
  938. //
  939. // If the most significant bit (DONT_RESOLVE_CONFLICT) of iMode is set,
  940. // then the caller is only interested in checking whether any conflicts
  941. // exist. Upon returning to the caller, the input options array will be
  942. // left untouched.
  943. //
  944. // Return Value:
  945. //
  946. // TRUE if there are no UI conflicts, otherwise FALSE if any
  947. // UI conflict is detected.
  948. //
  949. BOOL
  950. ResolveUIConflicts(
  951. IN PRAWBINARYDATA pRawData,
  952. IN OUT POPTSELECT pOptions,
  953. IN INT iMaxOptions,
  954. IN INT iMode
  955. );
  956. //
  957. // Additional flag bit for iMode parameter of ResolveUIConflicts
  958. //
  959. #define DONT_RESOLVE_CONFLICT 0x80000000
  960. //
  961. // Routine Description: EnumEnabledOptions
  962. //
  963. // Determine which options of the specified feature should be enabled
  964. // based on the current option selections of printer features
  965. //
  966. // Arguments:
  967. //
  968. // pRawData - Points to raw binary printer description data
  969. // pOptions - Points to the current feature option selections
  970. // dwFeatureIndex - Specifies the index of the feature in question
  971. // pbEnabledOptions - An array of BOOLs, each entry corresponds to an option
  972. // of the specified feature. On exit, if the entry is TRUE, the corresponding
  973. // option is enabled. Otherwise, the corresponding option should be disabled.
  974. // iMode - Specifies how the conflicts should be resolved:
  975. // MODE_DOCUMENT_STICKY - only resolve conflicts between doc-sticky features
  976. // MODE_PRINTER_STICKY - only resolve conflicts between printer-sticky features
  977. // MODE_DOCANDPRINTER_STICKY - resolve conflicts all features
  978. //
  979. // Return Value:
  980. //
  981. // TRUE if any option for the specified feature is enabled,
  982. // FALSE if all options of the specified feature are disabled
  983. // (i.e. the feature itself is disabled)
  984. //
  985. BOOL
  986. EnumEnabledOptions(
  987. IN PRAWBINARYDATA pRawData,
  988. IN POPTSELECT pOptions,
  989. IN DWORD dwFeatureIndex,
  990. OUT PBOOL pbEnabledOptions,
  991. IN INT iMode
  992. );
  993. //
  994. // Routine Description: EnumNewUIConflict
  995. //
  996. // Check if there are any conflicts between the currently selected options
  997. // for the specified feature an other feature/option selections.
  998. //
  999. // Arguments:
  1000. //
  1001. // pRawData - Points to raw binary printer description data
  1002. // pOptions - Points to the current feature/option selections
  1003. // dwFeatureIndex - Specifies the index of the interested printer feature
  1004. // pbSelectedOptions - Specifies which options for the specified feature are selected
  1005. // pConflictPair - Return the conflicting pair of feature/option selections
  1006. //
  1007. // Return Value:
  1008. //
  1009. // TRUE if there is a conflict between the selected options for the specified feature
  1010. // and other feature option selections.
  1011. //
  1012. // FALSE if the selected options for the specified feature is consistent with other
  1013. // feature option selections.
  1014. //
  1015. BOOL
  1016. EnumNewUIConflict(
  1017. IN PRAWBINARYDATA pRawData,
  1018. IN POPTSELECT pOptions,
  1019. IN DWORD dwFeatureIndex,
  1020. IN PBOOL pbSelectedOptions,
  1021. OUT PCONFLICTPAIR pConflictPair
  1022. );
  1023. //
  1024. // Routine Description: EnumNewPickOneUIConflict
  1025. //
  1026. // Check if there are any conflicts between the currently selected option
  1027. // for the specified feature an other feature/option selections.
  1028. //
  1029. // This is similar to EnumNewUIConflict above except that only one selected
  1030. // option is allowed for the specified feature.
  1031. //
  1032. // Arguments:
  1033. //
  1034. // pRawData - Points to raw binary printer description data
  1035. // pOptions - Points to the current feature/option selections
  1036. // dwFeatureIndex - Specifies the index of the interested printer feature
  1037. // dwOptionIndex - Specifies the selected option of the specified feature
  1038. // pConflictPair - Return the conflicting pair of feature/option selections
  1039. //
  1040. // Return Value:
  1041. //
  1042. // TRUE if there is a conflict between the selected option for the specified feature
  1043. // and other feature/option selections.
  1044. //
  1045. // FALSE if the selected option for the specified feature is consistent with other
  1046. // feature/option selections.
  1047. //
  1048. BOOL
  1049. EnumNewPickOneUIConflict(
  1050. IN PRAWBINARYDATA pRawData,
  1051. IN POPTSELECT pOptions,
  1052. IN DWORD dwFeatureIndex,
  1053. IN DWORD dwOptionIndex,
  1054. OUT PCONFLICTPAIR pConflictPair
  1055. );
  1056. //
  1057. // Routine Description: ChangeOptionsViaID
  1058. //
  1059. // Modifies an option array using the information in public devmode fields
  1060. //
  1061. // Arguments:
  1062. //
  1063. // pInfoHdr - Points to an instance of binary printer description data
  1064. // pOptions - Points to the option array to be modified
  1065. // dwFeatureID - Specifies which field(s) of the input devmode should be used
  1066. // pDevmode - Specifies the input devmode
  1067. //
  1068. // Return Value:
  1069. //
  1070. // TRUE if successful, FALSE if the specified feature ID is not supported
  1071. // or there is an error
  1072. //
  1073. BOOL
  1074. ChangeOptionsViaID(
  1075. IN PINFOHEADER pInfoHdr,
  1076. IN OUT POPTSELECT pOptions,
  1077. IN DWORD dwFeatureID,
  1078. IN PDEVMODE pDevmode
  1079. );
  1080. //
  1081. // Routine Description: MapToDeviceOptIndex
  1082. //
  1083. // Map logical values to device feature option index
  1084. //
  1085. // Arguments:
  1086. //
  1087. // pInfoHdr - Points to an instance of binary printer description data
  1088. // dwFeatureID - Indicate which feature the logical values are related to
  1089. // lParam1, lParam2 - Parameters depending on dwFeatureID
  1090. // pdwOptionIndexes - if Not NULL, means fill this array with all indicies
  1091. // which match the search criteria. In this case the return value
  1092. // is the number of elements in the array initialized. Currently
  1093. // we assume the array is large enough (256 elements).
  1094. //
  1095. // dwFeatureID = GID_PAGESIZE:
  1096. // map logical paper specification to physical page size option
  1097. //
  1098. // lParam1 = paper width in microns
  1099. // lParam2 = paper height in microns
  1100. //
  1101. // dwFeatureID = GID_RESOLUTION:
  1102. // map logical resolution to physical resolution option
  1103. //
  1104. // lParam1 = x-resolution in dpi
  1105. // lParam2 = y-resolution in dpi
  1106. //
  1107. // Return Value:
  1108. //
  1109. // Index of the feature option corresponding to the specified logical values;
  1110. // OPTION_INDEX_ANY if the specified logical values cannot be mapped to
  1111. // any feature option.
  1112. //
  1113. // if pdwOptionIndexes Not NULL, the return value is the number of elements
  1114. // written to. Zero means the specified logical values cannot be mapped to
  1115. // any feature option.
  1116. //
  1117. DWORD
  1118. MapToDeviceOptIndex(
  1119. IN PINFOHEADER pInfoHdr,
  1120. IN DWORD dwFeatureID,
  1121. IN LONG lParam1,
  1122. IN LONG lParam2,
  1123. OUT PDWORD pdwOptionIndexes
  1124. );
  1125. //
  1126. // Routine Description: CombineOptionArray
  1127. //
  1128. // Combine doc-sticky with printer-sticky option selections to form a single option array
  1129. //
  1130. // Arguments:
  1131. //
  1132. // pRawData - Points to raw binary printer description data
  1133. // pCombinedOptions - Points to an array of OPTSELECTs for holding the combined options
  1134. // iMaxOptions - Max number of entries in pCombinedOptions array
  1135. // pDocOptions - Specifies the array of doc-sticky options
  1136. // pPrinterOptions - Specifies the array of printer-sticky options
  1137. //
  1138. // Return Value:
  1139. //
  1140. // FALSE if the combined option array is not large enough to store
  1141. // all the option values, TRUE otherwise.
  1142. //
  1143. // Note:
  1144. //
  1145. // Either pDocOptions or pPrinterOptions could be NULL but not both. If pDocOptions
  1146. // is NULL, then in the combined option array, the options for document-sticky
  1147. // features will be OPTION_INDEX_ANY. Same is true when pPrinterOptions is NULL.
  1148. //
  1149. BOOL
  1150. CombineOptionArray(
  1151. IN PRAWBINARYDATA pRawData,
  1152. OUT POPTSELECT pCombinedOptions,
  1153. IN INT iMaxOptions,
  1154. IN POPTSELECT pDocOptions,
  1155. IN POPTSELECT pPrinterOptions
  1156. );
  1157. //
  1158. // Routine Description: SeparateOptionArray
  1159. //
  1160. // Separate an option array into doc-sticky and for printer-sticky options
  1161. //
  1162. // Arguments:
  1163. //
  1164. // pRawData - Points to raw binary printer description data
  1165. // pCombinedOptions - Points to the combined option array to be separated
  1166. // pOptions - Points to an array of OPTSELECT structures
  1167. // for storing the separated option array
  1168. // iMaxOptions - Max number of entries in pOptions array
  1169. // iMode - Whether the caller is interested in doc- or printer-sticky options:
  1170. // MODE_DOCUMENT_STICKY
  1171. // MODE_PRINTER_STICKY
  1172. //
  1173. // Return Value:
  1174. //
  1175. // FALSE if the destination option array is not large enough to hold
  1176. // the separated option values, TRUE otherwise.
  1177. //
  1178. BOOL
  1179. SeparateOptionArray(
  1180. IN PRAWBINARYDATA pRawData,
  1181. IN POPTSELECT pCombinedOptions,
  1182. OUT POPTSELECT pOptions,
  1183. IN INT iMaxOptions,
  1184. IN INT iMode
  1185. );
  1186. //
  1187. // Routine Description: ReconstructOptionArray
  1188. //
  1189. // Modify an option array to change the selected options for the specified feature
  1190. //
  1191. // Arguments:
  1192. //
  1193. // pRawData - Points to raw binary printer description data
  1194. // pOptions - Points to an array of OPTSELECT structures to be modified
  1195. // iMaxOptions - Max number of entries in pOptions array
  1196. // dwFeatureIndex - Specifies the index of printer feature in question
  1197. // pbSelectedOptions - Which options of the specified feature is selected
  1198. //
  1199. // Return Value:
  1200. //
  1201. // FALSE if the input option array is not large enough to hold
  1202. // all modified option values. TRUE otherwise.
  1203. //
  1204. // Note:
  1205. //
  1206. // Number of BOOLs in pSelectedOptions must match the number of options
  1207. // for the specified feature.
  1208. //
  1209. // This function always leaves the option array in a compact format (i.e.
  1210. // all unused entries are left at the end of the array).
  1211. //
  1212. BOOL
  1213. ReconstructOptionArray(
  1214. IN PRAWBINARYDATA pRawData,
  1215. IN OUT POPTSELECT pOptions,
  1216. IN INT iMaxOptions,
  1217. IN DWORD dwFeatureIndex,
  1218. IN PBOOL pbSelectedOptions
  1219. );
  1220. #endif // !_PARSER_H_