r9742: merging reg_objects and NT_PRINTER_DATA changes from SAMBA_3_0
[Samba.git] / source / include / nt_printing.h
blobf0d50878ce4177ce7dfdaee884b3c2edd7ab7cbc
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 SMB parameters and setup
5 Copyright (C) Andrew Tridgell 1992-2000,
6 Copyright (C) Jean Francois Micouleau 1998-2000.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef NT_PRINTING_H_
24 #define NT_PRINTING_H_
26 #define ORIENTATION 0x00000001L
27 #define PAPERSIZE 0x00000002L
28 #define PAPERLENGTH 0x00000004L
29 #define PAPERWIDTH 0x00000008L
30 #define SCALE 0x00000010L
31 #define COPIES 0x00000100L
32 #define DEFAULTSOURCE 0x00000200L
33 #define PRINTQUALITY 0x00000400L
34 #define COLOR 0x00000800L
35 #define DUPLEX 0x00001000L
36 #define YRESOLUTION 0x00002000L
37 #define TTOPTION 0x00004000L
38 #define COLLATE 0x00008000L
39 #define FORMNAME 0x00010000L
40 #define LOGPIXELS 0x00020000L
41 #define BITSPERPEL 0x00040000L
42 #define PELSWIDTH 0x00080000L
43 #define PELSHEIGHT 0x00100000L
44 #define DISPLAYFLAGS 0x00200000L
45 #define DISPLAYFREQUENCY 0x00400000L
46 #define PANNINGWIDTH 0x00800000L
47 #define PANNINGHEIGHT 0x01000000L
49 #define ORIENT_PORTRAIT 1
50 #define ORIENT_LANDSCAPE 2
52 #define PAPER_FIRST PAPER_LETTER
53 #define PAPER_LETTER 1 /* Letter 8 1/2 x 11 in */
54 #define PAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */
55 #define PAPER_TABLOID 3 /* Tabloid 11 x 17 in */
56 #define PAPER_LEDGER 4 /* Ledger 17 x 11 in */
57 #define PAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */
58 #define PAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */
59 #define PAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */
60 #define PAPER_A3 8 /* A3 297 x 420 mm */
61 #define PAPER_A4 9 /* A4 210 x 297 mm */
62 #define PAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */
63 #define PAPER_A5 11 /* A5 148 x 210 mm */
64 #define PAPER_B4 12 /* B4 (JIS) 250 x 354 */
65 #define PAPER_B5 13 /* B5 (JIS) 182 x 257 mm */
66 #define PAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */
67 #define PAPER_QUARTO 15 /* Quarto 215 x 275 mm */
68 #define PAPER_10X14 16 /* 10x14 in */
69 #define PAPER_11X17 17 /* 11x17 in */
70 #define PAPER_NOTE 18 /* Note 8 1/2 x 11 in */
71 #define PAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 */
72 #define PAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 */
73 #define PAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 */
74 #define PAPER_ENV_12 22 /* Envelope #12 4 \276 x 11 */
75 #define PAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 */
76 #define PAPER_CSHEET 24 /* C size sheet */
77 #define PAPER_DSHEET 25 /* D size sheet */
78 #define PAPER_ESHEET 26 /* E size sheet */
79 #define PAPER_ENV_DL 27 /* Envelope DL 110 x 220mm */
80 #define PAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */
81 #define PAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */
82 #define PAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */
83 #define PAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */
84 #define PAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */
85 #define PAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */
86 #define PAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */
87 #define PAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */
88 #define PAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */
89 #define PAPER_ENV_MONARCH 37 /* Envelope Monarch 3.875 x 7.5 in */
90 #define PAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */
91 #define PAPER_FANFOLD_US 39 /* US Std Fanfold 14 7/8 x 11 in */
92 #define PAPER_FANFOLD_STD_GERMAN 40 /* German Std Fanfold 8 1/2 x 12 in */
93 #define PAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */
95 #define PAPER_LAST PAPER_FANFOLD_LGL_GERMAN
96 #define PAPER_USER 256
98 #define BIN_FIRST BIN_UPPER
99 #define BIN_UPPER 1
100 #define BIN_ONLYONE 1
101 #define BIN_LOWER 2
102 #define BIN_MIDDLE 3
103 #define BIN_MANUAL 4
104 #define BIN_ENVELOPE 5
105 #define BIN_ENVMANUAL 6
106 #define BIN_AUTO 7
107 #define BIN_TRACTOR 8
108 #define BIN_SMALLFMT 9
109 #define BIN_LARGEFMT 10
110 #define BIN_LARGECAPACITY 11
111 #define BIN_CASSETTE 14
112 #define BIN_FORMSOURCE 15
113 #define BIN_LAST BIN_FORMSOURCE
115 #define BIN_USER 256 /* device specific bins start here */
117 #define RES_DRAFT (-1)
118 #define RES_LOW (-2)
119 #define RES_MEDIUM (-3)
120 #define RES_HIGH (-4)
122 #define COLOR_MONOCHROME 1
123 #define COLOR_COLOR 2
125 #define DUP_SIMPLEX 1
126 #define DUP_VERTICAL 2
127 #define DUP_HORIZONTAL 3
129 #define TT_BITMAP 1 /* print TT fonts as graphics */
130 #define TT_DOWNLOAD 2 /* download TT fonts as soft fonts */
131 #define TT_SUBDEV 3 /* substitute device fonts for TT fonts */
133 #define COLLATE_FALSE 0
134 #define COLLATE_TRUE 1
136 typedef struct nt_printer_driver_info_level_3
138 uint32 cversion;
140 fstring name;
141 fstring environment;
142 fstring driverpath;
143 fstring datafile;
144 fstring configfile;
145 fstring helpfile;
146 fstring monitorname;
147 fstring defaultdatatype;
148 fstring *dependentfiles;
149 } NT_PRINTER_DRIVER_INFO_LEVEL_3;
151 /* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
152 typedef struct {
153 uint32 version;
154 fstring name;
155 fstring environment;
156 fstring driverpath;
157 fstring datafile;
158 fstring configfile;
159 fstring helpfile;
160 fstring monitorname;
161 fstring defaultdatatype;
162 fstring mfgname;
163 fstring oemurl;
164 fstring hardwareid;
165 fstring provider;
166 fstring *dependentfiles;
167 fstring *previousnames;
168 } NT_PRINTER_DRIVER_INFO_LEVEL_6;
171 typedef struct nt_printer_driver_info_level
173 NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
174 NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
175 } NT_PRINTER_DRIVER_INFO_LEVEL;
177 /* predefined registry key names for printer data */
179 #define SPOOL_PRINTERDATA_KEY "PrinterDriverData"
180 #define SPOOL_DSSPOOLER_KEY "DsSpooler"
181 #define SPOOL_DSDRIVER_KEY "DsDriver"
182 #define SPOOL_DSUSER_KEY "DsUser"
183 #define SPOOL_PNPDATA_KEY "PnPData"
184 #define SPOOL_OID_KEY "OID"
186 /* predefined value names for printer data */
187 #define SPOOL_REG_ASSETNUMBER "assetNumber"
188 #define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute"
189 #define SPOOL_REG_DEFAULTPRIORITY "defaultPriority"
190 #define SPOOL_REG_DESCRIPTION "description"
191 #define SPOOL_REG_DRIVERNAME "driverName"
192 #define SPOOL_REG_DRIVERVERSION "driverVersion"
193 #define SPOOL_REG_FLAGS "flags"
194 #define SPOOL_REG_LOCATION "location"
195 #define SPOOL_REG_OPERATINGSYSTEM "operatingSystem"
196 #define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix"
197 #define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack"
198 #define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion"
199 #define SPOOL_REG_PORTNAME "portName"
200 #define SPOOL_REG_PRINTATTRIBUTES "printAttributes"
201 #define SPOOL_REG_PRINTBINNAMES "printBinNames"
202 #define SPOOL_REG_PRINTCOLLATE "printCollate"
203 #define SPOOL_REG_PRINTCOLOR "printColor"
204 #define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported"
205 #define SPOOL_REG_PRINTENDTIME "printEndTime"
206 #define SPOOL_REG_PRINTERNAME "printerName"
207 #define SPOOL_REG_PRINTFORMNAME "printFormName"
208 #define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs"
209 #define SPOOL_REG_PRINTLANGUAGE "printLanguage"
210 #define SPOOL_REG_PRINTMACADDRESS "printMACAddress"
211 #define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies"
212 #define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported"
213 #define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent"
214 #define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent"
215 #define SPOOL_REG_PRINTMEDIAREADY "printMediaReady"
216 #define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported"
217 #define SPOOL_REG_PRINTMEMORY "printMemory"
218 #define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent"
219 #define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent"
220 #define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress"
221 #define SPOOL_REG_PRINTNOTIFY "printNotify"
222 #define SPOOL_REG_PRINTNUMBERUP "printNumberUp"
223 #define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported"
224 #define SPOOL_REG_PRINTOWNER "printOwner"
225 #define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute"
226 #define SPOOL_REG_PRINTRATE "printRate"
227 #define SPOOL_REG_PRINTRATEUNIT "printRateUnit"
228 #define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile"
229 #define SPOOL_REG_PRINTSHARENAME "printShareName"
230 #define SPOOL_REG_PRINTSPOOLING "printSpooling"
231 #define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling"
232 #define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled"
233 #define SPOOL_REGVAL_PRINTDIRECT "PrintDirect"
234 #define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported"
235 #define SPOOL_REG_PRINTSTARTTIME "printStartTime"
236 #define SPOOL_REG_PRINTSTATUS "printStatus"
237 #define SPOOL_REG_PRIORITY "priority"
238 #define SPOOL_REG_SERVERNAME "serverName"
239 #define SPOOL_REG_SHORTSERVERNAME "shortServerName"
240 #define SPOOL_REG_UNCNAME "uNCName"
241 #define SPOOL_REG_URL "url"
242 #define SPOOL_REG_VERSIONNUMBER "versionNumber"
244 /* container for a single registry key */
246 typedef struct {
247 char *name;
248 REGVAL_CTR *values;
249 } NT_PRINTER_KEY;
251 /* container for all printer data */
253 typedef struct {
254 int num_keys;
255 NT_PRINTER_KEY *keys;
256 } NT_PRINTER_DATA;
258 #define MAXDEVICENAME 32
260 typedef struct ntdevicemode
262 fstring devicename;
263 fstring formname;
265 uint16 specversion;
266 uint16 driverversion;
267 uint16 size;
268 uint16 driverextra;
269 uint16 orientation;
270 uint16 papersize;
271 uint16 paperlength;
272 uint16 paperwidth;
273 uint16 scale;
274 uint16 copies;
275 uint16 defaultsource;
276 uint16 printquality;
277 uint16 color;
278 uint16 duplex;
279 uint16 yresolution;
280 uint16 ttoption;
281 uint16 collate;
282 uint16 logpixels;
284 uint32 fields;
285 uint32 bitsperpel;
286 uint32 pelswidth;
287 uint32 pelsheight;
288 uint32 displayflags;
289 uint32 displayfrequency;
290 uint32 icmmethod;
291 uint32 icmintent;
292 uint32 mediatype;
293 uint32 dithertype;
294 uint32 reserved1;
295 uint32 reserved2;
296 uint32 panningwidth;
297 uint32 panningheight;
298 uint8 *nt_dev_private;
299 } NT_DEVICEMODE;
301 typedef struct nt_printer_info_level_2
303 uint32 attributes;
304 uint32 priority;
305 uint32 default_priority;
306 uint32 starttime;
307 uint32 untiltime;
308 uint32 status;
309 uint32 cjobs;
310 uint32 averageppm;
311 fstring servername;
312 fstring printername;
313 fstring sharename;
314 fstring portname;
315 fstring drivername;
316 pstring comment;
317 fstring location;
318 NT_DEVICEMODE *devmode;
319 fstring sepfile;
320 fstring printprocessor;
321 fstring datatype;
322 fstring parameters;
323 NT_PRINTER_DATA *data;
324 SEC_DESC_BUF *secdesc_buf;
325 uint32 changeid;
326 uint32 c_setprinter;
327 uint32 setuptime;
328 } NT_PRINTER_INFO_LEVEL_2;
330 typedef struct nt_printer_info_level
332 NT_PRINTER_INFO_LEVEL_2 *info_2;
333 } NT_PRINTER_INFO_LEVEL;
335 typedef struct
337 fstring name;
338 uint32 flag;
339 uint32 width;
340 uint32 length;
341 uint32 left;
342 uint32 top;
343 uint32 right;
344 uint32 bottom;
345 } nt_forms_struct;
347 #ifndef SAMBA_PRINTER_PORT_NAME
348 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
349 #endif
351 /* DOS header format */
352 #define DOS_HEADER_SIZE 64
353 #define DOS_HEADER_MAGIC_OFFSET 0
354 #define DOS_HEADER_MAGIC 0x5A4D
355 #define DOS_HEADER_LFANEW_OFFSET 60
357 /* New Executable format (Win or OS/2 1.x segmented) */
358 #define NE_HEADER_SIZE 64
359 #define NE_HEADER_SIGNATURE_OFFSET 0
360 #define NE_HEADER_SIGNATURE 0x454E
361 #define NE_HEADER_TARGET_OS_OFFSET 54
362 #define NE_HEADER_TARGOS_WIN 0x02
363 #define NE_HEADER_MINOR_VER_OFFSET 62
364 #define NE_HEADER_MAJOR_VER_OFFSET 63
366 /* Portable Executable format */
367 #define PE_HEADER_SIZE 248
368 #define PE_HEADER_SIGNATURE_OFFSET 0
369 #define PE_HEADER_SIGNATURE 0x00004550
370 #define PE_HEADER_MACHINE_OFFSET 4
371 #define PE_HEADER_MACHINE_I386 0x14c
372 #define PE_HEADER_NUMBER_OF_SECTIONS 6
373 #define PE_HEADER_MAJOR_OS_VER_OFFSET 64
374 #define PE_HEADER_MINOR_OS_VER_OFFSET 66
375 #define PE_HEADER_MAJOR_IMG_VER_OFFSET 68
376 #define PE_HEADER_MINOR_IMG_VER_OFFSET 70
377 #define PE_HEADER_MAJOR_SS_VER_OFFSET 72
378 #define PE_HEADER_MINOR_SS_VER_OFFSET 74
379 #define PE_HEADER_SECT_HEADER_SIZE 40
380 #define PE_HEADER_SECT_NAME_OFFSET 0
381 #define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
382 #define PE_HEADER_SECT_PTR_DATA_OFFSET 20
384 /* Microsoft file version format */
385 #define VS_SIGNATURE "VS_VERSION_INFO"
386 #define VS_MAGIC_VALUE 0xfeef04bd
387 #define VS_MAJOR_OFFSET 8
388 #define VS_MINOR_OFFSET 12
389 #define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
390 #define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
391 #define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
393 /* Notify spoolss clients that something has changed. The
394 notification data is either stored in two uint32 values or a
395 variable length array. */
397 #define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
399 typedef struct spoolss_notify_msg {
400 fstring printer; /* Name of printer notified */
401 uint32 type; /* Printer or job notify */
402 uint32 field; /* Notify field changed */
403 uint32 id; /* Job id */
404 uint32 len; /* Length of data, 0 for two uint32 value */
405 uint32 flags;
406 union {
407 uint32 value[2];
408 char *data;
409 } notify;
410 } SPOOLSS_NOTIFY_MSG;
412 typedef struct {
413 fstring printername;
414 uint32 num_msgs;
415 SPOOLSS_NOTIFY_MSG *msgs;
416 } SPOOLSS_NOTIFY_MSG_GROUP;
418 typedef struct {
419 TALLOC_CTX *ctx;
420 uint32 num_groups;
421 SPOOLSS_NOTIFY_MSG_GROUP *msg_groups;
422 } SPOOLSS_NOTIFY_MSG_CTR;
424 #define PRINTER_HANDLE_IS_PRINTER 0
425 #define PRINTER_HANDLE_IS_PRINTSERVER 1
427 /* structure to store the printer handles */
428 /* and a reference to what it's pointing to */
429 /* and the notify info asked about */
430 /* that's the central struct */
431 typedef struct _Printer{
432 struct _Printer *prev, *next;
433 BOOL document_started;
434 BOOL page_started;
435 uint32 jobid; /* jobid in printing backend */
436 BOOL printer_type;
437 TALLOC_CTX *ctx;
438 fstring servername;
439 fstring sharename;
440 uint32 type;
441 uint32 access_granted;
442 struct {
443 uint32 flags;
444 uint32 options;
445 fstring localmachine;
446 uint32 printerlocal;
447 SPOOL_NOTIFY_OPTION *option;
448 POLICY_HND client_hnd;
449 BOOL client_connected;
450 uint32 change;
451 /* are we in a FindNextPrinterChangeNotify() call? */
452 BOOL fnpcn;
453 } notify;
454 struct {
455 fstring machine;
456 fstring user;
457 } client;
459 /* devmode sent in the OpenPrinter() call */
460 NT_DEVICEMODE *nt_devmode;
462 /* cache the printer info */
463 NT_PRINTER_INFO_LEVEL *printer_info;
465 } Printer_entry;
467 #endif /* NT_PRINTING_H_ */