spoolss: fix spoolss_WritePrinter IDL.
[jra/samba/.git] / librpc / idl / spoolss.idl
1 #include "idl_types.h"
2
3 /*
4   spoolss interface definitions
5 */
6 import "misc.idl", "security.idl", "winreg.idl";
7
8 [ uuid("12345678-1234-abcd-ef00-0123456789ab"),
9   version(1.0),
10   endpoint("ncacn_np:[\\pipe\\spoolss]"),
11   pointer_default(unique),
12   helpstring("Spooler SubSystem"),
13   helper("../librpc/ndr/ndr_spoolss_buf.h")
14 ] interface spoolss
15 {
16         typedef [v1_enum] enum winreg_Type winreg_Type;
17         typedef struct {
18                 uint16 year;
19                 uint16 month;
20                 uint16 day_of_week;
21                 uint16 day;
22                 uint16 hour;
23                 uint16 minute;
24                 uint16 second;
25                 uint16 millisecond;
26         } spoolss_Time;
27
28         typedef struct {
29                 [relative] nstring *printername;
30                 [relative] nstring *servername;
31                 uint32 cjobs;
32                 uint32 total_jobs;
33                 uint32 total_bytes;
34                 spoolss_Time time;              
35                 uint32 global_counter;
36                 uint32 total_pages;
37                 uint32 version;
38                 uint32 unknown10;
39                 uint32 unknown11;
40                 uint32 unknown12;
41                 uint32 session_counter;
42                 uint32 unknown14;
43                 uint32 printer_errors;
44                 uint32 unknown16;
45                 uint32 unknown17;
46                 uint32 unknown18;
47                 uint32 unknown19;
48                 uint32 change_id;
49                 uint32 unknown21;
50                 uint32 status;
51                 uint32 unknown23;
52                 uint32 c_setprinter;
53                 uint16 unknown25;
54                 uint16 unknown26;
55                 uint32 unknown27;
56                 uint32 unknown28;
57                 uint32 unknown29;
58         } spoolss_PrinterInfo0;
59
60         typedef [public,gensize] struct {
61                 [charset(UTF16)] uint16 devicename[32];
62                 uint16 specversion;
63                 uint16 driverversion;
64                 uint16 size;
65                 [value(r->driverextra_data.length)] uint16 __driverextra_length;
66                 uint32 fields;
67                 uint16 orientation;
68                 uint16 papersize;
69                 uint16 paperlength;
70                 uint16 paperwidth;
71                 uint16 scale;
72                 uint16 copies;
73                 uint16 defaultsource;
74                 uint16 printquality;
75                 uint16 color;
76                 uint16 duplex;
77                 uint16 yresolution;
78                 uint16 ttoption;
79                 uint16 collate;
80                 [charset(UTF16)] uint16 formname[32];
81                 uint16 logpixels;
82                 uint32 bitsperpel;
83                 uint32 pelswidth;
84                 uint32 pelsheight;
85                 uint32 displayflags;
86                 uint32 displayfrequency;
87                 uint32 icmmethod;
88                 uint32 icmintent;
89                 uint32 mediatype;
90                 uint32 dithertype;
91                 uint32 reserved1;
92                 uint32 reserved2;
93                 uint32 panningwidth;
94                 uint32 panningheight;
95                 [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
96         } spoolss_DeviceMode;
97
98         typedef [public] bitmap {
99                 PRINTER_ENUM_DEFAULT     = 0x00000001,
100                 PRINTER_ENUM_LOCAL       = 0x00000002,
101                 PRINTER_ENUM_CONNECTIONS = 0x00000004,
102                 PRINTER_ENUM_FAVORITE    = 0x00000004,
103                 PRINTER_ENUM_NAME        = 0x00000008,
104                 PRINTER_ENUM_REMOTE      = 0x00000010,
105                 PRINTER_ENUM_SHARED      = 0x00000020,
106                 PRINTER_ENUM_NETWORK     = 0x00000040,
107                 PRINTER_ENUM_EXPAND      = 0x00004000,
108                 PRINTER_ENUM_CONTAINER   = 0x00008000,
109                 PRINTER_ENUM_ICON1       = 0x00010000,
110                 PRINTER_ENUM_ICON2       = 0x00020000,
111                 PRINTER_ENUM_ICON3       = 0x00040000,
112                 PRINTER_ENUM_ICON4       = 0x00080000,
113                 PRINTER_ENUM_ICON5       = 0x00100000,
114                 PRINTER_ENUM_ICON6       = 0x00200000,
115                 PRINTER_ENUM_ICON7       = 0x00400000,
116                 PRINTER_ENUM_ICON8       = 0x00800000,
117                 PRINTER_ENUM_HIDE        = 0x01000000
118         } spoolss_EnumPrinterFlags;
119
120         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->iconv_convenience, 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,ref] 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         WERROR spoolss_DeletePrinter(
397                 [in] policy_handle *handle
398         );
399
400         /******************/
401         /* Function: 0x07 */
402         typedef [v1_enum] enum {
403                 SPOOLSS_PRINTER_CONTROL_UNPAUSE    = 0,
404                 SPOOLSS_PRINTER_CONTROL_PAUSE      = 1,
405                 SPOOLSS_PRINTER_CONTROL_RESUME     = 2,
406                 SPOOLSS_PRINTER_CONTROL_PURGE      = 3,
407                 SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
408         } spoolss_PrinterControl;
409
410         typedef [switch_type(uint32)] union {
411                 [case(0)] spoolss_PrinterInfo0 *info0;
412                 [case(1)] spoolss_PrinterInfo1 *info1;
413                 [case(2)] spoolss_PrinterInfo2 *info2;
414                 [case(3)] spoolss_PrinterInfo3 *info3;
415                 [case(4)] spoolss_PrinterInfo4 *info4;
416                 [case(5)] spoolss_PrinterInfo5 *info5;
417                 [case(6)] spoolss_PrinterInfo6 *info6;
418                 [case(7)] spoolss_PrinterInfo7 *info7;
419                 [case(8)] spoolss_DeviceModeInfo *info8;
420                 [case(9)] spoolss_DeviceModeInfo *info9;
421                 [default];
422         } spoolss_SetPrinterInfo;
423
424         WERROR spoolss_SetPrinter(
425                 [in,ref] policy_handle *handle,
426                 [in] uint32 level,
427                 [in,switch_is(level)] spoolss_SetPrinterInfo info,
428                 [in] spoolss_DevmodeContainer devmode_ctr,
429                 [in] sec_desc_buf secdesc_ctr,
430                 [in] spoolss_PrinterControl command
431         );
432
433         /******************/
434         /* Function: 0x08 */
435         [public] WERROR spoolss_GetPrinter(
436                 [in,ref] policy_handle *handle,
437                 [in]     uint32 level,
438                 [in,unique] DATA_BLOB *buffer,
439                 [in]     uint32 offered,
440                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
441                 [out,ref] uint32 *needed
442         );
443
444         /******************/
445         /* Function: 0x09 */
446         [todo] WERROR spoolss_AddPrinterDriver(
447         );
448
449         typedef struct {
450                 [relative] nstring *driver_name;
451         } spoolss_DriverInfo1;
452
453         typedef [v1_enum] enum {
454                 SPOOLSS_DRIVER_VERSION_9X       = 0,
455                 SPOOLSS_DRIVER_VERSION_NT35     = 1,
456                 SPOOLSS_DRIVER_VERSION_NT4      = 2,
457                 SPOOLSS_DRIVER_VERSION_200X     = 3
458         } spoolss_DriverOSVersion;
459
460         typedef struct {
461                 spoolss_DriverOSVersion version;
462                 [relative] nstring *driver_name;
463                 [relative] nstring *architecture;
464                 [relative] nstring *driver_path;
465                 [relative] nstring *data_file;
466                 [relative] nstring *config_file;
467         } spoolss_DriverInfo2;
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                 [relative] nstring *help_file;
477                 [relative] nstring_array *dependent_files;
478                 [relative] nstring *monitor_name;
479                 [relative] nstring *default_datatype;
480         } spoolss_DriverInfo3;
481
482         typedef struct {
483                 spoolss_DriverOSVersion version;
484                 [relative] nstring *driver_name;
485                 [relative] nstring *architecture;
486                 [relative] nstring *driver_path;
487                 [relative] nstring *data_file;
488                 [relative] nstring *config_file;
489                 [relative] nstring *help_file;
490                 [relative] nstring_array *dependent_files;
491                 [relative] nstring *monitor_name;
492                 [relative] nstring *default_datatype;
493                 [relative] nstring_array *previous_names;
494         } spoolss_DriverInfo4;
495
496         typedef struct {
497                 spoolss_DriverOSVersion version;
498                 [relative] nstring *driver_name;
499                 [relative] nstring *architecture;
500                 [relative] nstring *driver_path;
501                 [relative] nstring *data_file;
502                 [relative] nstring *config_file;
503                 uint32 driver_attributes;
504                 uint32 config_version;
505                 uint32 driver_version;
506         } spoolss_DriverInfo5;
507
508         typedef struct {
509                 spoolss_DriverOSVersion version;
510                 [relative] nstring *driver_name;
511                 [relative] nstring *architecture;
512                 [relative] nstring *driver_path;
513                 [relative] nstring *data_file;
514                 [relative] nstring *config_file;
515                 [relative] nstring *help_file;
516                 [relative] nstring_array *dependent_files;
517                 [relative] nstring *monitor_name;
518                 [relative] nstring *default_datatype;
519                 [relative] nstring_array *previous_names;
520                 NTTIME driver_data;
521                 hyper driver_version;
522                 [relative] nstring *manufacturer_name;
523                 [relative] nstring *manufacturer_url;
524                 [relative] nstring *hardware_id;
525                 [relative] nstring *provider;
526         } spoolss_DriverInfo6;
527
528         typedef [nodiscriminant,relative_base,public] union {
529                 [case(1)] spoolss_DriverInfo1 info1;
530                 [case(2)] spoolss_DriverInfo2 info2;
531                 [case(3)] spoolss_DriverInfo3 info3;
532                 [case(4)] spoolss_DriverInfo4 info4;
533                 [case(5)] spoolss_DriverInfo5 info5;
534                 [case(6)] spoolss_DriverInfo6 info6;
535                 [default];
536         } spoolss_DriverInfo;
537
538         /******************/
539         /* Function: 0x0a */
540         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
541                 [in,unique] [string,charset(UTF16)] uint16 *server,
542                 [in,unique] [string,charset(UTF16)] uint16 *environment,
543                 [in] uint32 level,
544                 [in,unique] DATA_BLOB *buffer,
545                 [in] uint32 offered,
546                 [out,unique] DATA_BLOB *info,
547                 [out] uint32 needed,
548                 [out] uint32 count
549         );
550         [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
551                 [in] uint32 level,
552                 [in] uint32 count,
553                 [out,switch_is(level)] spoolss_DriverInfo info[count]
554         );
555         [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
556                 [in,unique] [string,charset(UTF16)] uint16 *server,
557                 [in,unique] [string,charset(UTF16)] uint16 *environment,
558                 [in] uint32 level,
559                 [in,unique] DATA_BLOB *buffer,
560                 [in] uint32 offered,
561                 [out,unique,switch_is(level),size_is(count)] spoolss_DriverInfo *info,
562                 [out] uint32 needed,
563                 [out] uint32 count
564         );
565
566         /******************/
567         /* Function: 0x0b */
568         [todo] WERROR spoolss_GetPrinterDriver(
569         );
570
571         /******************/
572         /* Function: 0x0c */
573         typedef struct {
574                 nstring directory_name;
575         } spoolss_DriverDirectoryInfo1;
576
577         /* NOTE: it's seems that w2k3 completly ignores the level
578                  in its server code
579          */
580         typedef [nodiscriminant,relative_base,gensize,public] union {
581                 [case(1)] spoolss_DriverDirectoryInfo1 info1;
582                 [default] spoolss_DriverDirectoryInfo1 info1;
583         } spoolss_DriverDirectoryInfo;
584
585         [public] WERROR spoolss_GetPrinterDriverDirectory(
586                 [in,unique] [string,charset(UTF16)] uint16 *server,
587                 [in,unique] [string,charset(UTF16)] uint16 *environment,
588                 [in] uint32 level,
589                 [in,unique] DATA_BLOB *buffer,
590                 [in] uint32 offered,
591                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
592                 [out,ref] uint32 *needed
593         );
594
595         /******************/
596         /* Function: 0x0d */
597         WERROR spoolss_DeletePrinterDriver(
598                 [in,ref] policy_handle *handle,
599                 [in,unique] [string,charset(UTF16)] uint16 *server,
600                 [in] [string,charset(UTF16)] uint16 architecture[],
601                 [in] [string,charset(UTF16)] uint16 driver[]
602         );
603
604         /******************/
605         /* Function: 0x0e */
606         [todo] WERROR spoolss_AddPrintProcessor(
607         );
608
609         /******************/
610         /* Function: 0x0f */
611         typedef struct {
612                 [relative] nstring *print_processor_name;
613         } spoolss_PrintProcessorInfo1;
614
615         typedef [nodiscriminant,relative_base,public] union {
616                 [case(1)] spoolss_PrintProcessorInfo1 info1;
617                 [default];
618         } spoolss_PrintProcessorInfo;
619
620         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
621                 [in,unique] [string,charset(UTF16)] uint16 *servername,
622                 [in,unique] [string,charset(UTF16)] uint16 *environment,
623                 [in] uint32 level,
624                 [in,unique] DATA_BLOB *buffer,
625                 [in] uint32 offered,
626                 [out,unique] DATA_BLOB *info,
627                 [out] uint32 needed,
628                 [out] uint32 count
629         );
630         [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
631                 [in] uint32 level,
632                 [in] uint32 count,
633                 [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
634         );
635         [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
636                 [in,unique] [string,charset(UTF16)] uint16 *servername,
637                 [in,unique] [string,charset(UTF16)] uint16 *environment,
638                 [in] uint32 level,
639                 [in,unique] DATA_BLOB *buffer,
640                 [in] uint32 offered,
641                 [out,unique,switch_is(level),size_is(count)] spoolss_PrintProcessorInfo *info,
642                 [out] uint32 needed,
643                 [out] uint32 count
644         );
645
646         /******************/
647         /* Function: 0x10 */
648         [todo] WERROR spoolss_GetPrintProcessorDirectory(
649         );
650
651         /******************/
652         /* Function: 0x11 */
653         typedef struct {
654                 [string,charset(UTF16)] uint16 *document_name;
655                 [string,charset(UTF16)] uint16 *output_file;
656                 [string,charset(UTF16)] uint16 *datatype;
657         } spoolss_DocumentInfo1;
658
659         typedef [switch_type(uint32)] union {
660                 [case(1)] spoolss_DocumentInfo1 *info1;
661                 [case(2)]; /* TODO */
662                 [case(3)]; /* TODO */
663                 [default];
664         } spoolss_DocumentInfo;
665
666         WERROR spoolss_StartDocPrinter(
667                 [in,ref] policy_handle *handle,
668                 [in] uint32 level,
669                 [in,switch_is(level)] spoolss_DocumentInfo info,
670                 [out,ref] uint32 *job_id
671         );
672
673         /******************/
674         /* Function: 0x12 */
675         WERROR spoolss_StartPagePrinter(
676                 [in,ref] policy_handle *handle
677         );
678
679         /******************/
680         /* Function: 0x13 */
681         WERROR spoolss_WritePrinter(
682                 [in,ref] policy_handle *handle,
683                 [in] DATA_BLOB data,
684                 [in,value(r->in.data.length)] uint32 _data_size,
685                 [out,ref] uint32 *num_written
686         );
687
688         /******************/
689         /* Function: 0x14 */
690         WERROR spoolss_EndPagePrinter(
691                 [in,ref] policy_handle *handle
692         );
693
694         /******************/
695         /* Function: 0x15 */
696         WERROR spoolss_AbortPrinter(
697                 [in,ref] policy_handle *handle
698         );
699
700         /******************/
701         /* Function: 0x16 */
702         WERROR spoolss_ReadPrinter(
703                 [in,ref] policy_handle *handle,
704                 [in] uint32 data_size,
705                 [out] DATA_BLOB data,
706                 [out,value(r->out.data.length)] uint32 _data_size
707         );
708
709         /******************/
710         /* Function: 0x17 */
711         WERROR spoolss_EndDocPrinter(
712                 [in,ref] policy_handle *handle
713         );
714
715         /******************/
716         /* Function: 0x18 */
717         [todo] WERROR spoolss_AddJob(
718         );
719
720         /******************/
721         /* Function: 0x19 */
722         [todo] WERROR spoolss_ScheduleJob(
723         );
724
725         /******************/
726         /* Function: 0x1a */
727         const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
728
729         typedef [public,gensize] struct {
730                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
731                 uint32 major;
732                 uint32 minor;
733                 uint32 build;
734                 [value(2)] uint32 unknown;
735                 [subcontext(0),subcontext_size(256)] nstring extra_string;
736         } spoolss_OSVersion;
737
738         typedef [public,gensize] struct {
739                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
740                 uint32 major;
741                 uint32 minor;
742                 uint32 build;
743                 [value(2)] uint32 unknown1;
744                 [subcontext(0),subcontext_size(256)] nstring extra_string;
745                 uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
746                 uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
747         } spoolss_OSVersionEx;
748
749         typedef [v1_enum] enum {
750                 SPOOLSS_PRINTER_DATA_TYPE_NULL = 0,
751                 SPOOLSS_PRINTER_DATA_TYPE_STRING = 1,
752                 SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3,
753                 SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4,
754                 SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY = 7
755         } spoolss_PrinterDataType;
756
757         typedef [nodiscriminant,public,gensize] union {
758                 [case(SPOOLSS_PRINTER_DATA_TYPE_NULL)];
759                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string;
760                 [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
761                 [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value;
762                 [case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] nstring_array string_array;
763                 [default,flag(NDR_REMAINING)] DATA_BLOB data;
764         } spoolss_PrinterData;
765
766         [noopnum,noprint,public] WERROR _spoolss_GetPrinterData(
767                 [in,ref] policy_handle *handle,
768                 [in]     [string,charset(UTF16)] uint16 value_name[],
769                 [in]     uint32 offered,
770                 [out]    spoolss_PrinterDataType type,
771                 [out]    DATA_BLOB data,
772                 [out]    uint32 needed
773         );
774         [noopnum,noprint,public] void __spoolss_GetPrinterData(
775                 [in] spoolss_PrinterDataType type,
776                 [out,switch_is(type)] spoolss_PrinterData data
777         );
778         [nopull,nopush,public] WERROR spoolss_GetPrinterData(
779                 [in,ref] policy_handle *handle,
780                 [in]     [string,charset(UTF16)] uint16 value_name[],
781                 [in]     uint32 offered,
782                 [out]    spoolss_PrinterDataType type,
783                 [out,subcontext(4),subcontext_size(offered),switch_is(type)] spoolss_PrinterData data,
784                 [out]    uint32 needed
785         );
786
787         /******************/
788         /* Function: 0x1b */
789         [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
790                 [in,ref] policy_handle *handle,
791                 [in] [string,charset(UTF16)] uint16 value_name[],
792                 [in] spoolss_PrinterDataType type,
793                 [in] DATA_BLOB data,
794                 [in] uint32 _offered
795         );
796         [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
797                 [in] spoolss_PrinterDataType type,
798                 [out,switch_is(type)] spoolss_PrinterData data
799         );
800         [nopush] WERROR spoolss_SetPrinterData(
801                 [in,ref] policy_handle *handle,
802                 [in] [string,charset(UTF16)] uint16 value_name[],
803                 [in] spoolss_PrinterDataType type,
804                 [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
805                 [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered
806         );
807
808         /******************/
809         /* Function: 0x1c */
810         [todo] WERROR spoolss_WaitForPrinterChange(
811         );
812
813         /******************/
814         /* Function: 0x1d */
815         [public] WERROR spoolss_ClosePrinter(
816                 [in,out,ref]     policy_handle *handle
817         );
818
819         /******************/
820         /* Function: 0x1e */
821         typedef [v1_enum] enum {
822                 SPOOLSS_FORM_USER       = 0,
823                 SPOOLSS_FORM_BUILTIN    = 1,
824                 SPOOLSS_FORM_PRINTER    = 2
825         } spoolss_FormFlags;
826
827         typedef struct {
828                 uint32 width;
829                 uint32 height;
830         } spoolss_FormSize;
831
832         typedef struct {
833                 uint32 left;
834                 uint32 top;
835                 uint32 right;
836                 uint32 bottom;
837         } spoolss_FormArea;
838
839         typedef struct {
840                 spoolss_FormFlags flags;
841                 [relative] nstring *form_name;
842                 spoolss_FormSize size;
843                 spoolss_FormArea area;
844         } spoolss_FormInfo1;
845
846         typedef [nodiscriminant,relative_base,public,gensize] union {
847                 [case(1)] spoolss_FormInfo1 info1;
848                 [default];
849         } spoolss_FormInfo;
850
851         typedef struct {
852                 spoolss_FormFlags flags;
853                 [string,charset(UTF16)] uint16 *form_name;
854                 spoolss_FormSize size;
855                 spoolss_FormArea area;
856         } spoolss_AddFormInfo1;
857
858         typedef [switch_type(uint32)] union {
859                 [case(1)] spoolss_AddFormInfo1 *info1;
860         } spoolss_AddFormInfo;
861
862         WERROR spoolss_AddForm(
863                 [in,ref] policy_handle *handle,
864                 [in] uint32 level,
865                 [in,switch_is(level)] spoolss_AddFormInfo info
866         );
867
868         /******************/
869         /* Function: 0x1f */
870         WERROR spoolss_DeleteForm(
871                 [in,ref] policy_handle *handle,
872                 [in] [string,charset(UTF16)] uint16 form_name[]
873         );
874
875         /******************/
876         /* Function: 0x20 */
877         WERROR spoolss_GetForm(
878                 [in,ref] policy_handle *handle,
879                 [in] [string,charset(UTF16)] uint16 form_name[],
880                 [in] uint32 level,
881                 [in,unique] DATA_BLOB *buffer,
882                 [in] uint32 offered,
883                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
884                 [out] uint32 needed
885         );
886
887         /******************/
888         /* Function: 0x21 */
889         WERROR spoolss_SetForm(
890                 [in,ref] policy_handle *handle,
891                 [in] [string,charset(UTF16)] uint16 form_name[],
892                 [in] uint32 level,
893                 [in,switch_is(level)] spoolss_AddFormInfo info
894         );
895
896         /******************/
897         /* Function: 0x22 */
898         [public,noopnum,noprint] WERROR _spoolss_EnumForms(
899                 [in,ref] policy_handle *handle,
900                 [in]     uint32 level,
901                 [in,unique] DATA_BLOB *buffer,
902                 [in]     uint32 offered,
903                 [out,unique] DATA_BLOB *info,
904                 [out]    uint32 needed,
905                 [out]    uint32 count
906         );
907         [public,noopnum,noprint] void __spoolss_EnumForms(
908                 [in] uint32 level,
909                 [in] uint32 count,
910                 [out,switch_is(level)] spoolss_FormInfo info[count]
911         );
912         [nopull,nopush] WERROR spoolss_EnumForms(
913                 [in,ref] policy_handle *handle,
914                 [in]     uint32 level,
915                 [in,unique] DATA_BLOB *buffer,
916                 [in]     uint32 offered,
917                 [out,unique,switch_is(level),size_is(count)] spoolss_FormInfo *info,
918                 [out] uint32 needed,
919                 [out] uint32 count
920         );
921
922         typedef struct {
923                 [relative] nstring *port_name;
924         } spoolss_PortInfo1;
925
926         typedef bitmap {
927                 SPOOLSS_PORT_TYPE_WRITE         = 0x00000001,
928                 SPOOLSS_PORT_TYPE_READ          = 0x00000002,
929                 SPOOLSS_PORT_TYPE_REDIRECTED    = 0x00000004,
930                 SPOOLSS_PORT_TYPE_NET_ATTACHED  = 0x00000008
931         } spoolss_PortType;
932
933         typedef struct {
934                 [relative] nstring *port_name;
935                 [relative] nstring *monitor_name;
936                 [relative] nstring *description;
937                 spoolss_PortType port_type;
938                 uint32 reserved;
939         } spoolss_PortInfo2;
940
941         typedef [nodiscriminant,relative_base,public] union {
942                 [case(1)] spoolss_PortInfo1 info1;
943                 [case(2)] spoolss_PortInfo2 info2;
944                 [case(3)]; /* TODO */
945                 [default];
946         } spoolss_PortInfo;
947
948         /******************/
949         /* Function: 0x23 */
950         [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
951                 [in,unique] [string,charset(UTF16)] uint16 *servername,
952                 [in] uint32 level,
953                 [in,unique] DATA_BLOB *buffer,
954                 [in] uint32 offered,
955                 [out,unique] DATA_BLOB *info,
956                 [out] uint32 needed,
957                 [out] uint32 count
958         );
959         [public,noopnum,noprint] void __spoolss_EnumPorts(
960                 [in] uint32 level,
961                 [in] uint32 count,
962                 [out,switch_is(level)] spoolss_PortInfo info[count]
963         );
964         [nopull,nopush] WERROR spoolss_EnumPorts(
965                 [in,unique] [string,charset(UTF16)] uint16 *servername,
966                 [in] uint32 level,
967                 [in,unique] DATA_BLOB *buffer,
968                 [in] uint32 offered,
969                 [out,unique,switch_is(level),size_is(count)] spoolss_PortInfo *info,
970                 [out] uint32 needed,
971                 [out] uint32 count
972         );
973
974         /******************/
975         /* Function: 0x24 */
976         typedef struct {
977                 [relative] nstring *monitor_name;
978         } spoolss_MonitorInfo1;
979
980         typedef struct {
981                 [relative] nstring *monitor_name;
982                 [relative] nstring *environment;
983                 [relative] nstring *dll_name;
984         } spoolss_MonitorInfo2;
985
986         typedef [nodiscriminant,relative_base,public] union {
987                 [case(1)] spoolss_MonitorInfo1 info1;
988                 [case(2)] spoolss_MonitorInfo2 info2;
989                 [default];
990         } spoolss_MonitorInfo;
991
992         [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
993                 [in,unique] [string,charset(UTF16)] uint16 *servername,
994                 [in] uint32 level,
995                 [in,unique] DATA_BLOB *buffer,
996                 [in] uint32 offered,
997                 [out,unique] DATA_BLOB *info,
998                 [out] uint32 needed,
999                 [out] uint32 count
1000         );
1001         [public,noopnum,noprint] void __spoolss_EnumMonitors(
1002                 [in] uint32 level,
1003                 [in] uint32 count,
1004                 [out,switch_is(level)] spoolss_MonitorInfo info[count]
1005         );
1006         [nopull,nopush] WERROR spoolss_EnumMonitors(
1007                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1008                 [in] uint32 level,
1009                 [in,unique] DATA_BLOB *buffer,
1010                 [in] uint32 offered,
1011                 [out,unique,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
1012                 [out] uint32 needed,
1013                 [out] uint32 count
1014         );
1015
1016         /******************/
1017         /* Function: 0x25 */
1018         WERROR spoolss_AddPort(
1019                [in,unique] [string,charset(UTF16)] uint16 *server_name,
1020                [in] uint32 unknown,
1021                [in] [string,charset(UTF16)] uint16 monitor_name[]
1022         );
1023
1024         /******************/
1025         /* Function: 0x26 */
1026         [todo] WERROR spoolss_ConfigurePort(
1027         );
1028
1029         /******************/
1030         /* Function: 0x27 */
1031         [todo] WERROR spoolss_DeletePort(
1032         );
1033
1034         /******************/
1035         /* Function: 0x28 */
1036         [todo] WERROR spoolss_CreatePrinterIC(
1037         );
1038
1039         /******************/
1040         /* Function: 0x29 */
1041         [todo] WERROR spoolss_PlayGDIScriptOnPrinterIC(
1042         );
1043
1044         /******************/
1045         /* Function: 0x2a */
1046         [todo] WERROR spoolss_DeletePrinterIC(
1047         );
1048
1049         /******************/
1050         /* Function: 0x2b */
1051         [todo] WERROR spoolss_AddPrinterConnection(
1052         );
1053
1054         /******************/
1055         /* Function: 0x2c */
1056         [todo] WERROR spoolss_DeletePrinterConnection(
1057         );
1058
1059         /******************/
1060         /* Function: 0x2d */
1061         [todo] WERROR spoolss_PrinterMessageBox(
1062                 /* Marked as obsolete in MSDN.  "Not necessary and has
1063                    no effect". */
1064         );
1065
1066         /******************/
1067         /* Function: 0x2e */
1068         [todo] WERROR spoolss_AddMonitor(
1069         );
1070
1071         /******************/
1072         /* Function: 0x2f */
1073         [todo] WERROR spoolss_DeleteMonitor(
1074         );
1075
1076         /******************/
1077         /* Function: 0x30 */
1078         [todo] WERROR spoolss_DeletePrintProcessor(
1079         );
1080
1081         /******************/
1082         /* Function: 0x31 */
1083         [todo] WERROR spoolss_AddPrintProvidor(
1084         );
1085
1086         /******************/
1087         /* Function: 0x32 */
1088         [todo] WERROR spoolss_DeletePrintProvidor(
1089         );
1090
1091         /******************/
1092         /* Function: 0x33 */
1093         [todo] WERROR spoolss_EnumPrintProcDataTypes(
1094         );
1095
1096         /******************/
1097         /* Function: 0x34 */
1098         [todo] WERROR spoolss_ResetPrinter(
1099         );
1100
1101         /******************/
1102         /* Function: 0x35 */
1103         WERROR spoolss_GetPrinterDriver2(
1104                 [in,ref] policy_handle *handle,
1105                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
1106                 [in]     uint32 level,
1107                 [in,unique] DATA_BLOB *buffer,
1108                 [in]     uint32 offered,
1109                 [in]     uint32 client_major_version,
1110                 [in]     uint32 client_minor_version,
1111                 [out,unique] DATA_BLOB *info,
1112                 [out]    uint32 needed,
1113                 [out]    uint32 server_major_version,
1114                 [out]    uint32 server_minor_version
1115         );
1116
1117         /******************/
1118         /* Function: 0x36 */
1119         [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
1120         );
1121
1122         /******************/
1123         /* Function: 0x37 */
1124         [todo] WERROR spoolss_FindNextPrinterChangeNotification(
1125         );
1126
1127         /******************/
1128         /* Function: 0x38 */
1129         [public] WERROR spoolss_FindClosePrinterNotify(
1130                 [in,ref] policy_handle *handle
1131         );
1132
1133         /******************/
1134         /* Function: 0x39 */
1135         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
1136         );
1137
1138         /******************/
1139         /* Function: 0x3a */
1140         [public] WERROR spoolss_ReplyOpenPrinter(
1141                 [in,string,charset(UTF16)] uint16 server_name[],
1142                 [in] uint32 printer_local,
1143                 [in] winreg_Type type,
1144                 [in] uint32 unknown1,
1145                 [in] uint32 unknown2,
1146                 [out,ref] policy_handle *handle
1147         );
1148
1149         /******************/
1150         /* Function: 0x3b */
1151         [todo] WERROR spoolss_RouterReplyPrinter(
1152         );
1153
1154         /******************/
1155         /* Function: 0x3c */
1156         [public] WERROR spoolss_ReplyClosePrinter(
1157                 [in,out,ref] policy_handle *handle
1158         );
1159
1160         /******************/
1161         /* Function: 0x3d */
1162         [todo] WERROR spoolss_AddPortEx(
1163         );
1164
1165         /******************/
1166         /* Function: 0x3e */
1167         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
1168         );
1169
1170         /******************/
1171         /* Function: 0x3f */
1172         [todo] WERROR spoolss_SpoolerInit(
1173         );
1174
1175         /******************/
1176         /* Function: 0x40 */
1177         [todo] WERROR spoolss_ResetPrinterEx(
1178         );
1179
1180         typedef [enum16bit] enum {
1181                 SPOOLSS_FIELD_SERVER_NAME               =  0,
1182                 SPOOLSS_FIELD_PRINTER_NAME              =  1,
1183                 SPOOLSS_FIELD_SHARE_NAME        =  2,
1184                 SPOOLSS_FIELD_PORT_NAME                 =  3,
1185                 SPOOLSS_FIELD_DRIVER_NAME               =  4,
1186                 SPOOLSS_FIELD_COMMENT                   =  5,
1187                 SPOOLSS_FIELD_LOCATION                  =  6,
1188                 SPOOLSS_FIELD_DEVMODE                   =  7,
1189                 SPOOLSS_FIELD_SEPFILE                   =  8,
1190                 SPOOLSS_FIELD_PRINT_PROCESSOR   =  9,
1191                 SPOOLSS_FIELD_PARAMETERS                = 10,
1192                 SPOOLSS_FIELD_DATATYPE                  = 11,
1193                 SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12,
1194                 SPOOLSS_FIELD_ATTRIBUTES                = 13,
1195                 SPOOLSS_FIELD_PRIORITY                  = 14,
1196                 SPOOLSS_FIELD_DEFAULT_PRIORITY  = 15,
1197                 SPOOLSS_FIELD_START_TIME                = 16,
1198                 SPOOLSS_FIELD_UNTIL_TIME                = 17,
1199                 SPOOLSS_FIELD_STATUS                    = 18,
1200                 SPOOLSS_FIELD_STATUS_STRING             = 19,
1201                 SPOOLSS_FIELD_CJOBS                             = 20,
1202                 SPOOLSS_FIELD_AVERAGE_PPM               = 21,
1203                 SPOOLSS_FIELD_TOTAL_PAGES               = 22,
1204                 SPOOLSS_FIELD_PAGES_PRINTED     = 23,
1205                 SPOOLSS_FIELD_TOTAL_BYTES               = 24,
1206                 SPOOLSS_FIELD_BYTES_PRINTED             = 25
1207         } spoolss_Field;
1208
1209         typedef [enum16bit] enum {
1210                 SPOOLSS_NOTIFY_PRINTER                  = 0,
1211                 SPOOLSS_NOTIFY_JOB                              = 1
1212         } spoolss_NotifyType;
1213
1214         /******************/
1215         /* Function: 0x41 */
1216         typedef struct {
1217                 spoolss_NotifyType type;
1218                 uint16 u1;
1219                 uint32 u2;
1220                 uint32 u3;
1221                 uint32 count;
1222                 [size_is(count)] spoolss_Field *fields;
1223         } spoolss_NotifyOptionsArray;
1224
1225         typedef struct {
1226                 uint32 version;
1227                 uint32 flags;
1228                 uint32 count;
1229                 [size_is(count)] spoolss_NotifyOptionsArray *options;
1230         } spoolss_NotifyOptionsContainer;
1231
1232         [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
1233                 [in,ref] policy_handle *handle,
1234                 [in] uint32 flags,
1235                 [in] uint32 options,
1236                 [in,unique] [string,charset(UTF16)] uint16 *str,
1237                 [in] uint32 printer_local,
1238                 [in,unique] spoolss_NotifyOptionsContainer *t1
1239         );
1240
1241         /******************/
1242         /* Function: 0x42 */
1243         [todo] WERROR spoolss_RouterRefreshPrinterChangeNotification(
1244         );
1245
1246         typedef struct {
1247                 uint32 size;
1248                 [size_is(size/2),unique,charset(UTF16)] uint16 *string;
1249         } spoolss_NotifyUTF16String;
1250
1251         typedef struct {
1252                 uint32 size;
1253                 [size_is(size),charset(DOS)] uint8 *string;
1254         } spoolss_NotifyDOSString;
1255
1256         typedef struct {
1257                 uint16 data[8];
1258         } spoolss_NotifyBlobData;
1259
1260         typedef struct {
1261                 uint32 len;
1262                 [unique] spoolss_NotifyBlobData *data;
1263         } spoolss_NotifyBlob;
1264
1265         typedef [switch_type(uint32)] union {
1266                 [case(1)] dlong integer;
1267                 [case(2)] spoolss_NotifyUTF16String utf16_string;
1268                 [case(3)] spoolss_NotifyDOSString ascii_string;
1269                 [case(4)] spoolss_NotifyBlob blob;
1270                 [case(5)] spoolss_NotifyDOSString ascii_string;
1271         } spoolss_NotifyData;
1272
1273         typedef struct {
1274                 spoolss_NotifyType type;
1275                 spoolss_Field field;
1276                 uint32 variable_type;
1277                 uint32 job_id;
1278                 [switch_is(variable_type)] spoolss_NotifyData data;
1279         } spoolss_Notify;
1280
1281         typedef struct {
1282                 uint32 version;
1283                 uint32 flags;
1284                 uint32 count;
1285                 [size_is(count)] spoolss_Notify notifies[];
1286         } spoolss_NotifyInfo;
1287
1288         /******************/
1289         /* Function: 0x43 */
1290         [public] WERROR spoolss_RemoteFindNextPrinterChangeNotifyEx(
1291                 [in,ref] policy_handle *handle,
1292                 [in] uint32 change_low,
1293                 [in,unique] spoolss_NotifyOptionsContainer *container,
1294                 [out,ref] spoolss_NotifyInfo **info
1295         );
1296
1297         /******************/
1298         /* Function: 0x44 */
1299         [todo] WERROR spoolss_44(
1300         );
1301
1302         typedef struct {
1303                 uint32 size;
1304                 [string,charset(UTF16)] uint16 *client;
1305                 [string,charset(UTF16)] uint16 *user;
1306                 uint32 build;
1307                 uint32 major;
1308                 uint32 minor;
1309                 uint32 processor;
1310         } spoolss_UserLevel1;
1311
1312         typedef union {
1313                 [case(1)]  spoolss_UserLevel1 *level1;
1314         } spoolss_UserLevel;
1315
1316         typedef bitmap {
1317                 SERVER_ACCESS_ADMINISTER        = 0x00000001,
1318                 SERVER_ACCESS_ENUMERATE         = 0x00000002,
1319                 PRINTER_ACCESS_ADMINISTER       = 0x00000004,
1320                 PRINTER_ACCESS_USE              = 0x00000008,
1321                 JOB_ACCESS_ADMINISTER           = 0x00000010
1322         } spoolss_AccessRights;
1323
1324         /* Access rights for print servers */
1325         const int SERVER_ALL_ACCESS     = SEC_STD_REQUIRED |
1326                                           SERVER_ACCESS_ADMINISTER |
1327                                           SERVER_ACCESS_ENUMERATE;
1328
1329         const int SERVER_READ           = SEC_STD_READ_CONTROL |
1330                                           SERVER_ACCESS_ENUMERATE;
1331
1332         const int SERVER_WRITE          = STANDARD_RIGHTS_WRITE_ACCESS |
1333                                           SERVER_ACCESS_ADMINISTER |
1334                                           SERVER_ACCESS_ENUMERATE;
1335
1336         const int SERVER_EXECUTE        = SEC_STD_READ_CONTROL |
1337                                           SERVER_ACCESS_ENUMERATE;
1338
1339         /* Access rights for printers */
1340         const int PRINTER_ALL_ACCESS    = SEC_STD_REQUIRED |
1341                                           PRINTER_ACCESS_ADMINISTER |
1342                                           PRINTER_ACCESS_USE;
1343
1344         const int PRINTER_READ          = SEC_STD_READ_CONTROL |
1345                                           PRINTER_ACCESS_USE;
1346
1347         const int PRINTER_WRITE         = STANDARD_RIGHTS_WRITE_ACCESS |
1348                                           PRINTER_ACCESS_USE;
1349
1350         const int PRINTER_EXECUTE       = SEC_STD_READ_CONTROL |
1351                                           PRINTER_ACCESS_USE;
1352
1353         /* Access rights for jobs */
1354         const int JOB_ALL_ACCESS        = SEC_STD_REQUIRED |
1355                                           JOB_ACCESS_ADMINISTER;
1356
1357         const int JOB_READ              = SEC_STD_READ_CONTROL |
1358                                           JOB_ACCESS_ADMINISTER;
1359
1360         const int JOB_WRITE             = STANDARD_RIGHTS_WRITE_ACCESS |
1361                                           JOB_ACCESS_ADMINISTER;
1362
1363         const int JOB_EXECUTE           = SEC_STD_READ_CONTROL |
1364                                           JOB_ACCESS_ADMINISTER;
1365
1366         /* ACE masks for various print permissions */
1367         const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
1368                                                 PRINTER_ALL_ACCESS;
1369
1370         const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
1371                                                 READ_CONTROL_ACCESS;
1372
1373         const int PRINTER_ACE_PRINT     = GENERIC_EXECUTE_ACCESS |
1374                                           READ_CONTROL_ACCESS |
1375                                           PRINTER_ACCESS_USE;
1376
1377         /******************/
1378         /* Function: 0x45 */
1379         [public] WERROR spoolss_OpenPrinterEx(
1380                 [in,unique]           [string,charset(UTF16)] uint16 *printername,
1381                 [in,unique]           [string,charset(UTF16)] uint16 *datatype,
1382                 [in]                  spoolss_DevmodeContainer devmode_ctr,
1383                 [in]                  uint32 access_mask,
1384                 [in]                  uint32 level,
1385                 [in,switch_is(level)] spoolss_UserLevel userlevel,
1386                 [out,ref]             policy_handle *handle
1387         );
1388
1389         /******************/
1390         /* Function: 0x46 */
1391         WERROR spoolss_AddPrinterEx(
1392                 [in,unique] [string,charset(UTF16)] uint16 *server,
1393                 [in] uint32 level,
1394                 [in,unique,switch_is(level)] spoolss_PrinterInfo *info,
1395                 [in] spoolss_DevmodeContainer devmode_ctr,
1396                 [in,unique] security_descriptor *secdesc,
1397                 [in] uint32 ulevel,
1398                 [in,switch_is(ulevel)] spoolss_UserLevel userlevel
1399         );
1400
1401         /******************/
1402         /* Function: 0x47 */
1403         [todo] WERROR spoolss_47(
1404         );
1405
1406         /******************/
1407         /* Function: 0x48 */
1408         WERROR spoolss_EnumPrinterData(
1409                 [in,ref] policy_handle *handle,
1410                 [in]     uint32 enum_index,
1411                 [out,ref,size_is(value_offered/2),charset(UTF16)] uint16 *value_name,
1412                 [in]     uint32 value_offered,
1413                 [out,ref] uint32 *value_needed,
1414                 [out,ref] uint32 *printerdata_type,
1415                 [out,ref] DATA_BLOB *buffer,
1416                 [in]     uint32 data_offered,
1417                 [out,ref] uint32 *data_needed
1418         );
1419
1420         /******************/
1421         /* Function: 0x49 */
1422         WERROR spoolss_DeletePrinterData(
1423                 [in,ref] policy_handle *handle,
1424                 [in] [string,charset(UTF16)] uint16 value_name[]
1425         );
1426
1427         /******************/
1428         /* Function: 0x4a */
1429         [todo] WERROR spoolss_4a(
1430         );
1431
1432         /******************/
1433         /* Function: 0x4b */
1434         [todo] WERROR spoolss_4b(
1435         );
1436
1437         /******************/
1438         /* Function: 0x4c */
1439         [todo] WERROR spoolss_4c(
1440         );
1441
1442         /******************/
1443         /* Function: 0x4d */
1444         WERROR spoolss_SetPrinterDataEx(
1445                 [in,ref] policy_handle *handle,
1446                 [in]     [string,charset(UTF16)] uint16 key_name[],
1447                 [in]     [string,charset(UTF16)] uint16 value_name[],
1448                 [in]     uint32 type,
1449                 [in]     DATA_BLOB buffer,
1450                 [in]     uint32 offered
1451         );
1452
1453         /******************/
1454         /* Function: 0x4e */
1455         WERROR spoolss_GetPrinterDataEx(
1456                 [in,ref] policy_handle *handle,
1457                 [in]     [string,charset(UTF16)] uint16 key_name[],
1458                 [in]     [string,charset(UTF16)] uint16 value_name[],
1459                 [in]     uint32 offered,
1460                 [out]    uint32 type,
1461                 [out]    DATA_BLOB buffer,
1462                 [out]    uint32 needed
1463         );
1464
1465         /******************/
1466         /* Function: 0x4f */
1467         [public] WERROR spoolss_EnumPrinterDataEx(
1468                 [in,ref] policy_handle *handle,
1469                 [in]     [string,charset(UTF16)] uint16 key_name[],
1470                 [in]     uint32 offered,
1471                 [out]    DATA_BLOB buffer,
1472                 [out]    uint32 needed,
1473                 [out]    uint32 count
1474         );
1475
1476         /******************/
1477         /* Function: 0x50 */
1478         [public] WERROR spoolss_EnumPrinterKey(
1479                 [in, ref] policy_handle *handle,
1480                 [in] [string,charset(UTF16)] uint16 key_name[],
1481                 [out] uint32 key_buffer_size,
1482                 [out] uint16 key_buffer[key_buffer_size],
1483                 [in,out] uint32 needed
1484         );
1485
1486         /******************/
1487         /* Function: 0x51 */
1488         WERROR spoolss_DeletePrinterDataEx(
1489                 [in,ref] policy_handle *handle,
1490                 [in] [string,charset(UTF16)] uint16 key_name[],
1491                 [in] [string,charset(UTF16)] uint16 value_name[]
1492         );
1493
1494         /******************/
1495         /* Function: 0x52 */
1496         [todo] WERROR spoolss_DeletePrinterKey(
1497         );
1498
1499         /******************/
1500         /* Function: 0x53 */
1501         [todo] WERROR spoolss_53(
1502         );
1503
1504         /******************/
1505         /* Function: 0x54 */
1506         [todo] WERROR spoolss_DeletePrinterDriverEx(
1507         );
1508
1509         /******************/
1510         /* Function: 0x55 */
1511         [todo] WERROR spoolss_55(
1512         );
1513
1514         /******************/
1515         /* Function: 0x56 */
1516         [todo] WERROR spoolss_56(
1517         );
1518
1519         /******************/
1520         /* Function: 0x57 */
1521         [todo] WERROR spoolss_57(
1522         );
1523
1524         /******************/
1525         /* Function: 0x58 */
1526         WERROR spoolss_XcvData(
1527                 [in,ref] policy_handle *handle,
1528                 [in] [string,charset(UTF16)] uint16 function_name[],
1529                 [in] DATA_BLOB in_data,
1530                 [in,value(r->in.in_data.length)] uint32 _in_data_length,
1531                 [in] uint32 offered,
1532                 [in] uint32 unknown1,
1533                 [out] DATA_BLOB out_data,
1534                 [out] uint32 needed,
1535                 [out] uint32 unknown2
1536         );
1537
1538         /******************/
1539         /* Function: 0x59 */
1540         [public,todo] WERROR spoolss_AddPrinterDriverEx(
1541         );
1542
1543         /******************/
1544         /* Function: 0x5a */
1545         [todo] WERROR spoolss_5a(
1546         );
1547
1548         /******************/
1549         /* Function: 0x5b */
1550         [todo] WERROR spoolss_5b(
1551         );
1552
1553         /******************/
1554         /* Function: 0x5c */
1555         [todo] WERROR spoolss_5c(
1556         );
1557
1558         /******************/
1559         /* Function: 0x5d */
1560         [todo] WERROR spoolss_5d(
1561         );
1562
1563         /******************/
1564         /* Function: 0x5e */
1565         [todo] WERROR spoolss_5e(
1566         );
1567
1568         /******************/
1569         /* Function: 0x5f */
1570         [todo] WERROR spoolss_5f(
1571         );
1572 }