spoolss: more mork on SetPrinterInfo() levels.
[samba.git] / librpc / idl / spoolss.idl
1 #include "idl_types.h"
2
3 /*
4   spoolss interface definitions
5 */
6 import "misc.idl", "security.idl", "winreg.idl";
7
8
9 cpp_quote("#define spoolss_security_descriptor security_descriptor")
10
11 [ uuid("12345678-1234-abcd-ef00-0123456789ab"),
12   version(1.0),
13   endpoint("ncacn_np:[\\pipe\\spoolss]"),
14   pointer_default(unique),
15   helpstring("Spooler SubSystem"),
16   helper("../librpc/ndr/ndr_spoolss_buf.h")
17 ] interface spoolss
18 {
19         typedef [v1_enum] enum winreg_Type winreg_Type;
20         typedef [gensize] struct {
21                 uint16 year;
22                 uint16 month;
23                 uint16 day_of_week;
24                 uint16 day;
25                 uint16 hour;
26                 uint16 minute;
27                 uint16 second;
28                 uint16 millisecond;
29         } spoolss_Time;
30
31         typedef struct {
32                 [value(ndr_size_spoolss_Time(time, ndr->iconv_convenience, ndr->flags))] uint32 size;
33                 [unique] spoolss_Time *time;
34         } spoolss_TimeCtr;
35
36         typedef enum {
37                 PROCESSOR_ARCHITECTURE_INTEL            = 0x0000,
38                 PROCESSOR_ARCHITECTURE_IA64             = 0x0006,
39                 PROCESSOR_ARCHITECTURE_AMD64            = 0x0009
40         } spoolss_ProcessorArchitecture;
41
42         typedef [v1_enum] enum {
43                 PROCESSOR_INTEL_386                     = 0x00000182,
44                 PROCESSOR_INTEL_486                     = 0x000001E6,
45                 PROCESSOR_INTEL_PENTIUM                 = 0x0000024A,
46                 PROCESSOR_INTEL_IA64                    = 0x00000898,
47                 PROCESSOR_AMD_X8664                     = 0x000022A0
48         } spoolss_ProcessorType;
49
50         typedef [v1_enum] enum {
51                 /* Windows 95, Windows 98, Windows Me, Windows NT4 */
52                 SPOOLSS_MAJOR_VERSION_NT4_95_98_ME      = 0x00000004,
53                 /* Windows 2000, Windows 2003, Windows XP */
54                 SPOOLSS_MAJOR_VERSION_2000_2003_XP      = 0x00000005,
55                 /* Windows Vista, Windows 2008 */
56                 SPOOLSS_MAJOR_VERSION_2008_VISTA        = 0x00000006
57         } spoolss_MajorVersion;
58
59         typedef [v1_enum] enum {
60                 /* Windows 2008, Windows Vista, Windows 2000, Windows NT4, Windows 95 */
61                 SPOOLSS_MINOR_VERSION_0                 = 0x00000000,
62                 /* Windows XP */
63                 SPOOLSS_MINOR_VERSION_XP                = 0x00000001,
64                 /* Windows 2003, Windows XP x64 */
65                 SPOOLSS_MINOR_VERSION_2003_XP64         = 0x00000002,
66                 /* Windows 98 */
67                 SPOOLSS_MINOR_VERSION_98                = 0x0000000a,
68                 /* Windows Me */
69                 SPOOLSS_MINOR_VERSION_ME                = 0x0000005a
70         } spoolss_MinorVersion;
71
72         const int PRINTER_STATUS_OK             = 0x00000000;
73
74         typedef [public] bitmap {
75                 PRINTER_STATUS_PAUSED           = 0x00000001,
76                 PRINTER_STATUS_ERROR            = 0x00000002,
77                 PRINTER_STATUS_PENDING_DELETION = 0x00000004,
78                 PRINTER_STATUS_PAPER_JAM        = 0x00000008,
79                 PRINTER_STATUS_PAPER_OUT        = 0x00000010,
80                 PRINTER_STATUS_MANUAL_FEED      = 0x00000020,
81                 PRINTER_STATUS_PAPER_PROBLEM    = 0x00000040,
82                 PRINTER_STATUS_OFFLINE          = 0x00000080,
83                 PRINTER_STATUS_IO_ACTIVE        = 0x00000100,
84                 PRINTER_STATUS_BUSY             = 0x00000200,
85                 PRINTER_STATUS_PRINTING         = 0x00000400,
86                 PRINTER_STATUS_OUTPUT_BIN_FULL  = 0x00000800,
87                 PRINTER_STATUS_NOT_AVAILABLE    = 0x00001000,
88                 PRINTER_STATUS_WAITING          = 0x00002000,
89                 PRINTER_STATUS_PROCESSING       = 0x00004000,
90                 PRINTER_STATUS_INITIALIZING     = 0x00008000,
91                 PRINTER_STATUS_WARMING_UP       = 0x00010000,
92                 PRINTER_STATUS_TONER_LOW        = 0x00020000,
93                 PRINTER_STATUS_NO_TONER         = 0x00040000,
94                 PRINTER_STATUS_PAGE_PUNT        = 0x00080000,
95                 PRINTER_STATUS_USER_INTERVENTION= 0x00100000,
96                 PRINTER_STATUS_OUT_OF_MEMORY    = 0x00200000,
97                 PRINTER_STATUS_DOOR_OPEN        = 0x00400000,
98                 PRINTER_STATUS_SERVER_UNKNOWN   = 0x00800000,
99                 PRINTER_STATUS_POWER_SAVE       = 0x01000000
100         } spoolss_PrinterStatus;
101
102         /* JOB status codes. */
103
104         const int JOB_STATUS_QUEUED = 0x0000;
105
106         typedef [bitmap32bit] bitmap {
107                 JOB_STATUS_PAUSED               = 0x00000001,
108                 JOB_STATUS_ERROR                = 0x00000002,
109                 JOB_STATUS_DELETING             = 0x00000004,
110                 JOB_STATUS_SPOOLING             = 0x00000008,
111                 JOB_STATUS_PRINTING             = 0x00000010,
112                 JOB_STATUS_OFFLINE              = 0x00000020,
113                 JOB_STATUS_PAPEROUT             = 0x00000040,
114                 JOB_STATUS_PRINTED              = 0x00000080,
115                 JOB_STATUS_DELETED              = 0x00000100,
116                 JOB_STATUS_BLOCKED_DEVQ         = 0x00000200,
117                 JOB_STATUS_USER_INTERVENTION    = 0x00000400,
118                 JOB_STATUS_RESTART              = 0x00000800,
119                 JOB_STATUS_COMPLETE             = 0x00001000
120         } spoolss_JobStatus;
121
122         typedef [public,gensize] struct {
123                 [relative] nstring *printername;
124                 [relative] nstring *servername;
125                 uint32 cjobs;
126                 uint32 total_jobs;
127                 uint32 total_bytes;
128                 spoolss_Time time;
129                 uint32 global_counter;
130                 uint32 total_pages;
131                 uint32 version;
132                 uint32 free_build;
133                 uint32 spooling;
134                 uint32 max_spooling;
135                 uint32 session_counter;
136                 uint32 num_error_out_of_paper;
137                 uint32 num_error_not_ready;
138                 spoolss_JobStatus job_error;
139                 uint32 number_of_processors;
140                 spoolss_ProcessorType processor_type;
141                 uint32 high_part_total_bytes;
142                 uint32 change_id;
143                 WERROR last_error;
144                 spoolss_PrinterStatus status;
145                 uint32 enumerate_network_printers;
146                 uint32 c_setprinter;
147                 spoolss_ProcessorArchitecture processor_architecture;
148                 uint16 processor_level;
149                 uint32 ref_ic;
150                 uint32 reserved2;
151                 uint32 reserved3;
152         } spoolss_PrinterInfo0;
153
154         typedef [bitmap32bit] bitmap {
155                 DEVMODE_ORIENTATION             = 0x00000001,
156                 DEVMODE_PAPERSIZE               = 0x00000002,
157                 DEVMODE_PAPERLENGTH             = 0x00000004,
158                 DEVMODE_PAPERWIDTH              = 0x00000008,
159                 DEVMODE_SCALE                   = 0x00000010,
160                 DEVMODE_POSITION                = 0x00000020,
161                 DEVMODE_NUP                     = 0x00000040,
162                 DEVMODE_COPIES                  = 0x00000100,
163                 DEVMODE_DEFAULTSOURCE           = 0x00000200,
164                 DEVMODE_PRINTQUALITY            = 0x00000400,
165                 DEVMODE_COLOR                   = 0x00000800,
166                 DEVMODE_DUPLEX                  = 0x00001000,
167                 DEVMODE_YRESOLUTION             = 0x00002000,
168                 DEVMODE_TTOPTION                = 0x00004000,
169                 DEVMODE_COLLATE                 = 0x00008000,
170                 DEVMODE_FORMNAME                = 0x00010000,
171                 DEVMODE_LOGPIXELS               = 0x00020000,
172                 DEVMODE_BITSPERPEL              = 0x00040000,
173                 DEVMODE_PELSWIDTH               = 0x00080000,
174                 DEVMODE_PELSHEIGHT              = 0x00100000,
175                 DEVMODE_DISPLAYFLAGS            = 0x00200000,
176                 DEVMODE_DISPLAYFREQUENCY        = 0x00400000,
177                 DEVMODE_ICMMETHOD               = 0x00800000,
178                 DEVMODE_ICMINTENT               = 0x01000000,
179                 DEVMODE_MEDIATYPE               = 0x02000000,
180                 DEVMODE_DITHERTYPE              = 0x04000000,
181                 DEVMODE_PANNINGWIDTH            = 0x08000000,
182                 DEVMODE_PANNINGHEIGHT           = 0x10000000
183         } spoolss_DeviceModeFields;
184
185         typedef [public,gensize] struct {
186                 [charset(UTF16)] uint16 devicename[32];
187                 uint16 specversion;
188                 uint16 driverversion;
189                 uint16 size;
190                 [value(r->driverextra_data.length)] uint16 __driverextra_length;
191                 spoolss_DeviceModeFields fields;
192                 uint16 orientation;
193                 uint16 papersize;
194                 uint16 paperlength;
195                 uint16 paperwidth;
196                 uint16 scale;
197                 uint16 copies;
198                 uint16 defaultsource;
199                 uint16 printquality;
200                 uint16 color;
201                 uint16 duplex;
202                 uint16 yresolution;
203                 uint16 ttoption;
204                 uint16 collate;
205                 [charset(UTF16)] uint16 formname[32];
206                 uint16 logpixels;
207                 uint32 bitsperpel;
208                 uint32 pelswidth;
209                 uint32 pelsheight;
210                 uint32 displayflags;
211                 uint32 displayfrequency;
212                 uint32 icmmethod;
213                 uint32 icmintent;
214                 uint32 mediatype;
215                 uint32 dithertype;
216                 uint32 reserved1;
217                 uint32 reserved2;
218                 uint32 panningwidth;
219                 uint32 panningheight;
220                 [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
221         } spoolss_DeviceMode;
222
223         typedef [public] bitmap {
224                 PRINTER_ENUM_DEFAULT     = 0x00000001,
225                 PRINTER_ENUM_LOCAL       = 0x00000002,
226                 PRINTER_ENUM_CONNECTIONS = 0x00000004,
227                 PRINTER_ENUM_FAVORITE    = 0x00000004,
228                 PRINTER_ENUM_NAME        = 0x00000008,
229                 PRINTER_ENUM_REMOTE      = 0x00000010,
230                 PRINTER_ENUM_SHARED      = 0x00000020,
231                 PRINTER_ENUM_NETWORK     = 0x00000040,
232                 PRINTER_ENUM_EXPAND      = 0x00004000,
233                 PRINTER_ENUM_CONTAINER   = 0x00008000,
234                 PRINTER_ENUM_ICON1       = 0x00010000,
235                 PRINTER_ENUM_ICON2       = 0x00020000,
236                 PRINTER_ENUM_ICON3       = 0x00040000,
237                 PRINTER_ENUM_ICON4       = 0x00080000,
238                 PRINTER_ENUM_ICON5       = 0x00100000,
239                 PRINTER_ENUM_ICON6       = 0x00200000,
240                 PRINTER_ENUM_ICON7       = 0x00400000,
241                 PRINTER_ENUM_ICON8       = 0x00800000,
242                 PRINTER_ENUM_HIDE        = 0x01000000
243         } spoolss_EnumPrinterFlags;
244
245         const int PRINTER_ENUM_ICONMASK = (PRINTER_ENUM_ICON1 |
246                                            PRINTER_ENUM_ICON2 |
247                                            PRINTER_ENUM_ICON3 |
248                                            PRINTER_ENUM_ICON4 |
249                                            PRINTER_ENUM_ICON5 |
250                                            PRINTER_ENUM_ICON6 |
251                                            PRINTER_ENUM_ICON7 |
252                                            PRINTER_ENUM_ICON8); /* 0x00ff0000 */
253
254         typedef [public,gensize] struct {
255                 spoolss_EnumPrinterFlags flags;
256                 [relative] nstring *description;
257                 [relative] nstring *name;
258                 [relative] nstring *comment;
259         } spoolss_PrinterInfo1;
260
261         typedef [public] bitmap {
262                 PRINTER_ATTRIBUTE_QUEUED                = 0x00000001,
263                 PRINTER_ATTRIBUTE_DIRECT                = 0x00000002,
264                 PRINTER_ATTRIBUTE_DEFAULT               = 0x00000004,
265                 PRINTER_ATTRIBUTE_SHARED                = 0x00000008,
266                 PRINTER_ATTRIBUTE_NETWORK               = 0x00000010,
267                 PRINTER_ATTRIBUTE_HIDDEN                = 0x00000020,
268                 PRINTER_ATTRIBUTE_LOCAL                 = 0x00000040,
269                 PRINTER_ATTRIBUTE_ENABLE_DEVQ           = 0x00000080,
270                 PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS       = 0x00000100,
271                 PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST     = 0x00000200,
272                 PRINTER_ATTRIBUTE_WORK_OFFLINE          = 0x00000400,
273                 PRINTER_ATTRIBUTE_ENABLE_BIDI           = 0x00000800,
274                 PRINTER_ATTRIBUTE_RAW_ONLY              = 0x00001000,
275                 PRINTER_ATTRIBUTE_PUBLISHED             = 0x00002000,
276                 PRINTER_ATTRIBUTE_FAX                   = 0x00004000,
277                 PRINTER_ATTRIBUTE_TS                    = 0x00008000
278         } spoolss_PrinterAttributes;
279
280         typedef [public,gensize,nopush] struct {
281                 [relative] nstring *servername;
282                 [relative] nstring *printername;
283                 [relative] nstring *sharename;
284                 [relative] nstring *portname;
285                 [relative] nstring *drivername;
286                 [relative] nstring *comment;
287                 [relative] nstring *location;
288                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
289                 [relative] nstring *sepfile;
290                 [relative] nstring *printprocessor;
291                 [relative] nstring *datatype;
292                 [relative] nstring *parameters;
293                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
294                 spoolss_PrinterAttributes attributes;
295                 [range(0,99)] uint32 priority;
296                 uint32 defaultpriority;
297                 uint32 starttime;
298                 uint32 untiltime;
299                 spoolss_PrinterStatus status;
300                 uint32 cjobs;
301                 uint32 averageppm;
302         } spoolss_PrinterInfo2;
303
304         typedef [public,gensize] struct {
305                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
306         } spoolss_PrinterInfo3;
307
308         typedef [public,gensize] struct {
309                 [relative] nstring *printername;
310                 [relative] nstring *servername;
311                 spoolss_PrinterAttributes attributes;
312         } spoolss_PrinterInfo4;
313
314         typedef [public,gensize] struct {
315                 [relative] nstring *printername;
316                 [relative] nstring *portname;
317                 spoolss_PrinterAttributes attributes;
318                 uint32 device_not_selected_timeout;
319                 uint32 transmission_retry_timeout;
320         } spoolss_PrinterInfo5;
321
322         typedef [public,gensize] struct {
323                 spoolss_PrinterStatus status;
324         } spoolss_PrinterInfo6;
325
326         typedef bitmap {
327                 DSPRINT_PUBLISH         = 0x00000001,
328                 DSPRINT_UPDATE          = 0x00000002,
329                 DSPRINT_UNPUBLISH       = 0x00000004,
330                 DSPRINT_REPUBLISH       = 0x00000008,
331                 DSPRINT_PENDING         = 0x80000000
332         } spoolss_DsPrintAction;
333
334         typedef [public,gensize] struct {
335                 [relative] nstring *guid; /* text form of printer guid */
336                 spoolss_DsPrintAction action;
337         } spoolss_PrinterInfo7;
338
339         typedef struct {
340                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
341         } spoolss_DeviceModeInfo;
342
343         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
344                 [case(0)] spoolss_PrinterInfo0 info0;
345                 [case(1)] spoolss_PrinterInfo1 info1;
346                 [case(2)] spoolss_PrinterInfo2 info2;
347                 [case(3)] spoolss_PrinterInfo3 info3;
348                 [case(4)] spoolss_PrinterInfo4 info4;
349                 [case(5)] spoolss_PrinterInfo5 info5;
350                 [case(6)] spoolss_PrinterInfo6 info6;
351                 [case(7)] spoolss_PrinterInfo7 info7;
352                 [case(8)] spoolss_DeviceModeInfo info8;
353                 [case(9)] spoolss_DeviceModeInfo info9;
354                 [default];
355         } spoolss_PrinterInfo;
356
357         /******************/
358         /* Function: 0x00 */
359         /* we are using this as internal parsing code */
360         [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
361                 [in] spoolss_EnumPrinterFlags flags,
362                 [in,unique] [string,charset(UTF16)] uint16 *server,
363                 [in] uint32 level,
364                 [in,unique] DATA_BLOB *buffer,
365                 [in] uint32 offered,
366                 [out,unique] DATA_BLOB *info,
367                 [out,ref] uint32 *needed,
368                 [out,ref] uint32 *count
369         );
370         [public,noopnum,noprint] void __spoolss_EnumPrinters(
371                 [in] uint32 level,
372                 [in] uint32 count,
373                 [out,switch_is(level)] spoolss_PrinterInfo info[count]
374         );
375         [nopull,nopush] WERROR spoolss_EnumPrinters(
376                 [in] spoolss_EnumPrinterFlags flags,
377                 [in,unique] [string,charset(UTF16)] uint16 *server,
378                 [in] uint32 level,
379                 [in,unique] DATA_BLOB *buffer,
380                 [in] uint32 offered,
381                 /* what we have here is a subcontext containing an array of no discriminant unions
382                  * and the array has no size in front
383                  */
384                 [out,ref] uint32 *count,
385                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrinterInfo **info,
386                 [out,ref] uint32 *needed
387         );
388
389         /******************/
390         /* Function: 0x01 */
391         typedef struct {
392                 [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->iconv_convenience, ndr->flags))] uint32 _ndr_size;
393                 [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
394         } spoolss_DevmodeContainer;
395
396         [public] WERROR spoolss_OpenPrinter(
397                 [in,unique] [string,charset(UTF16)] uint16 *printername,
398                 [in,unique] [string,charset(UTF16)] uint16 *datatype,
399                 [in] spoolss_DevmodeContainer devmode_ctr,
400                 [in] spoolss_AccessRights access_mask,
401                 [out,ref] policy_handle *handle
402         );
403
404         /******************/
405         /* Function: 0x02 */
406
407         typedef [public,gensize] struct {
408                 uint32 job_id;
409                 [relative] nstring *printer_name;
410                 [relative] nstring *server_name;
411                 [relative] nstring *user_name;
412                 [relative] nstring *document_name;
413                 [relative] nstring *data_type;
414                 [relative] nstring *text_status;
415                 spoolss_JobStatus status;
416                 [range(0,99)] uint32 priority;
417                 uint32 position;
418                 uint32 total_pages;
419                 uint32 pages_printed;
420                 spoolss_Time submitted;
421         } spoolss_JobInfo1;
422
423         typedef [public,gensize] struct {
424                 uint32 job_id;
425                 [relative] nstring *printer_name;
426                 [relative] nstring *server_name;
427                 [relative] nstring *user_name;
428                 [relative] nstring *document_name;
429                 [relative] nstring *notify_name;
430                 [relative] nstring *data_type;
431                 [relative] nstring *print_processor;
432                 [relative] nstring *parameters;
433                 [relative] nstring *driver_name;
434                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
435                 [relative] nstring *text_status;
436                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
437                 spoolss_JobStatus status;
438                 [range(0,99)] uint32 priority;
439                 uint32 position;
440                 uint32 start_time;
441                 uint32 until_time;
442                 uint32 total_pages;
443                 uint32 size;
444                 spoolss_Time submitted;
445                 uint32 time;
446                 uint32 pages_printed;
447         } spoolss_JobInfo2;
448
449         typedef [public,gensize] struct {
450                 uint32 job_id;
451                 uint32 next_job_id;
452                 uint32 reserved;
453         } spoolss_JobInfo3;
454
455         typedef [public,gensize] struct {
456                 uint32 job_id;
457                 [relative] nstring *printer_name;
458                 [relative] nstring *server_name;
459                 [relative] nstring *user_name;
460                 [relative] nstring *document_name;
461                 [relative] nstring *notify_name;
462                 [relative] nstring *data_type;
463                 [relative] nstring *print_processor;
464                 [relative] nstring *parameters;
465                 [relative] nstring *driver_name;
466                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
467                 [relative] nstring *text_status;
468                 [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
469                 spoolss_JobStatus status;
470                 [range(0,99)] uint32 priority;
471                 uint32 position;
472                 uint32 start_time;
473                 uint32 until_time;
474                 uint32 total_pages;
475                 uint32 size;
476                 spoolss_Time submitted;
477                 uint32 time;
478                 uint32 pages_printed;
479                 uint32 size_high;
480         } spoolss_JobInfo4;
481
482         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
483                 [case(1)] spoolss_JobInfo1 info1;
484                 [case(2)] spoolss_JobInfo2 info2;
485                 [case(3)] spoolss_JobInfo3 info3;
486                 [case(4)] spoolss_JobInfo4 info4;
487                 [default];
488         } spoolss_JobInfo;
489
490         typedef struct {
491                 uint32 job_id;
492                 [string,charset(UTF16)] uint16 *printer_name;
493                 [string,charset(UTF16)] uint16 *server_name;
494                 [string,charset(UTF16)] uint16 *user_name;
495                 [string,charset(UTF16)] uint16 *document_name;
496                 [string,charset(UTF16)] uint16 *data_type;
497                 [string,charset(UTF16)] uint16 *text_status;
498                 spoolss_JobStatus status;
499                 [range(0,99)] uint32 priority;
500                 uint32 position;
501                 uint32 total_pages;
502                 uint32 pages_printed;
503                 spoolss_Time submitted;
504         } spoolss_SetJobInfo1;
505
506         typedef struct {
507                 uint32 job_id;
508                 [string,charset(UTF16)] uint16 *printer_name;
509                 [string,charset(UTF16)] uint16 *server_name;
510                 [string,charset(UTF16)] uint16 *user_name;
511                 [string,charset(UTF16)] uint16 *document_name;
512                 [string,charset(UTF16)] uint16 *notify_name;
513                 [string,charset(UTF16)] uint16 *data_type;
514                 [string,charset(UTF16)] uint16 *print_processor;
515                 [string,charset(UTF16)] uint16 *parameters;
516                 [string,charset(UTF16)] uint16 *driver_name;
517                 uint32 _devmode_ptr; /* pointer to truncated devicemode */
518                 [string,charset(UTF16)] uint16 *text_status;
519                 uint32 _secdesc_ptr;
520                 spoolss_JobStatus status;
521                 [range(0,99)] uint32 priority;
522                 uint32 position;
523                 uint32 start_time;
524                 uint32 until_time;
525                 uint32 total_pages;
526                 uint32 size;
527                 spoolss_Time submitted;
528                 uint32 time;
529                 uint32 pages_printed;
530         } spoolss_SetJobInfo2;
531
532         typedef struct {
533                 uint32 job_id;
534                 [string,charset(UTF16)] uint16 *printer_name;
535                 [string,charset(UTF16)] uint16 *server_name;
536                 [string,charset(UTF16)] uint16 *user_name;
537                 [string,charset(UTF16)] uint16 *document_name;
538                 [string,charset(UTF16)] uint16 *notify_name;
539                 [string,charset(UTF16)] uint16 *data_type;
540                 [string,charset(UTF16)] uint16 *print_processor;
541                 [string,charset(UTF16)] uint16 *parameters;
542                 [string,charset(UTF16)] uint16 *driver_name;
543                 uint32 _devmode_ptr; /* pointer to truncated devicemode */
544                 [string,charset(UTF16)] uint16 *text_status;
545                 uint32 _secdesc_ptr;
546                 spoolss_JobStatus status;
547                 [range(0,99)] uint32 priority;
548                 uint32 position;
549                 uint32 start_time;
550                 uint32 until_time;
551                 uint32 total_pages;
552                 uint32 size;
553                 spoolss_Time submitted;
554                 uint32 time;
555                 uint32 pages_printed;
556                 uint32 size_high;
557         } spoolss_SetJobInfo4;
558
559         typedef [public] union {
560                 [case(1)] spoolss_SetJobInfo1 *info1;
561                 [case(2)] spoolss_SetJobInfo2 *info2;
562                 [case(3)] spoolss_JobInfo3    *info3;
563                 [case(4)] spoolss_SetJobInfo4 *info4;
564                 [default];
565         } spoolss_SetJobInfo;
566
567         typedef struct {
568                 uint32 level;
569                 [switch_is(level)] spoolss_SetJobInfo info;
570         } spoolss_JobInfoContainer;
571
572         typedef [v1_enum] enum {
573                 SPOOLSS_JOB_CONTROL_PAUSE               = 1,
574                 SPOOLSS_JOB_CONTROL_RESUME              = 2,
575                 SPOOLSS_JOB_CONTROL_CANCEL              = 3,
576                 SPOOLSS_JOB_CONTROL_RESTART             = 4,
577                 SPOOLSS_JOB_CONTROL_DELETE              = 5,
578                 SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER     = 6,
579                 SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED   = 7,
580                 SPOOLSS_JOB_CONTROL_RETAIN              = 8,
581                 SPOOLSS_JOB_CONTROL_RELEASE             = 9
582         } spoolss_JobControl;
583
584         WERROR spoolss_SetJob(
585                 [in,ref] policy_handle *handle,
586                 [in] uint32 job_id,
587                 [in,unique] spoolss_JobInfoContainer *ctr,
588                 [in] spoolss_JobControl command
589         );
590
591         /******************/
592         /* Function: 0x03 */
593         WERROR spoolss_GetJob(
594                 [in,ref] policy_handle *handle,
595                 [in]     uint32 job_id,
596                 [in]     uint32 level,
597                 [in,unique] DATA_BLOB *buffer,
598                 [in]     uint32 offered,
599                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
600                 [out,ref] uint32 *needed
601         );
602
603         /******************/
604         /* Function: 0x04 */
605         [public,noopnum,noprint] WERROR _spoolss_EnumJobs(
606                 [in,ref] policy_handle *handle,
607                 [in]     uint32 firstjob,
608                 [in]     uint32 numjobs,
609                 [in]     uint32 level,
610                 [in,unique] DATA_BLOB *buffer,
611                 [in]     uint32 offered,
612                 [out,unique] DATA_BLOB *info,
613                 [out,ref] uint32 *needed,
614                 [out,ref] uint32 *count
615         );
616         [public,noopnum,noprint] void __spoolss_EnumJobs(
617                 [in] uint32 level,
618                 [in] uint32 count,
619                 [out,switch_is(level)] spoolss_JobInfo info[count]
620         );
621         [nopull,nopush] WERROR spoolss_EnumJobs(
622                 [in,ref] policy_handle *handle,
623                 [in]     uint32 firstjob,
624                 [in]     uint32 numjobs,
625                 [in]     uint32 level,
626                 [in,unique] DATA_BLOB *buffer,
627                 [in]     uint32 offered,
628                 [out,ref] uint32 *count,
629                 [out,ref,switch_is(level),size_is(,*count)] spoolss_JobInfo **info,
630                 [out,ref] uint32 *needed
631         );
632
633         /******************/
634         /* Function: 0x05 */
635         [todo] WERROR spoolss_AddPrinter(
636                 /* This function is not implemented in Samba 3 as no
637                    clients have been observed using it. */
638         );
639
640         /******************/
641         /* Function: 0x06 */
642         WERROR spoolss_DeletePrinter(
643                 [in] policy_handle *handle
644         );
645
646         /******************/
647         /* Function: 0x07 */
648         typedef [v1_enum] enum {
649                 SPOOLSS_PRINTER_CONTROL_UNPAUSE    = 0,
650                 SPOOLSS_PRINTER_CONTROL_PAUSE      = 1,
651                 SPOOLSS_PRINTER_CONTROL_RESUME     = 2,
652                 SPOOLSS_PRINTER_CONTROL_PURGE      = 3,
653                 SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
654         } spoolss_PrinterControl;
655
656         typedef struct {
657                 [string,charset(UTF16)] uint16 *servername;
658                 [string,charset(UTF16)] uint16 *printername;
659                 uint32 cjobs;
660                 uint32 total_jobs;
661                 uint32 total_bytes;
662                 spoolss_Time time;
663                 uint32 global_counter;
664                 uint32 total_pages;
665                 uint32 version;
666                 uint32 free_build;
667                 uint32 spooling;
668                 uint32 max_spooling;
669                 uint32 session_counter;
670                 uint32 num_error_out_of_paper;
671                 uint32 num_error_not_ready;
672                 uint32 job_error;
673                 uint32 number_of_processors;
674                 spoolss_ProcessorType processor_type;
675                 uint32 high_part_total_bytes;
676                 uint32 change_id;
677                 WERROR last_error;
678                 uint32 status;
679                 uint32 enumerate_network_printers;
680                 uint32 c_setprinter;
681                 spoolss_ProcessorArchitecture processor_architecture;
682                 uint16 processor_level;
683                 uint32 ref_ic;
684                 uint32 reserved2;
685                 uint32 reserved3;
686         } spoolss_SetPrinterInfo0;
687
688         typedef struct {
689                 spoolss_EnumPrinterFlags flags;
690                 [string,charset(UTF16)] uint16 *description;
691                 [string,charset(UTF16)] uint16 *name;
692                 [string,charset(UTF16)] uint16 *comment;
693         } spoolss_SetPrinterInfo1;
694
695         typedef struct {
696                 [string,charset(UTF16)] uint16 *servername;
697                 [string,charset(UTF16)] uint16 *printername;
698                 [string,charset(UTF16)] uint16 *sharename;
699                 [string,charset(UTF16)] uint16 *portname;
700                 [string,charset(UTF16)] uint16 *drivername;
701                 [string,charset(UTF16)] uint16 *comment;
702                 [string,charset(UTF16)] uint16 *location;
703                 uint32 devmode_ptr;
704                 [string,charset(UTF16)] uint16 *sepfile;
705                 [string,charset(UTF16)] uint16 *printprocessor;
706                 [string,charset(UTF16)] uint16 *datatype;
707                 [string,charset(UTF16)] uint16 *parameters;
708                 uint32 secdesc_ptr;
709                 spoolss_PrinterAttributes attributes;
710                 [range(0,99)] uint32 priority;
711                 uint32 defaultpriority;
712                 uint32 starttime;
713                 uint32 untiltime;
714                 spoolss_PrinterStatus status;
715                 uint32 cjobs;
716                 uint32 averageppm;
717         } spoolss_SetPrinterInfo2;
718
719         typedef struct {
720                 uint32 sec_desc_ptr;
721         } spoolss_SetPrinterInfo3;
722
723         typedef struct {
724                 [string,charset(UTF16)] uint16 *printername;
725                 [string,charset(UTF16)] uint16 *servername;
726                 spoolss_PrinterAttributes attributes;
727         } spoolss_SetPrinterInfo4;
728
729         typedef struct {
730                 [string,charset(UTF16)] uint16 *printername;
731                 [string,charset(UTF16)] uint16 *portname;
732                 spoolss_PrinterAttributes attributes;
733                 uint32 device_not_selected_timeout;
734                 uint32 transmission_retry_timeout;
735         } spoolss_SetPrinterInfo5;
736
737         typedef struct {
738                 spoolss_PrinterStatus status;
739         } spoolss_SetPrinterInfo6;
740
741         typedef struct {
742                 [string,charset(UTF16)] uint16 *guid; /* text form of printer guid */
743                 spoolss_DsPrintAction action;
744         } spoolss_SetPrinterInfo7;
745
746         typedef struct {
747                 uint32 devmode_ptr;
748         } spoolss_SetPrinterInfo8;
749
750         typedef struct {
751                 uint32 devmode_ptr;
752         } spoolss_SetPrinterInfo9;
753
754         typedef [switch_type(uint32)] union {
755                 [case(0)] spoolss_SetPrinterInfo0 *info0;
756                 [case(1)] spoolss_SetPrinterInfo1 *info1;
757                 [case(2)] spoolss_SetPrinterInfo2 *info2;
758                 [case(3)] spoolss_SetPrinterInfo3 *info3;
759                 [case(4)] spoolss_SetPrinterInfo4 *info4;
760                 [case(5)] spoolss_SetPrinterInfo5 *info5;
761                 [case(6)] spoolss_SetPrinterInfo6 *info6;
762                 [case(7)] spoolss_SetPrinterInfo7 *info7;
763                 [case(8)] spoolss_SetPrinterInfo8 *info8;
764                 [case(9)] spoolss_SetPrinterInfo9 *info9;
765                 [default];
766         } spoolss_SetPrinterInfo;
767
768         typedef struct {
769                 uint32 level;
770                 [switch_is(level)] spoolss_SetPrinterInfo info;
771         } spoolss_SetPrinterInfoCtr;
772
773         WERROR spoolss_SetPrinter(
774                 [in,ref] policy_handle *handle,
775                 [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
776                 [in,ref] spoolss_DevmodeContainer *devmode_ctr,
777                 [in,ref] sec_desc_buf *secdesc_ctr,
778                 [in] spoolss_PrinterControl command
779         );
780
781         /******************/
782         /* Function: 0x08 */
783         [public] WERROR spoolss_GetPrinter(
784                 [in,ref] policy_handle *handle,
785                 [in]     uint32 level,
786                 [in,unique] DATA_BLOB *buffer,
787                 [in]     uint32 offered,
788                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
789                 [out,ref] uint32 *needed
790         );
791
792         /******************/
793         /* Function: 0x09 */
794
795         typedef [public] struct {
796                 [value((ndr_size_spoolss_StringArray(r, ndr->iconv_convenience, ndr->flags)-4)/2)] uint32 _ndr_size;
797                 /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string;
798         } spoolss_StringArray;
799
800         typedef struct {
801                 [string,charset(UTF16)] uint16 *driver_name;
802         } spoolss_AddDriverInfo1;
803
804         typedef [v1_enum,public] enum {
805                 SPOOLSS_DRIVER_VERSION_9X       = 0,
806                 SPOOLSS_DRIVER_VERSION_NT35     = 1,
807                 SPOOLSS_DRIVER_VERSION_NT4      = 2,
808                 SPOOLSS_DRIVER_VERSION_200X     = 3
809         } spoolss_DriverOSVersion;
810
811         typedef struct {
812                 spoolss_DriverOSVersion version;
813                 [string,charset(UTF16)] uint16 *driver_name;
814                 [string,charset(UTF16)] uint16 *architecture;
815                 [string,charset(UTF16)] uint16 *driver_path;
816                 [string,charset(UTF16)] uint16 *data_file;
817                 [string,charset(UTF16)] uint16 *config_file;
818         } spoolss_AddDriverInfo2;
819
820         typedef struct {
821                 spoolss_DriverOSVersion version;
822                 [string,charset(UTF16)] uint16 *driver_name;
823                 [string,charset(UTF16)] uint16 *architecture;
824                 [string,charset(UTF16)] uint16 *driver_path;
825                 [string,charset(UTF16)] uint16 *data_file;
826                 [string,charset(UTF16)] uint16 *config_file;
827                 [string,charset(UTF16)] uint16 *help_file;
828                 [string,charset(UTF16)] uint16 *monitor_name;
829                 [string,charset(UTF16)] uint16 *default_datatype;
830                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
831                 spoolss_StringArray *dependent_files;
832         } spoolss_AddDriverInfo3;
833
834         typedef struct {
835                 spoolss_DriverOSVersion version;
836                 [string,charset(UTF16)] uint16 *driver_name;
837                 [string,charset(UTF16)] uint16 *architecture;
838                 [string,charset(UTF16)] uint16 *driver_path;
839                 [string,charset(UTF16)] uint16 *data_file;
840                 [string,charset(UTF16)] uint16 *config_file;
841                 [string,charset(UTF16)] uint16 *help_file;
842                 [string,charset(UTF16)] uint16 *monitor_name;
843                 [string,charset(UTF16)] uint16 *default_datatype;
844                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
845                 spoolss_StringArray *dependent_files;
846                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
847                 spoolss_StringArray *previous_names;
848         } spoolss_AddDriverInfo4;
849
850         typedef [bitmap32bit] bitmap {
851                 PRINTER_DRIVER_PACKAGE_AWARE = 0x00000002
852         } spoolss_DriverAttributes;
853
854         typedef struct {
855                 spoolss_DriverOSVersion version;
856                 [string,charset(UTF16)] uint16 *driver_name;
857                 [string,charset(UTF16)] uint16 *architecture;
858                 [string,charset(UTF16)] uint16 *driver_path;
859                 [string,charset(UTF16)] uint16 *data_file;
860                 [string,charset(UTF16)] uint16 *config_file;
861                 spoolss_DriverAttributes driver_attributes;
862                 uint32 config_version;
863                 uint32 driver_version;
864         } spoolss_AddDriverInfo5;
865
866         typedef struct {
867                 spoolss_DriverOSVersion version;
868                 [string,charset(UTF16)] uint16 *driver_name;
869                 [string,charset(UTF16)] uint16 *architecture;
870                 [string,charset(UTF16)] uint16 *driver_path;
871                 [string,charset(UTF16)] uint16 *data_file;
872                 [string,charset(UTF16)] uint16 *config_file;
873                 [string,charset(UTF16)] uint16 *help_file;
874                 [string,charset(UTF16)] uint16 *monitor_name;
875                 [string,charset(UTF16)] uint16 *default_datatype;
876                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
877                 spoolss_StringArray *dependent_files;
878                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
879                 spoolss_StringArray *previous_names;
880                 NTTIME driver_date;
881                 hyper driver_version;
882                 [string,charset(UTF16)] uint16 *manufacturer_name;
883                 [string,charset(UTF16)] uint16 *manufacturer_url;
884                 [string,charset(UTF16)] uint16 *hardware_id;
885                 [string,charset(UTF16)] uint16 *provider;
886         } spoolss_AddDriverInfo6;
887
888         typedef struct {
889                 spoolss_DriverOSVersion version;
890                 [string,charset(UTF16)] uint16 *driver_name;
891                 [string,charset(UTF16)] uint16 *architecture;
892                 [string,charset(UTF16)] uint16 *driver_path;
893                 [string,charset(UTF16)] uint16 *data_file;
894                 [string,charset(UTF16)] uint16 *config_file;
895                 [string,charset(UTF16)] uint16 *help_file;
896                 [string,charset(UTF16)] uint16 *monitor_name;
897                 [string,charset(UTF16)] uint16 *default_datatype;
898                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
899                 spoolss_StringArray *dependent_files;
900                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
901                 spoolss_StringArray *previous_names;
902                 NTTIME driver_date;
903                 hyper driver_version;
904                 [string,charset(UTF16)] uint16 *manufacturer_name;
905                 [string,charset(UTF16)] uint16 *manufacturer_url;
906                 [string,charset(UTF16)] uint16 *hardware_id;
907                 [string,charset(UTF16)] uint16 *provider;
908                 [string,charset(UTF16)] uint16 *print_processor;
909                 [string,charset(UTF16)] uint16 *vendor_setup;
910                 [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles;
911                 spoolss_StringArray *color_profiles;
912                 [string,charset(UTF16)] uint16 *inf_path;
913                 uint32 printer_driver_attributes;
914                 [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies;
915                 spoolss_StringArray *core_driver_dependencies;
916                 NTTIME min_inbox_driver_ver_date;
917                 hyper min_inbox_driver_ver_version;
918         } spoolss_AddDriverInfo8;
919
920         typedef [switch_type(uint32)] union {
921                 [case(1)] spoolss_AddDriverInfo1 *info1;
922                 [case(2)] spoolss_AddDriverInfo2 *info2;
923                 [case(3)] spoolss_AddDriverInfo3 *info3;
924                 [case(4)] spoolss_AddDriverInfo4 *info4;
925                 [case(6)] spoolss_AddDriverInfo6 *info6;
926                 [case(8)] spoolss_AddDriverInfo8 *info8;
927         } spoolss_AddDriverInfo;
928
929         typedef struct {
930                 uint32 level;
931                 [switch_is(level)] spoolss_AddDriverInfo info;
932         } spoolss_AddDriverInfoCtr;
933
934         WERROR spoolss_AddPrinterDriver(
935                 [in,unique] [string,charset(UTF16)] uint16 *servername,
936                 [in,ref] spoolss_AddDriverInfoCtr *info_ctr
937         );
938
939         typedef [public,gensize] struct {
940                 [relative] nstring *driver_name;
941         } spoolss_DriverInfo1;
942
943         typedef [public,gensize] struct {
944                 spoolss_DriverOSVersion version;
945                 [relative] nstring *driver_name;
946                 [relative] nstring *architecture;
947                 [relative] nstring *driver_path;
948                 [relative] nstring *data_file;
949                 [relative] nstring *config_file;
950         } spoolss_DriverInfo2;
951
952         typedef [public,gensize] struct {
953                 spoolss_DriverOSVersion version;
954                 [relative] nstring *driver_name;
955                 [relative] nstring *architecture;
956                 [relative] nstring *driver_path;
957                 [relative] nstring *data_file;
958                 [relative] nstring *config_file;
959                 [relative] nstring *help_file;
960                 [relative] nstring_array *dependent_files;
961                 [relative] nstring *monitor_name;
962                 [relative] nstring *default_datatype;
963         } spoolss_DriverInfo3;
964
965         typedef [public,gensize] struct {
966                 spoolss_DriverOSVersion version;
967                 [relative] nstring *driver_name;
968                 [relative] nstring *architecture;
969                 [relative] nstring *driver_path;
970                 [relative] nstring *data_file;
971                 [relative] nstring *config_file;
972                 [relative] nstring *help_file;
973                 [relative] nstring_array *dependent_files;
974                 [relative] nstring *monitor_name;
975                 [relative] nstring *default_datatype;
976                 [relative] nstring_array *previous_names;
977         } spoolss_DriverInfo4;
978
979         typedef [public,gensize] struct {
980                 spoolss_DriverOSVersion version;
981                 [relative] nstring *driver_name;
982                 [relative] nstring *architecture;
983                 [relative] nstring *driver_path;
984                 [relative] nstring *data_file;
985                 [relative] nstring *config_file;
986                 spoolss_DriverAttributes driver_attributes;
987                 uint32 config_version;
988                 uint32 driver_version;
989         } spoolss_DriverInfo5;
990
991         typedef [public,gensize] struct {
992                 spoolss_DriverOSVersion version;
993                 [relative] nstring *driver_name;
994                 [relative] nstring *architecture;
995                 [relative] nstring *driver_path;
996                 [relative] nstring *data_file;
997                 [relative] nstring *config_file;
998                 [relative] nstring *help_file;
999                 [relative] nstring_array *dependent_files;
1000                 [relative] nstring *monitor_name;
1001                 [relative] nstring *default_datatype;
1002                 [relative] nstring_array *previous_names;
1003                 NTTIME driver_date;
1004                 hyper driver_version;
1005                 [relative] nstring *manufacturer_name;
1006                 [relative] nstring *manufacturer_url;
1007                 [relative] nstring *hardware_id;
1008                 [relative] nstring *provider;
1009         } spoolss_DriverInfo6;
1010
1011         typedef [public,gensize] struct {
1012                 spoolss_DriverOSVersion version;
1013                 [relative] nstring *driver_name;
1014                 [relative] nstring *architecture;
1015                 [relative] nstring *driver_path;
1016                 [relative] nstring *data_file;
1017                 [relative] nstring *config_file;
1018                 [relative] nstring *help_file;
1019                 [relative] nstring *monitor_name;
1020                 [relative] nstring *default_datatype;
1021                 [relative] nstring_array *dependent_files;
1022                 [relative] nstring_array *previous_names;
1023                 NTTIME driver_date;
1024                 hyper driver_version;
1025                 [relative] nstring *manufacturer_name;
1026                 [relative] nstring *manufacturer_url;
1027                 [relative] nstring *hardware_id;
1028                 [relative] nstring *provider;
1029                 [relative] nstring *print_processor;
1030                 [relative] nstring *vendor_setup;
1031                 [relative] nstring_array *color_profiles;
1032                 [relative] nstring *inf_path;
1033                 uint32 printer_driver_attributes;
1034                 [relative] nstring_array *core_driver_dependencies;
1035                 NTTIME min_inbox_driver_ver_date;
1036                 hyper min_inbox_driver_ver_version;
1037         } spoolss_DriverInfo8;
1038
1039         typedef [v1_enum] enum {
1040                 SPOOLSS_DRIVER_FILE_TYPE_RENDERING      = 0x00000000,
1041                 SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION  = 0x00000001,
1042                 SPOOLSS_DRIVER_FILE_TYPE_DATA           = 0x00000002,
1043                 SPOOLSS_DRIVER_FILE_TYPE_HELP           = 0x00000003,
1044                 SPOOLSS_DRIVER_FILE_TYPE_OTHER          = 0x00000004
1045         } spoolss_DriverFileType;
1046
1047         typedef [public] struct {
1048                 [relative] nstring *file_name;
1049                 spoolss_DriverFileType file_type;
1050                 uint32 file_version;
1051         } spoolss_DriverFileInfo;
1052
1053         typedef [public,gensize,nopush,nopull] struct {
1054                 spoolss_DriverOSVersion version;
1055                 [relative] nstring *driver_name;
1056                 [relative] nstring *architecture;
1057                 [relative] [size_is(file_count)] spoolss_DriverFileInfo *file_info;
1058                 uint32 file_count;
1059                 [relative] nstring *monitor_name;
1060                 [relative] nstring *default_datatype;
1061                 [relative] nstring_array *previous_names;
1062                 NTTIME driver_date;
1063                 hyper driver_version;
1064                 [relative] nstring *manufacturer_name;
1065                 [relative] nstring *manufacturer_url;
1066                 [relative] nstring *hardware_id;
1067                 [relative] nstring *provider;
1068         } spoolss_DriverInfo101;
1069
1070         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
1071                 [case(1)] spoolss_DriverInfo1 info1;
1072                 [case(2)] spoolss_DriverInfo2 info2;
1073                 [case(3)] spoolss_DriverInfo3 info3;
1074                 [case(4)] spoolss_DriverInfo4 info4;
1075                 [case(5)] spoolss_DriverInfo5 info5;
1076                 [case(6)] spoolss_DriverInfo6 info6;
1077                 [case(8)] spoolss_DriverInfo8 info8;
1078                 [case(101)] spoolss_DriverInfo101 info101;
1079                 [default];
1080         } spoolss_DriverInfo;
1081
1082         /******************/
1083         /* Function: 0x0a */
1084         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
1085                 [in,unique] [string,charset(UTF16)] uint16 *server,
1086                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1087                 [in] uint32 level,
1088                 [in,unique] DATA_BLOB *buffer,
1089                 [in] uint32 offered,
1090                 [out,unique] DATA_BLOB *info,
1091                 [out,ref] uint32 *needed,
1092                 [out,ref] uint32 *count
1093         );
1094         [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
1095                 [in] uint32 level,
1096                 [in] uint32 count,
1097                 [out,switch_is(level)] spoolss_DriverInfo info[count]
1098         );
1099         [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
1100                 [in,unique] [string,charset(UTF16)] uint16 *server,
1101                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1102                 [in] uint32 level,
1103                 [in,unique] DATA_BLOB *buffer,
1104                 [in] uint32 offered,
1105                 [out,ref] uint32 *count,
1106                 [out,ref,switch_is(level),size_is(,*count)] spoolss_DriverInfo **info,
1107                 [out,ref] uint32 *needed
1108         );
1109
1110         /******************/
1111         /* Function: 0x0b */
1112         [todo] WERROR spoolss_GetPrinterDriver(
1113         );
1114
1115         /******************/
1116         /* Function: 0x0c */
1117         typedef [public,gensize] struct {
1118                 nstring directory_name;
1119         } spoolss_DriverDirectoryInfo1;
1120
1121         /* NOTE: it's seems that w2k3 completly ignores the level
1122                  in its server code
1123          */
1124         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
1125                 [case(1)] spoolss_DriverDirectoryInfo1 info1;
1126                 [default] spoolss_DriverDirectoryInfo1 info1;
1127         } spoolss_DriverDirectoryInfo;
1128
1129         [public] WERROR spoolss_GetPrinterDriverDirectory(
1130                 [in,unique] [string,charset(UTF16)] uint16 *server,
1131                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1132                 [in] uint32 level,
1133                 [in,unique] DATA_BLOB *buffer,
1134                 [in] uint32 offered,
1135                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
1136                 [out,ref] uint32 *needed
1137         );
1138
1139         /******************/
1140         /* Function: 0x0d */
1141         WERROR spoolss_DeletePrinterDriver(
1142                 [in,unique] [string,charset(UTF16)] uint16 *server,
1143                 [in] [string,charset(UTF16)] uint16 architecture[],
1144                 [in] [string,charset(UTF16)] uint16 driver[]
1145         );
1146
1147         /******************/
1148         /* Function: 0x0e */
1149         WERROR spoolss_AddPrintProcessor(
1150                 [in,unique] [string,charset(UTF16)] uint16 *server,
1151                 [in] [string,charset(UTF16)] uint16 architecture[],
1152                 [in] [string,charset(UTF16)] uint16 path_name[],
1153                 [in] [string,charset(UTF16)] uint16 print_processor_name[]
1154         );
1155
1156         /******************/
1157         /* Function: 0x0f */
1158         typedef [public,gensize] struct {
1159                 [relative] nstring *print_processor_name;
1160         } spoolss_PrintProcessorInfo1;
1161
1162         typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
1163                 [case(1)] spoolss_PrintProcessorInfo1 info1;
1164                 [default];
1165         } spoolss_PrintProcessorInfo;
1166
1167         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
1168                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1169                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1170                 [in] uint32 level,
1171                 [in,unique] DATA_BLOB *buffer,
1172                 [in] uint32 offered,
1173                 [out,unique] DATA_BLOB *info,
1174                 [out,ref] uint32 *needed,
1175                 [out,ref] uint32 *count
1176         );
1177         [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
1178                 [in] uint32 level,
1179                 [in] uint32 count,
1180                 [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
1181         );
1182         [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
1183                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1184                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1185                 [in] uint32 level,
1186                 [in,unique] DATA_BLOB *buffer,
1187                 [in] uint32 offered,
1188                 [out,ref] uint32 *count,
1189                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcessorInfo **info,
1190                 [out,ref] uint32 *needed
1191         );
1192
1193         /******************/
1194         /* Function: 0x10 */
1195         typedef [public,gensize] struct {
1196                 nstring directory_name;
1197         } spoolss_PrintProcessorDirectoryInfo1;
1198
1199         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
1200                 [case(1)] spoolss_PrintProcessorDirectoryInfo1 info1;
1201                 [default] spoolss_PrintProcessorDirectoryInfo1 info1;
1202         } spoolss_PrintProcessorDirectoryInfo;
1203
1204         WERROR spoolss_GetPrintProcessorDirectory(
1205                 [in,unique] [string,charset(UTF16)] uint16 *server,
1206                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1207                 [in] uint32 level,
1208                 [in,unique] DATA_BLOB *buffer,
1209                 [in] uint32 offered,
1210                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrintProcessorDirectoryInfo *info,
1211                 [out,ref] uint32 *needed
1212         );
1213
1214         /******************/
1215         /* Function: 0x11 */
1216         typedef struct {
1217                 [string,charset(UTF16)] uint16 *document_name;
1218                 [string,charset(UTF16)] uint16 *output_file;
1219                 [string,charset(UTF16)] uint16 *datatype;
1220         } spoolss_DocumentInfo1;
1221
1222         typedef [switch_type(uint32)] union {
1223                 [case(1)] spoolss_DocumentInfo1 *info1;
1224                 [case(2)]; /* TODO */
1225                 [case(3)]; /* TODO */
1226                 [default];
1227         } spoolss_DocumentInfo;
1228
1229         WERROR spoolss_StartDocPrinter(
1230                 [in,ref] policy_handle *handle,
1231                 [in] uint32 level,
1232                 [in,switch_is(level)] spoolss_DocumentInfo info,
1233                 [out,ref] uint32 *job_id
1234         );
1235
1236         /******************/
1237         /* Function: 0x12 */
1238         WERROR spoolss_StartPagePrinter(
1239                 [in,ref] policy_handle *handle
1240         );
1241
1242         /******************/
1243         /* Function: 0x13 */
1244         WERROR spoolss_WritePrinter(
1245                 [in,ref] policy_handle *handle,
1246                 [in] DATA_BLOB data,
1247                 [in,value(r->in.data.length)] uint32 _data_size,
1248                 [out,ref] uint32 *num_written
1249         );
1250
1251         /******************/
1252         /* Function: 0x14 */
1253         WERROR spoolss_EndPagePrinter(
1254                 [in,ref] policy_handle *handle
1255         );
1256
1257         /******************/
1258         /* Function: 0x15 */
1259         WERROR spoolss_AbortPrinter(
1260                 [in,ref] policy_handle *handle
1261         );
1262
1263         /******************/
1264         /* Function: 0x16 */
1265         WERROR spoolss_ReadPrinter(
1266                 [in,ref] policy_handle *handle,
1267                 [out,ref] [size_is(data_size)] uint8 *data,
1268                 [in] uint32 data_size,
1269                 [out,ref] uint32 *_data_size
1270         );
1271
1272         /******************/
1273         /* Function: 0x17 */
1274         WERROR spoolss_EndDocPrinter(
1275                 [in,ref] policy_handle *handle
1276         );
1277
1278         /******************/
1279         /* Function: 0x18 */
1280         WERROR spoolss_AddJob(
1281                 [in,ref] policy_handle *handle,
1282                 [in] uint32 level,
1283                 [in,out,unique] [size_is(offered)] uint8 *buffer,
1284                 [in] uint32 offered,
1285                 [out,ref] uint32 *needed
1286         );
1287
1288         /******************/
1289         /* Function: 0x19 */
1290         WERROR spoolss_ScheduleJob(
1291                 [in,ref] policy_handle *handle,
1292                 [in] uint32 jobid
1293         );
1294
1295         /******************/
1296         /* Function: 0x1a */
1297
1298         const string SPL_ARCH_WIN40             = "WIN40";
1299         const string SPL_ARCH_W32X86            = "W32X86";
1300         const string SPL_ARCH_W32MIPS           = "W32MIPS";
1301         const string SPL_ARCH_W32ALPHA          = "W32ALPHA";
1302         const string SPL_ARCH_W32PPC            = "W32PPC";
1303         const string SPL_ARCH_IA64              = "IA64";
1304         const string SPL_ARCH_X64               = "x64";
1305
1306         const string SPOOLSS_ARCHITECTURE_ALL                   = "all";
1307         const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
1308         const string SPOOLSS_DEFAULT_SERVER_PATH                = "C:\\WINDOWS\\system32\\spool";
1309
1310         typedef [public,gensize] struct {
1311                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
1312                 uint32 major;
1313                 uint32 minor;
1314                 uint32 build;
1315                 [value(2)] uint32 unknown;
1316                 [subcontext(0),subcontext_size(256)] nstring extra_string;
1317         } spoolss_OSVersion;
1318
1319         typedef [public,gensize] struct {
1320                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
1321                 uint32 major;
1322                 uint32 minor;
1323                 uint32 build;
1324                 [value(2)] uint32 unknown1;
1325                 [subcontext(0),subcontext_size(256)] nstring extra_string;
1326                 uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
1327                 uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
1328         } spoolss_OSVersionEx;
1329
1330         typedef [nodiscriminant,public,gensize] union {
1331                 [case(REG_NONE)];
1332                 [case(REG_SZ)] nstring string;
1333                 [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
1334                 [case(REG_DWORD)] uint32 value;
1335                 [case(REG_MULTI_SZ)] nstring_array string_array;
1336                 [default,flag(NDR_REMAINING)] DATA_BLOB data;
1337         } spoolss_PrinterData;
1338
1339         WERROR spoolss_GetPrinterData(
1340                 [in,ref] policy_handle *handle,
1341                 [in]     [string,charset(UTF16)] uint16 value_name[],
1342                 [out,ref] winreg_Type *type,
1343                 [out,ref] [size_is(offered)] uint8 *data,
1344                 [in]     uint32 offered,
1345                 [out,ref] uint32 *needed
1346         );
1347
1348         /******************/
1349         /* Function: 0x1b */
1350         WERROR spoolss_SetPrinterData(
1351                 [in,ref] policy_handle *handle,
1352                 [in]     [string,charset(UTF16)] uint16 value_name[],
1353                 [in]     winreg_Type type,
1354                 [in,ref] [size_is(offered)] uint8 *data,
1355                 [in]     uint32 offered
1356         );
1357
1358         /******************/
1359         /* Function: 0x1c */
1360         [todo] WERROR spoolss_WaitForPrinterChange(
1361         );
1362
1363         /******************/
1364         /* Function: 0x1d */
1365         [public] WERROR spoolss_ClosePrinter(
1366                 [in,out,ref]     policy_handle *handle
1367         );
1368
1369         /******************/
1370         /* Function: 0x1e */
1371         typedef [v1_enum] enum {
1372                 SPOOLSS_FORM_USER       = 0,
1373                 SPOOLSS_FORM_BUILTIN    = 1,
1374                 SPOOLSS_FORM_PRINTER    = 2
1375         } spoolss_FormFlags;
1376
1377         typedef struct {
1378                 uint32 width;
1379                 uint32 height;
1380         } spoolss_FormSize;
1381
1382         typedef struct {
1383                 uint32 left;
1384                 uint32 top;
1385                 uint32 right;
1386                 uint32 bottom;
1387         } spoolss_FormArea;
1388
1389         typedef [public,gensize] struct {
1390                 spoolss_FormFlags flags;
1391                 [relative] nstring *form_name;
1392                 spoolss_FormSize size;
1393                 spoolss_FormArea area;
1394         } spoolss_FormInfo1;
1395
1396         typedef [bitmap32bit] bitmap {
1397                 SPOOLSS_FORM_STRING_TYPE_NONE           = 0x00000001,
1398                 SPOOLSS_FORM_STRING_TYPE_MUI_DLL        = 0x00000002,
1399                 SPOOLSS_FORM_STRING_TYPE_LANG_PAIR      = 0x00000004
1400         } spoolss_FormStringType;
1401
1402         typedef [public,gensize] struct {
1403                 spoolss_FormFlags flags;
1404                 [relative] nstring *form_name;
1405                 spoolss_FormSize size;
1406                 spoolss_FormArea area;
1407                 [relative] astring *keyword;
1408                 spoolss_FormStringType string_type;
1409                 [relative] nstring *mui_dll;
1410                 uint32 ressource_id;
1411                 [relative] nstring *display_name;
1412                 uint32 lang_id;
1413         } spoolss_FormInfo2;
1414
1415         typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
1416                 [case(1)] spoolss_FormInfo1 info1;
1417                 [case(2)] spoolss_FormInfo2 info2;
1418                 [default];
1419         } spoolss_FormInfo;
1420
1421         typedef struct {
1422                 spoolss_FormFlags flags;
1423                 [string,charset(UTF16)] uint16 *form_name;
1424                 spoolss_FormSize size;
1425                 spoolss_FormArea area;
1426         } spoolss_AddFormInfo1;
1427
1428         typedef struct {
1429                 spoolss_FormFlags flags;
1430                 [string,charset(UTF16)] uint16 *form_name;
1431                 spoolss_FormSize size;
1432                 spoolss_FormArea area;
1433                 [string,charset(DOS)] uint8 *keyword;
1434                 spoolss_FormStringType string_type;
1435                 [string,charset(UTF16)] uint16 *mui_dll;
1436                 uint32 ressource_id;
1437                 [string,charset(UTF16)] uint16 *display_name;
1438                 uint32 lang_id;
1439         } spoolss_AddFormInfo2;
1440
1441         typedef [switch_type(uint32)] union {
1442                 [case(1)] spoolss_AddFormInfo1 *info1;
1443                 [case(2)] spoolss_AddFormInfo2 *info2;
1444         } spoolss_AddFormInfo;
1445
1446         WERROR spoolss_AddForm(
1447                 [in,ref] policy_handle *handle,
1448                 [in] uint32 level,
1449                 [in,switch_is(level)] spoolss_AddFormInfo info
1450         );
1451
1452         /******************/
1453         /* Function: 0x1f */
1454         WERROR spoolss_DeleteForm(
1455                 [in,ref] policy_handle *handle,
1456                 [in] [string,charset(UTF16)] uint16 form_name[]
1457         );
1458
1459         /******************/
1460         /* Function: 0x20 */
1461         WERROR spoolss_GetForm(
1462                 [in,ref] policy_handle *handle,
1463                 [in] [string,charset(UTF16)] uint16 form_name[],
1464                 [in] uint32 level,
1465                 [in,unique] DATA_BLOB *buffer,
1466                 [in] uint32 offered,
1467                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
1468                 [out,ref] uint32 *needed
1469         );
1470
1471         /******************/
1472         /* Function: 0x21 */
1473         WERROR spoolss_SetForm(
1474                 [in,ref] policy_handle *handle,
1475                 [in] [string,charset(UTF16)] uint16 form_name[],
1476                 [in] uint32 level,
1477                 [in,switch_is(level)] spoolss_AddFormInfo info
1478         );
1479
1480         /******************/
1481         /* Function: 0x22 */
1482         [public,noopnum,noprint] WERROR _spoolss_EnumForms(
1483                 [in,ref] policy_handle *handle,
1484                 [in]     uint32 level,
1485                 [in,unique] DATA_BLOB *buffer,
1486                 [in]     uint32 offered,
1487                 [out,unique] DATA_BLOB *info,
1488                 [out,ref] uint32 *needed,
1489                 [out,ref] uint32 *count
1490         );
1491         [public,noopnum,noprint] void __spoolss_EnumForms(
1492                 [in] uint32 level,
1493                 [in] uint32 count,
1494                 [out,switch_is(level)] spoolss_FormInfo info[count]
1495         );
1496         [nopull,nopush] WERROR spoolss_EnumForms(
1497                 [in,ref] policy_handle *handle,
1498                 [in]     uint32 level,
1499                 [in,unique] DATA_BLOB *buffer,
1500                 [in]     uint32 offered,
1501                 [out,ref] uint32 *count,
1502                 [out,ref,switch_is(level),size_is(,*count)] spoolss_FormInfo **info,
1503                 [out,ref] uint32 *needed
1504         );
1505
1506         /*
1507          * Special strings for the OpenPrinter() call.  See the MSDN DDK
1508          * docs on the XcvDataPort() for more details.
1509          */
1510
1511         const string SPL_LOCAL_PORT             = "Local Port";
1512         const string SPL_TCPIP_PORT             = "Standard TCP/IP Port";
1513         const string SPL_XCV_MONITOR_LOCALMON   = ",XcvMonitor Local Port";
1514         const string SPL_XCV_MONITOR_TCPMON     = ",XcvMonitor Standard TCP/IP Port";
1515
1516         typedef [public,gensize] struct {
1517                 [relative] nstring *port_name;
1518         } spoolss_PortInfo1;
1519
1520         typedef bitmap {
1521                 SPOOLSS_PORT_TYPE_WRITE         = 0x00000001,
1522                 SPOOLSS_PORT_TYPE_READ          = 0x00000002,
1523                 SPOOLSS_PORT_TYPE_REDIRECTED    = 0x00000004,
1524                 SPOOLSS_PORT_TYPE_NET_ATTACHED  = 0x00000008
1525         } spoolss_PortType;
1526
1527         typedef [public,gensize] struct {
1528                 [relative] nstring *port_name;
1529                 [relative] nstring *monitor_name;
1530                 [relative] nstring *description;
1531                 spoolss_PortType port_type;
1532                 uint32 reserved;
1533         } spoolss_PortInfo2;
1534
1535         typedef [v1_enum] enum {
1536                 PORT_STATUS_CLEAR               = 0x00000000,
1537                 PORT_STATUS_OFFLINE             = 0x00000001,
1538                 PORT_STATUS_PAPER_JAM           = 0x00000002,
1539                 PORT_STATUS_PAPER_OUT           = 0x00000003,
1540                 PORT_STATUS_OUTPUT_BIN_FULL     = 0x00000004,
1541                 PORT_STATUS_PAPER_PROBLEM       = 0x00000005,
1542                 PORT_STATUS_NO_TONER            = 0x00000006,
1543                 PORT_STATUS_DOOR_OPEN           = 0x00000007,
1544                 PORT_STATUS_USER_INTERVENTION   = 0x00000008,
1545                 PORT_STATUS_OUT_OF_MEMORY       = 0x00000009,
1546                 PORT_STATUS_TONER_LOW           = 0x0000000A,
1547                 PORT_STATUS_WARMING_UP          = 0x0000000B,
1548                 PORT_STATUS_POWER_SAVE          = 0x0000000C
1549         } spoolss_PortStatus;
1550
1551         typedef [v1_enum] enum {
1552                 PORT_STATUS_TYPE_ERROR          = 0x00000001,
1553                 PORT_STATUS_TYPE_WARNING        = 0x00000002,
1554                 PORT_STATUS_TYPE_INFO           = 0x00000003
1555         } spoolss_PortSeverity;
1556
1557         typedef [public,gensize] struct {
1558                 spoolss_PortStatus status;
1559                 [relative] nstring *status_string;
1560                 spoolss_PortSeverity severity;
1561         } spoolss_PortInfo3;
1562
1563         typedef [public,gensize] struct {
1564                 [relative] nstring *port_name;
1565                 DATA_BLOB monitor_data; /* relative ?? */
1566         } spoolss_PortInfoFF;
1567
1568         typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
1569                 [case(1)] spoolss_PortInfo1 info1;
1570                 [case(2)] spoolss_PortInfo2 info2;
1571                 [case(3)] spoolss_PortInfo3 info3;
1572                 [case(0xff)] spoolss_PortInfoFF infoFF;
1573                 [default];
1574         } spoolss_PortInfo;
1575
1576         /******************/
1577         /* Function: 0x23 */
1578         [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
1579                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1580                 [in] uint32 level,
1581                 [in,unique] DATA_BLOB *buffer,
1582                 [in] uint32 offered,
1583                 [out,unique] DATA_BLOB *info,
1584                 [out,ref] uint32 *needed,
1585                 [out,ref] uint32 *count
1586         );
1587         [public,noopnum,noprint] void __spoolss_EnumPorts(
1588                 [in] uint32 level,
1589                 [in] uint32 count,
1590                 [out,switch_is(level)] spoolss_PortInfo info[count]
1591         );
1592         [nopull,nopush] WERROR spoolss_EnumPorts(
1593                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1594                 [in] uint32 level,
1595                 [in,unique] DATA_BLOB *buffer,
1596                 [in] uint32 offered,
1597                 [out,ref] uint32 *count,
1598                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PortInfo **info,
1599                 [out,ref] uint32 *needed
1600         );
1601
1602         /******************/
1603         /* Function: 0x24 */
1604         typedef [public,gensize] struct {
1605                 [relative] nstring *monitor_name;
1606         } spoolss_MonitorInfo1;
1607
1608         typedef [public,gensize] struct {
1609                 [relative] nstring *monitor_name;
1610                 [relative] nstring *environment;
1611                 [relative] nstring *dll_name;
1612         } spoolss_MonitorInfo2;
1613
1614         typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
1615                 [case(1)] spoolss_MonitorInfo1 info1;
1616                 [case(2)] spoolss_MonitorInfo2 info2;
1617                 [default];
1618         } spoolss_MonitorInfo;
1619
1620         [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
1621                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1622                 [in] uint32 level,
1623                 [in,unique] DATA_BLOB *buffer,
1624                 [in] uint32 offered,
1625                 [out,unique] DATA_BLOB *info,
1626                 [out,ref] uint32 *needed,
1627                 [out,ref] uint32 *count
1628         );
1629         [public,noopnum,noprint] void __spoolss_EnumMonitors(
1630                 [in] uint32 level,
1631                 [in] uint32 count,
1632                 [out,switch_is(level)] spoolss_MonitorInfo info[count]
1633         );
1634         [nopull,nopush] WERROR spoolss_EnumMonitors(
1635                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1636                 [in] uint32 level,
1637                 [in,unique] DATA_BLOB *buffer,
1638                 [in] uint32 offered,
1639                 [out,ref] uint32 *count,
1640                 [out,ref,switch_is(level),size_is(,*count)] spoolss_MonitorInfo **info,
1641                 [out,ref] uint32 *needed
1642         );
1643
1644         /******************/
1645         /* Function: 0x25 */
1646         WERROR spoolss_AddPort(
1647                [in,unique] [string,charset(UTF16)] uint16 *server_name,
1648                [in] uint32 unknown,
1649                [in] [string,charset(UTF16)] uint16 monitor_name[]
1650         );
1651
1652         /******************/
1653         /* Function: 0x26 */
1654         [todo] WERROR spoolss_ConfigurePort(
1655         );
1656
1657         /******************/
1658         /* Function: 0x27 */
1659         [todo] WERROR spoolss_DeletePort(
1660         );
1661
1662         /******************/
1663         /* Function: 0x28 */
1664         [todo] WERROR spoolss_CreatePrinterIC(
1665         );
1666
1667         /******************/
1668         /* Function: 0x29 */
1669         [todo] WERROR spoolss_PlayGDIScriptOnPrinterIC(
1670         );
1671
1672         /******************/
1673         /* Function: 0x2a */
1674         [todo] WERROR spoolss_DeletePrinterIC(
1675         );
1676
1677         /******************/
1678         /* Function: 0x2b */
1679         [todo] WERROR spoolss_AddPrinterConnection(
1680         );
1681
1682         /******************/
1683         /* Function: 0x2c */
1684         [todo] WERROR spoolss_DeletePrinterConnection(
1685         );
1686
1687         /******************/
1688         /* Function: 0x2d */
1689         [todo] WERROR spoolss_PrinterMessageBox(
1690                 /* Marked as obsolete in MSDN.  "Not necessary and has
1691                    no effect". */
1692         );
1693
1694         /******************/
1695         /* Function: 0x2e */
1696         [todo] WERROR spoolss_AddMonitor(
1697         );
1698
1699         /******************/
1700         /* Function: 0x2f */
1701         [todo] WERROR spoolss_DeleteMonitor(
1702         );
1703
1704         /******************/
1705         /* Function: 0x30 */
1706         [todo] WERROR spoolss_DeletePrintProcessor(
1707         );
1708
1709         /******************/
1710         /* Function: 0x31 */
1711         [todo] WERROR spoolss_AddPrintProvidor(
1712         );
1713
1714         /******************/
1715         /* Function: 0x32 */
1716         [todo] WERROR spoolss_DeletePrintProvidor(
1717         );
1718
1719         /******************/
1720         /* Function: 0x33 */
1721
1722         typedef [public,gensize] struct {
1723                 [relative] nstring *name_array;
1724         } spoolss_PrintProcDataTypesInfo1;
1725
1726         typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
1727                 [case(1)] spoolss_PrintProcDataTypesInfo1 info1;
1728                 [default];
1729         } spoolss_PrintProcDataTypesInfo;
1730
1731         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcDataTypes(
1732                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1733                 [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
1734                 [in] uint32 level,
1735                 [in,unique] DATA_BLOB *buffer,
1736                 [in] uint32 offered,
1737                 [out,unique] DATA_BLOB *info,
1738                 [out,ref] uint32 *needed,
1739                 [out,ref] uint32 *count
1740         );
1741         [public,noopnum,noprint] void __spoolss_EnumPrintProcDataTypes(
1742                 [in] uint32 level,
1743                 [in] uint32 count,
1744                 [out,switch_is(level)] spoolss_PrintProcDataTypesInfo info[count]
1745         );
1746         [nopull,nopush] WERROR spoolss_EnumPrintProcDataTypes(
1747                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1748                 [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
1749                 [in] uint32 level,
1750                 [in,unique] DATA_BLOB *buffer,
1751                 [in] uint32 offered,
1752                 [out,ref] uint32 *count,
1753                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcDataTypesInfo **info,
1754                 [out,ref] uint32 *needed
1755         );
1756
1757         /******************/
1758         /* Function: 0x34 */
1759         WERROR spoolss_ResetPrinter(
1760                 [in,ref] policy_handle *handle,
1761                 [in,unique] [string,charset(UTF16)] uint16 *data_type,
1762                 [in,ref] spoolss_DevmodeContainer *devmode_ctr
1763         );
1764
1765         /******************/
1766         /* Function: 0x35 */
1767         WERROR spoolss_GetPrinterDriver2(
1768                 [in,ref] policy_handle *handle,
1769                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
1770                 [in]     uint32 level,
1771                 [in,unique] DATA_BLOB *buffer,
1772                 [in]     uint32 offered,
1773                 [in]     uint32 client_major_version,
1774                 [in]     uint32 client_minor_version,
1775                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
1776                 [out,ref] uint32 *needed,
1777                 [out,ref] uint32 *server_major_version,
1778                 [out,ref] uint32 *server_minor_version
1779         );
1780
1781         /******************/
1782         /* Function: 0x36 */
1783         [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
1784         );
1785
1786         /******************/
1787         /* Function: 0x37 */
1788         [todo] WERROR spoolss_FindNextPrinterChangeNotification(
1789         );
1790
1791         /******************/
1792         /* Function: 0x38 */
1793         [public] WERROR spoolss_FindClosePrinterNotify(
1794                 [in,ref] policy_handle *handle
1795         );
1796
1797         /******************/
1798         /* Function: 0x39 */
1799         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
1800         );
1801
1802         /******************/
1803         /* Function: 0x3a */
1804         [public] WERROR spoolss_ReplyOpenPrinter(
1805                 [in,string,charset(UTF16)] uint16 server_name[],
1806                 [in] uint32 printer_local,
1807                 [in] winreg_Type type,
1808                 [in,range(0,512)] uint32 bufsize,
1809                 [in,unique,size_is(bufsize)] uint8 *buffer,
1810                 [out,ref] policy_handle *handle
1811         );
1812
1813         /******************/
1814         /* Function: 0x3b */
1815
1816         typedef [bitmap32bit] bitmap {
1817                 PRINTER_CHANGE_ADD_PRINTER                      = 0x00000001,
1818                 PRINTER_CHANGE_SET_PRINTER                      = 0x00000002,
1819                 PRINTER_CHANGE_DELETE_PRINTER                   = 0x00000004,
1820                 PRINTER_CHANGE_FAILED_CONNECTION_PRINTER        = 0x00000008,
1821                 PRINTER_CHANGE_ADD_JOB                          = 0x00000100,
1822                 PRINTER_CHANGE_SET_JOB                          = 0x00000200,
1823                 PRINTER_CHANGE_DELETE_JOB                       = 0x00000400,
1824                 PRINTER_CHANGE_WRITE_JOB                        = 0x00000800,
1825                 PRINTER_CHANGE_ADD_FORM                         = 0x00010000,
1826                 PRINTER_CHANGE_SET_FORM                         = 0x00020000,
1827                 PRINTER_CHANGE_DELETE_FORM                      = 0x00040000,
1828                 PRINTER_CHANGE_ADD_PORT                         = 0x00100000,
1829                 PRINTER_CHANGE_CONFIGURE_PORT                   = 0x00200000,
1830                 PRINTER_CHANGE_DELETE_PORT                      = 0x00400000,
1831                 PRINTER_CHANGE_ADD_PRINT_PROCESSOR              = 0x01000000,
1832                 PRINTER_CHANGE_DELETE_PRINT_PROCESSOR           = 0x04000000,
1833                 PRINTER_CHANGE_SERVER                           = 0x08000000,
1834                 PRINTER_CHANGE_ADD_PRINTER_DRIVER               = 0x10000000,
1835                 PRINTER_CHANGE_SET_PRINTER_DRIVER               = 0x20000000,
1836                 PRINTER_CHANGE_DELETE_PRINTER_DRIVER            = 0x40000000,
1837                 PRINTER_CHANGE_TIMEOUT                          = 0x80000000
1838         } spoolss_PrinterChangeFlags;
1839
1840         const int PRINTER_CHANGE_PRINTER                        = 0x000000FF;
1841
1842         const int PRINTER_CHANGE_JOB                            = 0x0000FF00;
1843
1844         const int PRINTER_CHANGE_FORM                           = (PRINTER_CHANGE_ADD_FORM |
1845                                                                    PRINTER_CHANGE_SET_FORM |
1846                                                                    PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */
1847
1848         const int PRINTER_CHANGE_PORT                           = (PRINTER_CHANGE_ADD_PORT |
1849                                                                    PRINTER_CHANGE_CONFIGURE_PORT |
1850                                                                    PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */
1851
1852         const int PRINTER_CHANGE_PRINT_PROCESSOR                = 0x07000000;
1853
1854         const int PRINTER_CHANGE_PRINTER_DRIVER                 = (PRINTER_CHANGE_ADD_PRINTER_DRIVER |
1855                                                                    PRINTER_CHANGE_SET_PRINTER_DRIVER |
1856                                                                    PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */
1857
1858         const int PRINTER_CHANGE_ALL                            = (PRINTER_CHANGE_PRINTER |
1859                                                                    PRINTER_CHANGE_JOB |
1860                                                                    PRINTER_CHANGE_FORM |
1861                                                                    PRINTER_CHANGE_PORT |
1862                                                                    PRINTER_CHANGE_PRINT_PROCESSOR |
1863                                                                    PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */
1864         WERROR spoolss_RouterReplyPrinter(
1865                 [in,ref] policy_handle *handle,
1866                 [in] spoolss_PrinterChangeFlags flags,
1867                 [in,range(0,512)] uint32 bufsize,
1868                 [in,unique,size_is(bufsize)] uint8 *buffer
1869         );
1870
1871         /******************/
1872         /* Function: 0x3c */
1873         [public] WERROR spoolss_ReplyClosePrinter(
1874                 [in,out,ref] policy_handle *handle
1875         );
1876
1877         /******************/
1878         /* Function: 0x3d */
1879         [todo] WERROR spoolss_AddPortEx(
1880         );
1881
1882         /******************/
1883         /* Function: 0x3e */
1884         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
1885         );
1886
1887         /******************/
1888         /* Function: 0x3f */
1889         [todo] WERROR spoolss_SpoolerInit(
1890         );
1891
1892         /******************/
1893         /* Function: 0x40 */
1894         [todo] WERROR spoolss_ResetPrinterEx(
1895         );
1896
1897         typedef [enum16bit,public] enum {
1898                 JOB_NOTIFY_FIELD_PRINTER_NAME                   = 0x00,
1899                 JOB_NOTIFY_FIELD_MACHINE_NAME                   = 0x01,
1900                 JOB_NOTIFY_FIELD_PORT_NAME                      = 0x02,
1901                 JOB_NOTIFY_FIELD_USER_NAME                      = 0x03,
1902                 JOB_NOTIFY_FIELD_NOTIFY_NAME                    = 0x04,
1903                 JOB_NOTIFY_FIELD_DATATYPE                       = 0x05,
1904                 JOB_NOTIFY_FIELD_PRINT_PROCESSOR                = 0x06,
1905                 JOB_NOTIFY_FIELD_PARAMETERS                     = 0x07,
1906                 JOB_NOTIFY_FIELD_DRIVER_NAME                    = 0x08,
1907                 JOB_NOTIFY_FIELD_DEVMODE                        = 0x09,
1908                 JOB_NOTIFY_FIELD_STATUS                         = 0x0a,
1909                 JOB_NOTIFY_FIELD_STATUS_STRING                  = 0x0b,
1910                 JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR            = 0x0c,
1911                 JOB_NOTIFY_FIELD_DOCUMENT                       = 0x0d,
1912                 JOB_NOTIFY_FIELD_PRIORITY                       = 0x0e,
1913                 JOB_NOTIFY_FIELD_POSITION                       = 0x0f,
1914                 JOB_NOTIFY_FIELD_SUBMITTED                      = 0x10,
1915                 JOB_NOTIFY_FIELD_START_TIME                     = 0x11,
1916                 JOB_NOTIFY_FIELD_UNTIL_TIME                     = 0x12,
1917                 JOB_NOTIFY_FIELD_TIME                           = 0x13,
1918                 JOB_NOTIFY_FIELD_TOTAL_PAGES                    = 0x14,
1919                 JOB_NOTIFY_FIELD_PAGES_PRINTED                  = 0x15,
1920                 JOB_NOTIFY_FIELD_TOTAL_BYTES                    = 0x16,
1921                 JOB_NOTIFY_FIELD_BYTES_PRINTED                  = 0x17
1922         } spoolss_JobNotifyField;
1923
1924         typedef [enum16bit,public] enum {
1925                 PRINTER_NOTIFY_FIELD_SERVER_NAME                = 0x00,
1926                 PRINTER_NOTIFY_FIELD_PRINTER_NAME               = 0x01,
1927                 PRINTER_NOTIFY_FIELD_SHARE_NAME                 = 0x02,
1928                 PRINTER_NOTIFY_FIELD_PORT_NAME                  = 0x03,
1929                 PRINTER_NOTIFY_FIELD_DRIVER_NAME                = 0x04,
1930                 PRINTER_NOTIFY_FIELD_COMMENT                    = 0x05,
1931                 PRINTER_NOTIFY_FIELD_LOCATION                   = 0x06,
1932                 PRINTER_NOTIFY_FIELD_DEVMODE                    = 0x07,
1933                 PRINTER_NOTIFY_FIELD_SEPFILE                    = 0x08,
1934                 PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR            = 0x09,
1935                 PRINTER_NOTIFY_FIELD_PARAMETERS                 = 0x0a,
1936                 PRINTER_NOTIFY_FIELD_DATATYPE                   = 0x0b,
1937                 PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR        = 0x0c,
1938                 PRINTER_NOTIFY_FIELD_ATTRIBUTES                 = 0x0d,
1939                 PRINTER_NOTIFY_FIELD_PRIORITY                   = 0x0e,
1940                 PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY           = 0x0f,
1941                 PRINTER_NOTIFY_FIELD_START_TIME                 = 0x10,
1942                 PRINTER_NOTIFY_FIELD_UNTIL_TIME                 = 0x11,
1943                 PRINTER_NOTIFY_FIELD_STATUS                     = 0x12,
1944                 PRINTER_NOTIFY_FIELD_STATUS_STRING              = 0x13,
1945                 PRINTER_NOTIFY_FIELD_CJOBS                      = 0x14,
1946                 PRINTER_NOTIFY_FIELD_AVERAGE_PPM                = 0x15,
1947                 PRINTER_NOTIFY_FIELD_TOTAL_PAGES                = 0x16,
1948                 PRINTER_NOTIFY_FIELD_PAGES_PRINTED              = 0x17,
1949                 PRINTER_NOTIFY_FIELD_TOTAL_BYTES                = 0x18,
1950                 PRINTER_NOTIFY_FIELD_BYTES_PRINTED              = 0x19,
1951                 PRINTER_NOTIFY_FIELD_OBJECT_GUID                = 0x1a,
1952                 PRINTER_NOTIFY_FIELD_FRIENDLY_NAME              = 0x1b
1953         } spoolss_PrintNotifyField;
1954
1955         typedef [enum16bit] enum {
1956                 PRINTER_NOTIFY_TYPE     = 0x00,
1957                 JOB_NOTIFY_TYPE         = 0x01
1958         } spoolss_NotifyType;
1959
1960         typedef [nodiscriminant,noprint] union {
1961                 [case(PRINTER_NOTIFY_TYPE)] uint16 field;
1962                 [case(JOB_NOTIFY_TYPE)] uint16 field;
1963                 [default] uint16 field;
1964         } spoolss_Field;
1965
1966         /******************/
1967         /* Function: 0x41 */
1968         typedef struct {
1969                 spoolss_NotifyType type;
1970                 uint16 u1;
1971                 uint32 u2;
1972                 uint32 u3;
1973                 uint32 count;
1974                 [size_is(count),switch_is(type)] spoolss_Field *fields;
1975         } spoolss_NotifyOptionType;
1976
1977         typedef [bitmap32bit] bitmap {
1978                 PRINTER_NOTIFY_OPTIONS_REFRESH  = 0x00000001
1979         } spoolssNotifyOptionFlags;
1980
1981         typedef struct {
1982                 [value(2)] uint32 version;
1983                 spoolssNotifyOptionFlags flags;
1984                 uint32 count;
1985                 [size_is(count)] spoolss_NotifyOptionType *types;
1986         } spoolss_NotifyOption;
1987
1988         [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
1989                 [in,ref] policy_handle *handle,
1990                 [in] spoolss_PrinterChangeFlags flags,
1991                 [in] uint32 options,
1992                 [in,unique] [string,charset(UTF16)] uint16 *local_machine,
1993                 [in] uint32 printer_local,
1994                 [in,unique] spoolss_NotifyOption *notify_options
1995         );
1996
1997         /******************/
1998         /* Function: 0x42 */
1999
2000         typedef struct {
2001                 uint32 size;
2002                 [size_is(size/2),unique,charset(UTF16)] uint16 *string;
2003         } spoolss_NotifyString;
2004
2005         typedef [v1_enum] enum {
2006                 NOTIFY_TABLE_DWORD              = 0x0001,
2007                 NOTIFY_TABLE_STRING             = 0x0002,
2008                 NOTIFY_TABLE_DEVMODE            = 0x0003,
2009                 NOTIFY_TABLE_TIME               = 0x0004,
2010                 NOTIFY_TABLE_SECURITYDESCRIPTOR = 0x0005
2011         } spoolss_NotifyTable;
2012
2013         typedef [switch_type(uint32)] union {
2014                 [case(1)] uint32 integer[2];
2015                 [case(2)] spoolss_NotifyString string;
2016                 [case(3)] spoolss_DevmodeContainer devmode;
2017                 [case(4)] spoolss_TimeCtr time;
2018                 [case(5)] sec_desc_buf sd;
2019         } spoolss_NotifyData;
2020
2021         typedef struct {
2022                 spoolss_NotifyType type;
2023                 [switch_is(type)] spoolss_Field field;
2024                 spoolss_NotifyTable variable_type;
2025                 uint32 job_id;
2026                 [switch_is(variable_type)] spoolss_NotifyData data;
2027         } spoolss_Notify;
2028
2029         typedef struct {
2030                 [value(2)] uint32 version;
2031                 uint32 flags;
2032                 uint32 count;
2033                 [size_is(count)] spoolss_Notify notifies[];
2034         } spoolss_NotifyInfo;
2035
2036         typedef [switch_type(uint32)] union {
2037                 [case(0)] spoolss_NotifyInfo *info0;
2038         } spoolss_ReplyPrinterInfo;
2039
2040         typedef [bitmap32bit] bitmap {
2041                 PRINTER_NOTIFY_INFO_DISCARDED           = 0x00000001,
2042                 PRINTER_NOTIFY_INFO_DISCARDNOTED        = 0x00010000,
2043                 PRINTER_NOTIFY_INFO_COLOR_MISMATCH      = 0x00080000
2044         } spoolss_PrinterNotifyFlags;
2045
2046         WERROR spoolss_RouterReplyPrinterEx(
2047                 [in,ref] policy_handle *handle,
2048                 [in] uint32 color,
2049                 [in] spoolss_PrinterChangeFlags flags,
2050                 [out,ref] spoolss_PrinterNotifyFlags *reply_result,
2051                 [in] uint32 reply_type,
2052                 [in,switch_is(reply_type)] spoolss_ReplyPrinterInfo info
2053         );
2054
2055         /******************/
2056         /* Function: 0x43 */
2057         [public] WERROR spoolss_RouterRefreshPrinterChangeNotify(
2058                 [in,ref] policy_handle *handle,
2059                 [in] uint32 change_low,
2060                 [in,unique] spoolss_NotifyOption *options,
2061                 [out,ref] spoolss_NotifyInfo **info
2062         );
2063
2064         /******************/
2065         /* Function: 0x44 */
2066         [todo] WERROR spoolss_44(
2067         );
2068
2069         typedef struct {
2070                 uint32 size;
2071                 [string,charset(UTF16)] uint16 *client;
2072                 [string,charset(UTF16)] uint16 *user;
2073                 uint32 build;
2074                 spoolss_MajorVersion major;
2075                 spoolss_MinorVersion minor;
2076                 spoolss_ProcessorArchitecture processor;
2077         } spoolss_UserLevel1;
2078
2079         typedef struct {
2080                 uint32 not_used;
2081         } spoolss_UserLevel2;
2082
2083         typedef struct {
2084                 uint32 size;
2085                 uint32 flags;
2086                 uint32 size2;
2087                 [string,charset(UTF16)] uint16 *client;
2088                 [string,charset(UTF16)] uint16 *user;
2089                 uint32 build;
2090                 spoolss_MajorVersion major;
2091                 spoolss_MinorVersion minor;
2092                 spoolss_ProcessorArchitecture processor;
2093                 udlong reserved;
2094         } spoolss_UserLevel3;
2095
2096         typedef [switch_type(uint32)] union {
2097                 [case(1)]  spoolss_UserLevel1 *level1;
2098                 [case(2)]  spoolss_UserLevel2 *level2;
2099                 [case(3)]  spoolss_UserLevel3 *level3;
2100         } spoolss_UserLevel;
2101
2102         typedef struct {
2103                 uint32 level;
2104                 [switch_is(level)] spoolss_UserLevel user_info;
2105         } spoolss_UserLevelCtr;
2106
2107         typedef bitmap {
2108                 SERVER_ACCESS_ADMINISTER        = 0x00000001,
2109                 SERVER_ACCESS_ENUMERATE         = 0x00000002,
2110                 PRINTER_ACCESS_ADMINISTER       = 0x00000004,
2111                 PRINTER_ACCESS_USE              = 0x00000008,
2112                 JOB_ACCESS_ADMINISTER           = 0x00000010,
2113                 JOB_ACCESS_READ                 = 0x00000020
2114         } spoolss_AccessRights;
2115
2116         /* Access rights for print servers */
2117         const int SERVER_ALL_ACCESS     = SEC_STD_REQUIRED |
2118                                           SERVER_ACCESS_ADMINISTER |
2119                                           SERVER_ACCESS_ENUMERATE;
2120
2121         const int SERVER_READ           = SEC_STD_READ_CONTROL |
2122                                           SERVER_ACCESS_ENUMERATE;
2123
2124         const int SERVER_WRITE          = STANDARD_RIGHTS_WRITE_ACCESS |
2125                                           SERVER_ACCESS_ADMINISTER |
2126                                           SERVER_ACCESS_ENUMERATE;
2127
2128         const int SERVER_EXECUTE        = SEC_STD_READ_CONTROL |
2129                                           SERVER_ACCESS_ENUMERATE;
2130
2131         /* Access rights for printers */
2132         const int PRINTER_ALL_ACCESS    = SEC_STD_REQUIRED |
2133                                           PRINTER_ACCESS_ADMINISTER |
2134                                           PRINTER_ACCESS_USE;
2135
2136         const int PRINTER_READ          = SEC_STD_READ_CONTROL |
2137                                           PRINTER_ACCESS_USE;
2138
2139         const int PRINTER_WRITE         = STANDARD_RIGHTS_WRITE_ACCESS |
2140                                           PRINTER_ACCESS_USE;
2141
2142         const int PRINTER_EXECUTE       = SEC_STD_READ_CONTROL |
2143                                           PRINTER_ACCESS_USE;
2144
2145         /* Access rights for jobs */
2146         const int JOB_ALL_ACCESS        = SEC_STD_REQUIRED |
2147                                           JOB_ACCESS_ADMINISTER;
2148
2149         const int JOB_READ              = SEC_STD_READ_CONTROL |
2150                                           JOB_ACCESS_ADMINISTER;
2151
2152         const int JOB_WRITE             = STANDARD_RIGHTS_WRITE_ACCESS |
2153                                           JOB_ACCESS_ADMINISTER;
2154
2155         const int JOB_EXECUTE           = SEC_STD_READ_CONTROL |
2156                                           JOB_ACCESS_ADMINISTER;
2157
2158         /* ACE masks for various print permissions */
2159         const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
2160                                                 PRINTER_ALL_ACCESS;
2161
2162         const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
2163                                                 READ_CONTROL_ACCESS;
2164
2165         const int PRINTER_ACE_PRINT     = GENERIC_EXECUTE_ACCESS |
2166                                           READ_CONTROL_ACCESS |
2167                                           PRINTER_ACCESS_USE;
2168
2169         /******************/
2170         /* Function: 0x45 */
2171         [public] WERROR spoolss_OpenPrinterEx(
2172                 [in,unique]           [string,charset(UTF16)] uint16 *printername,
2173                 [in,unique]           [string,charset(UTF16)] uint16 *datatype,
2174                 [in]                  spoolss_DevmodeContainer devmode_ctr,
2175                 [in]                  spoolss_AccessRights access_mask,
2176                 [in]                  uint32 level,
2177                 [in,switch_is(level)] spoolss_UserLevel userlevel,
2178                 [out,ref]             policy_handle *handle
2179         );
2180
2181         /******************/
2182         /* Function: 0x46 */
2183         WERROR spoolss_AddPrinterEx(
2184                 [in,unique] [string,charset(UTF16)] uint16 *server,
2185                 [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
2186                 [in,ref] spoolss_DevmodeContainer *devmode_ctr,
2187                 [in,ref] sec_desc_buf *secdesc_ctr,
2188                 [in,ref] spoolss_UserLevelCtr *userlevel_ctr,
2189                 [out,ref] policy_handle *handle
2190         );
2191
2192         /******************/
2193         /* Function: 0x47 */
2194         [todo] WERROR spoolss_47(
2195         );
2196
2197         /******************/
2198         /* Function: 0x48 */
2199         WERROR spoolss_EnumPrinterData(
2200                 [in,ref] policy_handle *handle,
2201                 [in]     uint32 enum_index,
2202                 [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[],
2203                 [in]     uint32 value_offered,
2204                 [out,ref] uint32 *value_needed,
2205                 [out,ref] winreg_Type *type,
2206                 [out,ref,size_is(data_offered),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *data,
2207                 [in]     uint32 data_offered,
2208                 [out,ref] uint32 *data_needed
2209         );
2210
2211         /******************/
2212         /* Function: 0x49 */
2213         WERROR spoolss_DeletePrinterData(
2214                 [in,ref] policy_handle *handle,
2215                 [in] [string,charset(UTF16)] uint16 value_name[]
2216         );
2217
2218         /******************/
2219         /* Function: 0x4a */
2220         [todo] WERROR spoolss_4a(
2221         );
2222
2223         /******************/
2224         /* Function: 0x4b */
2225         [todo] WERROR spoolss_4b(
2226         );
2227
2228         /******************/
2229         /* Function: 0x4c */
2230         [todo] WERROR spoolss_4c(
2231         );
2232
2233         /******************/
2234         /* Function: 0x4d */
2235         WERROR spoolss_SetPrinterDataEx(
2236                 [in,ref] policy_handle *handle,
2237                 [in]     [string,charset(UTF16)] uint16 key_name[],
2238                 [in]     [string,charset(UTF16)] uint16 value_name[],
2239                 [in]     winreg_Type type,
2240                 [in,ref] [size_is(offered)] uint8 *data,
2241                 [in]     uint32 offered
2242         );
2243
2244         /******************/
2245         /* Function: 0x4e */
2246         WERROR spoolss_GetPrinterDataEx(
2247                 [in,ref] policy_handle *handle,
2248                 [in]     [string,charset(UTF16)] uint16 key_name[],
2249                 [in]     [string,charset(UTF16)] uint16 value_name[],
2250                 [out,ref] winreg_Type *type,
2251                 [out,ref] [size_is(offered)] uint8 *data,
2252                 [in]     uint32 offered,
2253                 [out,ref] uint32 *needed
2254         );
2255
2256         /******************/
2257         /* Function: 0x4f */
2258
2259         typedef [relative_base,public,gensize] struct {
2260                 [relative] nstring *value_name;
2261                 [value(2*strlen_m_term(value_name))] uint32 value_name_len;
2262                 winreg_Type type;
2263                 [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING)] DATA_BLOB *data;
2264                 [value(data->length)] uint32 data_length;
2265         } spoolss_PrinterEnumValues;
2266
2267         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx(
2268                 [in,ref] policy_handle *handle,
2269                 [in]     [string,charset(UTF16)] uint16 key_name[],
2270                 [out] DATA_BLOB info,
2271                 [in] uint32 offered,
2272                 [out,ref] uint32 *needed,
2273                 [out,ref] uint32 *count
2274         );
2275         [public,noopnum,noprint] void __spoolss_EnumPrinterDataEx(
2276                 [in] uint32 count,
2277                 [out] spoolss_PrinterEnumValues info[count]
2278         );
2279         [nopull,nopush] WERROR spoolss_EnumPrinterDataEx(
2280                 [in,ref] policy_handle *handle,
2281                 [in]     [string,charset(UTF16)] uint16 key_name[],
2282                 [in] uint32 offered,
2283                 [out,ref] uint32 *count,
2284                 [out,ref,size_is(,*count)] spoolss_PrinterEnumValues **info,
2285                 [out,ref] uint32 *needed
2286         );
2287
2288         typedef [nodiscriminant] union {
2289                 [case(0)];
2290                 [case(1)];
2291                 [default] nstring_array string_array;
2292         } spoolss_KeyNames;
2293
2294         /******************/
2295         /* Function: 0x50 */
2296         [public] WERROR spoolss_EnumPrinterKey(
2297                 [in, ref] policy_handle *handle,
2298                 [in] [string,charset(UTF16)] uint16 key_name[],
2299                 [out,ref] uint32 *_ndr_size,
2300                 [out,ref,subcontext(0),subcontext_size(*_ndr_size*2),switch_is(*_ndr_size)] spoolss_KeyNames *key_buffer,
2301                 [in] uint32 offered,
2302                 [out,ref] uint32 *needed
2303         );
2304
2305         /******************/
2306         /* Function: 0x51 */
2307         WERROR spoolss_DeletePrinterDataEx(
2308                 [in,ref] policy_handle *handle,
2309                 [in] [string,charset(UTF16)] uint16 key_name[],
2310                 [in] [string,charset(UTF16)] uint16 value_name[]
2311         );
2312
2313         /******************/
2314         /* Function: 0x52 */
2315         WERROR spoolss_DeletePrinterKey(
2316                 [in,ref] policy_handle *handle,
2317                 [in] [string,charset(UTF16)] uint16 key_name[]
2318         );
2319
2320         /******************/
2321         /* Function: 0x53 */
2322         [todo] WERROR spoolss_53(
2323         );
2324
2325         /******************/
2326         /* Function: 0x54 */
2327         typedef [public,bitmap32bit] bitmap {
2328                 DPD_DELETE_UNUSED_FILES         = 0x00000001,
2329                 DPD_DELETE_SPECIFIC_VERSION     = 0x00000002,
2330                 DPD_DELETE_ALL_FILES            = 0x00000004
2331         } spoolss_DeleteDriverFlags;
2332
2333         WERROR spoolss_DeletePrinterDriverEx(
2334                 [in,unique] [string,charset(UTF16)] uint16 *server,
2335                 [in] [string,charset(UTF16)] uint16 architecture[],
2336                 [in] [string,charset(UTF16)] uint16 driver[],
2337                 [in] spoolss_DeleteDriverFlags delete_flags,
2338                 [in] uint32 version
2339         );
2340
2341         /******************/
2342         /* Function: 0x55 */
2343         [todo] WERROR spoolss_55(
2344         );
2345
2346         /******************/
2347         /* Function: 0x56 */
2348         [todo] WERROR spoolss_56(
2349         );
2350
2351         /******************/
2352         /* Function: 0x57 */
2353         [todo] WERROR spoolss_57(
2354         );
2355
2356         /******************/
2357         /* Function: 0x58 */
2358
2359         typedef [v1_enum] enum {
2360                 PROTOCOL_RAWTCP_TYPE    = 1,
2361                 PROTOCOL_LPR_TYPE       = 2
2362         } spoolss_PortProtocol;
2363
2364         typedef [public] struct {
2365                 [charset(UTF16)] uint16 portname[64];
2366                 [value(0x00000001)] uint32 version;
2367                 spoolss_PortProtocol protocol;
2368                 [value(sizeof(r))] uint32 size;
2369                 uint32 reserved;
2370                 [charset(UTF16)] uint16 hostaddress[49];
2371                 [charset(UTF16)] uint16 snmpcommunity[33];
2372                 uint32 dblspool;
2373                 [charset(UTF16)] uint16 queue[33];
2374                 [charset(UTF16)] uint16 ip_address[16]; /* s3 had 17 */
2375                 [charset(UTF16)] uint16 hardware_address[13];
2376                 [charset(UTF16)] uint16 device_type[257];
2377                 uint32 port_number;
2378                 boolean32 snmp_enabled;
2379                 uint32 snmp_dev_index;
2380         } spoolss_PortData1;
2381
2382         typedef [public] struct {
2383                 [charset(UTF16)] uint16 portname[64];
2384                 [value(0x00000002)] uint32 version;
2385                 spoolss_PortProtocol protocol;
2386                 [value(sizeof(r))] uint32 size;
2387                 uint32 reserved;
2388                 [charset(UTF16)] uint16 hostaddress[128];
2389                 [charset(UTF16)] uint16 snmpcommunity[33];
2390                 uint32 dblspool;
2391                 [charset(UTF16)] uint16 queue[33];
2392                 [charset(UTF16)] uint16 device_type[257];
2393                 uint32 port_number;
2394                 boolean32 snmp_enabled;
2395                 uint32 snmp_dev_index;
2396                 uint32 port_monitor_mib_index;
2397         } spoolss_PortData2;
2398
2399         typedef [public] struct {
2400                 nstring dll_name;
2401         } spoolss_MonitorUi;
2402
2403         WERROR spoolss_XcvData(
2404                 [in,ref] policy_handle *handle,
2405                 [in] [string,charset(UTF16)] uint16 function_name[],
2406                 [in] DATA_BLOB in_data,
2407                 [in,value(r->in.in_data.length)] uint32 _in_data_length,
2408                 [out,ref] [size_is(out_data_size)] uint8 *out_data,
2409                 [in] uint32 out_data_size,
2410                 [out,ref] uint32 *needed,
2411                 [in,out,ref] uint32 *status_code
2412         );
2413
2414         /******************/
2415         /* Function: 0x59 */
2416
2417         typedef [bitmap32bit] bitmap {
2418                 APD_STRICT_UPGRADE              = 0x00000001,
2419                 APD_STRICT_DOWNGRADE            = 0x00000002,
2420                 APD_COPY_ALL_FILES              = 0x00000004,
2421                 APD_COPY_NEW_FILES              = 0x00000008,
2422                 APD_COPY_FROM_DIRECTORY         = 0x00000010,
2423                 APD_DONT_COPY_FILES_TO_CLUSTER  = 0x00001000,
2424                 APD_COPY_TO_ALL_SPOOLERS        = 0x00002000,
2425                 APD_RETURN_BLOCKING_STATUS_CODE = 0x00010000
2426         } spoolss_AddPrinterDriverExFlags;
2427
2428         [public] WERROR spoolss_AddPrinterDriverEx(
2429                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2430                 [in,ref] spoolss_AddDriverInfoCtr *info_ctr,
2431                 [in] spoolss_AddPrinterDriverExFlags flags
2432         );
2433
2434         /******************/
2435         /* Function: 0x5a */
2436         [todo] WERROR spoolss_5a(
2437         );
2438
2439         /******************/
2440         /* Function: 0x5b */
2441         [todo] WERROR spoolss_5b(
2442         );
2443
2444         /******************/
2445         /* Function: 0x5c */
2446         [todo] WERROR spoolss_5c(
2447         );
2448
2449         /******************/
2450         /* Function: 0x5d */
2451         [todo] WERROR spoolss_5d(
2452         );
2453
2454         /******************/
2455         /* Function: 0x5e */
2456         [todo] WERROR spoolss_5e(
2457         );
2458
2459         /******************/
2460         /* Function: 0x5f */
2461         [todo] WERROR spoolss_5f(
2462         );
2463 }