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