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