s3-spoolss: move PRINTER_ENUM_ICONMASK to IDL.
[samba.git] / librpc / idl / spoolss.idl
1 #include "idl_types.h"
2
3 /*
4   spoolss interface definitions
5 */
6 import "misc.idl", "security.idl", "winreg.idl";
7
8 [ 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 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                 [relative] nstring *printername;
30                 [relative] nstring *servername;
31                 uint32 cjobs;
32                 uint32 total_jobs;
33                 uint32 total_bytes;
34                 spoolss_Time time;              
35                 uint32 global_counter;
36                 uint32 total_pages;
37                 uint32 version;
38                 uint32 unknown10;
39                 uint32 unknown11;
40                 uint32 unknown12;
41                 uint32 session_counter;
42                 uint32 unknown14;
43                 uint32 printer_errors;
44                 uint32 unknown16;
45                 uint32 unknown17;
46                 uint32 unknown18;
47                 uint32 unknown19;
48                 uint32 change_id;
49                 uint32 unknown21;
50                 uint32 status;
51                 uint32 unknown23;
52                 uint32 c_setprinter;
53                 uint16 unknown25;
54                 uint16 unknown26;
55                 uint32 unknown27;
56                 uint32 unknown28;
57                 uint32 unknown29;
58         } spoolss_PrinterInfo0;
59
60         typedef [public,gensize] struct {
61                 [charset(UTF16)] uint16 devicename[32];
62                 uint16 specversion;
63                 uint16 driverversion;
64                 uint16 size;
65                 [value(r->driverextra_data.length)] uint16 __driverextra_length;
66                 uint32 fields;
67                 uint16 orientation;
68                 uint16 papersize;
69                 uint16 paperlength;
70                 uint16 paperwidth;
71                 uint16 scale;
72                 uint16 copies;
73                 uint16 defaultsource;
74                 uint16 printquality;
75                 uint16 color;
76                 uint16 duplex;
77                 uint16 yresolution;
78                 uint16 ttoption;
79                 uint16 collate;
80                 [charset(UTF16)] uint16 formname[32];
81                 uint16 logpixels;
82                 uint32 bitsperpel;
83                 uint32 pelswidth;
84                 uint32 pelsheight;
85                 uint32 displayflags;
86                 uint32 displayfrequency;
87                 uint32 icmmethod;
88                 uint32 icmintent;
89                 uint32 mediatype;
90                 uint32 dithertype;
91                 uint32 reserved1;
92                 uint32 reserved2;
93                 uint32 panningwidth;
94                 uint32 panningheight;
95                 [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
96         } spoolss_DeviceMode;
97
98         typedef [public] bitmap {
99                 PRINTER_ENUM_DEFAULT     = 0x00000001,
100                 PRINTER_ENUM_LOCAL       = 0x00000002,
101                 PRINTER_ENUM_CONNECTIONS = 0x00000004,
102                 PRINTER_ENUM_FAVORITE    = 0x00000004,
103                 PRINTER_ENUM_NAME        = 0x00000008,
104                 PRINTER_ENUM_REMOTE      = 0x00000010,
105                 PRINTER_ENUM_SHARED      = 0x00000020,
106                 PRINTER_ENUM_NETWORK     = 0x00000040,
107                 PRINTER_ENUM_EXPAND      = 0x00004000,
108                 PRINTER_ENUM_CONTAINER   = 0x00008000,
109                 PRINTER_ENUM_ICON1       = 0x00010000,
110                 PRINTER_ENUM_ICON2       = 0x00020000,
111                 PRINTER_ENUM_ICON3       = 0x00040000,
112                 PRINTER_ENUM_ICON4       = 0x00080000,
113                 PRINTER_ENUM_ICON5       = 0x00100000,
114                 PRINTER_ENUM_ICON6       = 0x00200000,
115                 PRINTER_ENUM_ICON7       = 0x00400000,
116                 PRINTER_ENUM_ICON8       = 0x00800000,
117                 PRINTER_ENUM_HIDE        = 0x01000000
118         } spoolss_EnumPrinterFlags;
119
120         const int PRINTER_ENUM_ICONMASK = (PRINTER_ENUM_ICON1 |
121                                            PRINTER_ENUM_ICON2 |
122                                            PRINTER_ENUM_ICON3 |
123                                            PRINTER_ENUM_ICON4 |
124                                            PRINTER_ENUM_ICON5 |
125                                            PRINTER_ENUM_ICON6 |
126                                            PRINTER_ENUM_ICON7 |
127                                            PRINTER_ENUM_ICON8); /* 0x00ff0000 */
128
129         typedef struct {
130                 spoolss_EnumPrinterFlags flags;
131                 [relative] nstring *name;
132                 [relative] nstring *description;
133                 [relative] nstring *comment;
134         } spoolss_PrinterInfo1;
135
136         typedef bitmap {
137                 PRINTER_ATTRIBUTE_QUEUED                = 0x00000001,
138                 PRINTER_ATTRIBUTE_DIRECT                = 0x00000002,
139                 PRINTER_ATTRIBUTE_DEFAULT               = 0x00000004,
140                 PRINTER_ATTRIBUTE_SHARED                = 0x00000008,
141                 PRINTER_ATTRIBUTE_NETWORK               = 0x00000010,
142                 PRINTER_ATTRIBUTE_HIDDEN                = 0x00000020,
143                 PRINTER_ATTRIBUTE_LOCAL                 = 0x00000040,
144                 PRINTER_ATTRIBUTE_ENABLE_DEVQ           = 0x00000080,
145                 PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS       = 0x00000100,
146                 PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST     = 0x00000200,
147                 PRINTER_ATTRIBUTE_WORK_OFFLINE          = 0x00000400,
148                 PRINTER_ATTRIBUTE_ENABLE_BIDI           = 0x00000800,
149                 PRINTER_ATTRIBUTE_RAW_ONLY              = 0x00001000,
150                 PRINTER_ATTRIBUTE_PUBLISHED             = 0x00002000,
151                 PRINTER_ATTRIBUTE_FAX                   = 0x00004000,
152                 PRINTER_ATTRIBUTE_TS                    = 0x00008000
153         } spoolss_PrinterAttributes;
154
155         typedef bitmap {
156                 PRINTER_STATUS_PAUSED           = 0x00000001,
157                 PRINTER_STATUS_ERROR            = 0x00000002,
158                 PRINTER_STATUS_PENDING_DELETION = 0x00000004,
159                 PRINTER_STATUS_PAPER_JAM        = 0x00000008,
160                 PRINTER_STATUS_PAPER_OUT        = 0x00000010,
161                 PRINTER_STATUS_MANUAL_FEED      = 0x00000020,
162                 PRINTER_STATUS_PAPER_PROBLEM    = 0x00000040,
163                 PRINTER_STATUS_OFFLINE          = 0x00000080,
164                 PRINTER_STATUS_IO_ACTIVE        = 0x00000100,
165                 PRINTER_STATUS_BUSY             = 0x00000200,
166                 PRINTER_STATUS_PRINTING         = 0x00000400,
167                 PRINTER_STATUS_OUTPUT_BIN_FULL  = 0x00000800,
168                 PRINTER_STATUS_NOT_AVAILABLE    = 0x00001000,
169                 PRINTER_STATUS_WAITING          = 0x00002000,
170                 PRINTER_STATUS_PROCESSING       = 0x00004000,
171                 PRINTER_STATUS_INITIALIZING     = 0x00008000,
172                 PRINTER_STATUS_WARMING_UP       = 0x00010000,
173                 PRINTER_STATUS_TONER_LOW        = 0x00020000,
174                 PRINTER_STATUS_NO_TONER         = 0x00040000,
175                 PRINTER_STATUS_PAGE_PUNT        = 0x00080000,
176                 PRINTER_STATUS_USER_INTERVENTION= 0x00100000,
177                 PRINTER_STATUS_OUT_OF_MEMORY    = 0x00200000,
178                 PRINTER_STATUS_DOOR_OPEN        = 0x00400000,
179                 PRINTER_STATUS_SERVER_UNKNOWN   = 0x00800000,
180                 PRINTER_STATUS_POWER_SAVE       = 0x01000000
181         } spoolss_PrinterStatus;
182
183         typedef struct {
184                 [relative] nstring *servername;
185                 [relative] nstring *printername;
186                 [relative] nstring *sharename;
187                 [relative] nstring *portname;
188                 [relative] nstring *drivername;
189                 [relative] nstring *comment;
190                 [relative] nstring *location;
191                 [relative,subcontext(0)] spoolss_DeviceMode *devmode;
192                 [relative] nstring *sepfile;
193                 [relative] nstring *printprocessor;
194                 [relative] nstring *datatype;
195                 [relative] nstring *parameters;
196                 [relative,subcontext(0)] security_descriptor *secdesc;
197                 spoolss_PrinterAttributes attributes;
198                 uint32 priority;
199                 uint32 defaultpriority;
200                 uint32 starttime;
201                 uint32 untiltime;
202                 spoolss_PrinterStatus status;
203                 uint32 cjobs;
204                 uint32 averageppm;
205         } spoolss_PrinterInfo2;
206
207         typedef struct {
208                 [relative,subcontext(0)] security_descriptor *secdesc;
209         } spoolss_PrinterInfo3;
210
211         typedef struct {
212                 [relative] nstring *printername;
213                 [relative] nstring *servername;
214                 spoolss_PrinterAttributes attributes;
215         } spoolss_PrinterInfo4;
216
217         typedef struct {
218                 [relative] nstring *printername;
219                 [relative] nstring *portname;
220                 spoolss_PrinterAttributes attributes;
221                 uint32 device_not_selected_timeout;
222                 uint32 transmission_retry_timeout;
223         } spoolss_PrinterInfo5;
224
225         typedef struct {
226                 spoolss_PrinterStatus status;
227         } spoolss_PrinterInfo6;
228
229         typedef bitmap {
230                 DSPRINT_PUBLISH         = 0x00000001,
231                 DSPRINT_UPDATE          = 0x00000002,
232                 DSPRINT_UNPUBLISH       = 0x00000004,
233                 DSPRINT_REPUBLISH       = 0x00000008,
234                 DSPRINT_PENDING         = 0x80000000
235         } spoolss_DsPrintAction;
236
237         typedef struct {
238                 [relative] nstring *guid; /* text form of printer guid */
239                 spoolss_DsPrintAction action;
240         } spoolss_PrinterInfo7;
241
242         typedef struct {
243                 [relative,subcontext(0)] spoolss_DeviceMode *devmode;
244         } spoolss_DeviceModeInfo;
245
246         typedef [nodiscriminant,relative_base,public] union {
247                 [case(0)] spoolss_PrinterInfo0 info0;
248                 [case(1)] spoolss_PrinterInfo1 info1;
249                 [case(2)] spoolss_PrinterInfo2 info2;
250                 [case(3)] spoolss_PrinterInfo3 info3;
251                 [case(4)] spoolss_PrinterInfo4 info4;
252                 [case(5)] spoolss_PrinterInfo5 info5;
253                 [case(6)] spoolss_PrinterInfo6 info6;
254                 [case(7)] spoolss_PrinterInfo7 info7;
255                 [case(8)] spoolss_DeviceModeInfo info8;
256                 [case(9)] spoolss_DeviceModeInfo info9;
257                 [default];
258         } spoolss_PrinterInfo;
259
260         /******************/
261         /* Function: 0x00 */
262         /* we are using this as internal parsing code */
263         [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
264                 [in] spoolss_EnumPrinterFlags flags,
265                 [in,unique] [string,charset(UTF16)] uint16 *server,
266                 [in] uint32 level,
267                 [in,unique] DATA_BLOB *buffer,
268                 [in] uint32 offered,
269                 [out,unique] DATA_BLOB *info,
270                 [out,ref] uint32 *needed,
271                 [out] uint32 count
272         );
273         [public,noopnum,noprint] void __spoolss_EnumPrinters(
274                 [in] uint32 level,
275                 [in] uint32 count,
276                 [out,switch_is(level)] spoolss_PrinterInfo info[count]
277         );
278         [nopull,nopush] WERROR spoolss_EnumPrinters(
279                 [in] spoolss_EnumPrinterFlags flags,
280                 [in,unique] [string,charset(UTF16)] uint16 *server,
281                 [in] uint32 level,
282                 [in,unique] DATA_BLOB *buffer,
283                 [in] uint32 offered,
284                 /* what we have here is a subcontext containing an array of no discriminant unions
285                  * and the array has no size in front
286                  */
287                 [out,unique,switch_is(level),size_is(count)] spoolss_PrinterInfo *info,
288                 [out,ref] uint32 *needed,
289                 [out] uint32 count
290         );
291
292         /******************/
293         /* Function: 0x01 */
294         typedef struct {
295                 [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->iconv_convenience, ndr->flags))] uint32 _ndr_size;
296                 [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
297         } spoolss_DevmodeContainer;
298
299         [public] WERROR spoolss_OpenPrinter(
300                 [in,unique] [string,charset(UTF16)] uint16 *printername,
301                 [in,unique] [string,charset(UTF16)] uint16 *datatype,
302                 [in] spoolss_DevmodeContainer devmode_ctr,
303                 [in] uint32 access_mask,
304                 [out,ref] policy_handle *handle
305         );
306
307         /******************/
308         /* Function: 0x02 */
309         typedef struct {
310                 uint32 job_id;
311                 [relative] nstring *printer_name;
312                 [relative] nstring *server_name;
313                 [relative] nstring *user_name;
314                 [relative] nstring *document_name;
315                 [relative] nstring *data_type;
316                 [relative] nstring *text_status;
317                 uint32 status;
318                 uint32 priority;
319                 uint32 position;
320                 uint32 total_pages;
321                 uint32 pages_printed;
322                 spoolss_Time time;
323         } spoolss_JobInfo1;
324
325         typedef [nodiscriminant,relative_base,public] union {
326                 [case(1)] spoolss_JobInfo1 info1;
327                 [case(2)]; /* TODO */
328                 [case(3)]; /* TODO */
329                 [default];
330         } spoolss_JobInfo;
331
332         typedef struct {
333                 uint32 level;
334                 [switch_is(level)] spoolss_JobInfo info;
335         } spoolss_JobInfoContainer;
336
337         typedef [v1_enum] enum {
338                 SPOOLSS_JOB_CONTROL_PAUSE               = 1,
339                 SPOOLSS_JOB_CONTROL_RESUME              = 2,
340                 SPOOLSS_JOB_CONTROL_CANCEL              = 3,
341                 SPOOLSS_JOB_CONTROL_RESTART             = 4,
342                 SPOOLSS_JOB_CONTROL_DELETE              = 5,
343                 SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER     = 6,
344                 SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED   = 7
345         } spoolss_JobControl;
346
347         WERROR spoolss_SetJob(
348                 [in,ref] policy_handle *handle,
349                 [in] uint32 job_id,
350                 [in,unique] spoolss_JobInfoContainer *ctr,
351                 [in] spoolss_JobControl command
352         );
353
354         /******************/
355         /* Function: 0x03 */
356         WERROR spoolss_GetJob(
357                 [in,ref] policy_handle *handle,
358                 [in]     uint32 job_id,
359                 [in]     uint32 level,
360                 [in,unique] DATA_BLOB *buffer,
361                 [in]     uint32 offered,
362                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
363                 [out,ref] uint32 *needed
364         );
365
366         /******************/
367         /* Function: 0x04 */
368         [public,noopnum,noprint] WERROR _spoolss_EnumJobs(
369                 [in,ref] policy_handle *handle,
370                 [in]     uint32 firstjob,
371                 [in]     uint32 numjobs,
372                 [in]     uint32 level,
373                 [in,unique] DATA_BLOB *buffer,
374                 [in]     uint32 offered,
375                 [out,unique] DATA_BLOB *info,
376                 [out,ref] uint32 *needed,
377                 [out]    uint32 count
378         );
379         [public,noopnum,noprint] void __spoolss_EnumJobs(
380                 [in] uint32 level,
381                 [in] uint32 count,
382                 [out,switch_is(level)] spoolss_JobInfo info[count]
383         );
384         [nopull,nopush] WERROR spoolss_EnumJobs(
385                 [in,ref] policy_handle *handle,
386                 [in]     uint32 firstjob,
387                 [in]     uint32 numjobs,
388                 [in]     uint32 level,
389                 [in,unique] DATA_BLOB *buffer,
390                 [in]     uint32 offered,
391                 [out,unique,switch_is(level),size_is(count)] spoolss_JobInfo *info,
392                 [out,ref] uint32 *needed,
393                 [out]    uint32 count
394         );
395
396         /******************/
397         /* Function: 0x05 */
398         [todo] WERROR spoolss_AddPrinter(
399                 /* This function is not implemented in Samba 3 as no
400                    clients have been observed using it. */
401         );
402
403         /******************/
404         /* Function: 0x06 */
405         WERROR spoolss_DeletePrinter(
406                 [in] policy_handle *handle
407         );
408
409         /******************/
410         /* Function: 0x07 */
411         typedef [v1_enum] enum {
412                 SPOOLSS_PRINTER_CONTROL_UNPAUSE    = 0,
413                 SPOOLSS_PRINTER_CONTROL_PAUSE      = 1,
414                 SPOOLSS_PRINTER_CONTROL_RESUME     = 2,
415                 SPOOLSS_PRINTER_CONTROL_PURGE      = 3,
416                 SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
417         } spoolss_PrinterControl;
418
419         typedef [switch_type(uint32)] union {
420                 [case(0)] spoolss_PrinterInfo0 *info0;
421                 [case(1)] spoolss_PrinterInfo1 *info1;
422                 [case(2)] spoolss_PrinterInfo2 *info2;
423                 [case(3)] spoolss_PrinterInfo3 *info3;
424                 [case(4)] spoolss_PrinterInfo4 *info4;
425                 [case(5)] spoolss_PrinterInfo5 *info5;
426                 [case(6)] spoolss_PrinterInfo6 *info6;
427                 [case(7)] spoolss_PrinterInfo7 *info7;
428                 [case(8)] spoolss_DeviceModeInfo *info8;
429                 [case(9)] spoolss_DeviceModeInfo *info9;
430                 [default];
431         } spoolss_SetPrinterInfo;
432
433         WERROR spoolss_SetPrinter(
434                 [in,ref] policy_handle *handle,
435                 [in] uint32 level,
436                 [in,switch_is(level)] spoolss_SetPrinterInfo info,
437                 [in] spoolss_DevmodeContainer devmode_ctr,
438                 [in] sec_desc_buf secdesc_ctr,
439                 [in] spoolss_PrinterControl command
440         );
441
442         /******************/
443         /* Function: 0x08 */
444         [public] WERROR spoolss_GetPrinter(
445                 [in,ref] policy_handle *handle,
446                 [in]     uint32 level,
447                 [in,unique] DATA_BLOB *buffer,
448                 [in]     uint32 offered,
449                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
450                 [out,ref] uint32 *needed
451         );
452
453         /******************/
454         /* Function: 0x09 */
455         [todo] WERROR spoolss_AddPrinterDriver(
456         );
457
458         typedef struct {
459                 [relative] nstring *driver_name;
460         } spoolss_DriverInfo1;
461
462         typedef [v1_enum] enum {
463                 SPOOLSS_DRIVER_VERSION_9X       = 0,
464                 SPOOLSS_DRIVER_VERSION_NT35     = 1,
465                 SPOOLSS_DRIVER_VERSION_NT4      = 2,
466                 SPOOLSS_DRIVER_VERSION_200X     = 3
467         } spoolss_DriverOSVersion;
468
469         typedef struct {
470                 spoolss_DriverOSVersion version;
471                 [relative] nstring *driver_name;
472                 [relative] nstring *architecture;
473                 [relative] nstring *driver_path;
474                 [relative] nstring *data_file;
475                 [relative] nstring *config_file;
476         } spoolss_DriverInfo2;
477
478         typedef struct {
479                 spoolss_DriverOSVersion version;
480                 [relative] nstring *driver_name;
481                 [relative] nstring *architecture;
482                 [relative] nstring *driver_path;
483                 [relative] nstring *data_file;
484                 [relative] nstring *config_file;
485                 [relative] nstring *help_file;
486                 [relative] nstring_array *dependent_files;
487                 [relative] nstring *monitor_name;
488                 [relative] nstring *default_datatype;
489         } spoolss_DriverInfo3;
490
491         typedef struct {
492                 spoolss_DriverOSVersion version;
493                 [relative] nstring *driver_name;
494                 [relative] nstring *architecture;
495                 [relative] nstring *driver_path;
496                 [relative] nstring *data_file;
497                 [relative] nstring *config_file;
498                 [relative] nstring *help_file;
499                 [relative] nstring_array *dependent_files;
500                 [relative] nstring *monitor_name;
501                 [relative] nstring *default_datatype;
502                 [relative] nstring_array *previous_names;
503         } spoolss_DriverInfo4;
504
505         typedef struct {
506                 spoolss_DriverOSVersion version;
507                 [relative] nstring *driver_name;
508                 [relative] nstring *architecture;
509                 [relative] nstring *driver_path;
510                 [relative] nstring *data_file;
511                 [relative] nstring *config_file;
512                 uint32 driver_attributes;
513                 uint32 config_version;
514                 uint32 driver_version;
515         } spoolss_DriverInfo5;
516
517         typedef struct {
518                 spoolss_DriverOSVersion version;
519                 [relative] nstring *driver_name;
520                 [relative] nstring *architecture;
521                 [relative] nstring *driver_path;
522                 [relative] nstring *data_file;
523                 [relative] nstring *config_file;
524                 [relative] nstring *help_file;
525                 [relative] nstring_array *dependent_files;
526                 [relative] nstring *monitor_name;
527                 [relative] nstring *default_datatype;
528                 [relative] nstring_array *previous_names;
529                 NTTIME driver_data;
530                 hyper driver_version;
531                 [relative] nstring *manufacturer_name;
532                 [relative] nstring *manufacturer_url;
533                 [relative] nstring *hardware_id;
534                 [relative] nstring *provider;
535         } spoolss_DriverInfo6;
536
537         typedef [nodiscriminant,relative_base,public] union {
538                 [case(1)] spoolss_DriverInfo1 info1;
539                 [case(2)] spoolss_DriverInfo2 info2;
540                 [case(3)] spoolss_DriverInfo3 info3;
541                 [case(4)] spoolss_DriverInfo4 info4;
542                 [case(5)] spoolss_DriverInfo5 info5;
543                 [case(6)] spoolss_DriverInfo6 info6;
544                 [default];
545         } spoolss_DriverInfo;
546
547         /******************/
548         /* Function: 0x0a */
549         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
550                 [in,unique] [string,charset(UTF16)] uint16 *server,
551                 [in,unique] [string,charset(UTF16)] uint16 *environment,
552                 [in] uint32 level,
553                 [in,unique] DATA_BLOB *buffer,
554                 [in] uint32 offered,
555                 [out,unique] DATA_BLOB *info,
556                 [out,ref] uint32 *needed,
557                 [out] uint32 count
558         );
559         [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
560                 [in] uint32 level,
561                 [in] uint32 count,
562                 [out,switch_is(level)] spoolss_DriverInfo info[count]
563         );
564         [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
565                 [in,unique] [string,charset(UTF16)] uint16 *server,
566                 [in,unique] [string,charset(UTF16)] uint16 *environment,
567                 [in] uint32 level,
568                 [in,unique] DATA_BLOB *buffer,
569                 [in] uint32 offered,
570                 [out,unique,switch_is(level),size_is(count)] spoolss_DriverInfo *info,
571                 [out,ref] uint32 *needed,
572                 [out] uint32 count
573         );
574
575         /******************/
576         /* Function: 0x0b */
577         [todo] WERROR spoolss_GetPrinterDriver(
578         );
579
580         /******************/
581         /* Function: 0x0c */
582         typedef struct {
583                 nstring directory_name;
584         } spoolss_DriverDirectoryInfo1;
585
586         /* NOTE: it's seems that w2k3 completly ignores the level
587                  in its server code
588          */
589         typedef [nodiscriminant,relative_base,gensize,public] union {
590                 [case(1)] spoolss_DriverDirectoryInfo1 info1;
591                 [default] spoolss_DriverDirectoryInfo1 info1;
592         } spoolss_DriverDirectoryInfo;
593
594         [public] WERROR spoolss_GetPrinterDriverDirectory(
595                 [in,unique] [string,charset(UTF16)] uint16 *server,
596                 [in,unique] [string,charset(UTF16)] uint16 *environment,
597                 [in] uint32 level,
598                 [in,unique] DATA_BLOB *buffer,
599                 [in] uint32 offered,
600                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
601                 [out,ref] uint32 *needed
602         );
603
604         /******************/
605         /* Function: 0x0d */
606         WERROR spoolss_DeletePrinterDriver(
607                 [in,unique] [string,charset(UTF16)] uint16 *server,
608                 [in] [string,charset(UTF16)] uint16 architecture[],
609                 [in] [string,charset(UTF16)] uint16 driver[]
610         );
611
612         /******************/
613         /* Function: 0x0e */
614         WERROR spoolss_AddPrintProcessor(
615                 [in,unique] [string,charset(UTF16)] uint16 *server,
616                 [in] [string,charset(UTF16)] uint16 architecture[],
617                 [in] [string,charset(UTF16)] uint16 path_name[],
618                 [in] [string,charset(UTF16)] uint16 print_processor_name[]
619         );
620
621         /******************/
622         /* Function: 0x0f */
623         typedef struct {
624                 [relative] nstring *print_processor_name;
625         } spoolss_PrintProcessorInfo1;
626
627         typedef [nodiscriminant,relative_base,public] union {
628                 [case(1)] spoolss_PrintProcessorInfo1 info1;
629                 [default];
630         } spoolss_PrintProcessorInfo;
631
632         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
633                 [in,unique] [string,charset(UTF16)] uint16 *servername,
634                 [in,unique] [string,charset(UTF16)] uint16 *environment,
635                 [in] uint32 level,
636                 [in,unique] DATA_BLOB *buffer,
637                 [in] uint32 offered,
638                 [out,unique] DATA_BLOB *info,
639                 [out,ref] uint32 *needed,
640                 [out] uint32 count
641         );
642         [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
643                 [in] uint32 level,
644                 [in] uint32 count,
645                 [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
646         );
647         [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
648                 [in,unique] [string,charset(UTF16)] uint16 *servername,
649                 [in,unique] [string,charset(UTF16)] uint16 *environment,
650                 [in] uint32 level,
651                 [in,unique] DATA_BLOB *buffer,
652                 [in] uint32 offered,
653                 [out,unique,switch_is(level),size_is(count)] spoolss_PrintProcessorInfo *info,
654                 [out,ref] uint32 *needed,
655                 [out] uint32 count
656         );
657
658         /******************/
659         /* Function: 0x10 */
660         [todo] WERROR spoolss_GetPrintProcessorDirectory(
661         );
662
663         /******************/
664         /* Function: 0x11 */
665         typedef struct {
666                 [string,charset(UTF16)] uint16 *document_name;
667                 [string,charset(UTF16)] uint16 *output_file;
668                 [string,charset(UTF16)] uint16 *datatype;
669         } spoolss_DocumentInfo1;
670
671         typedef [switch_type(uint32)] union {
672                 [case(1)] spoolss_DocumentInfo1 *info1;
673                 [case(2)]; /* TODO */
674                 [case(3)]; /* TODO */
675                 [default];
676         } spoolss_DocumentInfo;
677
678         WERROR spoolss_StartDocPrinter(
679                 [in,ref] policy_handle *handle,
680                 [in] uint32 level,
681                 [in,switch_is(level)] spoolss_DocumentInfo info,
682                 [out,ref] uint32 *job_id
683         );
684
685         /******************/
686         /* Function: 0x12 */
687         WERROR spoolss_StartPagePrinter(
688                 [in,ref] policy_handle *handle
689         );
690
691         /******************/
692         /* Function: 0x13 */
693         WERROR spoolss_WritePrinter(
694                 [in,ref] policy_handle *handle,
695                 [in] DATA_BLOB data,
696                 [in,value(r->in.data.length)] uint32 _data_size,
697                 [out,ref] uint32 *num_written
698         );
699
700         /******************/
701         /* Function: 0x14 */
702         WERROR spoolss_EndPagePrinter(
703                 [in,ref] policy_handle *handle
704         );
705
706         /******************/
707         /* Function: 0x15 */
708         WERROR spoolss_AbortPrinter(
709                 [in,ref] policy_handle *handle
710         );
711
712         /******************/
713         /* Function: 0x16 */
714         WERROR spoolss_ReadPrinter(
715                 [in,ref] policy_handle *handle,
716                 [out,ref] [size_is(data_size)] uint8 *data,
717                 [in] uint32 data_size,
718                 [out,ref] uint32 *_data_size
719         );
720
721         /******************/
722         /* Function: 0x17 */
723         WERROR spoolss_EndDocPrinter(
724                 [in,ref] policy_handle *handle
725         );
726
727         /******************/
728         /* Function: 0x18 */
729         [todo] WERROR spoolss_AddJob(
730         );
731
732         /******************/
733         /* Function: 0x19 */
734         [todo] WERROR spoolss_ScheduleJob(
735         );
736
737         /******************/
738         /* Function: 0x1a */
739         const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
740
741         typedef [public,gensize] struct {
742                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
743                 uint32 major;
744                 uint32 minor;
745                 uint32 build;
746                 [value(2)] uint32 unknown;
747                 [subcontext(0),subcontext_size(256)] nstring extra_string;
748         } spoolss_OSVersion;
749
750         typedef [public,gensize] struct {
751                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
752                 uint32 major;
753                 uint32 minor;
754                 uint32 build;
755                 [value(2)] uint32 unknown1;
756                 [subcontext(0),subcontext_size(256)] nstring extra_string;
757                 uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
758                 uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
759         } spoolss_OSVersionEx;
760
761         typedef [v1_enum] enum {
762                 SPOOLSS_PRINTER_DATA_TYPE_NULL = 0,
763                 SPOOLSS_PRINTER_DATA_TYPE_STRING = 1,
764                 SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3,
765                 SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4,
766                 SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY = 7
767         } spoolss_PrinterDataType;
768
769         typedef [nodiscriminant,public,gensize] union {
770                 [case(SPOOLSS_PRINTER_DATA_TYPE_NULL)];
771                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string;
772                 [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
773                 [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value;
774                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] nstring_array string_array;
775                 [default,flag(NDR_REMAINING)] DATA_BLOB data;
776         } spoolss_PrinterData;
777
778         [noopnum,noprint,public] WERROR _spoolss_GetPrinterData(
779                 [in,ref] policy_handle *handle,
780                 [in]     [string,charset(UTF16)] uint16 value_name[],
781                 [in]     uint32 offered,
782                 [out,ref] spoolss_PrinterDataType *type,
783                 [out]    DATA_BLOB data,
784                 [out,ref] uint32 *needed
785         );
786         [noopnum,noprint,public] void __spoolss_GetPrinterData(
787                 [in] spoolss_PrinterDataType type,
788                 [out,switch_is(type)] spoolss_PrinterData data
789         );
790         [nopull,nopush,public] WERROR spoolss_GetPrinterData(
791                 [in,ref] policy_handle *handle,
792                 [in]     [string,charset(UTF16)] uint16 value_name[],
793                 [in]     uint32 offered,
794                 [out,ref] spoolss_PrinterDataType *type,
795                 [out,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData data,
796                 [out,ref] uint32 *needed
797         );
798
799         /******************/
800         /* Function: 0x1b */
801         [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
802                 [in,ref] policy_handle *handle,
803                 [in] [string,charset(UTF16)] uint16 value_name[],
804                 [in] spoolss_PrinterDataType type,
805                 [in] DATA_BLOB data,
806                 [in] uint32 _offered
807         );
808         [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
809                 [in] spoolss_PrinterDataType type,
810                 [out,switch_is(type)] spoolss_PrinterData data
811         );
812         [nopush] WERROR spoolss_SetPrinterData(
813                 [in,ref] policy_handle *handle,
814                 [in] [string,charset(UTF16)] uint16 value_name[],
815                 [in] spoolss_PrinterDataType type,
816                 [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
817                 [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered
818         );
819
820         /******************/
821         /* Function: 0x1c */
822         [todo] WERROR spoolss_WaitForPrinterChange(
823         );
824
825         /******************/
826         /* Function: 0x1d */
827         [public] WERROR spoolss_ClosePrinter(
828                 [in,out,ref]     policy_handle *handle
829         );
830
831         /******************/
832         /* Function: 0x1e */
833         typedef [v1_enum] enum {
834                 SPOOLSS_FORM_USER       = 0,
835                 SPOOLSS_FORM_BUILTIN    = 1,
836                 SPOOLSS_FORM_PRINTER    = 2
837         } spoolss_FormFlags;
838
839         typedef struct {
840                 uint32 width;
841                 uint32 height;
842         } spoolss_FormSize;
843
844         typedef struct {
845                 uint32 left;
846                 uint32 top;
847                 uint32 right;
848                 uint32 bottom;
849         } spoolss_FormArea;
850
851         typedef struct {
852                 spoolss_FormFlags flags;
853                 [relative] nstring *form_name;
854                 spoolss_FormSize size;
855                 spoolss_FormArea area;
856         } spoolss_FormInfo1;
857
858         typedef [nodiscriminant,relative_base,public,gensize] union {
859                 [case(1)] spoolss_FormInfo1 info1;
860                 [default];
861         } spoolss_FormInfo;
862
863         typedef struct {
864                 spoolss_FormFlags flags;
865                 [string,charset(UTF16)] uint16 *form_name;
866                 spoolss_FormSize size;
867                 spoolss_FormArea area;
868         } spoolss_AddFormInfo1;
869
870         typedef [switch_type(uint32)] union {
871                 [case(1)] spoolss_AddFormInfo1 *info1;
872         } spoolss_AddFormInfo;
873
874         WERROR spoolss_AddForm(
875                 [in,ref] policy_handle *handle,
876                 [in] uint32 level,
877                 [in,switch_is(level)] spoolss_AddFormInfo info
878         );
879
880         /******************/
881         /* Function: 0x1f */
882         WERROR spoolss_DeleteForm(
883                 [in,ref] policy_handle *handle,
884                 [in] [string,charset(UTF16)] uint16 form_name[]
885         );
886
887         /******************/
888         /* Function: 0x20 */
889         WERROR spoolss_GetForm(
890                 [in,ref] policy_handle *handle,
891                 [in] [string,charset(UTF16)] uint16 form_name[],
892                 [in] uint32 level,
893                 [in,unique] DATA_BLOB *buffer,
894                 [in] uint32 offered,
895                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
896                 [out,ref] uint32 *needed
897         );
898
899         /******************/
900         /* Function: 0x21 */
901         WERROR spoolss_SetForm(
902                 [in,ref] policy_handle *handle,
903                 [in] [string,charset(UTF16)] uint16 form_name[],
904                 [in] uint32 level,
905                 [in,switch_is(level)] spoolss_AddFormInfo info
906         );
907
908         /******************/
909         /* Function: 0x22 */
910         [public,noopnum,noprint] WERROR _spoolss_EnumForms(
911                 [in,ref] policy_handle *handle,
912                 [in]     uint32 level,
913                 [in,unique] DATA_BLOB *buffer,
914                 [in]     uint32 offered,
915                 [out,unique] DATA_BLOB *info,
916                 [out,ref] uint32 *needed,
917                 [out]    uint32 count
918         );
919         [public,noopnum,noprint] void __spoolss_EnumForms(
920                 [in] uint32 level,
921                 [in] uint32 count,
922                 [out,switch_is(level)] spoolss_FormInfo info[count]
923         );
924         [nopull,nopush] WERROR spoolss_EnumForms(
925                 [in,ref] policy_handle *handle,
926                 [in]     uint32 level,
927                 [in,unique] DATA_BLOB *buffer,
928                 [in]     uint32 offered,
929                 [out,unique,switch_is(level),size_is(count)] spoolss_FormInfo *info,
930                 [out,ref] uint32 *needed,
931                 [out] uint32 count
932         );
933
934         typedef struct {
935                 [relative] nstring *port_name;
936         } spoolss_PortInfo1;
937
938         typedef bitmap {
939                 SPOOLSS_PORT_TYPE_WRITE         = 0x00000001,
940                 SPOOLSS_PORT_TYPE_READ          = 0x00000002,
941                 SPOOLSS_PORT_TYPE_REDIRECTED    = 0x00000004,
942                 SPOOLSS_PORT_TYPE_NET_ATTACHED  = 0x00000008
943         } spoolss_PortType;
944
945         typedef struct {
946                 [relative] nstring *port_name;
947                 [relative] nstring *monitor_name;
948                 [relative] nstring *description;
949                 spoolss_PortType port_type;
950                 uint32 reserved;
951         } spoolss_PortInfo2;
952
953         typedef [nodiscriminant,relative_base,public] union {
954                 [case(1)] spoolss_PortInfo1 info1;
955                 [case(2)] spoolss_PortInfo2 info2;
956                 [case(3)]; /* TODO */
957                 [default];
958         } spoolss_PortInfo;
959
960         /******************/
961         /* Function: 0x23 */
962         [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
963                 [in,unique] [string,charset(UTF16)] uint16 *servername,
964                 [in] uint32 level,
965                 [in,unique] DATA_BLOB *buffer,
966                 [in] uint32 offered,
967                 [out,unique] DATA_BLOB *info,
968                 [out,ref] uint32 *needed,
969                 [out] uint32 count
970         );
971         [public,noopnum,noprint] void __spoolss_EnumPorts(
972                 [in] uint32 level,
973                 [in] uint32 count,
974                 [out,switch_is(level)] spoolss_PortInfo info[count]
975         );
976         [nopull,nopush] WERROR spoolss_EnumPorts(
977                 [in,unique] [string,charset(UTF16)] uint16 *servername,
978                 [in] uint32 level,
979                 [in,unique] DATA_BLOB *buffer,
980                 [in] uint32 offered,
981                 [out,unique,switch_is(level),size_is(count)] spoolss_PortInfo *info,
982                 [out,ref] uint32 *needed,
983                 [out] uint32 count
984         );
985
986         /******************/
987         /* Function: 0x24 */
988         typedef struct {
989                 [relative] nstring *monitor_name;
990         } spoolss_MonitorInfo1;
991
992         typedef struct {
993                 [relative] nstring *monitor_name;
994                 [relative] nstring *environment;
995                 [relative] nstring *dll_name;
996         } spoolss_MonitorInfo2;
997
998         typedef [nodiscriminant,relative_base,public] union {
999                 [case(1)] spoolss_MonitorInfo1 info1;
1000                 [case(2)] spoolss_MonitorInfo2 info2;
1001                 [default];
1002         } spoolss_MonitorInfo;
1003
1004         [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
1005                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1006                 [in] uint32 level,
1007                 [in,unique] DATA_BLOB *buffer,
1008                 [in] uint32 offered,
1009                 [out,unique] DATA_BLOB *info,
1010                 [out,ref] uint32 *needed,
1011                 [out] uint32 count
1012         );
1013         [public,noopnum,noprint] void __spoolss_EnumMonitors(
1014                 [in] uint32 level,
1015                 [in] uint32 count,
1016                 [out,switch_is(level)] spoolss_MonitorInfo info[count]
1017         );
1018         [nopull,nopush] WERROR spoolss_EnumMonitors(
1019                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1020                 [in] uint32 level,
1021                 [in,unique] DATA_BLOB *buffer,
1022                 [in] uint32 offered,
1023                 [out,unique,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
1024                 [out,ref] uint32 *needed,
1025                 [out] uint32 count
1026         );
1027
1028         /******************/
1029         /* Function: 0x25 */
1030         WERROR spoolss_AddPort(
1031                [in,unique] [string,charset(UTF16)] uint16 *server_name,
1032                [in] uint32 unknown,
1033                [in] [string,charset(UTF16)] uint16 monitor_name[]
1034         );
1035
1036         /******************/
1037         /* Function: 0x26 */
1038         [todo] WERROR spoolss_ConfigurePort(
1039         );
1040
1041         /******************/
1042         /* Function: 0x27 */
1043         [todo] WERROR spoolss_DeletePort(
1044         );
1045
1046         /******************/
1047         /* Function: 0x28 */
1048         [todo] WERROR spoolss_CreatePrinterIC(
1049         );
1050
1051         /******************/
1052         /* Function: 0x29 */
1053         [todo] WERROR spoolss_PlayGDIScriptOnPrinterIC(
1054         );
1055
1056         /******************/
1057         /* Function: 0x2a */
1058         [todo] WERROR spoolss_DeletePrinterIC(
1059         );
1060
1061         /******************/
1062         /* Function: 0x2b */
1063         [todo] WERROR spoolss_AddPrinterConnection(
1064         );
1065
1066         /******************/
1067         /* Function: 0x2c */
1068         [todo] WERROR spoolss_DeletePrinterConnection(
1069         );
1070
1071         /******************/
1072         /* Function: 0x2d */
1073         [todo] WERROR spoolss_PrinterMessageBox(
1074                 /* Marked as obsolete in MSDN.  "Not necessary and has
1075                    no effect". */
1076         );
1077
1078         /******************/
1079         /* Function: 0x2e */
1080         [todo] WERROR spoolss_AddMonitor(
1081         );
1082
1083         /******************/
1084         /* Function: 0x2f */
1085         [todo] WERROR spoolss_DeleteMonitor(
1086         );
1087
1088         /******************/
1089         /* Function: 0x30 */
1090         [todo] WERROR spoolss_DeletePrintProcessor(
1091         );
1092
1093         /******************/
1094         /* Function: 0x31 */
1095         [todo] WERROR spoolss_AddPrintProvidor(
1096         );
1097
1098         /******************/
1099         /* Function: 0x32 */
1100         [todo] WERROR spoolss_DeletePrintProvidor(
1101         );
1102
1103         /******************/
1104         /* Function: 0x33 */
1105         [todo] WERROR spoolss_EnumPrintProcDataTypes(
1106         );
1107
1108         /******************/
1109         /* Function: 0x34 */
1110         [todo] WERROR spoolss_ResetPrinter(
1111         );
1112
1113         /******************/
1114         /* Function: 0x35 */
1115         WERROR spoolss_GetPrinterDriver2(
1116                 [in,ref] policy_handle *handle,
1117                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
1118                 [in]     uint32 level,
1119                 [in,unique] DATA_BLOB *buffer,
1120                 [in]     uint32 offered,
1121                 [in]     uint32 client_major_version,
1122                 [in]     uint32 client_minor_version,
1123                 [out,unique] DATA_BLOB *info,
1124                 [out,ref] uint32 *needed,
1125                 [out,ref] uint32 *server_major_version,
1126                 [out,ref] uint32 *server_minor_version
1127         );
1128
1129         /******************/
1130         /* Function: 0x36 */
1131         [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
1132         );
1133
1134         /******************/
1135         /* Function: 0x37 */
1136         [todo] WERROR spoolss_FindNextPrinterChangeNotification(
1137         );
1138
1139         /******************/
1140         /* Function: 0x38 */
1141         [public] WERROR spoolss_FindClosePrinterNotify(
1142                 [in,ref] policy_handle *handle
1143         );
1144
1145         /******************/
1146         /* Function: 0x39 */
1147         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
1148         );
1149
1150         /******************/
1151         /* Function: 0x3a */
1152         [public] WERROR spoolss_ReplyOpenPrinter(
1153                 [in,string,charset(UTF16)] uint16 server_name[],
1154                 [in] uint32 printer_local,
1155                 [in] winreg_Type type,
1156                 [in] uint32 unknown1,
1157                 [in] uint32 unknown2,
1158                 [out,ref] policy_handle *handle
1159         );
1160
1161         /******************/
1162         /* Function: 0x3b */
1163
1164         typedef [bitmap32bit] bitmap {
1165                 PRINTER_CHANGE_ADD_PRINTER                      = 0x00000001,
1166                 PRINTER_CHANGE_SET_PRINTER                      = 0x00000002,
1167                 PRINTER_CHANGE_DELETE_PRINTER                   = 0x00000004,
1168                 PRINTER_CHANGE_FAILED_CONNECTION_PRINTER        = 0x00000008,
1169                 PRINTER_CHANGE_ADD_JOB                          = 0x00000100,
1170                 PRINTER_CHANGE_SET_JOB                          = 0x00000200,
1171                 PRINTER_CHANGE_DELETE_JOB                       = 0x00000400,
1172                 PRINTER_CHANGE_WRITE_JOB                        = 0x00000800,
1173                 PRINTER_CHANGE_ADD_FORM                         = 0x00010000,
1174                 PRINTER_CHANGE_SET_FORM                         = 0x00020000,
1175                 PRINTER_CHANGE_DELETE_FORM                      = 0x00040000,
1176                 PRINTER_CHANGE_ADD_PORT                         = 0x00100000,
1177                 PRINTER_CHANGE_CONFIGURE_PORT                   = 0x00200000,
1178                 PRINTER_CHANGE_DELETE_PORT                      = 0x00400000,
1179                 PRINTER_CHANGE_ADD_PRINT_PROCESSOR              = 0x01000000,
1180                 PRINTER_CHANGE_DELETE_PRINT_PROCESSOR           = 0x04000000,
1181                 PRINTER_CHANGE_ADD_PRINTER_DRIVER               = 0x10000000,
1182                 PRINTER_CHANGE_SET_PRINTER_DRIVER               = 0x20000000,
1183                 PRINTER_CHANGE_DELETE_PRINTER_DRIVER            = 0x40000000,
1184                 PRINTER_CHANGE_TIMEOUT                          = 0x80000000
1185         } spoolss_PrinterChangeFlags;
1186
1187         const int PRINTER_CHANGE_PRINTER                        = (PRINTER_CHANGE_ADD_PRINTER |
1188                                                                    PRINTER_CHANGE_SET_PRINTER |
1189                                                                    PRINTER_CHANGE_DELETE_PRINTER |
1190                                                                    PRINTER_CHANGE_FAILED_CONNECTION_PRINTER); /* 0x000000FF */
1191
1192         const int PRINTER_CHANGE_JOB                            = (PRINTER_CHANGE_ADD_JOB |
1193                                                                    PRINTER_CHANGE_SET_JOB |
1194                                                                    PRINTER_CHANGE_DELETE_JOB |
1195                                                                    PRINTER_CHANGE_WRITE_JOB); /* 0x0000FF00 */
1196
1197         const int PRINTER_CHANGE_FORM                           = (PRINTER_CHANGE_ADD_FORM |
1198                                                                    PRINTER_CHANGE_SET_FORM |
1199                                                                    PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */
1200
1201         const int PRINTER_CHANGE_PORT                           = (PRINTER_CHANGE_ADD_PORT |
1202                                                                    PRINTER_CHANGE_CONFIGURE_PORT |
1203                                                                    PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */
1204
1205         const int PRINTER_CHANGE_PRINT_PROCESSOR                = (PRINTER_CHANGE_ADD_PRINT_PROCESSOR |
1206                                                                    PRINTER_CHANGE_DELETE_PRINT_PROCESSOR); /* 0x07000000 */
1207
1208         const int PRINTER_CHANGE_PRINTER_DRIVER                 = (PRINTER_CHANGE_ADD_PRINTER_DRIVER |
1209                                                                    PRINTER_CHANGE_SET_PRINTER_DRIVER |
1210                                                                    PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */
1211
1212         const int PRINTER_CHANGE_ALL                            = (PRINTER_CHANGE_JOB |
1213                                                                    PRINTER_CHANGE_FORM |
1214                                                                    PRINTER_CHANGE_PORT |
1215                                                                    PRINTER_CHANGE_PRINT_PROCESSOR |
1216                                                                    PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */
1217         WERROR spoolss_RouterReplyPrinter(
1218                 [in,ref] policy_handle *handle,
1219                 [in] spoolss_PrinterChangeFlags flags,
1220                 [in,range(0,512)] uint32 bufsize,
1221                 [in,unique,size_is(bufsize)] uint8 *buffer
1222         );
1223
1224         /******************/
1225         /* Function: 0x3c */
1226         [public] WERROR spoolss_ReplyClosePrinter(
1227                 [in,out,ref] policy_handle *handle
1228         );
1229
1230         /******************/
1231         /* Function: 0x3d */
1232         [todo] WERROR spoolss_AddPortEx(
1233         );
1234
1235         /******************/
1236         /* Function: 0x3e */
1237         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
1238         );
1239
1240         /******************/
1241         /* Function: 0x3f */
1242         [todo] WERROR spoolss_SpoolerInit(
1243         );
1244
1245         /******************/
1246         /* Function: 0x40 */
1247         [todo] WERROR spoolss_ResetPrinterEx(
1248         );
1249
1250         typedef [enum16bit] enum {
1251                 SPOOLSS_FIELD_SERVER_NAME               =  0,
1252                 SPOOLSS_FIELD_PRINTER_NAME              =  1,
1253                 SPOOLSS_FIELD_SHARE_NAME        =  2,
1254                 SPOOLSS_FIELD_PORT_NAME                 =  3,
1255                 SPOOLSS_FIELD_DRIVER_NAME               =  4,
1256                 SPOOLSS_FIELD_COMMENT                   =  5,
1257                 SPOOLSS_FIELD_LOCATION                  =  6,
1258                 SPOOLSS_FIELD_DEVMODE                   =  7,
1259                 SPOOLSS_FIELD_SEPFILE                   =  8,
1260                 SPOOLSS_FIELD_PRINT_PROCESSOR   =  9,
1261                 SPOOLSS_FIELD_PARAMETERS                = 10,
1262                 SPOOLSS_FIELD_DATATYPE                  = 11,
1263                 SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12,
1264                 SPOOLSS_FIELD_ATTRIBUTES                = 13,
1265                 SPOOLSS_FIELD_PRIORITY                  = 14,
1266                 SPOOLSS_FIELD_DEFAULT_PRIORITY  = 15,
1267                 SPOOLSS_FIELD_START_TIME                = 16,
1268                 SPOOLSS_FIELD_UNTIL_TIME                = 17,
1269                 SPOOLSS_FIELD_STATUS                    = 18,
1270                 SPOOLSS_FIELD_STATUS_STRING             = 19,
1271                 SPOOLSS_FIELD_CJOBS                             = 20,
1272                 SPOOLSS_FIELD_AVERAGE_PPM               = 21,
1273                 SPOOLSS_FIELD_TOTAL_PAGES               = 22,
1274                 SPOOLSS_FIELD_PAGES_PRINTED     = 23,
1275                 SPOOLSS_FIELD_TOTAL_BYTES               = 24,
1276                 SPOOLSS_FIELD_BYTES_PRINTED             = 25
1277         } spoolss_Field;
1278
1279         typedef [enum16bit] enum {
1280                 SPOOLSS_NOTIFY_PRINTER                  = 0,
1281                 SPOOLSS_NOTIFY_JOB                              = 1
1282         } spoolss_NotifyType;
1283
1284         /******************/
1285         /* Function: 0x41 */
1286         typedef struct {
1287                 spoolss_NotifyType type;
1288                 uint16 u1;
1289                 uint32 u2;
1290                 uint32 u3;
1291                 uint32 count;
1292                 [size_is(count)] spoolss_Field *fields;
1293         } spoolss_NotifyOptionsArray;
1294
1295         typedef struct {
1296                 uint32 version;
1297                 uint32 flags;
1298                 uint32 count;
1299                 [size_is(count)] spoolss_NotifyOptionsArray *options;
1300         } spoolss_NotifyOptionsContainer;
1301
1302         [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
1303                 [in,ref] policy_handle *handle,
1304                 [in] uint32 flags,
1305                 [in] uint32 options,
1306                 [in,unique] [string,charset(UTF16)] uint16 *str,
1307                 [in] uint32 printer_local,
1308                 [in,unique] spoolss_NotifyOptionsContainer *t1
1309         );
1310
1311         /******************/
1312         /* Function: 0x42 */
1313         [todo] WERROR spoolss_RouterRefreshPrinterChangeNotification(
1314         );
1315
1316         typedef struct {
1317                 uint32 size;
1318                 [size_is(size/2),unique,charset(UTF16)] uint16 *string;
1319         } spoolss_NotifyUTF16String;
1320
1321         typedef struct {
1322                 uint32 size;
1323                 [size_is(size),charset(DOS)] uint8 *string;
1324         } spoolss_NotifyDOSString;
1325
1326         typedef struct {
1327                 uint16 data[8];
1328         } spoolss_NotifyBlobData;
1329
1330         typedef struct {
1331                 uint32 len;
1332                 [unique] spoolss_NotifyBlobData *data;
1333         } spoolss_NotifyBlob;
1334
1335         typedef [switch_type(uint32)] union {
1336                 [case(1)] dlong integer;
1337                 [case(2)] spoolss_NotifyUTF16String utf16_string;
1338                 [case(3)] spoolss_NotifyDOSString ascii_string;
1339                 [case(4)] spoolss_NotifyBlob blob;
1340                 [case(5)] spoolss_NotifyDOSString ascii_string;
1341         } spoolss_NotifyData;
1342
1343         typedef struct {
1344                 spoolss_NotifyType type;
1345                 spoolss_Field field;
1346                 uint32 variable_type;
1347                 uint32 job_id;
1348                 [switch_is(variable_type)] spoolss_NotifyData data;
1349         } spoolss_Notify;
1350
1351         typedef struct {
1352                 uint32 version;
1353                 uint32 flags;
1354                 uint32 count;
1355                 [size_is(count)] spoolss_Notify notifies[];
1356         } spoolss_NotifyInfo;
1357
1358         /******************/
1359         /* Function: 0x43 */
1360         [public] WERROR spoolss_RemoteFindNextPrinterChangeNotifyEx(
1361                 [in,ref] policy_handle *handle,
1362                 [in] uint32 change_low,
1363                 [in,unique] spoolss_NotifyOptionsContainer *container,
1364                 [out,ref] spoolss_NotifyInfo **info
1365         );
1366
1367         /******************/
1368         /* Function: 0x44 */
1369         [todo] WERROR spoolss_44(
1370         );
1371
1372         typedef struct {
1373                 uint32 size;
1374                 [string,charset(UTF16)] uint16 *client;
1375                 [string,charset(UTF16)] uint16 *user;
1376                 uint32 build;
1377                 uint32 major;
1378                 uint32 minor;
1379                 uint32 processor;
1380         } spoolss_UserLevel1;
1381
1382         typedef union {
1383                 [case(1)]  spoolss_UserLevel1 *level1;
1384         } spoolss_UserLevel;
1385
1386         typedef bitmap {
1387                 SERVER_ACCESS_ADMINISTER        = 0x00000001,
1388                 SERVER_ACCESS_ENUMERATE         = 0x00000002,
1389                 PRINTER_ACCESS_ADMINISTER       = 0x00000004,
1390                 PRINTER_ACCESS_USE              = 0x00000008,
1391                 JOB_ACCESS_ADMINISTER           = 0x00000010
1392         } spoolss_AccessRights;
1393
1394         /* Access rights for print servers */
1395         const int SERVER_ALL_ACCESS     = SEC_STD_REQUIRED |
1396                                           SERVER_ACCESS_ADMINISTER |
1397                                           SERVER_ACCESS_ENUMERATE;
1398
1399         const int SERVER_READ           = SEC_STD_READ_CONTROL |
1400                                           SERVER_ACCESS_ENUMERATE;
1401
1402         const int SERVER_WRITE          = STANDARD_RIGHTS_WRITE_ACCESS |
1403                                           SERVER_ACCESS_ADMINISTER |
1404                                           SERVER_ACCESS_ENUMERATE;
1405
1406         const int SERVER_EXECUTE        = SEC_STD_READ_CONTROL |
1407                                           SERVER_ACCESS_ENUMERATE;
1408
1409         /* Access rights for printers */
1410         const int PRINTER_ALL_ACCESS    = SEC_STD_REQUIRED |
1411                                           PRINTER_ACCESS_ADMINISTER |
1412                                           PRINTER_ACCESS_USE;
1413
1414         const int PRINTER_READ          = SEC_STD_READ_CONTROL |
1415                                           PRINTER_ACCESS_USE;
1416
1417         const int PRINTER_WRITE         = STANDARD_RIGHTS_WRITE_ACCESS |
1418                                           PRINTER_ACCESS_USE;
1419
1420         const int PRINTER_EXECUTE       = SEC_STD_READ_CONTROL |
1421                                           PRINTER_ACCESS_USE;
1422
1423         /* Access rights for jobs */
1424         const int JOB_ALL_ACCESS        = SEC_STD_REQUIRED |
1425                                           JOB_ACCESS_ADMINISTER;
1426
1427         const int JOB_READ              = SEC_STD_READ_CONTROL |
1428                                           JOB_ACCESS_ADMINISTER;
1429
1430         const int JOB_WRITE             = STANDARD_RIGHTS_WRITE_ACCESS |
1431                                           JOB_ACCESS_ADMINISTER;
1432
1433         const int JOB_EXECUTE           = SEC_STD_READ_CONTROL |
1434                                           JOB_ACCESS_ADMINISTER;
1435
1436         /* ACE masks for various print permissions */
1437         const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
1438                                                 PRINTER_ALL_ACCESS;
1439
1440         const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
1441                                                 READ_CONTROL_ACCESS;
1442
1443         const int PRINTER_ACE_PRINT     = GENERIC_EXECUTE_ACCESS |
1444                                           READ_CONTROL_ACCESS |
1445                                           PRINTER_ACCESS_USE;
1446
1447         /******************/
1448         /* Function: 0x45 */
1449         [public] WERROR spoolss_OpenPrinterEx(
1450                 [in,unique]           [string,charset(UTF16)] uint16 *printername,
1451                 [in,unique]           [string,charset(UTF16)] uint16 *datatype,
1452                 [in]                  spoolss_DevmodeContainer devmode_ctr,
1453                 [in]                  uint32 access_mask,
1454                 [in]                  uint32 level,
1455                 [in,switch_is(level)] spoolss_UserLevel userlevel,
1456                 [out,ref]             policy_handle *handle
1457         );
1458
1459         /******************/
1460         /* Function: 0x46 */
1461         WERROR spoolss_AddPrinterEx(
1462                 [in,unique] [string,charset(UTF16)] uint16 *server,
1463                 [in] uint32 level,
1464                 [in,unique,switch_is(level)] spoolss_PrinterInfo *info,
1465                 [in] spoolss_DevmodeContainer devmode_ctr,
1466                 [in,unique] security_descriptor *secdesc,
1467                 [in] uint32 ulevel,
1468                 [in,switch_is(ulevel)] spoolss_UserLevel userlevel
1469         );
1470
1471         /******************/
1472         /* Function: 0x47 */
1473         [todo] WERROR spoolss_47(
1474         );
1475
1476         /******************/
1477         /* Function: 0x48 */
1478         WERROR spoolss_EnumPrinterData(
1479                 [in,ref] policy_handle *handle,
1480                 [in]     uint32 enum_index,
1481                 [out,ref,size_is(value_offered/2),charset(UTF16)] uint16 *value_name,
1482                 [in]     uint32 value_offered,
1483                 [out,ref] uint32 *value_needed,
1484                 [out,ref] uint32 *printerdata_type,
1485                 [out,ref] DATA_BLOB *buffer,
1486                 [in]     uint32 data_offered,
1487                 [out,ref] uint32 *data_needed
1488         );
1489
1490         /******************/
1491         /* Function: 0x49 */
1492         WERROR spoolss_DeletePrinterData(
1493                 [in,ref] policy_handle *handle,
1494                 [in] [string,charset(UTF16)] uint16 value_name[]
1495         );
1496
1497         /******************/
1498         /* Function: 0x4a */
1499         [todo] WERROR spoolss_4a(
1500         );
1501
1502         /******************/
1503         /* Function: 0x4b */
1504         [todo] WERROR spoolss_4b(
1505         );
1506
1507         /******************/
1508         /* Function: 0x4c */
1509         [todo] WERROR spoolss_4c(
1510         );
1511
1512         /******************/
1513         /* Function: 0x4d */
1514         WERROR spoolss_SetPrinterDataEx(
1515                 [in,ref] policy_handle *handle,
1516                 [in]     [string,charset(UTF16)] uint16 key_name[],
1517                 [in]     [string,charset(UTF16)] uint16 value_name[],
1518                 [in]     uint32 type,
1519                 [in]     DATA_BLOB buffer,
1520                 [in]     uint32 offered
1521         );
1522
1523         /******************/
1524         /* Function: 0x4e */
1525         WERROR spoolss_GetPrinterDataEx(
1526                 [in,ref] policy_handle *handle,
1527                 [in]     [string,charset(UTF16)] uint16 key_name[],
1528                 [in]     [string,charset(UTF16)] uint16 value_name[],
1529                 [out,ref] uint32 *type,
1530                 [out,ref] [size_is(offered)] uint8 *buffer,
1531                 [in]     uint32 offered,
1532                 [out,ref] uint32 *needed
1533         );
1534
1535         /******************/
1536         /* Function: 0x4f */
1537         [public] WERROR spoolss_EnumPrinterDataEx(
1538                 [in,ref] policy_handle *handle,
1539                 [in]     [string,charset(UTF16)] uint16 key_name[],
1540                 [out,ref] [size_is(offered)] uint8 *buffer,
1541                 [in]     uint32 offered,
1542                 [out,ref] uint32 *needed,
1543                 [out,ref] uint32 *count
1544         );
1545
1546         /******************/
1547         /* Function: 0x50 */
1548         [public] WERROR spoolss_EnumPrinterKey(
1549                 [in, ref] policy_handle *handle,
1550                 [in] [string,charset(UTF16)] uint16 key_name[],
1551                 [out,ref] [size_is(key_buffer_size/2)] uint16 *key_buffer,
1552                 [in] uint32 key_buffer_size,
1553                 [out,ref] uint32 *needed
1554         );
1555
1556         /******************/
1557         /* Function: 0x51 */
1558         WERROR spoolss_DeletePrinterDataEx(
1559                 [in,ref] policy_handle *handle,
1560                 [in] [string,charset(UTF16)] uint16 key_name[],
1561                 [in] [string,charset(UTF16)] uint16 value_name[]
1562         );
1563
1564         /******************/
1565         /* Function: 0x52 */
1566         WERROR spoolss_DeletePrinterKey(
1567                 [in,ref] policy_handle *handle,
1568                 [in] [string,charset(UTF16)] uint16 key_name[]
1569         );
1570
1571         /******************/
1572         /* Function: 0x53 */
1573         [todo] WERROR spoolss_53(
1574         );
1575
1576         /******************/
1577         /* Function: 0x54 */
1578         typedef [public,bitmap32bit] bitmap {
1579                 DPD_DELETE_UNUSED_FILES         = 0x00000001,
1580                 DPD_DELETE_SPECIFIC_VERSION     = 0x00000002,
1581                 DPD_DELETE_ALL_FILES            = 0x00000004
1582         } spoolss_DeleteDriverFlags;
1583
1584         WERROR spoolss_DeletePrinterDriverEx(
1585                 [in,unique] [string,charset(UTF16)] uint16 *server,
1586                 [in] [string,charset(UTF16)] uint16 architecture[],
1587                 [in] [string,charset(UTF16)] uint16 driver[],
1588                 [in] spoolss_DeleteDriverFlags delete_flags,
1589                 [in] uint32 version
1590         );
1591
1592         /******************/
1593         /* Function: 0x55 */
1594         [todo] WERROR spoolss_55(
1595         );
1596
1597         /******************/
1598         /* Function: 0x56 */
1599         [todo] WERROR spoolss_56(
1600         );
1601
1602         /******************/
1603         /* Function: 0x57 */
1604         [todo] WERROR spoolss_57(
1605         );
1606
1607         /******************/
1608         /* Function: 0x58 */
1609         WERROR spoolss_XcvData(
1610                 [in,ref] policy_handle *handle,
1611                 [in] [string,charset(UTF16)] uint16 function_name[],
1612                 [in] DATA_BLOB in_data,
1613                 [in,value(r->in.in_data.length)] uint32 _in_data_length,
1614                 [out,ref] [size_is(out_data_size)] uint8 *out_data,
1615                 [in] uint32 out_data_size,
1616                 [out,ref] uint32 *needed,
1617                 [in,out,ref] uint32 *status_code
1618         );
1619
1620         /******************/
1621         /* Function: 0x59 */
1622         [public,todo] WERROR spoolss_AddPrinterDriverEx(
1623         );
1624
1625         /******************/
1626         /* Function: 0x5a */
1627         [todo] WERROR spoolss_5a(
1628         );
1629
1630         /******************/
1631         /* Function: 0x5b */
1632         [todo] WERROR spoolss_5b(
1633         );
1634
1635         /******************/
1636         /* Function: 0x5c */
1637         [todo] WERROR spoolss_5c(
1638         );
1639
1640         /******************/
1641         /* Function: 0x5d */
1642         [todo] WERROR spoolss_5d(
1643         );
1644
1645         /******************/
1646         /* Function: 0x5e */
1647         [todo] WERROR spoolss_5e(
1648         );
1649
1650         /******************/
1651         /* Function: 0x5f */
1652         [todo] WERROR spoolss_5f(
1653         );
1654 }