2 Unix SMB/Netbios implementation.
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 3 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, see <http://www.gnu.org/licenses/>.
22 #ifndef NT_PRINTING_H_
23 #define NT_PRINTING_H_
25 /* predefined registry key names for printer data */
27 #define SPOOL_PRINTERDATA_KEY "PrinterDriverData"
28 #define SPOOL_DSSPOOLER_KEY "DsSpooler"
29 #define SPOOL_DSDRIVER_KEY "DsDriver"
30 #define SPOOL_DSUSER_KEY "DsUser"
31 #define SPOOL_PNPDATA_KEY "PnPData"
32 #define SPOOL_OID_KEY "OID"
34 /* predefined value names for printer data */
35 #define SPOOL_REG_ASSETNUMBER "assetNumber"
36 #define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute"
37 #define SPOOL_REG_DEFAULTPRIORITY "defaultPriority"
38 #define SPOOL_REG_DESCRIPTION "description"
39 #define SPOOL_REG_DRIVERNAME "driverName"
40 #define SPOOL_REG_DRIVERVERSION "driverVersion"
41 #define SPOOL_REG_FLAGS "flags"
42 #define SPOOL_REG_LOCATION "location"
43 #define SPOOL_REG_OPERATINGSYSTEM "operatingSystem"
44 #define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix"
45 #define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack"
46 #define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion"
47 #define SPOOL_REG_PORTNAME "portName"
48 #define SPOOL_REG_PRINTATTRIBUTES "printAttributes"
49 #define SPOOL_REG_PRINTBINNAMES "printBinNames"
50 #define SPOOL_REG_PRINTCOLLATE "printCollate"
51 #define SPOOL_REG_PRINTCOLOR "printColor"
52 #define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported"
53 #define SPOOL_REG_PRINTENDTIME "printEndTime"
54 #define SPOOL_REG_PRINTERNAME "printerName"
55 #define SPOOL_REG_PRINTFORMNAME "printFormName"
56 #define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs"
57 #define SPOOL_REG_PRINTLANGUAGE "printLanguage"
58 #define SPOOL_REG_PRINTMACADDRESS "printMACAddress"
59 #define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies"
60 #define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported"
61 #define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent"
62 #define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent"
63 #define SPOOL_REG_PRINTMEDIAREADY "printMediaReady"
64 #define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported"
65 #define SPOOL_REG_PRINTMEMORY "printMemory"
66 #define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent"
67 #define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent"
68 #define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress"
69 #define SPOOL_REG_PRINTNOTIFY "printNotify"
70 #define SPOOL_REG_PRINTNUMBERUP "printNumberUp"
71 #define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported"
72 #define SPOOL_REG_PRINTOWNER "printOwner"
73 #define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute"
74 #define SPOOL_REG_PRINTRATE "printRate"
75 #define SPOOL_REG_PRINTRATEUNIT "printRateUnit"
76 #define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile"
77 #define SPOOL_REG_PRINTSHARENAME "printShareName"
78 #define SPOOL_REG_PRINTSPOOLING "printSpooling"
79 #define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling"
80 #define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled"
81 #define SPOOL_REGVAL_PRINTDIRECT "PrintDirect"
82 #define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported"
83 #define SPOOL_REG_PRINTSTARTTIME "printStartTime"
84 #define SPOOL_REG_PRINTSTATUS "printStatus"
85 #define SPOOL_REG_PRIORITY "priority"
86 #define SPOOL_REG_SERVERNAME "serverName"
87 #define SPOOL_REG_SHORTSERVERNAME "shortServerName"
88 #define SPOOL_REG_UNCNAME "uNCName"
89 #define SPOOL_REG_URL "url"
90 #define SPOOL_REG_VERSIONNUMBER "versionNumber"
92 /* container for a single registry key */
96 struct regval_ctr *values;
99 /* container for all printer data */
103 NT_PRINTER_KEY *keys;
106 #define MAXDEVICENAME 32
108 typedef struct ntdevicemode
114 uint16 driverversion;
123 uint16 defaultsource;
137 uint32 displayfrequency;
145 uint32 panningheight;
146 uint8 *nt_dev_private;
149 typedef struct nt_printer_info_level_2
153 uint32 default_priority;
166 NT_DEVICEMODE *devmode;
168 fstring printprocessor;
171 NT_PRINTER_DATA *data;
172 SEC_DESC_BUF *secdesc_buf;
176 } NT_PRINTER_INFO_LEVEL_2;
178 typedef struct nt_printer_info_level
180 NT_PRINTER_INFO_LEVEL_2 *info_2;
181 } NT_PRINTER_INFO_LEVEL;
195 #ifndef SAMBA_PRINTER_PORT_NAME
196 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
199 /* DOS header format */
200 #define DOS_HEADER_SIZE 64
201 #define DOS_HEADER_MAGIC_OFFSET 0
202 #define DOS_HEADER_MAGIC 0x5A4D
203 #define DOS_HEADER_LFANEW_OFFSET 60
205 /* New Executable format (Win or OS/2 1.x segmented) */
206 #define NE_HEADER_SIZE 64
207 #define NE_HEADER_SIGNATURE_OFFSET 0
208 #define NE_HEADER_SIGNATURE 0x454E
209 #define NE_HEADER_TARGET_OS_OFFSET 54
210 #define NE_HEADER_TARGOS_WIN 0x02
211 #define NE_HEADER_MINOR_VER_OFFSET 62
212 #define NE_HEADER_MAJOR_VER_OFFSET 63
214 /* Portable Executable format */
215 #define PE_HEADER_SIZE 24
216 #define PE_HEADER_SIGNATURE_OFFSET 0
217 #define PE_HEADER_SIGNATURE 0x00004550
218 #define PE_HEADER_MACHINE_OFFSET 4
219 #define PE_HEADER_MACHINE_I386 0x14c
220 #define PE_HEADER_NUMBER_OF_SECTIONS 6
221 #define PE_HEADER_OPTIONAL_HEADER_SIZE 20
222 #define PE_HEADER_SECT_HEADER_SIZE 40
223 #define PE_HEADER_SECT_NAME_OFFSET 0
224 #define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
225 #define PE_HEADER_SECT_PTR_DATA_OFFSET 20
227 /* Microsoft file version format */
228 #define VS_SIGNATURE "VS_VERSION_INFO"
229 #define VS_MAGIC_VALUE 0xfeef04bd
230 #define VS_MAJOR_OFFSET 8
231 #define VS_MINOR_OFFSET 12
232 #define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
233 #define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
234 #define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
236 /* Notify spoolss clients that something has changed. The
237 notification data is either stored in two uint32 values or a
238 variable length array. */
240 #define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
242 typedef struct spoolss_notify_msg {
243 fstring printer; /* Name of printer notified */
244 uint32 type; /* Printer or job notify */
245 uint32 field; /* Notify field changed */
246 uint32 id; /* Job id */
247 uint32 len; /* Length of data, 0 for two uint32 value */
253 } SPOOLSS_NOTIFY_MSG;
258 SPOOLSS_NOTIFY_MSG *msgs;
259 } SPOOLSS_NOTIFY_MSG_GROUP;
264 SPOOLSS_NOTIFY_MSG_GROUP *msg_groups;
265 } SPOOLSS_NOTIFY_MSG_CTR;
267 #define SPLHND_PRINTER 1
268 #define SPLHND_SERVER 2
269 #define SPLHND_PORTMON_TCP 3
270 #define SPLHND_PORTMON_LOCAL 4
272 /* structure to store the printer handles */
273 /* and a reference to what it's pointing to */
274 /* and the notify info asked about */
275 /* that's the central struct */
276 typedef struct _Printer{
277 struct _Printer *prev, *next;
278 bool document_started;
280 uint32 jobid; /* jobid in printing backend */
285 uint32 access_granted;
289 fstring localmachine;
291 struct spoolss_NotifyOption *option;
292 struct policy_handle client_hnd;
293 bool client_connected;
295 /* are we in a FindNextPrinterChangeNotify() call? */
303 /* devmode sent in the OpenPrinter() call */
304 NT_DEVICEMODE *nt_devmode;
306 /* cache the printer info */
307 NT_PRINTER_INFO_LEVEL *printer_info;
312 * The printer attributes.
313 * I #defined all of them (grabbed form MSDN)
315 * ( SHARED | NETWORK | RAW_ONLY )
316 * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
319 #define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\
320 PRINTER_ATTRIBUTE_SHARED|\
321 PRINTER_ATTRIBUTE_LOCAL)
322 #define PRINTER_ATTRIBUTE_NOT_SAMBA (PRINTER_ATTRIBUTE_NETWORK)
324 #define DRIVER_ANY_VERSION 0xffffffff
325 #define DRIVER_MAX_VERSION 4
327 struct print_architecture_table_node {
328 const char *long_archi;
329 const char *short_archi;
333 #endif /* NT_PRINTING_H_ */