1 | /*DDK*************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* COPYRIGHT Copyright (C) 1991, 2003 IBM Corporation */
|
---|
4 | /* */
|
---|
5 | /* The following IBM OS/2 source code is provided to you solely for */
|
---|
6 | /* the purpose of assisting you in your development of OS/2 device */
|
---|
7 | /* drivers. You may use this code in accordance with the IBM License */
|
---|
8 | /* Agreement provided in the IBM Developer Connection Device Driver */
|
---|
9 | /* Source Kit for OS/2. This Copyright statement may not be removed. */
|
---|
10 | /* */
|
---|
11 | /*****************************************************************************/
|
---|
12 | /****************************************************************************/
|
---|
13 | /* */
|
---|
14 | /* */
|
---|
15 | /****************************************************************************/
|
---|
16 |
|
---|
17 | #define ALLPPDS 450
|
---|
18 | #define DIRECTORY_PPB 1
|
---|
19 | #define TRUE 1
|
---|
20 | #define FALSE 0
|
---|
21 | #define NONE -1
|
---|
22 | #define BANNER 0
|
---|
23 | #define NOBANNER 1
|
---|
24 | #define NORMAL 0
|
---|
25 | #define REVERSE 1
|
---|
26 | #define PORTRAIT 0
|
---|
27 | #define LANDSCAPE 1
|
---|
28 | #define CNFRES 0
|
---|
29 | #define PPDRES 1
|
---|
30 | #define RESBUF 2
|
---|
31 | #define SGNRES 3
|
---|
32 | #define DIRRES 4
|
---|
33 | #define LCLRES 5
|
---|
34 | #define IMAXRES 5
|
---|
35 | #define SYSTEM 0
|
---|
36 | #define RAW 1
|
---|
37 | #define ENCAPS 2
|
---|
38 | #define ATRAY 0
|
---|
39 | #define BTRAY 1
|
---|
40 | #define CTRAY 2
|
---|
41 | #define DTRAY 3
|
---|
42 | #define ETRAY 4
|
---|
43 | #define MANUAL 5 /* treated as the last tray */
|
---|
44 | #define MAX_FNAMESIZE 40 /* Maximum size of a file name */
|
---|
45 | /*
|
---|
46 | ** Increase MAX_INPUT from 256 to 512 to allow for more PPD files.
|
---|
47 | */
|
---|
48 | #define MAX_INPUT 512 /* Maximum number of PPD files in directory
|
---|
49 | segment */
|
---|
50 |
|
---|
51 | #define INPBINS 16 /* Max no of input bins */
|
---|
52 | #define OUTBINS 3 /* Max no of output bins */
|
---|
53 | #define PRBUFSZ 4096
|
---|
54 | #define MAX_PSIZE 64
|
---|
55 | #define APPKEYSIZE 20
|
---|
56 | #define MAX_KEYAPPSIZE 78 /* Max size for application name in ini */
|
---|
57 |
|
---|
58 | #define DEF_IEXT ".ppd"
|
---|
59 | #define DEF_OEXT ".ppb"
|
---|
60 | #define PB CHAR *
|
---|
61 | #define MAX_CHARS_IN_EXTENSION 3
|
---|
62 | #define MAX_CHARS_IN_FILENAME 8
|
---|
63 |
|
---|
64 | //#define MEDIATYPE_STRING "MediaType"
|
---|
65 |
|
---|
66 | /*****************************************************************************/
|
---|
67 | /*
|
---|
68 | ** V3.0UI
|
---|
69 | */
|
---|
70 | /*
|
---|
71 | ** A UI entry is each entry within a *OpenUI / *CloseUI.
|
---|
72 | */
|
---|
73 | typedef struct _UI_ENTRY
|
---|
74 | {
|
---|
75 | USHORT ofsOption; // Option string offset
|
---|
76 | USHORT ofsTransString; // Translation string offset
|
---|
77 | USHORT ofsValue; // Value string offset
|
---|
78 | } UI_ENTRY, *PUI_ENTRY;
|
---|
79 |
|
---|
80 |
|
---|
81 | /*
|
---|
82 | ** A UI block is defined here as all data that falls within an
|
---|
83 | ** *OpenUI / *CloseUI.
|
---|
84 | */
|
---|
85 | typedef struct _UI_BLOCK
|
---|
86 | {
|
---|
87 | USHORT ofsUIName; // Offset to block name
|
---|
88 | USHORT ofsUITransString; // Offset to block translation string
|
---|
89 | USHORT usOrderDep; // Numeric value, order of block in list
|
---|
90 | USHORT usDisplayOrder; // Order block is displayed in listbox
|
---|
91 |
|
---|
92 | USHORT usUILocation; // Job location where block is written
|
---|
93 | #define UI_ORDER_ANYSETUP 0
|
---|
94 | #define UI_ORDER_JCLSETUP 1
|
---|
95 | #define UI_ORDER_PAGESETUP 2
|
---|
96 | #define UI_ORDER_DOCSETUP 4
|
---|
97 | #define UI_ORDER_PROLOGSETUP 8
|
---|
98 | #define UI_ORDER_EXITSERVER 0x10
|
---|
99 |
|
---|
100 | USHORT usSelectType; // Selection type for Job Properties
|
---|
101 | #define UI_SELECT_BOOLEAN 4
|
---|
102 | #define UI_SELECT_PICKMANY 2
|
---|
103 | #define UI_SELECT_PICKONE 1
|
---|
104 |
|
---|
105 | UCHAR ucGroupType;
|
---|
106 | #define UIGT_DEFAULTOPTION 0 // Displayed in Job Properties
|
---|
107 | #define UIGT_INSTALLABLEOPTION 1 // Displayed in Printer Properties
|
---|
108 |
|
---|
109 | UCHAR ucPanelID; // Identifies owner of feature
|
---|
110 | #define UIP_OS2_FEATURE 0 // Feature supported by IBM's J.P. Dialog
|
---|
111 | #define UIP_OEM_FEATURE 1 // Feature supported by OEM Dialog
|
---|
112 | #define UIP_PREDEF_FEATURE 2 // Feature predefined in PPD
|
---|
113 |
|
---|
114 | USHORT usDefaultEntry; // 0-based offset of default entry (below)
|
---|
115 | USHORT usNumOfEntries; // Number of entries in block
|
---|
116 | UI_ENTRY uiEntry[ 1 ]; // List of UI entries
|
---|
117 | } UI_BLOCK, *PUI_BLOCK;
|
---|
118 |
|
---|
119 | /*
|
---|
120 | ** p is a pointer to the current UI_BLOCK structure.
|
---|
121 | */
|
---|
122 | #define QUERY_BLOCK_SIZE( p ) (sizeof( UI_BLOCK ) + \
|
---|
123 | (((p)->usNumOfEntries - 1) * \
|
---|
124 | sizeof( UI_ENTRY )))
|
---|
125 | #define INCREMENT_BLOCK_PTR( p ) p = (PUI_BLOCK) ((PCHAR) p + \
|
---|
126 | QUERY_BLOCK_SIZE( p ))
|
---|
127 |
|
---|
128 |
|
---|
129 | /*
|
---|
130 | ** The UI list makes up of all *OpenUI / *CloseUI blocks in the PPD. This
|
---|
131 | ** contains a header an a pointer to the list buffer.
|
---|
132 | */
|
---|
133 | typedef struct _UI_LIST
|
---|
134 | {
|
---|
135 | USHORT usNumOfBlocks; // Number of total blocks
|
---|
136 | USHORT usBlockListSize; // Byte size of UI list
|
---|
137 | PUI_BLOCK pBlockList; // Pointer to UI list buffer
|
---|
138 |
|
---|
139 | } UI_LIST, *PUI_LIST;
|
---|
140 |
|
---|
141 | typedef ULONG UI_SEL;
|
---|
142 | typedef UI_SEL *PUI_SEL;
|
---|
143 |
|
---|
144 | /*
|
---|
145 | ** This structure deals with the user-selected UI's. There is a buffer called
|
---|
146 | ** the UI selection buffer. Each 32-bit value in the list is reserved for
|
---|
147 | ** a UI block and each bit in each 32-bit value represents a UI entry. If
|
---|
148 | ** the bit is set to 1, that UI entry is to be sent out with the job. It is
|
---|
149 | ** possible to have multiple entry selections per block.
|
---|
150 | ** This structure contains the byte length of the UI selection block and a
|
---|
151 | ** pointer to the UI selecton block.
|
---|
152 | */
|
---|
153 | typedef struct _UI_SELLIST
|
---|
154 | {
|
---|
155 | USHORT usCurrUIListSize; // Total byte size of UI selection list
|
---|
156 | USHORT ofsSelectList; // Offset to UI selection list
|
---|
157 | } UI_SELLIST, *PUI_SELLIST;
|
---|
158 | #define ASSIGN_UISELLIST_PTR( p ) (PUI_SEL) ((PBYTE) (p) + sizeof( CNFDATA ))
|
---|
159 |
|
---|
160 | /*
|
---|
161 | ** The User Interface Constraints provide a set of mutually exclusive options.
|
---|
162 | ** This has been provided so that printers can indicate if any options will
|
---|
163 | ** not work with other options. For example, a duplex may not support
|
---|
164 | ** envelopes, so the UI constraints will indicate that if either any envelope
|
---|
165 | ** or the duplex is selected, then the other cannot be selected.
|
---|
166 | ** The UI constraint list contains the ID of the related dialog box ID for
|
---|
167 | ** that given key.
|
---|
168 | ** The Entry structure is used for each key. The key ID contains the dialog
|
---|
169 | ** ID for the key. The Key2 ID is used for any keys that use a list box and
|
---|
170 | ** contains a specific ID for that key in the list box.
|
---|
171 | ** The Block structure contains the IDs of both keys that are not to be
|
---|
172 | ** selected together.
|
---|
173 | ** The list structure contains a variable list of the UIC_BLOCK structures.
|
---|
174 | */
|
---|
175 | typedef struct _UIC_ENTRY
|
---|
176 | {
|
---|
177 | USHORT ofsUIBlock; // Offset to block in block list
|
---|
178 | UI_SEL bOption; // Bit value of option(s) for a given keyword
|
---|
179 | } UIC_ENTRY, *PUIC_ENTRY;
|
---|
180 |
|
---|
181 | typedef struct _UIC_BLOCK
|
---|
182 | {
|
---|
183 | UIC_ENTRY uicEntry1; // Mutually exclusive key 1
|
---|
184 | UIC_ENTRY uicEntry2; // Mutually exclusive key 2
|
---|
185 | } UIC_BLOCK, *PUIC_BLOCK;
|
---|
186 |
|
---|
187 | typedef struct _UIC_LIST
|
---|
188 | {
|
---|
189 | USHORT usNumOfUICs; // Number of UIC_BLOCKs
|
---|
190 | PUIC_BLOCK puicBlockList; // Variable-length list of UIC_BLOCKs
|
---|
191 | } UIC_LIST, *PUIC_LIST;
|
---|
192 |
|
---|
193 | /*
|
---|
194 | ** The following macro calculates the size of the UI_LIST structure, including
|
---|
195 | ** the list of UIC_BLOCKs, in bytes.
|
---|
196 | ** Argument u is a PUIC_LIST pointer.
|
---|
197 | */
|
---|
198 | #define UIC_LIST_SIZE( u ) (sizeof( UIC_LIST ) + (sizeof( UIC_BLOCK ) * \
|
---|
199 | ((PUIC_LIST) (u)->usNumOfUICs - 1)))
|
---|
200 | /*****************************************************************************/
|
---|
201 |
|
---|
202 | /*
|
---|
203 | ** defines for the duplex options
|
---|
204 | */
|
---|
205 |
|
---|
206 | #define DUPLEX_NONE -1
|
---|
207 | #define DUPLEX_FALSE 0
|
---|
208 | #define DUPLEX_DUPLEXNOTUMBLE 1
|
---|
209 | #define DUPLEX_DUPLEXTUMBLE 2
|
---|
210 |
|
---|
211 |
|
---|
212 |
|
---|
213 | /*** RESLIST is a structure that points to a variable array of RESTYPE
|
---|
214 | ** structures.
|
---|
215 | ** uNumOfRes - Number of RESTYPE structures in pResType.
|
---|
216 | ** uResOffset - This contains a zero-based offset where the resolution
|
---|
217 | ** information is kept in a variable-length buffer. The information
|
---|
218 | ** for the resolution is kept the following way (in order):
|
---|
219 | ** 2-byte resolution value, in dots-per-inch
|
---|
220 | ** ------------------------------------------
|
---|
221 | ** 1-byte length of the following string:
|
---|
222 | ** ------------------------------------------
|
---|
223 | ** string length, this string does not always
|
---|
224 | ** have a terminating NULL character
|
---|
225 | **
|
---|
226 | ** PRESLIST - Pointer to a RESLIST structure.
|
---|
227 | */
|
---|
228 | /*
|
---|
229 | ** Add a flag to indicate if this resolution is used as part of the JCL
|
---|
230 | ** format. If TRUE, the resoluion is part of JCL. False otherwise.
|
---|
231 | */
|
---|
232 | typedef struct _RESLIST
|
---|
233 | {
|
---|
234 | SHORT uNumOfRes;
|
---|
235 | SHORT uResOffset;
|
---|
236 | BOOL bIsJCLResolution;
|
---|
237 | } RESLIST;
|
---|
238 | typedef RESLIST *PRESLIST;
|
---|
239 |
|
---|
240 | typedef struct _PPD1
|
---|
241 | {
|
---|
242 | SHORT iSizeBuffer; /* size buffer where params are stored */
|
---|
243 | SHORT ofsPswrd; /* offset pointer to password */
|
---|
244 | SHORT iPpm; /* No of pages printed/minute */
|
---|
245 | LONG lFreeVM; /* amount of free virtual memory */
|
---|
246 | SHORT ofsPrType; /* offset pointer to printer type */
|
---|
247 | SHORT ofsPrName; /* offset pointer to printer name */
|
---|
248 | SHORT iResDpi; /* Resolution in dots per inch */
|
---|
249 |
|
---|
250 | /*
|
---|
251 | ** Structure containing the available PostScript resolutions.
|
---|
252 | */
|
---|
253 | RESLIST ResList;
|
---|
254 |
|
---|
255 | /*
|
---|
256 | ** Screen frequencly in cells per inch multiplied by 100
|
---|
257 | */
|
---|
258 | LONG lScrFreq;
|
---|
259 | SHORT fIsColorDevice; /* whether device supports colour or not */
|
---|
260 | /*
|
---|
261 | ** whether device supports independent file system or not
|
---|
262 | */
|
---|
263 | SHORT fIsFileSystem;
|
---|
264 | SHORT ofsReset; /* offset to printer reset command string */
|
---|
265 | SHORT ofsExitserver; /* offset to exitserver command string */
|
---|
266 | LONG iScreenAngle; /* Halftone Screen angle */
|
---|
267 |
|
---|
268 | /*
|
---|
269 | ** Added this field to the structure. This field is an
|
---|
270 | ** offset that allows the driver to identify what PostScript
|
---|
271 | ** level the current device supports.
|
---|
272 | */
|
---|
273 | USHORT usLanguageLevel; /* Contains language level */
|
---|
274 | SHORT ofsTransferNor; /* offset to Normalised transfer function */
|
---|
275 | /*
|
---|
276 | ** offset to Normalised Inverse transfer function
|
---|
277 | */
|
---|
278 | SHORT ofsTransferInv;
|
---|
279 | /*
|
---|
280 | ** @1462 offset to PS mode emul. init. string
|
---|
281 | */
|
---|
282 | SHORT ofsInitString; /* offset to PS mode emul. init. string */
|
---|
283 |
|
---|
284 | /*
|
---|
285 | ** This offset points to the JCL to PS interpreter string.
|
---|
286 | */
|
---|
287 | SHORT ofsJCLToPS;
|
---|
288 |
|
---|
289 | /*
|
---|
290 | ** @1462 offset to PS mode emul. terminate string
|
---|
291 | */
|
---|
292 | SHORT ofsTermString; /* offset to PS mode emul. terminate string */
|
---|
293 | SHORT sDefaultDuplex; /* default duplex mode */
|
---|
294 | SHORT ofsDuplexFalse; /* string to turn off duplex/tumble */
|
---|
295 | SHORT ofsDuplexNoTumble; /* string to turn on duplex */
|
---|
296 | SHORT ofsDuplexTumble; /* string to turn on duplex/tumble */
|
---|
297 | SHORT ofsPCFileName;
|
---|
298 | } PPD1;
|
---|
299 |
|
---|
300 | typedef struct _PPD2
|
---|
301 | {
|
---|
302 | SHORT ofsDfpgsz; /* offset pointer to default paper size */
|
---|
303 | /* - now an index value */
|
---|
304 | SHORT fIsVariablePaper; /* true if variable paper supported */
|
---|
305 | SHORT ofsDefimagearea; /* offset to paper name string */
|
---|
306 | SHORT ofsDefpaperdim; /* offset to paper dim string */
|
---|
307 | SHORT iCmpgpairs; /* no of paper command pairs */
|
---|
308 | SHORT ofsLspgCmnds; /* offset pointer to list of paper commands */
|
---|
309 | SHORT iDmpgpairs; /* no of paper dimension pairs */
|
---|
310 | SHORT ofsDimxyPgsz; /* offset pointer to list of xy dimensions */
|
---|
311 | SHORT iImgpgpairs; /* no of paper imageable coordinate pairs */
|
---|
312 | /*
|
---|
313 | ** offset pointer to list of Imageable page and coordinates pairs
|
---|
314 | */
|
---|
315 | SHORT ofsImgblPgsz;
|
---|
316 | SHORT ofsCustomPageSize ; /* Custom Paper Support */
|
---|
317 | SHORT iCustomPageSizeMinWidth ;
|
---|
318 | SHORT iCustomPageSizeMaxWidth ;
|
---|
319 | SHORT iCustomPageSizeMinHeight ;
|
---|
320 | SHORT iCustomPageSizeMaxHeight ;
|
---|
321 |
|
---|
322 | } PPD2;
|
---|
323 |
|
---|
324 | typedef struct _PPD3
|
---|
325 | {
|
---|
326 | SHORT iManualfeed; /* default manual feed true=1,false=0,none=-1 */
|
---|
327 | /*
|
---|
328 | ** offset pointer to command for manual feed true
|
---|
329 | */
|
---|
330 | SHORT ofsManualtrue;
|
---|
331 | /*
|
---|
332 | ** offset pointer to command for manual feed false
|
---|
333 | */
|
---|
334 | SHORT ofsManualfalse;
|
---|
335 | SHORT ofsDefinputslot; /* offset pointer to default input bin */
|
---|
336 | SHORT iInpbinpairs; /* no of bin name and command pairs */
|
---|
337 | /*
|
---|
338 | ** offset pointer to list of bin names & select commands
|
---|
339 | */
|
---|
340 | SHORT ofsCmInpbins;
|
---|
341 |
|
---|
342 |
|
---|
343 | SHORT iNumOfPageSizes; // Number of page sizes in list
|
---|
344 | SHORT ofsPageSizes; // List of paper sizes
|
---|
345 | } PPD3;
|
---|
346 |
|
---|
347 | typedef struct _PPD4
|
---|
348 | {
|
---|
349 | /*
|
---|
350 | ** Default output order can be normal or reverse
|
---|
351 | */
|
---|
352 | SHORT fIsDefoutorder;
|
---|
353 | /*
|
---|
354 | ** offset pointer to command string for output order normal
|
---|
355 | */
|
---|
356 | SHORT ofsOrdernormal;
|
---|
357 | /*
|
---|
358 | ** offset pointer to command string for output order reverse
|
---|
359 | */
|
---|
360 | SHORT ofsOrderreverse;
|
---|
361 | /*
|
---|
362 | ** offset pointer to name of default output order
|
---|
363 | */
|
---|
364 | SHORT ofsDefoutputbin;
|
---|
365 | /*
|
---|
366 | ** no of bin name and command pairs
|
---|
367 | */
|
---|
368 | SHORT iOutbinpairs;
|
---|
369 | /*
|
---|
370 | ** offset pointer to list of bin select commands
|
---|
371 | */
|
---|
372 | SHORT ofsCmOutbins;
|
---|
373 | } PPD4;
|
---|
374 |
|
---|
375 | typedef struct _PPD5
|
---|
376 | {
|
---|
377 | SHORT ofsDeffont; /* offset pointer to default font name */
|
---|
378 | SHORT iFonts; /* no of fonts supported */
|
---|
379 | SHORT ofsFontnames; /* offset pointer to list of font names */
|
---|
380 | } PPD5;
|
---|
381 |
|
---|
382 | typedef struct _PPD6
|
---|
383 | {
|
---|
384 | USHORT usFormCount; /* Count of forms */
|
---|
385 | SHORT ofsFormTable; /* Forms Table */
|
---|
386 | SHORT ofsFormIndex; /* Index Table */
|
---|
387 | } PPD6;
|
---|
388 |
|
---|
389 |
|
---|
390 | typedef struct _DESPPD
|
---|
391 | {
|
---|
392 | PPD1 desItems; /* Individual items defined */
|
---|
393 | PPD2 desPage; /* Storage for paper descriptors defined */
|
---|
394 | PPD3 desInpbins; /* Storage for Input bin descriptors defined */
|
---|
395 | PPD4 desOutbins; /* Storage for Output bin descriptors defined */
|
---|
396 | PPD5 desFonts; /* Storage for Font names defined */
|
---|
397 | PPD6 desForms; /* Form tables */
|
---|
398 |
|
---|
399 | /*
|
---|
400 | */
|
---|
401 | UI_LIST stUIList;
|
---|
402 |
|
---|
403 | UIC_LIST stUICList;
|
---|
404 |
|
---|
405 | PBYTE pPSStringBuff;
|
---|
406 | } DESPPD, *PDESPPD;
|
---|
407 |
|
---|
408 |
|
---|