s3-spoolss: remove old _spoolss_EndPagePrinter.
[kai/samba-autobuild/.git] / source3 / include / rpc_spoolss.h
1 /* 
2    Unix SMB/Netbios implementation.
3
4    Copyright (C) Andrew Tridgell              1992-2000,
5    Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6    Copyright (C) Jean Francois Micouleau      1998-2000.
7    Copyright (C) Gerald Carter                2001-2006.
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #include "librpc/gen_ndr/spoolss.h"
24
25 #ifndef _RPC_SPOOLSS_H          /* _RPC_SPOOLSS_H */
26 #define _RPC_SPOOLSS_H
27
28 /* spoolss pipe: this are the calls which are not implemented ...
29 #define SPOOLSS_GETPRINTERDRIVER                        0x0b
30 #define SPOOLSS_READPRINTER                             0x16
31 #define SPOOLSS_WAITFORPRINTERCHANGE                    0x1c
32 #define SPOOLSS_ADDPORT                                 0x25
33 #define SPOOLSS_CONFIGUREPORT                           0x26
34 #define SPOOLSS_DELETEPORT                              0x27
35 #define SPOOLSS_CREATEPRINTERIC                         0x28
36 #define SPOOLSS_PLAYGDISCRIPTONPRINTERIC                0x29
37 #define SPOOLSS_DELETEPRINTERIC                         0x2a
38 #define SPOOLSS_ADDPRINTERCONNECTION                    0x2b
39 #define SPOOLSS_DELETEPRINTERCONNECTION                 0x2c
40 #define SPOOLSS_PRINTERMESSAGEBOX                       0x2d
41 #define SPOOLSS_ADDMONITOR                              0x2e
42 #define SPOOLSS_DELETEMONITOR                           0x2f
43 #define SPOOLSS_DELETEPRINTPROCESSOR                    0x30
44 #define SPOOLSS_ADDPRINTPROVIDOR                        0x31
45 #define SPOOLSS_DELETEPRINTPROVIDOR                     0x32
46 #define SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION      0x36
47 #define SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION       0x37
48 #define SPOOLSS_ROUTERFINDFIRSTPRINTERNOTIFICATIONOLD   0x39
49 #define SPOOLSS_ADDPORTEX                               0x3d
50 #define SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFICATION0x3e
51 #define SPOOLSS_SPOOLERINIT                             0x3f
52 #define SPOOLSS_RESETPRINTEREX                          0x40
53 */
54
55 /* those are implemented */
56 #define SPOOLSS_ENUMPRINTERS                            0x00
57 #define SPOOLSS_OPENPRINTER                             0x01
58 #define SPOOLSS_SETJOB                                  0x02
59 #define SPOOLSS_GETJOB                                  0x03
60 #define SPOOLSS_ENUMJOBS                                0x04
61 #define SPOOLSS_ADDPRINTER                              0x05
62 #define SPOOLSS_DELETEPRINTER                           0x06
63 #define SPOOLSS_SETPRINTER                              0x07
64 #define SPOOLSS_GETPRINTER                              0x08
65 #define SPOOLSS_ADDPRINTERDRIVER                        0x09
66 #define SPOOLSS_ENUMPRINTERDRIVERS                      0x0a
67 #define SPOOLSS_GETPRINTERDRIVERDIRECTORY               0x0c
68 #define SPOOLSS_DELETEPRINTERDRIVER                     0x0d
69 #define SPOOLSS_ADDPRINTPROCESSOR                       0x0e
70 #define SPOOLSS_ENUMPRINTPROCESSORS                     0x0f
71 #define SPOOLSS_GETPRINTPROCESSORDIRECTORY              0x10
72 #define SPOOLSS_STARTDOCPRINTER                         0x11
73 #define SPOOLSS_STARTPAGEPRINTER                        0x12
74 #define SPOOLSS_WRITEPRINTER                            0x13
75 #define SPOOLSS_ENDPAGEPRINTER                          0x14
76 #define SPOOLSS_ABORTPRINTER                            0x15
77 #define SPOOLSS_ENDDOCPRINTER                           0x17
78 #define SPOOLSS_ADDJOB                                  0x18
79 #define SPOOLSS_SCHEDULEJOB                             0x19
80 #define SPOOLSS_GETPRINTERDATA                          0x1a
81 #define SPOOLSS_SETPRINTERDATA                          0x1b
82 #define SPOOLSS_CLOSEPRINTER                            0x1d
83 #define SPOOLSS_ADDFORM                                 0x1e
84 #define SPOOLSS_DELETEFORM                              0x1f
85 #define SPOOLSS_GETFORM                                 0x20
86 #define SPOOLSS_SETFORM                                 0x21
87 #define SPOOLSS_ENUMFORMS                               0x22
88 #define SPOOLSS_ENUMPORTS                               0x23
89 #define SPOOLSS_ENUMMONITORS                            0x24
90 #define SPOOLSS_ENUMPRINTPROCDATATYPES                  0x33
91 #define SPOOLSS_RESETPRINTER                            0x34
92 #define SPOOLSS_GETPRINTERDRIVER2                       0x35
93 #define SPOOLSS_FCPN                                    0x38    /* FindClosePrinterNotify */
94 #define SPOOLSS_REPLYOPENPRINTER                        0x3a
95 #define SPOOLSS_ROUTERREPLYPRINTER                      0x3b
96 #define SPOOLSS_REPLYCLOSEPRINTER                       0x3c
97 #define SPOOLSS_RFFPCNEX                                0x41    /* RemoteFindFirstPrinterChangeNotifyEx */
98 #define SPOOLSS_RRPCN                                   0x42    /* RouteRefreshPrinterChangeNotification */
99 #define SPOOLSS_RFNPCNEX                                0x43    /* RemoteFindNextPrinterChangeNotifyEx */
100 #define SPOOLSS_OPENPRINTEREX                           0x45
101 #define SPOOLSS_ADDPRINTEREX                            0x46
102 #define SPOOLSS_ENUMPRINTERDATA                         0x48
103 #define SPOOLSS_DELETEPRINTERDATA                       0x49
104 #define SPOOLSS_SETPRINTERDATAEX                        0x4d
105 #define SPOOLSS_GETPRINTERDATAEX                        0x4e
106 #define SPOOLSS_ENUMPRINTERDATAEX                       0x4f
107 #define SPOOLSS_ENUMPRINTERKEY                          0x50
108 #define SPOOLSS_DELETEPRINTERDATAEX                     0x51
109 #define SPOOLSS_DELETEPRINTERKEY                        0x52
110 #define SPOOLSS_DELETEPRINTERDRIVEREX                   0x54
111 #define SPOOLSS_XCVDATAPORT                             0x58
112 #define SPOOLSS_ADDPRINTERDRIVEREX                      0x59
113
114 /* 
115  * Special strings for the OpenPrinter() call.  See the MSDN DDK
116  * docs on the XcvDataPort() for more details.
117  */
118
119 #define SPL_LOCAL_PORT            "Local Port"
120 #define SPL_TCPIP_PORT            "Standard TCP/IP Port"
121 #define SPL_XCV_MONITOR_LOCALMON  ",XcvMonitor Local Port"
122 #define SPL_XCV_MONITOR_TCPMON    ",XcvMonitor Standard TCP/IP Port"
123
124
125 #define PRINTER_CONTROL_UNPAUSE         0x00000000
126 #define PRINTER_CONTROL_PAUSE           0x00000001
127 #define PRINTER_CONTROL_RESUME          0x00000002
128 #define PRINTER_CONTROL_PURGE           0x00000003
129 #define PRINTER_CONTROL_SET_STATUS      0x00000004
130
131 #define PRINTER_STATUS_OK               0x00000000
132 #define JOB_ACCESS_READ                 0x00000020
133
134 /* JOB status codes. */
135
136 #define JOB_STATUS_QUEUED               0x0000
137 #define JOB_STATUS_PAUSED               0x0001
138 #define JOB_STATUS_ERROR                0x0002
139 #define JOB_STATUS_DELETING             0x0004
140 #define JOB_STATUS_SPOOLING             0x0008
141 #define JOB_STATUS_PRINTING             0x0010
142 #define JOB_STATUS_OFFLINE              0x0020
143 #define JOB_STATUS_PAPEROUT             0x0040
144 #define JOB_STATUS_PRINTED              0x0080
145 #define JOB_STATUS_DELETED              0x0100
146 #define JOB_STATUS_BLOCKED              0x0200
147 #define JOB_STATUS_USER_INTERVENTION    0x0400
148
149 /* Notify field types */
150
151 #define NOTIFY_ONE_VALUE 1              /* Notify data is stored in value1 */
152 #define NOTIFY_TWO_VALUE 2              /* Notify data is stored in value2 */
153 #define NOTIFY_POINTER   3              /* Data is a pointer to a buffer */
154 #define NOTIFY_STRING    4              /* Data is a pointer to a buffer w/length */
155 #define NOTIFY_SECDESC   5              /* Data is a security descriptor */
156
157 #define PRINTER_NOTIFY_TYPE 0x00
158 #define JOB_NOTIFY_TYPE     0x01
159 #define PRINT_TABLE_END     0xFF
160
161 #define MAX_PRINTER_NOTIFY 26
162 #define MAX_JOB_NOTIFY 24
163
164 #define MAX_NOTIFY_TYPE_FOR_NOW 26
165
166 #define PRINTER_NOTIFY_SERVER_NAME              0x00
167 #define PRINTER_NOTIFY_PRINTER_NAME             0x01
168 #define PRINTER_NOTIFY_SHARE_NAME               0x02
169 #define PRINTER_NOTIFY_PORT_NAME                0x03
170 #define PRINTER_NOTIFY_DRIVER_NAME              0x04
171 #define PRINTER_NOTIFY_COMMENT                  0x05
172 #define PRINTER_NOTIFY_LOCATION                 0x06
173 #define PRINTER_NOTIFY_DEVMODE                  0x07
174 #define PRINTER_NOTIFY_SEPFILE                  0x08
175 #define PRINTER_NOTIFY_PRINT_PROCESSOR          0x09
176 #define PRINTER_NOTIFY_PARAMETERS               0x0A
177 #define PRINTER_NOTIFY_DATATYPE                 0x0B
178 #define PRINTER_NOTIFY_SECURITY_DESCRIPTOR      0x0C
179 #define PRINTER_NOTIFY_ATTRIBUTES               0x0D
180 #define PRINTER_NOTIFY_PRIORITY                 0x0E
181 #define PRINTER_NOTIFY_DEFAULT_PRIORITY         0x0F
182 #define PRINTER_NOTIFY_START_TIME               0x10
183 #define PRINTER_NOTIFY_UNTIL_TIME               0x11
184 #define PRINTER_NOTIFY_STATUS                   0x12
185 #define PRINTER_NOTIFY_STATUS_STRING            0x13
186 #define PRINTER_NOTIFY_CJOBS                    0x14
187 #define PRINTER_NOTIFY_AVERAGE_PPM              0x15
188 #define PRINTER_NOTIFY_TOTAL_PAGES              0x16
189 #define PRINTER_NOTIFY_PAGES_PRINTED            0x17
190 #define PRINTER_NOTIFY_TOTAL_BYTES              0x18
191 #define PRINTER_NOTIFY_BYTES_PRINTED            0x19
192
193 #define JOB_NOTIFY_PRINTER_NAME                 0x00
194 #define JOB_NOTIFY_MACHINE_NAME                 0x01
195 #define JOB_NOTIFY_PORT_NAME                    0x02
196 #define JOB_NOTIFY_USER_NAME                    0x03
197 #define JOB_NOTIFY_NOTIFY_NAME                  0x04
198 #define JOB_NOTIFY_DATATYPE                     0x05
199 #define JOB_NOTIFY_PRINT_PROCESSOR              0x06
200 #define JOB_NOTIFY_PARAMETERS                   0x07
201 #define JOB_NOTIFY_DRIVER_NAME                  0x08
202 #define JOB_NOTIFY_DEVMODE                      0x09
203 #define JOB_NOTIFY_STATUS                       0x0A
204 #define JOB_NOTIFY_STATUS_STRING                0x0B
205 #define JOB_NOTIFY_SECURITY_DESCRIPTOR          0x0C
206 #define JOB_NOTIFY_DOCUMENT                     0x0D
207 #define JOB_NOTIFY_PRIORITY                     0x0E
208 #define JOB_NOTIFY_POSITION                     0x0F
209 #define JOB_NOTIFY_SUBMITTED                    0x10
210 #define JOB_NOTIFY_START_TIME                   0x11
211 #define JOB_NOTIFY_UNTIL_TIME                   0x12
212 #define JOB_NOTIFY_TIME                         0x13
213 #define JOB_NOTIFY_TOTAL_PAGES                  0x14
214 #define JOB_NOTIFY_PAGES_PRINTED                0x15
215 #define JOB_NOTIFY_TOTAL_BYTES                  0x16
216 #define JOB_NOTIFY_BYTES_PRINTED                0x17
217
218 #define PRINTER_NOTIFY_OPTIONS_REFRESH          0x01
219
220 #define PRINTER_CHANGE_ADD_PRINTER                      0x00000001
221 #define PRINTER_CHANGE_SET_PRINTER                      0x00000002
222 #define PRINTER_CHANGE_DELETE_PRINTER                   0x00000004
223 #define PRINTER_CHANGE_FAILED_CONNECTION_PRINTER        0x00000008
224 #define PRINTER_CHANGE_PRINTER  (PRINTER_CHANGE_ADD_PRINTER | \
225                                  PRINTER_CHANGE_SET_PRINTER | \
226                                  PRINTER_CHANGE_DELETE_PRINTER | \
227                                  PRINTER_CHANGE_FAILED_CONNECTION_PRINTER )
228
229 #define PRINTER_CHANGE_ADD_JOB                          0x00000100
230 #define PRINTER_CHANGE_SET_JOB                          0x00000200
231 #define PRINTER_CHANGE_DELETE_JOB                       0x00000400
232 #define PRINTER_CHANGE_WRITE_JOB                        0x00000800
233 #define PRINTER_CHANGE_JOB      (PRINTER_CHANGE_ADD_JOB | \
234                                  PRINTER_CHANGE_SET_JOB | \
235                                  PRINTER_CHANGE_DELETE_JOB | \
236                                  PRINTER_CHANGE_WRITE_JOB )
237
238 #define PRINTER_CHANGE_ADD_FORM                         0x00010000
239 #define PRINTER_CHANGE_SET_FORM                         0x00020000
240 #define PRINTER_CHANGE_DELETE_FORM                      0x00040000
241 #define PRINTER_CHANGE_FORM     (PRINTER_CHANGE_ADD_FORM | \
242                                  PRINTER_CHANGE_SET_FORM | \
243                                  PRINTER_CHANGE_DELETE_FORM )
244
245 #define PRINTER_CHANGE_ADD_PORT                         0x00100000
246 #define PRINTER_CHANGE_CONFIGURE_PORT                   0x00200000
247 #define PRINTER_CHANGE_DELETE_PORT                      0x00400000
248 #define PRINTER_CHANGE_PORT     (PRINTER_CHANGE_ADD_PORT | \
249                                  PRINTER_CHANGE_CONFIGURE_PORT | \
250                                  PRINTER_CHANGE_DELETE_PORT )
251
252 #define PRINTER_CHANGE_ADD_PRINT_PROCESSOR              0x01000000
253 #define PRINTER_CHANGE_DELETE_PRINT_PROCESSOR           0x04000000
254 #define PRINTER_CHANGE_PRINT_PROCESSOR  (PRINTER_CHANGE_ADD_PRINT_PROCESSOR | \
255                                          PRINTER_CHANGE_DELETE_PRINT_PROCESSOR )
256
257 #define PRINTER_CHANGE_ADD_PRINTER_DRIVER               0x10000000
258 #define PRINTER_CHANGE_SET_PRINTER_DRIVER               0x20000000
259 #define PRINTER_CHANGE_DELETE_PRINTER_DRIVER            0x40000000
260 #define PRINTER_CHANGE_PRINTER_DRIVER   (PRINTER_CHANGE_ADD_PRINTER_DRIVER | \
261                                          PRINTER_CHANGE_SET_PRINTER_DRIVER | \
262                                          PRINTER_CHANGE_DELETE_PRINTER_DRIVER )
263
264 #define PRINTER_CHANGE_TIMEOUT                          0x80000000
265 #define PRINTER_CHANGE_ALL      (PRINTER_CHANGE_JOB | \
266                                  PRINTER_CHANGE_FORM | \
267                                  PRINTER_CHANGE_PORT | \
268                                  PRINTER_CHANGE_PRINT_PROCESSOR | \
269                                  PRINTER_CHANGE_PRINTER_DRIVER )
270
271 #define PRINTER_NOTIFY_INFO_DISCARDED   0x1
272
273 /*
274  * Set of macros for flagging what changed in the PRINTER_INFO_2 struct
275  * when sending messages to other smbd's
276  */
277 #define PRINTER_MESSAGE_NULL            0x00000000
278 #define PRINTER_MESSAGE_DRIVER          0x00000001
279 #define PRINTER_MESSAGE_COMMENT         0x00000002
280 #define PRINTER_MESSAGE_PRINTERNAME     0x00000004
281 #define PRINTER_MESSAGE_LOCATION        0x00000008
282 #define PRINTER_MESSAGE_DEVMODE         0x00000010      /* not curently supported */
283 #define PRINTER_MESSAGE_SEPFILE         0x00000020
284 #define PRINTER_MESSAGE_PRINTPROC       0x00000040
285 #define PRINTER_MESSAGE_PARAMS          0x00000080
286 #define PRINTER_MESSAGE_DATATYPE        0x00000100
287 #define PRINTER_MESSAGE_SECDESC         0x00000200
288 #define PRINTER_MESSAGE_CJOBS           0x00000400
289 #define PRINTER_MESSAGE_PORT            0x00000800
290 #define PRINTER_MESSAGE_SHARENAME       0x00001000
291 #define PRINTER_MESSAGE_ATTRIBUTES      0x00002000
292
293 typedef struct printer_message_info {
294         uint32 low;             /* PRINTER_CHANGE_XXX */
295         uint32 high;            /* PRINTER_CHANGE_XXX */
296         fstring printer_name;
297         uint32 flags;           /* PRINTER_MESSAGE_XXX */
298 }
299 PRINTER_MESSAGE_INFO;
300
301 /*
302  * The printer attributes.
303  * I #defined all of them (grabbed form MSDN)
304  * I'm only using:
305  * ( SHARED | NETWORK | RAW_ONLY )
306  * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
307  */
308
309 #define PRINTER_ATTRIBUTE_SAMBA                 (PRINTER_ATTRIBUTE_RAW_ONLY|\
310                                                  PRINTER_ATTRIBUTE_SHARED|\
311                                                  PRINTER_ATTRIBUTE_LOCAL)
312 #define PRINTER_ATTRIBUTE_NOT_SAMBA             (PRINTER_ATTRIBUTE_NETWORK)
313
314 #define NO_PRIORITY      0
315 #define MAX_PRIORITY    99
316 #define MIN_PRIORITY     1
317 #define DEF_PRIORITY     1
318
319 /* the flags of each printers */
320 #define PRINTER_ENUM_UNKNOWN_8         0x00000008
321 #define PRINTER_ENUM_ICONMASK           0x00ff0000
322
323 /* FLAGS for SPOOLSS_DELETEPRINTERDRIVEREX */
324
325 #define DPD_DELETE_UNUSED_FILES         0x00000001
326 #define DPD_DELETE_SPECIFIC_VERSION     0x00000002
327 #define DPD_DELETE_ALL_FILES            0x00000004
328
329 #define DRIVER_ANY_VERSION              0xffffffff
330 #define DRIVER_MAX_VERSION              4
331
332 /* FLAGS for SPOOLSS_ADDPRINTERDRIVEREX */
333
334 #define APD_STRICT_UPGRADE              0x00000001
335 #define APD_STRICT_DOWNGRADE            0x00000002
336 #define APD_COPY_ALL_FILES              0x00000004
337 #define APD_COPY_NEW_FILES              0x00000008
338
339
340 /* this struct is undocumented */
341 /* thanks to the ddk ... */
342 typedef struct {
343         uint32 size;            /* length of user_name & client_name + 2? */
344         UNISTR2 *client_name;
345         UNISTR2 *user_name;
346         uint32 build;
347         uint32 major;
348         uint32 minor;
349         uint32 processor;
350 } SPOOL_USER_1;
351
352 typedef struct {
353         uint32 level;
354         union {
355                 SPOOL_USER_1 *user1;
356         } user;
357 } SPOOL_USER_CTR;
358
359 /*
360  * various bits in the DEVICEMODE.fields member
361  */
362
363 #define DEVMODE_ORIENTATION             0x00000001
364 #define DEVMODE_PAPERSIZE               0x00000002
365 #define DEVMODE_PAPERLENGTH             0x00000004
366 #define DEVMODE_PAPERWIDTH              0x00000008
367 #define DEVMODE_SCALE                   0x00000010
368 #define DEVMODE_POSITION                0x00000020
369 #define DEVMODE_NUP                     0x00000040
370 #define DEVMODE_COPIES                  0x00000100
371 #define DEVMODE_DEFAULTSOURCE           0x00000200
372 #define DEVMODE_PRINTQUALITY            0x00000400
373 #define DEVMODE_COLOR                   0x00000800
374 #define DEVMODE_DUPLEX                  0x00001000
375 #define DEVMODE_YRESOLUTION             0x00002000
376 #define DEVMODE_TTOPTION                0x00004000
377 #define DEVMODE_COLLATE                 0x00008000
378 #define DEVMODE_FORMNAME                0x00010000
379 #define DEVMODE_LOGPIXELS               0x00020000
380 #define DEVMODE_BITSPERPEL              0x00040000
381 #define DEVMODE_PELSWIDTH               0x00080000
382 #define DEVMODE_PELSHEIGHT              0x00100000
383 #define DEVMODE_DISPLAYFLAGS            0x00200000
384 #define DEVMODE_DISPLAYFREQUENCY        0x00400000
385 #define DEVMODE_ICMMETHOD               0x00800000
386 #define DEVMODE_ICMINTENT               0x01000000
387 #define DEVMODE_MEDIATYPE               0x02000000
388 #define DEVMODE_DITHERTYPE              0x04000000
389 #define DEVMODE_PANNINGWIDTH            0x08000000
390 #define DEVMODE_PANNINGHEIGHT           0x10000000
391
392
393 /* 
394  * Devicemode structure
395  */
396
397 typedef struct devicemode
398 {
399         UNISTR devicename;
400         uint16 specversion;
401         uint16 driverversion;
402         uint16 size;
403         uint16 driverextra;
404         uint32 fields;
405         uint16 orientation;
406         uint16 papersize;
407         uint16 paperlength;
408         uint16 paperwidth;
409         uint16 scale;
410         uint16 copies;
411         uint16 defaultsource;
412         uint16 printquality;
413         uint16 color;
414         uint16 duplex;
415         uint16 yresolution;
416         uint16 ttoption;
417         uint16 collate;
418         UNISTR formname;
419         uint16 logpixels;
420         uint32 bitsperpel;
421         uint32 pelswidth;
422         uint32 pelsheight;
423         uint32 displayflags;
424         uint32 displayfrequency;
425         uint32 icmmethod;
426         uint32 icmintent;
427         uint32 mediatype;
428         uint32 dithertype;
429         uint32 reserved1;
430         uint32 reserved2;
431         uint32 panningwidth;
432         uint32 panningheight;
433         uint8 *dev_private;
434 }
435 DEVICEMODE;
436
437 typedef struct _devmode_cont
438 {
439         uint32 size;
440         uint32 devmode_ptr;
441         DEVICEMODE *devmode;
442 }
443 DEVMODE_CTR;
444
445 typedef struct _printer_default
446 {
447         uint32 datatype_ptr;
448         UNISTR2 datatype;
449         DEVMODE_CTR devmode_cont;
450         uint32 access_required;
451 }
452 PRINTER_DEFAULT;
453
454 /********************************************/
455
456 typedef struct {
457         UNISTR2 *printername;
458         PRINTER_DEFAULT printer_default;
459 } SPOOL_Q_OPEN_PRINTER;
460
461 typedef struct {
462         POLICY_HND handle;      /* handle used along all transactions (20*uint8) */
463         WERROR status;
464 } SPOOL_R_OPEN_PRINTER;
465
466 /********************************************/
467
468 typedef struct {
469         UNISTR2 *printername;
470         PRINTER_DEFAULT printer_default;
471         uint32 user_switch;
472         SPOOL_USER_CTR user_ctr;
473 } SPOOL_Q_OPEN_PRINTER_EX;
474
475 typedef struct {
476         POLICY_HND handle;      /* handle used along all transactions (20*uint8) */
477         WERROR status;
478 } SPOOL_R_OPEN_PRINTER_EX;
479
480 /********************************************/
481
482 typedef struct spool_notify_option_type
483 {
484         uint16 type;
485         uint16 reserved0;
486         uint32 reserved1;
487         uint32 reserved2;
488         uint32 count;
489         uint32 fields_ptr;
490         uint32 count2;
491         uint16 fields[MAX_NOTIFY_TYPE_FOR_NOW];
492 }
493 SPOOL_NOTIFY_OPTION_TYPE;
494
495 typedef struct spool_notify_option_type_ctr
496 {
497         uint32 count;
498         SPOOL_NOTIFY_OPTION_TYPE *type;
499 }
500 SPOOL_NOTIFY_OPTION_TYPE_CTR;
501
502
503
504 typedef struct s_header_type
505 {
506         uint32 type;
507         union
508         {
509                 uint32 value;
510                 UNISTR string;
511         }
512         data;
513 }
514 HEADER_TYPE;
515
516
517 typedef struct spool_q_getprinterdata
518 {
519         POLICY_HND handle;
520         UNISTR2 valuename;
521         uint32 size;
522 }
523 SPOOL_Q_GETPRINTERDATA;
524
525 typedef struct spool_r_getprinterdata
526 {
527         uint32 type;
528         uint32 size;
529         uint8 *data;
530         uint32 needed;
531         WERROR status;
532 }
533 SPOOL_R_GETPRINTERDATA;
534
535 typedef struct spool_q_deleteprinterdata
536 {
537         POLICY_HND handle;
538         UNISTR2 valuename;
539 }
540 SPOOL_Q_DELETEPRINTERDATA;
541
542 typedef struct spool_r_deleteprinterdata
543 {
544         WERROR status;
545 }
546 SPOOL_R_DELETEPRINTERDATA;
547
548 typedef struct spool_q_deleteprinterdriver
549 {
550         uint32 server_ptr;
551         UNISTR2 server;
552         UNISTR2 arch;
553         UNISTR2 driver;
554 }
555 SPOOL_Q_DELETEPRINTERDRIVER;
556
557 typedef struct spool_r_deleteprinterdriver
558 {
559         WERROR status;
560 }
561 SPOOL_R_DELETEPRINTERDRIVER;
562
563 typedef struct spool_q_deleteprinterdriverex
564 {
565         uint32 server_ptr;
566         UNISTR2 server;
567         UNISTR2 arch;
568         UNISTR2 driver;
569         uint32 delete_flags;
570         uint32 version;
571 }
572 SPOOL_Q_DELETEPRINTERDRIVEREX;
573
574 typedef struct spool_r_deleteprinterdriverex
575 {
576         WERROR status;
577 }
578 SPOOL_R_DELETEPRINTERDRIVEREX;
579
580
581 typedef struct spool_doc_info_1
582 {
583         uint32 p_docname;
584         uint32 p_outputfile;
585         uint32 p_datatype;
586         UNISTR2 docname;
587         UNISTR2 outputfile;
588         UNISTR2 datatype;
589 }
590 DOC_INFO_1;
591
592 typedef struct spool_doc_info
593 {
594         uint32 switch_value;
595         DOC_INFO_1 doc_info_1;
596 }
597 DOC_INFO;
598
599 typedef struct spool_doc_info_container
600 {
601         uint32 level;
602         DOC_INFO docinfo;
603 }
604 DOC_INFO_CONTAINER;
605
606 typedef struct spool_q_startdocprinter
607 {
608         POLICY_HND handle;
609         DOC_INFO_CONTAINER doc_info_container;
610 }
611 SPOOL_Q_STARTDOCPRINTER;
612
613 typedef struct spool_r_startdocprinter
614 {
615         uint32 jobid;
616         WERROR status;
617 }
618 SPOOL_R_STARTDOCPRINTER;
619
620 typedef struct spool_q_enddocprinter
621 {
622         POLICY_HND handle;
623 }
624 SPOOL_Q_ENDDOCPRINTER;
625
626 typedef struct spool_r_enddocprinter
627 {
628         WERROR status;
629 }
630 SPOOL_R_ENDDOCPRINTER;
631
632 typedef struct spool_q_writeprinter
633 {
634         POLICY_HND handle;
635         uint32 buffer_size;
636         uint8 *buffer;
637         uint32 buffer_size2;
638 }
639 SPOOL_Q_WRITEPRINTER;
640
641 typedef struct spool_r_writeprinter
642 {
643         uint32 buffer_written;
644         WERROR status;
645 }
646 SPOOL_R_WRITEPRINTER;
647
648 typedef struct spool_notify_option
649 {
650         uint32 version;
651         uint32 flags;
652         uint32 count;
653         uint32 option_type_ptr;
654         SPOOL_NOTIFY_OPTION_TYPE_CTR ctr;
655 }
656 SPOOL_NOTIFY_OPTION;
657
658 typedef struct spool_notify_info_data
659 {
660         uint16 type;
661         uint16 field;
662         uint32 reserved;
663         uint32 id;
664         union {
665                 uint32 value[2];
666                 struct {
667                         uint32 length;
668                         uint16 *string;
669                 } data;
670                 struct {
671                         uint32  size;
672                         SEC_DESC *desc;
673                 } sd;
674         }
675         notify_data;
676         uint32 size;
677         uint32 enc_type;
678 } SPOOL_NOTIFY_INFO_DATA;
679
680 typedef struct spool_notify_info
681 {
682         uint32 version;
683         uint32 flags;
684         uint32 count;
685         SPOOL_NOTIFY_INFO_DATA *data;
686 }
687 SPOOL_NOTIFY_INFO;
688
689 /* If the struct name looks obscure, yes it is ! */
690 /* RemoteFindFirstPrinterChangeNotificationEx query struct */
691 typedef struct spoolss_q_rffpcnex
692 {
693         POLICY_HND handle;
694         uint32 flags;
695         uint32 options;
696         uint32 localmachine_ptr;
697         UNISTR2 localmachine;
698         uint32 printerlocal;
699         uint32 option_ptr;
700         SPOOL_NOTIFY_OPTION *option;
701 }
702 SPOOL_Q_RFFPCNEX;
703
704 typedef struct spool_r_rffpcnex
705 {
706         WERROR status;
707 }
708 SPOOL_R_RFFPCNEX;
709
710 /* Remote Find Next Printer Change Notify Ex */
711 typedef struct spool_q_rfnpcnex
712 {
713         POLICY_HND handle;
714         uint32 change;
715         uint32 option_ptr;
716         SPOOL_NOTIFY_OPTION *option;
717 }
718 SPOOL_Q_RFNPCNEX;
719
720 typedef struct spool_r_rfnpcnex
721 {
722         uint32 info_ptr;
723         SPOOL_NOTIFY_INFO info;
724         WERROR status;
725 }
726 SPOOL_R_RFNPCNEX;
727
728 /* Find Close Printer Notify */
729 typedef struct spool_q_fcpn
730 {
731         POLICY_HND handle;
732 }
733 SPOOL_Q_FCPN;
734
735 typedef struct spool_r_fcpn
736 {
737         WERROR status;
738 }
739 SPOOL_R_FCPN;
740
741
742 typedef struct printer_info_0
743 {
744         UNISTR printername;
745         UNISTR servername;
746         uint32 cjobs;
747         uint32 total_jobs;
748         uint32 total_bytes;
749         
750         uint16 year;
751         uint16 month;
752         uint16 dayofweek;
753         uint16 day;
754         uint16 hour;
755         uint16 minute;
756         uint16 second;
757         uint16 milliseconds;
758
759         uint32 global_counter;
760         uint32 total_pages;
761
762         uint16 major_version;
763         uint16 build_version;
764
765         uint32 unknown7;
766         uint32 unknown8;
767         uint32 unknown9;
768         uint32 session_counter;
769         uint32 unknown11;
770         uint32 printer_errors;
771         uint32 unknown13;
772         uint32 unknown14;
773         uint32 unknown15;
774         uint32 unknown16;
775         uint32 change_id;
776         uint32 unknown18;
777         uint32 status;
778         uint32 unknown20;
779         uint32 c_setprinter;
780
781         uint16 unknown22;
782         uint16 unknown23;
783         uint16 unknown24;
784         uint16 unknown25;
785         uint16 unknown26;
786         uint16 unknown27;
787         uint16 unknown28;
788         uint16 unknown29;
789 } PRINTER_INFO_0;
790
791 typedef struct printer_info_1
792 {
793         uint32 flags;
794         UNISTR description;
795         UNISTR name;
796         UNISTR comment;
797 }
798 PRINTER_INFO_1;
799
800 typedef struct printer_info_2
801 {
802         UNISTR servername;
803         UNISTR printername;
804         UNISTR sharename;
805         UNISTR portname;
806         UNISTR drivername;
807         UNISTR comment;
808         UNISTR location;
809         DEVICEMODE *devmode;
810         UNISTR sepfile;
811         UNISTR printprocessor;
812         UNISTR datatype;
813         UNISTR parameters;
814         SEC_DESC *secdesc;
815         uint32 attributes;
816         uint32 priority;
817         uint32 defaultpriority;
818         uint32 starttime;
819         uint32 untiltime;
820         uint32 status;
821         uint32 cjobs;
822         uint32 averageppm;
823 }
824 PRINTER_INFO_2;
825
826 typedef struct printer_info_3
827 {
828         SEC_DESC *secdesc;
829 }
830 PRINTER_INFO_3;
831
832 typedef struct printer_info_4
833 {
834         UNISTR printername;
835         UNISTR servername;
836         uint32 attributes;
837 }
838 PRINTER_INFO_4;
839
840 typedef struct printer_info_5
841 {
842         UNISTR printername;
843         UNISTR portname;
844         uint32 attributes;
845         uint32 device_not_selected_timeout;
846         uint32 transmission_retry_timeout;
847 }
848 PRINTER_INFO_5;
849
850 typedef struct printer_info_6
851 {
852         uint32 status;
853 }
854 PRINTER_INFO_6;
855
856 #define SPOOL_DS_PUBLISH        1
857 #define SPOOL_DS_UPDATE         2
858 #define SPOOL_DS_UNPUBLISH      4
859 #define SPOOL_DS_PENDING        0x80000000
860
861 typedef struct printer_info_7
862 {
863         UNISTR guid; /* text form of printer guid */
864         uint32 action;
865 }
866 PRINTER_INFO_7;
867
868 typedef struct spool_q_enumprinters
869 {
870         uint32 flags;
871         uint32 servername_ptr;
872         UNISTR2 servername;
873         uint32 level;
874         RPC_BUFFER *buffer;
875         uint32 offered;
876 }
877 SPOOL_Q_ENUMPRINTERS;
878
879 typedef struct printer_info_ctr_info
880 {
881         PRINTER_INFO_0 *printers_0;
882         PRINTER_INFO_1 *printers_1;
883         PRINTER_INFO_2 *printers_2;
884         PRINTER_INFO_3 *printers_3;
885         PRINTER_INFO_4 *printers_4;
886         PRINTER_INFO_5 *printers_5;
887         PRINTER_INFO_7 *printers_7;
888 }
889 PRINTER_INFO_CTR;
890
891 typedef struct spool_r_enumprinters
892 {
893         RPC_BUFFER *buffer;
894         uint32 needed;          /* bytes needed */
895         uint32 returned;        /* number of printers */
896         WERROR status;
897 }
898 SPOOL_R_ENUMPRINTERS;
899
900
901 typedef struct spool_q_getprinter
902 {
903         POLICY_HND handle;
904         uint32 level;
905         RPC_BUFFER *buffer;
906         uint32 offered;
907 }
908 SPOOL_Q_GETPRINTER;
909
910 typedef struct printer_info_info
911 {
912         union
913         {
914                 PRINTER_INFO_0 *info0;
915                 PRINTER_INFO_1 *info1;
916                 PRINTER_INFO_2 *info2;
917                 void *info;
918         } printer;
919 } PRINTER_INFO;
920
921 typedef struct spool_r_getprinter
922 {
923         RPC_BUFFER *buffer;
924         uint32 needed;
925         WERROR status;
926 } SPOOL_R_GETPRINTER;
927
928 typedef struct driver_info_1
929 {
930         UNISTR name;
931 } DRIVER_INFO_1;
932
933 typedef struct driver_info_2
934 {
935         uint32 version;
936         UNISTR name;
937         UNISTR architecture;
938         UNISTR driverpath;
939         UNISTR datafile;
940         UNISTR configfile;
941 } DRIVER_INFO_2;
942
943 typedef struct driver_info_3
944 {
945         uint32 version;
946         UNISTR name;
947         UNISTR architecture;
948         UNISTR driverpath;
949         UNISTR datafile;
950         UNISTR configfile;
951         UNISTR helpfile;
952         uint16 *dependentfiles;
953         UNISTR monitorname;
954         UNISTR defaultdatatype;
955 }
956 DRIVER_INFO_3;
957
958 typedef struct driver_info_6
959 {
960         uint32 version;
961         UNISTR name;
962         UNISTR architecture;
963         UNISTR driverpath;
964         UNISTR datafile;
965         UNISTR configfile;
966         UNISTR helpfile;
967         uint16 *dependentfiles;
968         UNISTR monitorname;
969         UNISTR defaultdatatype;
970         uint16* previousdrivernames;
971         NTTIME driver_date;
972         uint32 padding;
973         uint32 driver_version_low;
974         uint32 driver_version_high;
975         UNISTR mfgname;
976         UNISTR oem_url;
977         UNISTR hardware_id;
978         UNISTR provider;
979 }
980 DRIVER_INFO_6;
981
982 typedef struct driver_info_info
983 {
984         DRIVER_INFO_1 *info1;
985         DRIVER_INFO_2 *info2;
986         DRIVER_INFO_3 *info3;
987         DRIVER_INFO_6 *info6;
988 }
989 PRINTER_DRIVER_CTR;
990
991 typedef struct spool_q_getprinterdriver2
992 {
993         POLICY_HND handle;
994         uint32 architecture_ptr;
995         UNISTR2 architecture;
996         uint32 level;
997         RPC_BUFFER *buffer;
998         uint32 offered;
999         uint32 clientmajorversion;
1000         uint32 clientminorversion;
1001 }
1002 SPOOL_Q_GETPRINTERDRIVER2;
1003
1004 typedef struct spool_r_getprinterdriver2
1005 {
1006         RPC_BUFFER *buffer;
1007         uint32 needed;
1008         uint32 servermajorversion;
1009         uint32 serverminorversion;
1010         WERROR status;
1011 }
1012 SPOOL_R_GETPRINTERDRIVER2;
1013
1014
1015 typedef struct add_jobinfo_1
1016 {
1017         UNISTR path;
1018         uint32 job_number;
1019 }
1020 ADD_JOBINFO_1;
1021
1022
1023 typedef struct spool_q_addjob
1024 {
1025         POLICY_HND handle;
1026         uint32 level;
1027         RPC_BUFFER *buffer;
1028         uint32 offered;
1029 }
1030 SPOOL_Q_ADDJOB;
1031
1032 typedef struct spool_r_addjob
1033 {
1034         RPC_BUFFER *buffer;
1035         uint32 needed;
1036         WERROR status;
1037 }
1038 SPOOL_R_ADDJOB;
1039
1040 /*
1041  * I'm really wondering how many different time formats
1042  * I will have to cope with
1043  *
1044  * JFM, 09/13/98 In a mad mood ;-(
1045 */
1046 typedef struct systemtime
1047 {
1048         uint16 year;
1049         uint16 month;
1050         uint16 dayofweek;
1051         uint16 day;
1052         uint16 hour;
1053         uint16 minute;
1054         uint16 second;
1055         uint16 milliseconds;
1056 }
1057 SYSTEMTIME;
1058
1059 typedef struct s_job_info_1
1060 {
1061         uint32 jobid;
1062         UNISTR printername;
1063         UNISTR machinename;
1064         UNISTR username;
1065         UNISTR document;
1066         UNISTR datatype;
1067         UNISTR text_status;
1068         uint32 status;
1069         uint32 priority;
1070         uint32 position;
1071         uint32 totalpages;
1072         uint32 pagesprinted;
1073         SYSTEMTIME submitted;
1074 }
1075 JOB_INFO_1;
1076
1077 typedef struct s_job_info_2
1078 {
1079         uint32 jobid;
1080         UNISTR printername;
1081         UNISTR machinename;
1082         UNISTR username;
1083         UNISTR document;
1084         UNISTR notifyname;
1085         UNISTR datatype;
1086         UNISTR printprocessor;
1087         UNISTR parameters;
1088         UNISTR drivername;
1089         DEVICEMODE *devmode;
1090         UNISTR text_status;
1091 /*      SEC_DESC sec_desc;*/
1092         uint32 status;
1093         uint32 priority;
1094         uint32 position;
1095         uint32 starttime;
1096         uint32 untiltime;
1097         uint32 totalpages;
1098         uint32 size;
1099         SYSTEMTIME submitted;
1100         uint32 timeelapsed;
1101         uint32 pagesprinted;
1102 }
1103 JOB_INFO_2;
1104
1105 typedef struct spool_q_enumjobs
1106 {
1107         POLICY_HND handle;
1108         uint32 firstjob;
1109         uint32 numofjobs;
1110         uint32 level;
1111         RPC_BUFFER *buffer;
1112         uint32 offered;
1113 }
1114 SPOOL_Q_ENUMJOBS;
1115
1116 typedef struct job_info_ctr_info
1117 {
1118         union
1119         {
1120                 JOB_INFO_1 *job_info_1;
1121                 JOB_INFO_2 *job_info_2;
1122                 void *info;
1123         } job;
1124
1125 } JOB_INFO_CTR;
1126
1127 typedef struct spool_r_enumjobs
1128 {
1129         RPC_BUFFER *buffer;
1130         uint32 needed;
1131         uint32 returned;
1132         WERROR status;
1133 }
1134 SPOOL_R_ENUMJOBS;
1135
1136 typedef struct spool_q_schedulejob
1137 {
1138         POLICY_HND handle;
1139         uint32 jobid;
1140 }
1141 SPOOL_Q_SCHEDULEJOB;
1142
1143 typedef struct spool_r_schedulejob
1144 {
1145         WERROR status;
1146 }
1147 SPOOL_R_SCHEDULEJOB;
1148
1149 typedef struct s_port_info_1
1150 {
1151         UNISTR port_name;
1152 }
1153 PORT_INFO_1;
1154
1155 typedef struct s_port_info_2
1156 {
1157         UNISTR port_name;
1158         UNISTR monitor_name;
1159         UNISTR description;
1160         uint32 port_type;
1161         uint32 reserved;
1162 }
1163 PORT_INFO_2;
1164
1165 /* Port Type bits */
1166 #define PORT_TYPE_WRITE         0x0001
1167 #define PORT_TYPE_READ          0x0002
1168 #define PORT_TYPE_REDIRECTED    0x0004
1169 #define PORT_TYPE_NET_ATTACHED  0x0008
1170
1171 typedef struct spool_q_enumports
1172 {
1173         uint32 name_ptr;
1174         UNISTR2 name;
1175         uint32 level;
1176         RPC_BUFFER *buffer;
1177         uint32 offered;
1178 }
1179 SPOOL_Q_ENUMPORTS;
1180
1181 typedef struct port_info_ctr_info
1182 {
1183         union
1184         {
1185                 PORT_INFO_1 *info_1;
1186                 PORT_INFO_2 *info_2;
1187         }
1188         port;
1189
1190 }
1191 PORT_INFO_CTR;
1192
1193 typedef struct spool_r_enumports
1194 {
1195         RPC_BUFFER *buffer;
1196         uint32 needed;          /* bytes needed */
1197         uint32 returned;        /* number of printers */
1198         WERROR status;
1199 }
1200 SPOOL_R_ENUMPORTS;
1201
1202 #define JOB_CONTROL_PAUSE              1
1203 #define JOB_CONTROL_RESUME             2
1204 #define JOB_CONTROL_CANCEL             3
1205 #define JOB_CONTROL_RESTART            4
1206 #define JOB_CONTROL_DELETE             5
1207
1208 typedef struct job_info_info
1209 {
1210         union
1211         {
1212                 JOB_INFO_1 job_info_1;
1213                 JOB_INFO_2 job_info_2;
1214         }
1215         job;
1216
1217 }
1218 JOB_INFO;
1219
1220 typedef struct spool_q_setjob
1221 {
1222         POLICY_HND handle;
1223         uint32 jobid;
1224         uint32 level;
1225         JOB_INFO ctr;
1226         uint32 command;
1227
1228 }
1229 SPOOL_Q_SETJOB;
1230
1231 typedef struct spool_r_setjob
1232 {
1233         WERROR status;
1234
1235 }
1236 SPOOL_R_SETJOB;
1237
1238 typedef struct spool_q_enumprinterdrivers
1239 {
1240         uint32 name_ptr;
1241         UNISTR2 name;
1242         uint32 environment_ptr;
1243         UNISTR2 environment;
1244         uint32 level;
1245         RPC_BUFFER *buffer;
1246         uint32 offered;
1247 }
1248 SPOOL_Q_ENUMPRINTERDRIVERS;
1249
1250 typedef struct spool_r_enumprinterdrivers
1251 {
1252         RPC_BUFFER *buffer;
1253         uint32 needed;
1254         uint32 returned;
1255         WERROR status;
1256 }
1257 SPOOL_R_ENUMPRINTERDRIVERS;
1258
1259 #define FORM_USER    0
1260 #define FORM_BUILTIN 1
1261 #define FORM_PRINTER 2
1262
1263 typedef struct spool_form_1
1264 {
1265         uint32 flag;
1266         UNISTR name;
1267         uint32 width;
1268         uint32 length;
1269         uint32 left;
1270         uint32 top;
1271         uint32 right;
1272         uint32 bottom;
1273 }
1274 FORM_1;
1275
1276 typedef struct spool_q_enumforms
1277 {
1278         POLICY_HND handle;
1279         uint32 level;
1280         RPC_BUFFER *buffer;
1281         uint32 offered;
1282 }
1283 SPOOL_Q_ENUMFORMS;
1284
1285 typedef struct spool_r_enumforms
1286 {
1287         RPC_BUFFER *buffer;
1288         uint32 needed;
1289         uint32 numofforms;
1290         WERROR status;
1291 }
1292 SPOOL_R_ENUMFORMS;
1293
1294 typedef struct spool_q_getform
1295 {
1296         POLICY_HND handle;
1297         UNISTR2 formname;
1298         uint32 level;
1299         RPC_BUFFER *buffer;
1300         uint32 offered;
1301 }
1302 SPOOL_Q_GETFORM;
1303
1304 typedef struct spool_r_getform
1305 {
1306         RPC_BUFFER *buffer;
1307         uint32 needed;
1308         WERROR status;
1309 }
1310 SPOOL_R_GETFORM;
1311
1312 typedef struct spool_printer_info_level_1
1313 {
1314         uint32 flags;
1315         uint32 description_ptr;
1316         uint32 name_ptr;
1317         uint32 comment_ptr;
1318         UNISTR2 description;
1319         UNISTR2 name;
1320         UNISTR2 comment;        
1321 } SPOOL_PRINTER_INFO_LEVEL_1;
1322
1323 typedef struct spool_printer_info_level_2
1324 {
1325         uint32 servername_ptr;
1326         uint32 printername_ptr;
1327         uint32 sharename_ptr;
1328         uint32 portname_ptr;
1329         uint32 drivername_ptr;
1330         uint32 comment_ptr;
1331         uint32 location_ptr;
1332         uint32 devmode_ptr;
1333         uint32 sepfile_ptr;
1334         uint32 printprocessor_ptr;
1335         uint32 datatype_ptr;
1336         uint32 parameters_ptr;
1337         uint32 secdesc_ptr;
1338         uint32 attributes;
1339         uint32 priority;
1340         uint32 default_priority;
1341         uint32 starttime;
1342         uint32 untiltime;
1343         uint32 status;
1344         uint32 cjobs;
1345         uint32 averageppm;
1346         UNISTR2 servername;
1347         UNISTR2 printername;
1348         UNISTR2 sharename;
1349         UNISTR2 portname;
1350         UNISTR2 drivername;
1351         UNISTR2 comment;
1352         UNISTR2 location;
1353         UNISTR2 sepfile;
1354         UNISTR2 printprocessor;
1355         UNISTR2 datatype;
1356         UNISTR2 parameters;
1357 }
1358 SPOOL_PRINTER_INFO_LEVEL_2;
1359
1360 typedef struct spool_printer_info_level_3
1361 {
1362         uint32 secdesc_ptr;
1363 }
1364 SPOOL_PRINTER_INFO_LEVEL_3;
1365
1366 typedef struct spool_printer_info_level_7
1367 {
1368         uint32 guid_ptr;
1369         uint32 action;
1370         UNISTR2 guid;
1371 }
1372 SPOOL_PRINTER_INFO_LEVEL_7;
1373
1374 typedef struct spool_printer_info_level
1375 {
1376         uint32 level;
1377         uint32 info_ptr;
1378         SPOOL_PRINTER_INFO_LEVEL_1 *info_1;
1379         SPOOL_PRINTER_INFO_LEVEL_2 *info_2;
1380         SPOOL_PRINTER_INFO_LEVEL_3 *info_3;
1381         SPOOL_PRINTER_INFO_LEVEL_7 *info_7;
1382 }
1383 SPOOL_PRINTER_INFO_LEVEL;
1384
1385 typedef struct spool_printer_driver_info_level_3
1386 {
1387         uint32 cversion;
1388         uint32 name_ptr;
1389         uint32 environment_ptr;
1390         uint32 driverpath_ptr;
1391         uint32 datafile_ptr;
1392         uint32 configfile_ptr;
1393         uint32 helpfile_ptr;
1394         uint32 monitorname_ptr;
1395         uint32 defaultdatatype_ptr;
1396         uint32 dependentfilessize;
1397         uint32 dependentfiles_ptr;
1398
1399         UNISTR2 name;
1400         UNISTR2 environment;
1401         UNISTR2 driverpath;
1402         UNISTR2 datafile;
1403         UNISTR2 configfile;
1404         UNISTR2 helpfile;
1405         UNISTR2 monitorname;
1406         UNISTR2 defaultdatatype;
1407         BUFFER5 dependentfiles;
1408
1409 }
1410 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3;
1411
1412 /* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
1413 typedef struct {
1414         uint32 version;
1415         uint32 name_ptr;
1416         uint32 environment_ptr;
1417         uint32 driverpath_ptr;
1418         uint32 datafile_ptr;
1419         uint32 configfile_ptr;
1420         uint32 helpfile_ptr;
1421         uint32 monitorname_ptr;
1422         uint32 defaultdatatype_ptr;
1423         uint32 dependentfiles_len;
1424         uint32 dependentfiles_ptr;
1425         uint32 previousnames_len;
1426         uint32 previousnames_ptr;
1427         NTTIME  driverdate;
1428         uint64  driverversion;
1429         uint32  dummy4;
1430         uint32 mfgname_ptr;
1431         uint32 oemurl_ptr;
1432         uint32 hardwareid_ptr;
1433         uint32 provider_ptr;
1434         UNISTR2 name;
1435         UNISTR2 environment;
1436         UNISTR2 driverpath;
1437         UNISTR2 datafile;
1438         UNISTR2 configfile;
1439         UNISTR2 helpfile;
1440         UNISTR2 monitorname;
1441         UNISTR2 defaultdatatype;
1442         BUFFER5 dependentfiles;
1443         BUFFER5 previousnames;
1444         UNISTR2 mfgname;
1445         UNISTR2 oemurl;
1446         UNISTR2 hardwareid;
1447         UNISTR2 provider;
1448 } SPOOL_PRINTER_DRIVER_INFO_LEVEL_6;
1449
1450
1451 typedef struct spool_printer_driver_info_level
1452 {
1453         uint32 level;
1454         uint32 ptr;
1455         SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
1456         SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
1457 }
1458 SPOOL_PRINTER_DRIVER_INFO_LEVEL;
1459
1460
1461 typedef struct spool_q_setprinter
1462 {
1463         POLICY_HND handle;
1464         uint32 level;
1465         SPOOL_PRINTER_INFO_LEVEL info;
1466         SEC_DESC_BUF *secdesc_ctr;
1467         DEVMODE_CTR devmode_ctr;
1468
1469         uint32 command;
1470
1471 }
1472 SPOOL_Q_SETPRINTER;
1473
1474 typedef struct spool_r_setprinter
1475 {
1476         WERROR status;
1477 }
1478 SPOOL_R_SETPRINTER;
1479
1480 /********************************************/
1481
1482 typedef struct {
1483         POLICY_HND handle;
1484 } SPOOL_Q_ABORTPRINTER;
1485
1486 typedef struct {
1487         WERROR status;
1488 } SPOOL_R_ABORTPRINTER;
1489
1490
1491 /********************************************/
1492
1493 typedef struct {
1494         UNISTR2 *server_name;
1495         uint32 level;
1496         SPOOL_PRINTER_INFO_LEVEL info;
1497         DEVMODE_CTR devmode_ctr;
1498         SEC_DESC_BUF *secdesc_ctr;
1499         uint32 user_switch;
1500         SPOOL_USER_CTR user_ctr;
1501 } SPOOL_Q_ADDPRINTEREX;
1502
1503 typedef struct {
1504         POLICY_HND handle;
1505         WERROR status;
1506 } SPOOL_R_ADDPRINTEREX;
1507
1508 /********************************************/
1509
1510 typedef struct spool_q_addprinterdriver
1511 {
1512         uint32 server_name_ptr;
1513         UNISTR2 server_name;
1514         uint32 level;
1515         SPOOL_PRINTER_DRIVER_INFO_LEVEL info;
1516 }
1517 SPOOL_Q_ADDPRINTERDRIVER;
1518
1519 typedef struct spool_r_addprinterdriver
1520 {
1521         WERROR status;
1522 }
1523 SPOOL_R_ADDPRINTERDRIVER;
1524
1525 typedef struct spool_q_addprinterdriverex
1526 {
1527         uint32 server_name_ptr;
1528         UNISTR2 server_name;
1529         uint32 level;
1530         SPOOL_PRINTER_DRIVER_INFO_LEVEL info;
1531         uint32 copy_flags;
1532 }
1533 SPOOL_Q_ADDPRINTERDRIVEREX;
1534
1535 typedef struct spool_r_addprinterdriverex
1536 {
1537         WERROR status;
1538 }
1539 SPOOL_R_ADDPRINTERDRIVEREX;
1540
1541
1542 typedef struct driver_directory_1
1543 {
1544         UNISTR name;
1545 }
1546 DRIVER_DIRECTORY_1;
1547
1548 typedef struct driver_info_ctr_info
1549 {
1550         DRIVER_DIRECTORY_1 *info1;
1551 }
1552 DRIVER_DIRECTORY_CTR;
1553
1554 typedef struct spool_q_getprinterdriverdirectory
1555 {
1556         uint32 name_ptr;
1557         UNISTR2 name;
1558         uint32 environment_ptr;
1559         UNISTR2 environment;
1560         uint32 level;
1561         RPC_BUFFER *buffer;
1562         uint32 offered;
1563 }
1564 SPOOL_Q_GETPRINTERDRIVERDIR;
1565
1566 typedef struct spool_r_getprinterdriverdirectory
1567 {
1568         RPC_BUFFER *buffer;
1569         uint32 needed;
1570         WERROR status;
1571 }
1572 SPOOL_R_GETPRINTERDRIVERDIR;
1573
1574 typedef struct spool_q_addprintprocessor
1575 {
1576         uint32 server_ptr;
1577         UNISTR2 server;
1578         UNISTR2 environment;
1579         UNISTR2 path;
1580         UNISTR2 name;
1581 }
1582 SPOOL_Q_ADDPRINTPROCESSOR;
1583
1584 typedef struct spool_r_addprintprocessor
1585 {
1586         WERROR status;
1587 }
1588 SPOOL_R_ADDPRINTPROCESSOR;
1589
1590
1591 typedef struct spool_q_enumprintprocessors
1592 {
1593         uint32 name_ptr;
1594         UNISTR2 name;
1595         uint32 environment_ptr;
1596         UNISTR2 environment;
1597         uint32 level;
1598         RPC_BUFFER *buffer;
1599         uint32 offered;
1600 }
1601 SPOOL_Q_ENUMPRINTPROCESSORS;
1602
1603 typedef struct printprocessor_1
1604 {
1605         UNISTR name;
1606 }
1607 PRINTPROCESSOR_1;
1608
1609 typedef struct spool_r_enumprintprocessors
1610 {
1611         RPC_BUFFER *buffer;
1612         uint32 needed;
1613         uint32 returned;
1614         WERROR status;
1615 }
1616 SPOOL_R_ENUMPRINTPROCESSORS;
1617
1618 typedef struct spool_q_enumprintprocdatatypes
1619 {
1620         uint32 name_ptr;
1621         UNISTR2 name;
1622         uint32 processor_ptr;
1623         UNISTR2 processor;
1624         uint32 level;
1625         RPC_BUFFER *buffer;
1626         uint32 offered;
1627 }
1628 SPOOL_Q_ENUMPRINTPROCDATATYPES;
1629
1630 typedef struct ppdatatype_1
1631 {
1632         UNISTR name;
1633 }
1634 PRINTPROCDATATYPE_1;
1635
1636 typedef struct spool_r_enumprintprocdatatypes
1637 {
1638         RPC_BUFFER *buffer;
1639         uint32 needed;
1640         uint32 returned;
1641         WERROR status;
1642 }
1643 SPOOL_R_ENUMPRINTPROCDATATYPES;
1644
1645 typedef struct printmonitor_1
1646 {
1647         UNISTR name;
1648 }
1649 PRINTMONITOR_1;
1650
1651 typedef struct printmonitor_2
1652 {
1653         UNISTR name;
1654         UNISTR environment;
1655         UNISTR dll_name;
1656 }
1657 PRINTMONITOR_2;
1658
1659 typedef struct spool_q_enumprintmonitors
1660 {
1661         uint32 name_ptr;
1662         UNISTR2 name;
1663         uint32 level;
1664         RPC_BUFFER *buffer;
1665         uint32 offered;
1666 }
1667 SPOOL_Q_ENUMPRINTMONITORS;
1668
1669 typedef struct spool_r_enumprintmonitors
1670 {
1671         RPC_BUFFER *buffer;
1672         uint32 needed;
1673         uint32 returned;
1674         WERROR status;
1675 }
1676 SPOOL_R_ENUMPRINTMONITORS;
1677
1678
1679 typedef struct spool_q_enumprinterdata
1680 {
1681         POLICY_HND handle;
1682         uint32 index;
1683         uint32 valuesize;
1684         uint32 datasize;
1685 }
1686 SPOOL_Q_ENUMPRINTERDATA;
1687
1688 typedef struct spool_r_enumprinterdata
1689 {
1690         uint32 valuesize;
1691         uint16 *value;
1692         uint32 realvaluesize;
1693         uint32 type;
1694         uint32 datasize;
1695         uint8 *data;
1696         uint32 realdatasize;
1697         WERROR status;
1698 }
1699 SPOOL_R_ENUMPRINTERDATA;
1700
1701 typedef struct spool_q_setprinterdata
1702 {
1703         POLICY_HND handle;
1704         UNISTR2 value;
1705         uint32 type;
1706         uint32 max_len;
1707         uint8 *data;
1708         uint32 real_len;
1709         uint32 numeric_data;
1710 }
1711 SPOOL_Q_SETPRINTERDATA;
1712
1713 typedef struct spool_r_setprinterdata
1714 {
1715         WERROR status;
1716 }
1717 SPOOL_R_SETPRINTERDATA;
1718
1719 typedef struct spool_q_resetprinter
1720 {
1721         POLICY_HND handle;
1722         uint32 datatype_ptr;
1723         UNISTR2 datatype;
1724         DEVMODE_CTR devmode_ctr;
1725
1726 } SPOOL_Q_RESETPRINTER;
1727
1728 typedef struct spool_r_resetprinter
1729 {
1730         WERROR status;
1731
1732 SPOOL_R_RESETPRINTER;
1733
1734
1735
1736 typedef struct _form
1737 {
1738         uint32 flags;
1739         uint32 name_ptr;
1740         uint32 size_x;
1741         uint32 size_y;
1742         uint32 left;
1743         uint32 top;
1744         uint32 right;
1745         uint32 bottom;
1746         UNISTR2 name;
1747 }
1748 FORM;
1749
1750 typedef struct spool_q_addform
1751 {
1752         POLICY_HND handle;
1753         uint32 level;
1754         uint32 level2;          /* This should really be part of the FORM structure */
1755         FORM form;
1756 }
1757 SPOOL_Q_ADDFORM;
1758
1759 typedef struct spool_r_addform
1760 {
1761         WERROR status;
1762 }
1763 SPOOL_R_ADDFORM;
1764
1765 typedef struct spool_q_setform
1766 {
1767         POLICY_HND handle;
1768         UNISTR2 name;
1769         uint32 level;
1770         uint32 level2;
1771         FORM form;
1772 }
1773 SPOOL_Q_SETFORM;
1774
1775 typedef struct spool_r_setform
1776 {
1777         WERROR status;
1778 }
1779 SPOOL_R_SETFORM;
1780
1781 typedef struct spool_q_deleteform
1782 {
1783         POLICY_HND handle;
1784         UNISTR2 name;
1785 }
1786 SPOOL_Q_DELETEFORM;
1787
1788 typedef struct spool_r_deleteform
1789 {
1790         WERROR status;
1791 }
1792 SPOOL_R_DELETEFORM;
1793
1794 typedef struct spool_q_getjob
1795 {
1796         POLICY_HND handle;
1797         uint32 jobid;
1798         uint32 level;
1799         RPC_BUFFER *buffer;
1800         uint32 offered;
1801 }
1802 SPOOL_Q_GETJOB;
1803
1804 typedef struct pjob_info_info
1805 {
1806         union
1807         {
1808                 JOB_INFO_1 *job_info_1;
1809                 JOB_INFO_2 *job_info_2;
1810                 void *info;
1811         }
1812         job;
1813
1814 }
1815 PJOB_INFO;
1816
1817 typedef struct spool_r_getjob
1818 {
1819         RPC_BUFFER *buffer;
1820         uint32 needed;
1821         WERROR status;
1822 }
1823 SPOOL_R_GETJOB;
1824
1825 typedef struct spool_q_replyopenprinter
1826 {
1827         UNISTR2 string;
1828         uint32 printer;
1829         uint32 type;
1830         uint32 unknown0;
1831         uint32 unknown1;
1832 }
1833 SPOOL_Q_REPLYOPENPRINTER;
1834
1835 typedef struct spool_r_replyopenprinter
1836 {
1837         POLICY_HND handle;
1838         WERROR status;
1839 }
1840 SPOOL_R_REPLYOPENPRINTER;
1841
1842 typedef struct spool_q_routerreplyprinter
1843 {
1844         POLICY_HND handle;
1845         uint32 condition;
1846         uint32 unknown1;        /* 0x00000001 */
1847         uint32 change_id;
1848         uint8  unknown2[5];     /* 0x0000000001 */
1849 }
1850 SPOOL_Q_ROUTERREPLYPRINTER;
1851
1852 typedef struct spool_r_routerreplyprinter
1853 {
1854         WERROR status;
1855 }
1856 SPOOL_R_ROUTERREPLYPRINTER;
1857
1858 typedef struct spool_q_replycloseprinter
1859 {
1860         POLICY_HND handle;
1861 }
1862 SPOOL_Q_REPLYCLOSEPRINTER;
1863
1864 typedef struct spool_r_replycloseprinter
1865 {
1866         POLICY_HND handle;
1867         WERROR status;
1868 }
1869 SPOOL_R_REPLYCLOSEPRINTER;
1870
1871 typedef struct spool_q_rrpcn
1872 {
1873         POLICY_HND handle;
1874         uint32 change_low;
1875         uint32 change_high;
1876         uint32 unknown0;
1877         uint32 unknown1;
1878         uint32 info_ptr;
1879         SPOOL_NOTIFY_INFO info; 
1880 }
1881 SPOOL_Q_REPLY_RRPCN;
1882
1883 typedef struct spool_r_rrpcn
1884 {
1885         uint32 unknown0;
1886         WERROR status;
1887 }
1888 SPOOL_R_REPLY_RRPCN;
1889
1890 typedef struct spool_q_getprinterdataex
1891 {
1892         POLICY_HND handle;
1893         UNISTR2 keyname;
1894         UNISTR2 valuename;
1895         uint32 size;
1896 }
1897 SPOOL_Q_GETPRINTERDATAEX;
1898
1899 typedef struct spool_r_getprinterdataex
1900 {
1901         uint32 type;
1902         uint32 size;
1903         uint8 *data;
1904         uint32 needed;
1905         WERROR status;
1906 }
1907 SPOOL_R_GETPRINTERDATAEX;
1908
1909 typedef struct spool_q_setprinterdataex
1910 {
1911         POLICY_HND handle;
1912         UNISTR2 key;
1913         UNISTR2 value;
1914         uint32 type;
1915         uint32 max_len;
1916         uint8 *data;
1917         uint32 real_len;
1918         uint32 numeric_data;
1919 }
1920 SPOOL_Q_SETPRINTERDATAEX;
1921
1922 typedef struct spool_r_setprinterdataex
1923 {
1924         WERROR status;
1925 }
1926 SPOOL_R_SETPRINTERDATAEX;
1927
1928
1929 typedef struct spool_q_deleteprinterdataex
1930 {
1931         POLICY_HND handle;
1932         UNISTR2 keyname;
1933         UNISTR2 valuename;
1934 }
1935 SPOOL_Q_DELETEPRINTERDATAEX;
1936
1937 typedef struct spool_r_deleteprinterdataex
1938 {
1939         WERROR status;
1940 }
1941 SPOOL_R_DELETEPRINTERDATAEX;
1942
1943
1944 typedef struct spool_q_enumprinterkey
1945 {
1946         POLICY_HND handle;
1947         UNISTR2 key;
1948         uint32 size;
1949 }
1950 SPOOL_Q_ENUMPRINTERKEY;
1951
1952 typedef struct spool_r_enumprinterkey
1953 {
1954         BUFFER5 keys;
1955         uint32 needed;  /* in bytes */
1956         WERROR status;
1957 }
1958 SPOOL_R_ENUMPRINTERKEY;
1959
1960 typedef struct spool_q_deleteprinterkey
1961 {
1962         POLICY_HND handle;
1963         UNISTR2 keyname;
1964 }
1965 SPOOL_Q_DELETEPRINTERKEY;
1966
1967 typedef struct spool_r_deleteprinterkey
1968 {
1969         WERROR status;
1970 }
1971 SPOOL_R_DELETEPRINTERKEY;
1972
1973 typedef struct printer_enum_values
1974 {
1975         UNISTR valuename;
1976         uint32 value_len;
1977         uint32 type;
1978         uint8  *data;
1979         uint32 data_len; 
1980         
1981 }
1982 PRINTER_ENUM_VALUES;
1983
1984 typedef struct printer_enum_values_ctr
1985 {
1986         uint32 size;
1987         uint32 size_of_array;
1988         PRINTER_ENUM_VALUES *values;
1989 }
1990 PRINTER_ENUM_VALUES_CTR;
1991
1992 typedef struct spool_q_enumprinterdataex
1993 {
1994         POLICY_HND handle;
1995         UNISTR2 key;
1996         uint32 size;
1997 }
1998 SPOOL_Q_ENUMPRINTERDATAEX;
1999
2000 typedef struct spool_r_enumprinterdataex
2001 {
2002         PRINTER_ENUM_VALUES_CTR ctr;
2003         uint32 needed;
2004         uint32 returned;
2005         WERROR status;
2006 }
2007 SPOOL_R_ENUMPRINTERDATAEX;
2008
2009 typedef struct printprocessor_directory_1
2010 {
2011         UNISTR name;
2012 }
2013 PRINTPROCESSOR_DIRECTORY_1;
2014
2015 typedef struct spool_q_getprintprocessordirectory
2016 {
2017         UNISTR2 name;
2018         UNISTR2 environment;
2019         uint32 level;
2020         RPC_BUFFER *buffer;
2021         uint32 offered;
2022 }
2023 SPOOL_Q_GETPRINTPROCESSORDIRECTORY;
2024
2025 typedef struct spool_r_getprintprocessordirectory
2026 {
2027         RPC_BUFFER *buffer;
2028         uint32 needed;
2029         WERROR status;
2030 }
2031 SPOOL_R_GETPRINTPROCESSORDIRECTORY;
2032
2033 /**************************************/
2034
2035 #define MAX_PORTNAME            64
2036 #define MAX_NETWORK_NAME        49
2037 #define MAX_SNMP_COMM_NAME      33
2038 #define MAX_QUEUE_NAME          33
2039 #define MAX_IPADDR_STRING       17
2040                 
2041 typedef struct {
2042         uint16 portname[MAX_PORTNAME];
2043         uint32 version;
2044         uint32 protocol;
2045         uint32 size;
2046         uint32 reserved;
2047         uint16 hostaddress[MAX_NETWORK_NAME];
2048         uint16 snmpcommunity[MAX_SNMP_COMM_NAME];
2049         uint32 dblspool;
2050         uint16 queue[MAX_QUEUE_NAME];
2051         uint16 ipaddress[MAX_IPADDR_STRING];
2052         uint32 port;
2053         uint32 snmpenabled;
2054         uint32 snmpdevindex;
2055 } SPOOL_PORT_DATA_1;
2056
2057 typedef struct {
2058         POLICY_HND handle;
2059         UNISTR2 dataname;
2060         RPC_BUFFER indata;
2061         uint32 indata_len;
2062         uint32 offered;
2063         uint32 unknown;
2064 } SPOOL_Q_XCVDATAPORT;
2065
2066 typedef struct {
2067         RPC_BUFFER outdata;
2068         uint32 needed;
2069         uint32 unknown;
2070         WERROR status;
2071 } SPOOL_R_XCVDATAPORT;
2072
2073 #define PRINTER_DRIVER_VERSION 2
2074 #define PRINTER_DRIVER_ARCHITECTURE "Windows NT x86"
2075
2076 #endif /* _RPC_SPOOLSS_H */
2077