spoolss: fill in spoolss_ScheduleJob.
[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 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         WERROR spoolss_AddJob(
730                 [in,ref] policy_handle *handle,
731                 [in] uint32 level,
732                 [in,out,unique] [size_is(offered)] uint8 *buffer,
733                 [in] uint32 offered,
734                 [out,ref] uint32 *needed
735         );
736
737         /******************/
738         /* Function: 0x19 */
739         WERROR spoolss_ScheduleJob(
740                 [in,ref] policy_handle *handle,
741                 [in] uint32 jobid
742         );
743
744         /******************/
745         /* Function: 0x1a */
746         const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
747
748         typedef [public,gensize] struct {
749                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
750                 uint32 major;
751                 uint32 minor;
752                 uint32 build;
753                 [value(2)] uint32 unknown;
754                 [subcontext(0),subcontext_size(256)] nstring extra_string;
755         } spoolss_OSVersion;
756
757         typedef [public,gensize] struct {
758                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
759                 uint32 major;
760                 uint32 minor;
761                 uint32 build;
762                 [value(2)] uint32 unknown1;
763                 [subcontext(0),subcontext_size(256)] nstring extra_string;
764                 uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
765                 uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
766         } spoolss_OSVersionEx;
767
768         typedef [v1_enum] enum {
769                 SPOOLSS_PRINTER_DATA_TYPE_NULL = 0,
770                 SPOOLSS_PRINTER_DATA_TYPE_STRING = 1,
771                 SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3,
772                 SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4,
773                 SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY = 7
774         } spoolss_PrinterDataType;
775
776         typedef [nodiscriminant,public,gensize] union {
777                 [case(SPOOLSS_PRINTER_DATA_TYPE_NULL)];
778                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string;
779                 [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
780                 [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value;
781                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] nstring_array string_array;
782                 [default,flag(NDR_REMAINING)] DATA_BLOB data;
783         } spoolss_PrinterData;
784
785         [noopnum,noprint,public] WERROR _spoolss_GetPrinterData(
786                 [in,ref] policy_handle *handle,
787                 [in]     [string,charset(UTF16)] uint16 value_name[],
788                 [in]     uint32 offered,
789                 [out,ref] spoolss_PrinterDataType *type,
790                 [out]    DATA_BLOB data,
791                 [out,ref] uint32 *needed
792         );
793         [noopnum,noprint,public] void __spoolss_GetPrinterData(
794                 [in] spoolss_PrinterDataType type,
795                 [out,switch_is(type)] spoolss_PrinterData data
796         );
797         [nopull,nopush,public] WERROR spoolss_GetPrinterData(
798                 [in,ref] policy_handle *handle,
799                 [in]     [string,charset(UTF16)] uint16 value_name[],
800                 [in]     uint32 offered,
801                 [out,ref] spoolss_PrinterDataType *type,
802                 [out,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData data,
803                 [out,ref] uint32 *needed
804         );
805
806         /******************/
807         /* Function: 0x1b */
808         [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
809                 [in,ref] policy_handle *handle,
810                 [in] [string,charset(UTF16)] uint16 value_name[],
811                 [in] spoolss_PrinterDataType type,
812                 [in] DATA_BLOB data,
813                 [in] uint32 _offered
814         );
815         [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
816                 [in] spoolss_PrinterDataType type,
817                 [out,switch_is(type)] spoolss_PrinterData data
818         );
819         [nopush] WERROR spoolss_SetPrinterData(
820                 [in,ref] policy_handle *handle,
821                 [in] [string,charset(UTF16)] uint16 value_name[],
822                 [in] spoolss_PrinterDataType type,
823                 [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
824                 [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered
825         );
826
827         /******************/
828         /* Function: 0x1c */
829         [todo] WERROR spoolss_WaitForPrinterChange(
830         );
831
832         /******************/
833         /* Function: 0x1d */
834         [public] WERROR spoolss_ClosePrinter(
835                 [in,out,ref]     policy_handle *handle
836         );
837
838         /******************/
839         /* Function: 0x1e */
840         typedef [v1_enum] enum {
841                 SPOOLSS_FORM_USER       = 0,
842                 SPOOLSS_FORM_BUILTIN    = 1,
843                 SPOOLSS_FORM_PRINTER    = 2
844         } spoolss_FormFlags;
845
846         typedef struct {
847                 uint32 width;
848                 uint32 height;
849         } spoolss_FormSize;
850
851         typedef struct {
852                 uint32 left;
853                 uint32 top;
854                 uint32 right;
855                 uint32 bottom;
856         } spoolss_FormArea;
857
858         typedef struct {
859                 spoolss_FormFlags flags;
860                 [relative] nstring *form_name;
861                 spoolss_FormSize size;
862                 spoolss_FormArea area;
863         } spoolss_FormInfo1;
864
865         typedef [nodiscriminant,relative_base,public,gensize] union {
866                 [case(1)] spoolss_FormInfo1 info1;
867                 [default];
868         } spoolss_FormInfo;
869
870         typedef struct {
871                 spoolss_FormFlags flags;
872                 [string,charset(UTF16)] uint16 *form_name;
873                 spoolss_FormSize size;
874                 spoolss_FormArea area;
875         } spoolss_AddFormInfo1;
876
877         typedef [switch_type(uint32)] union {
878                 [case(1)] spoolss_AddFormInfo1 *info1;
879         } spoolss_AddFormInfo;
880
881         WERROR spoolss_AddForm(
882                 [in,ref] policy_handle *handle,
883                 [in] uint32 level,
884                 [in,switch_is(level)] spoolss_AddFormInfo info
885         );
886
887         /******************/
888         /* Function: 0x1f */
889         WERROR spoolss_DeleteForm(
890                 [in,ref] policy_handle *handle,
891                 [in] [string,charset(UTF16)] uint16 form_name[]
892         );
893
894         /******************/
895         /* Function: 0x20 */
896         WERROR spoolss_GetForm(
897                 [in,ref] policy_handle *handle,
898                 [in] [string,charset(UTF16)] uint16 form_name[],
899                 [in] uint32 level,
900                 [in,unique] DATA_BLOB *buffer,
901                 [in] uint32 offered,
902                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
903                 [out,ref] uint32 *needed
904         );
905
906         /******************/
907         /* Function: 0x21 */
908         WERROR spoolss_SetForm(
909                 [in,ref] policy_handle *handle,
910                 [in] [string,charset(UTF16)] uint16 form_name[],
911                 [in] uint32 level,
912                 [in,switch_is(level)] spoolss_AddFormInfo info
913         );
914
915         /******************/
916         /* Function: 0x22 */
917         [public,noopnum,noprint] WERROR _spoolss_EnumForms(
918                 [in,ref] policy_handle *handle,
919                 [in]     uint32 level,
920                 [in,unique] DATA_BLOB *buffer,
921                 [in]     uint32 offered,
922                 [out,unique] DATA_BLOB *info,
923                 [out,ref] uint32 *needed,
924                 [out]    uint32 count
925         );
926         [public,noopnum,noprint] void __spoolss_EnumForms(
927                 [in] uint32 level,
928                 [in] uint32 count,
929                 [out,switch_is(level)] spoolss_FormInfo info[count]
930         );
931         [nopull,nopush] WERROR spoolss_EnumForms(
932                 [in,ref] policy_handle *handle,
933                 [in]     uint32 level,
934                 [in,unique] DATA_BLOB *buffer,
935                 [in]     uint32 offered,
936                 [out,unique,switch_is(level),size_is(count)] spoolss_FormInfo *info,
937                 [out,ref] uint32 *needed,
938                 [out] uint32 count
939         );
940
941         typedef struct {
942                 [relative] nstring *port_name;
943         } spoolss_PortInfo1;
944
945         typedef bitmap {
946                 SPOOLSS_PORT_TYPE_WRITE         = 0x00000001,
947                 SPOOLSS_PORT_TYPE_READ          = 0x00000002,
948                 SPOOLSS_PORT_TYPE_REDIRECTED    = 0x00000004,
949                 SPOOLSS_PORT_TYPE_NET_ATTACHED  = 0x00000008
950         } spoolss_PortType;
951
952         typedef struct {
953                 [relative] nstring *port_name;
954                 [relative] nstring *monitor_name;
955                 [relative] nstring *description;
956                 spoolss_PortType port_type;
957                 uint32 reserved;
958         } spoolss_PortInfo2;
959
960         typedef [nodiscriminant,relative_base,public] union {
961                 [case(1)] spoolss_PortInfo1 info1;
962                 [case(2)] spoolss_PortInfo2 info2;
963                 [case(3)]; /* TODO */
964                 [default];
965         } spoolss_PortInfo;
966
967         /******************/
968         /* Function: 0x23 */
969         [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
970                 [in,unique] [string,charset(UTF16)] uint16 *servername,
971                 [in] uint32 level,
972                 [in,unique] DATA_BLOB *buffer,
973                 [in] uint32 offered,
974                 [out,unique] DATA_BLOB *info,
975                 [out,ref] uint32 *needed,
976                 [out] uint32 count
977         );
978         [public,noopnum,noprint] void __spoolss_EnumPorts(
979                 [in] uint32 level,
980                 [in] uint32 count,
981                 [out,switch_is(level)] spoolss_PortInfo info[count]
982         );
983         [nopull,nopush] WERROR spoolss_EnumPorts(
984                 [in,unique] [string,charset(UTF16)] uint16 *servername,
985                 [in] uint32 level,
986                 [in,unique] DATA_BLOB *buffer,
987                 [in] uint32 offered,
988                 [out,unique,switch_is(level),size_is(count)] spoolss_PortInfo *info,
989                 [out,ref] uint32 *needed,
990                 [out] uint32 count
991         );
992
993         /******************/
994         /* Function: 0x24 */
995         typedef struct {
996                 [relative] nstring *monitor_name;
997         } spoolss_MonitorInfo1;
998
999         typedef struct {
1000                 [relative] nstring *monitor_name;
1001                 [relative] nstring *environment;
1002                 [relative] nstring *dll_name;
1003         } spoolss_MonitorInfo2;
1004
1005         typedef [nodiscriminant,relative_base,public] union {
1006                 [case(1)] spoolss_MonitorInfo1 info1;
1007                 [case(2)] spoolss_MonitorInfo2 info2;
1008                 [default];
1009         } spoolss_MonitorInfo;
1010
1011         [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
1012                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1013                 [in] uint32 level,
1014                 [in,unique] DATA_BLOB *buffer,
1015                 [in] uint32 offered,
1016                 [out,unique] DATA_BLOB *info,
1017                 [out,ref] uint32 *needed,
1018                 [out] uint32 count
1019         );
1020         [public,noopnum,noprint] void __spoolss_EnumMonitors(
1021                 [in] uint32 level,
1022                 [in] uint32 count,
1023                 [out,switch_is(level)] spoolss_MonitorInfo info[count]
1024         );
1025         [nopull,nopush] WERROR spoolss_EnumMonitors(
1026                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1027                 [in] uint32 level,
1028                 [in,unique] DATA_BLOB *buffer,
1029                 [in] uint32 offered,
1030                 [out,unique,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
1031                 [out,ref] uint32 *needed,
1032                 [out] uint32 count
1033         );
1034
1035         /******************/
1036         /* Function: 0x25 */
1037         WERROR spoolss_AddPort(
1038                [in,unique] [string,charset(UTF16)] uint16 *server_name,
1039                [in] uint32 unknown,
1040                [in] [string,charset(UTF16)] uint16 monitor_name[]
1041         );
1042
1043         /******************/
1044         /* Function: 0x26 */
1045         [todo] WERROR spoolss_ConfigurePort(
1046         );
1047
1048         /******************/
1049         /* Function: 0x27 */
1050         [todo] WERROR spoolss_DeletePort(
1051         );
1052
1053         /******************/
1054         /* Function: 0x28 */
1055         [todo] WERROR spoolss_CreatePrinterIC(
1056         );
1057
1058         /******************/
1059         /* Function: 0x29 */
1060         [todo] WERROR spoolss_PlayGDIScriptOnPrinterIC(
1061         );
1062
1063         /******************/
1064         /* Function: 0x2a */
1065         [todo] WERROR spoolss_DeletePrinterIC(
1066         );
1067
1068         /******************/
1069         /* Function: 0x2b */
1070         [todo] WERROR spoolss_AddPrinterConnection(
1071         );
1072
1073         /******************/
1074         /* Function: 0x2c */
1075         [todo] WERROR spoolss_DeletePrinterConnection(
1076         );
1077
1078         /******************/
1079         /* Function: 0x2d */
1080         [todo] WERROR spoolss_PrinterMessageBox(
1081                 /* Marked as obsolete in MSDN.  "Not necessary and has
1082                    no effect". */
1083         );
1084
1085         /******************/
1086         /* Function: 0x2e */
1087         [todo] WERROR spoolss_AddMonitor(
1088         );
1089
1090         /******************/
1091         /* Function: 0x2f */
1092         [todo] WERROR spoolss_DeleteMonitor(
1093         );
1094
1095         /******************/
1096         /* Function: 0x30 */
1097         [todo] WERROR spoolss_DeletePrintProcessor(
1098         );
1099
1100         /******************/
1101         /* Function: 0x31 */
1102         [todo] WERROR spoolss_AddPrintProvidor(
1103         );
1104
1105         /******************/
1106         /* Function: 0x32 */
1107         [todo] WERROR spoolss_DeletePrintProvidor(
1108         );
1109
1110         /******************/
1111         /* Function: 0x33 */
1112         [todo] WERROR spoolss_EnumPrintProcDataTypes(
1113         );
1114
1115         /******************/
1116         /* Function: 0x34 */
1117         [todo] WERROR spoolss_ResetPrinter(
1118         );
1119
1120         /******************/
1121         /* Function: 0x35 */
1122         WERROR spoolss_GetPrinterDriver2(
1123                 [in,ref] policy_handle *handle,
1124                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
1125                 [in]     uint32 level,
1126                 [in,unique] DATA_BLOB *buffer,
1127                 [in]     uint32 offered,
1128                 [in]     uint32 client_major_version,
1129                 [in]     uint32 client_minor_version,
1130                 [out,unique] DATA_BLOB *info,
1131                 [out,ref] uint32 *needed,
1132                 [out,ref] uint32 *server_major_version,
1133                 [out,ref] uint32 *server_minor_version
1134         );
1135
1136         /******************/
1137         /* Function: 0x36 */
1138         [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
1139         );
1140
1141         /******************/
1142         /* Function: 0x37 */
1143         [todo] WERROR spoolss_FindNextPrinterChangeNotification(
1144         );
1145
1146         /******************/
1147         /* Function: 0x38 */
1148         [public] WERROR spoolss_FindClosePrinterNotify(
1149                 [in,ref] policy_handle *handle
1150         );
1151
1152         /******************/
1153         /* Function: 0x39 */
1154         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
1155         );
1156
1157         /******************/
1158         /* Function: 0x3a */
1159         [public] WERROR spoolss_ReplyOpenPrinter(
1160                 [in,string,charset(UTF16)] uint16 server_name[],
1161                 [in] uint32 printer_local,
1162                 [in] winreg_Type type,
1163                 [in] uint32 unknown1,
1164                 [in] uint32 unknown2,
1165                 [out,ref] policy_handle *handle
1166         );
1167
1168         /******************/
1169         /* Function: 0x3b */
1170
1171         typedef [bitmap32bit] bitmap {
1172                 PRINTER_CHANGE_ADD_PRINTER                      = 0x00000001,
1173                 PRINTER_CHANGE_SET_PRINTER                      = 0x00000002,
1174                 PRINTER_CHANGE_DELETE_PRINTER                   = 0x00000004,
1175                 PRINTER_CHANGE_FAILED_CONNECTION_PRINTER        = 0x00000008,
1176                 PRINTER_CHANGE_ADD_JOB                          = 0x00000100,
1177                 PRINTER_CHANGE_SET_JOB                          = 0x00000200,
1178                 PRINTER_CHANGE_DELETE_JOB                       = 0x00000400,
1179                 PRINTER_CHANGE_WRITE_JOB                        = 0x00000800,
1180                 PRINTER_CHANGE_ADD_FORM                         = 0x00010000,
1181                 PRINTER_CHANGE_SET_FORM                         = 0x00020000,
1182                 PRINTER_CHANGE_DELETE_FORM                      = 0x00040000,
1183                 PRINTER_CHANGE_ADD_PORT                         = 0x00100000,
1184                 PRINTER_CHANGE_CONFIGURE_PORT                   = 0x00200000,
1185                 PRINTER_CHANGE_DELETE_PORT                      = 0x00400000,
1186                 PRINTER_CHANGE_ADD_PRINT_PROCESSOR              = 0x01000000,
1187                 PRINTER_CHANGE_DELETE_PRINT_PROCESSOR           = 0x04000000,
1188                 PRINTER_CHANGE_ADD_PRINTER_DRIVER               = 0x10000000,
1189                 PRINTER_CHANGE_SET_PRINTER_DRIVER               = 0x20000000,
1190                 PRINTER_CHANGE_DELETE_PRINTER_DRIVER            = 0x40000000,
1191                 PRINTER_CHANGE_TIMEOUT                          = 0x80000000
1192         } spoolss_PrinterChangeFlags;
1193
1194         const int PRINTER_CHANGE_PRINTER                        = (PRINTER_CHANGE_ADD_PRINTER |
1195                                                                    PRINTER_CHANGE_SET_PRINTER |
1196                                                                    PRINTER_CHANGE_DELETE_PRINTER |
1197                                                                    PRINTER_CHANGE_FAILED_CONNECTION_PRINTER); /* 0x000000FF */
1198
1199         const int PRINTER_CHANGE_JOB                            = (PRINTER_CHANGE_ADD_JOB |
1200                                                                    PRINTER_CHANGE_SET_JOB |
1201                                                                    PRINTER_CHANGE_DELETE_JOB |
1202                                                                    PRINTER_CHANGE_WRITE_JOB); /* 0x0000FF00 */
1203
1204         const int PRINTER_CHANGE_FORM                           = (PRINTER_CHANGE_ADD_FORM |
1205                                                                    PRINTER_CHANGE_SET_FORM |
1206                                                                    PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */
1207
1208         const int PRINTER_CHANGE_PORT                           = (PRINTER_CHANGE_ADD_PORT |
1209                                                                    PRINTER_CHANGE_CONFIGURE_PORT |
1210                                                                    PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */
1211
1212         const int PRINTER_CHANGE_PRINT_PROCESSOR                = (PRINTER_CHANGE_ADD_PRINT_PROCESSOR |
1213                                                                    PRINTER_CHANGE_DELETE_PRINT_PROCESSOR); /* 0x07000000 */
1214
1215         const int PRINTER_CHANGE_PRINTER_DRIVER                 = (PRINTER_CHANGE_ADD_PRINTER_DRIVER |
1216                                                                    PRINTER_CHANGE_SET_PRINTER_DRIVER |
1217                                                                    PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */
1218
1219         const int PRINTER_CHANGE_ALL                            = (PRINTER_CHANGE_JOB |
1220                                                                    PRINTER_CHANGE_FORM |
1221                                                                    PRINTER_CHANGE_PORT |
1222                                                                    PRINTER_CHANGE_PRINT_PROCESSOR |
1223                                                                    PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */
1224         WERROR spoolss_RouterReplyPrinter(
1225                 [in,ref] policy_handle *handle,
1226                 [in] spoolss_PrinterChangeFlags flags,
1227                 [in,range(0,512)] uint32 bufsize,
1228                 [in,unique,size_is(bufsize)] uint8 *buffer
1229         );
1230
1231         /******************/
1232         /* Function: 0x3c */
1233         [public] WERROR spoolss_ReplyClosePrinter(
1234                 [in,out,ref] policy_handle *handle
1235         );
1236
1237         /******************/
1238         /* Function: 0x3d */
1239         [todo] WERROR spoolss_AddPortEx(
1240         );
1241
1242         /******************/
1243         /* Function: 0x3e */
1244         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
1245         );
1246
1247         /******************/
1248         /* Function: 0x3f */
1249         [todo] WERROR spoolss_SpoolerInit(
1250         );
1251
1252         /******************/
1253         /* Function: 0x40 */
1254         [todo] WERROR spoolss_ResetPrinterEx(
1255         );
1256
1257         typedef [enum16bit] enum {
1258                 SPOOLSS_FIELD_SERVER_NAME               =  0,
1259                 SPOOLSS_FIELD_PRINTER_NAME              =  1,
1260                 SPOOLSS_FIELD_SHARE_NAME        =  2,
1261                 SPOOLSS_FIELD_PORT_NAME                 =  3,
1262                 SPOOLSS_FIELD_DRIVER_NAME               =  4,
1263                 SPOOLSS_FIELD_COMMENT                   =  5,
1264                 SPOOLSS_FIELD_LOCATION                  =  6,
1265                 SPOOLSS_FIELD_DEVMODE                   =  7,
1266                 SPOOLSS_FIELD_SEPFILE                   =  8,
1267                 SPOOLSS_FIELD_PRINT_PROCESSOR   =  9,
1268                 SPOOLSS_FIELD_PARAMETERS                = 10,
1269                 SPOOLSS_FIELD_DATATYPE                  = 11,
1270                 SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12,
1271                 SPOOLSS_FIELD_ATTRIBUTES                = 13,
1272                 SPOOLSS_FIELD_PRIORITY                  = 14,
1273                 SPOOLSS_FIELD_DEFAULT_PRIORITY  = 15,
1274                 SPOOLSS_FIELD_START_TIME                = 16,
1275                 SPOOLSS_FIELD_UNTIL_TIME                = 17,
1276                 SPOOLSS_FIELD_STATUS                    = 18,
1277                 SPOOLSS_FIELD_STATUS_STRING             = 19,
1278                 SPOOLSS_FIELD_CJOBS                             = 20,
1279                 SPOOLSS_FIELD_AVERAGE_PPM               = 21,
1280                 SPOOLSS_FIELD_TOTAL_PAGES               = 22,
1281                 SPOOLSS_FIELD_PAGES_PRINTED     = 23,
1282                 SPOOLSS_FIELD_TOTAL_BYTES               = 24,
1283                 SPOOLSS_FIELD_BYTES_PRINTED             = 25
1284         } spoolss_Field;
1285
1286         typedef [enum16bit] enum {
1287                 SPOOLSS_NOTIFY_PRINTER                  = 0,
1288                 SPOOLSS_NOTIFY_JOB                              = 1
1289         } spoolss_NotifyType;
1290
1291         /******************/
1292         /* Function: 0x41 */
1293         typedef struct {
1294                 spoolss_NotifyType type;
1295                 uint16 u1;
1296                 uint32 u2;
1297                 uint32 u3;
1298                 uint32 count;
1299                 [size_is(count)] spoolss_Field *fields;
1300         } spoolss_NotifyOptionsArray;
1301
1302         typedef struct {
1303                 uint32 version;
1304                 uint32 flags;
1305                 uint32 count;
1306                 [size_is(count)] spoolss_NotifyOptionsArray *options;
1307         } spoolss_NotifyOptionsContainer;
1308
1309         [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
1310                 [in,ref] policy_handle *handle,
1311                 [in] uint32 flags,
1312                 [in] uint32 options,
1313                 [in,unique] [string,charset(UTF16)] uint16 *str,
1314                 [in] uint32 printer_local,
1315                 [in,unique] spoolss_NotifyOptionsContainer *t1
1316         );
1317
1318         /******************/
1319         /* Function: 0x42 */
1320         [todo] WERROR spoolss_RouterRefreshPrinterChangeNotification(
1321         );
1322
1323         typedef struct {
1324                 uint32 size;
1325                 [size_is(size/2),unique,charset(UTF16)] uint16 *string;
1326         } spoolss_NotifyUTF16String;
1327
1328         typedef struct {
1329                 uint32 size;
1330                 [size_is(size),charset(DOS)] uint8 *string;
1331         } spoolss_NotifyDOSString;
1332
1333         typedef struct {
1334                 uint16 data[8];
1335         } spoolss_NotifyBlobData;
1336
1337         typedef struct {
1338                 uint32 len;
1339                 [unique] spoolss_NotifyBlobData *data;
1340         } spoolss_NotifyBlob;
1341
1342         typedef [switch_type(uint32)] union {
1343                 [case(1)] dlong integer;
1344                 [case(2)] spoolss_NotifyUTF16String utf16_string;
1345                 [case(3)] spoolss_NotifyDOSString ascii_string;
1346                 [case(4)] spoolss_NotifyBlob blob;
1347                 [case(5)] spoolss_NotifyDOSString ascii_string;
1348         } spoolss_NotifyData;
1349
1350         typedef struct {
1351                 spoolss_NotifyType type;
1352                 spoolss_Field field;
1353                 uint32 variable_type;
1354                 uint32 job_id;
1355                 [switch_is(variable_type)] spoolss_NotifyData data;
1356         } spoolss_Notify;
1357
1358         typedef struct {
1359                 uint32 version;
1360                 uint32 flags;
1361                 uint32 count;
1362                 [size_is(count)] spoolss_Notify notifies[];
1363         } spoolss_NotifyInfo;
1364
1365         /******************/
1366         /* Function: 0x43 */
1367         [public] WERROR spoolss_RemoteFindNextPrinterChangeNotifyEx(
1368                 [in,ref] policy_handle *handle,
1369                 [in] uint32 change_low,
1370                 [in,unique] spoolss_NotifyOptionsContainer *container,
1371                 [out,ref] spoolss_NotifyInfo **info
1372         );
1373
1374         /******************/
1375         /* Function: 0x44 */
1376         [todo] WERROR spoolss_44(
1377         );
1378
1379         typedef struct {
1380                 uint32 size;
1381                 [string,charset(UTF16)] uint16 *client;
1382                 [string,charset(UTF16)] uint16 *user;
1383                 uint32 build;
1384                 uint32 major;
1385                 uint32 minor;
1386                 uint32 processor;
1387         } spoolss_UserLevel1;
1388
1389         typedef union {
1390                 [case(1)]  spoolss_UserLevel1 *level1;
1391         } spoolss_UserLevel;
1392
1393         typedef bitmap {
1394                 SERVER_ACCESS_ADMINISTER        = 0x00000001,
1395                 SERVER_ACCESS_ENUMERATE         = 0x00000002,
1396                 PRINTER_ACCESS_ADMINISTER       = 0x00000004,
1397                 PRINTER_ACCESS_USE              = 0x00000008,
1398                 JOB_ACCESS_ADMINISTER           = 0x00000010
1399         } spoolss_AccessRights;
1400
1401         /* Access rights for print servers */
1402         const int SERVER_ALL_ACCESS     = SEC_STD_REQUIRED |
1403                                           SERVER_ACCESS_ADMINISTER |
1404                                           SERVER_ACCESS_ENUMERATE;
1405
1406         const int SERVER_READ           = SEC_STD_READ_CONTROL |
1407                                           SERVER_ACCESS_ENUMERATE;
1408
1409         const int SERVER_WRITE          = STANDARD_RIGHTS_WRITE_ACCESS |
1410                                           SERVER_ACCESS_ADMINISTER |
1411                                           SERVER_ACCESS_ENUMERATE;
1412
1413         const int SERVER_EXECUTE        = SEC_STD_READ_CONTROL |
1414                                           SERVER_ACCESS_ENUMERATE;
1415
1416         /* Access rights for printers */
1417         const int PRINTER_ALL_ACCESS    = SEC_STD_REQUIRED |
1418                                           PRINTER_ACCESS_ADMINISTER |
1419                                           PRINTER_ACCESS_USE;
1420
1421         const int PRINTER_READ          = SEC_STD_READ_CONTROL |
1422                                           PRINTER_ACCESS_USE;
1423
1424         const int PRINTER_WRITE         = STANDARD_RIGHTS_WRITE_ACCESS |
1425                                           PRINTER_ACCESS_USE;
1426
1427         const int PRINTER_EXECUTE       = SEC_STD_READ_CONTROL |
1428                                           PRINTER_ACCESS_USE;
1429
1430         /* Access rights for jobs */
1431         const int JOB_ALL_ACCESS        = SEC_STD_REQUIRED |
1432                                           JOB_ACCESS_ADMINISTER;
1433
1434         const int JOB_READ              = SEC_STD_READ_CONTROL |
1435                                           JOB_ACCESS_ADMINISTER;
1436
1437         const int JOB_WRITE             = STANDARD_RIGHTS_WRITE_ACCESS |
1438                                           JOB_ACCESS_ADMINISTER;
1439
1440         const int JOB_EXECUTE           = SEC_STD_READ_CONTROL |
1441                                           JOB_ACCESS_ADMINISTER;
1442
1443         /* ACE masks for various print permissions */
1444         const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
1445                                                 PRINTER_ALL_ACCESS;
1446
1447         const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
1448                                                 READ_CONTROL_ACCESS;
1449
1450         const int PRINTER_ACE_PRINT     = GENERIC_EXECUTE_ACCESS |
1451                                           READ_CONTROL_ACCESS |
1452                                           PRINTER_ACCESS_USE;
1453
1454         /******************/
1455         /* Function: 0x45 */
1456         [public] WERROR spoolss_OpenPrinterEx(
1457                 [in,unique]           [string,charset(UTF16)] uint16 *printername,
1458                 [in,unique]           [string,charset(UTF16)] uint16 *datatype,
1459                 [in]                  spoolss_DevmodeContainer devmode_ctr,
1460                 [in]                  uint32 access_mask,
1461                 [in]                  uint32 level,
1462                 [in,switch_is(level)] spoolss_UserLevel userlevel,
1463                 [out,ref]             policy_handle *handle
1464         );
1465
1466         /******************/
1467         /* Function: 0x46 */
1468         WERROR spoolss_AddPrinterEx(
1469                 [in,unique] [string,charset(UTF16)] uint16 *server,
1470                 [in] uint32 level,
1471                 [in,unique,switch_is(level)] spoolss_PrinterInfo *info,
1472                 [in] spoolss_DevmodeContainer devmode_ctr,
1473                 [in,unique] security_descriptor *secdesc,
1474                 [in] uint32 ulevel,
1475                 [in,switch_is(ulevel)] spoolss_UserLevel userlevel
1476         );
1477
1478         /******************/
1479         /* Function: 0x47 */
1480         [todo] WERROR spoolss_47(
1481         );
1482
1483         /******************/
1484         /* Function: 0x48 */
1485         WERROR spoolss_EnumPrinterData(
1486                 [in,ref] policy_handle *handle,
1487                 [in]     uint32 enum_index,
1488                 [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[],
1489                 [in]     uint32 value_offered,
1490                 [out,ref] uint32 *value_needed,
1491                 [out,ref] uint32 *printerdata_type,
1492                 [out,ref] DATA_BLOB *buffer,
1493                 [in]     uint32 data_offered,
1494                 [out,ref] uint32 *data_needed
1495         );
1496
1497         /******************/
1498         /* Function: 0x49 */
1499         WERROR spoolss_DeletePrinterData(
1500                 [in,ref] policy_handle *handle,
1501                 [in] [string,charset(UTF16)] uint16 value_name[]
1502         );
1503
1504         /******************/
1505         /* Function: 0x4a */
1506         [todo] WERROR spoolss_4a(
1507         );
1508
1509         /******************/
1510         /* Function: 0x4b */
1511         [todo] WERROR spoolss_4b(
1512         );
1513
1514         /******************/
1515         /* Function: 0x4c */
1516         [todo] WERROR spoolss_4c(
1517         );
1518
1519         /******************/
1520         /* Function: 0x4d */
1521         WERROR spoolss_SetPrinterDataEx(
1522                 [in,ref] policy_handle *handle,
1523                 [in]     [string,charset(UTF16)] uint16 key_name[],
1524                 [in]     [string,charset(UTF16)] uint16 value_name[],
1525                 [in]     uint32 type,
1526                 [in]     DATA_BLOB buffer,
1527                 [in]     uint32 offered
1528         );
1529
1530         /******************/
1531         /* Function: 0x4e */
1532         WERROR spoolss_GetPrinterDataEx(
1533                 [in,ref] policy_handle *handle,
1534                 [in]     [string,charset(UTF16)] uint16 key_name[],
1535                 [in]     [string,charset(UTF16)] uint16 value_name[],
1536                 [out,ref] uint32 *type,
1537                 [out,ref] [size_is(offered)] uint8 *buffer,
1538                 [in]     uint32 offered,
1539                 [out,ref] uint32 *needed
1540         );
1541
1542         /******************/
1543         /* Function: 0x4f */
1544         [public] WERROR spoolss_EnumPrinterDataEx(
1545                 [in,ref] policy_handle *handle,
1546                 [in]     [string,charset(UTF16)] uint16 key_name[],
1547                 [out,ref] [size_is(offered)] uint8 *buffer,
1548                 [in]     uint32 offered,
1549                 [out,ref] uint32 *needed,
1550                 [out,ref] uint32 *count
1551         );
1552
1553         /******************/
1554         /* Function: 0x50 */
1555         [public] WERROR spoolss_EnumPrinterKey(
1556                 [in, ref] policy_handle *handle,
1557                 [in] [string,charset(UTF16)] uint16 key_name[],
1558                 [out,ref] [size_is(key_buffer_size/2)] uint16 *key_buffer,
1559                 [in] uint32 key_buffer_size,
1560                 [out,ref] uint32 *needed
1561         );
1562
1563         /******************/
1564         /* Function: 0x51 */
1565         WERROR spoolss_DeletePrinterDataEx(
1566                 [in,ref] policy_handle *handle,
1567                 [in] [string,charset(UTF16)] uint16 key_name[],
1568                 [in] [string,charset(UTF16)] uint16 value_name[]
1569         );
1570
1571         /******************/
1572         /* Function: 0x52 */
1573         WERROR spoolss_DeletePrinterKey(
1574                 [in,ref] policy_handle *handle,
1575                 [in] [string,charset(UTF16)] uint16 key_name[]
1576         );
1577
1578         /******************/
1579         /* Function: 0x53 */
1580         [todo] WERROR spoolss_53(
1581         );
1582
1583         /******************/
1584         /* Function: 0x54 */
1585         typedef [public,bitmap32bit] bitmap {
1586                 DPD_DELETE_UNUSED_FILES         = 0x00000001,
1587                 DPD_DELETE_SPECIFIC_VERSION     = 0x00000002,
1588                 DPD_DELETE_ALL_FILES            = 0x00000004
1589         } spoolss_DeleteDriverFlags;
1590
1591         WERROR spoolss_DeletePrinterDriverEx(
1592                 [in,unique] [string,charset(UTF16)] uint16 *server,
1593                 [in] [string,charset(UTF16)] uint16 architecture[],
1594                 [in] [string,charset(UTF16)] uint16 driver[],
1595                 [in] spoolss_DeleteDriverFlags delete_flags,
1596                 [in] uint32 version
1597         );
1598
1599         /******************/
1600         /* Function: 0x55 */
1601         [todo] WERROR spoolss_55(
1602         );
1603
1604         /******************/
1605         /* Function: 0x56 */
1606         [todo] WERROR spoolss_56(
1607         );
1608
1609         /******************/
1610         /* Function: 0x57 */
1611         [todo] WERROR spoolss_57(
1612         );
1613
1614         /******************/
1615         /* Function: 0x58 */
1616         WERROR spoolss_XcvData(
1617                 [in,ref] policy_handle *handle,
1618                 [in] [string,charset(UTF16)] uint16 function_name[],
1619                 [in] DATA_BLOB in_data,
1620                 [in,value(r->in.in_data.length)] uint32 _in_data_length,
1621                 [out,ref] [size_is(out_data_size)] uint8 *out_data,
1622                 [in] uint32 out_data_size,
1623                 [out,ref] uint32 *needed,
1624                 [in,out,ref] uint32 *status_code
1625         );
1626
1627         /******************/
1628         /* Function: 0x59 */
1629         [public,todo] WERROR spoolss_AddPrinterDriverEx(
1630         );
1631
1632         /******************/
1633         /* Function: 0x5a */
1634         [todo] WERROR spoolss_5a(
1635         );
1636
1637         /******************/
1638         /* Function: 0x5b */
1639         [todo] WERROR spoolss_5b(
1640         );
1641
1642         /******************/
1643         /* Function: 0x5c */
1644         [todo] WERROR spoolss_5c(
1645         );
1646
1647         /******************/
1648         /* Function: 0x5d */
1649         [todo] WERROR spoolss_5d(
1650         );
1651
1652         /******************/
1653         /* Function: 0x5e */
1654         [todo] WERROR spoolss_5e(
1655         );
1656
1657         /******************/
1658         /* Function: 0x5f */
1659         [todo] WERROR spoolss_5f(
1660         );
1661 }