spoolss: more mork on SetPrinterInfo() levels.
[ira/wip.git] / librpc / idl / spoolss.idl
1 #include "idl_types.h"
2
3 /*
4   spoolss interface definitions
5 */
6 import "misc.idl", "security.idl", "winreg.idl";
7
8 [ uuid("12345678-1234-abcd-ef00-0123456789ab"),
9   version(1.0),
10   endpoint("ncacn_np:[\\pipe\\spoolss]"),
11   pointer_default(unique),
12   helpstring("Spooler SubSystem"),
13   helper("../librpc/ndr/ndr_spoolss_buf.h")
14 ] interface spoolss
15 {
16         typedef [v1_enum] enum winreg_Type winreg_Type;
17         typedef [gensize] struct {
18                 uint16 year;
19                 uint16 month;
20                 uint16 day_of_week;
21                 uint16 day;
22                 uint16 hour;
23                 uint16 minute;
24                 uint16 second;
25                 uint16 millisecond;
26         } spoolss_Time;
27
28         typedef struct {
29                 [value(ndr_size_spoolss_Time(time, ndr->iconv_convenience, ndr->flags))] uint32 size;
30                 [unique] spoolss_Time *time;
31         } spoolss_TimeCtr;
32
33         typedef enum {
34                 PROCESSOR_ARCHITECTURE_INTEL            = 0x0000,
35                 PROCESSOR_ARCHITECTURE_IA64             = 0x0006,
36                 PROCESSOR_ARCHITECTURE_AMD64            = 0x0009
37         } spoolss_ProcessorArchitecture;
38
39         typedef [v1_enum] enum {
40                 PROCESSOR_INTEL_386                     = 0x00000182,
41                 PROCESSOR_INTEL_486                     = 0x000001E6,
42                 PROCESSOR_INTEL_PENTIUM                 = 0x0000024A,
43                 PROCESSOR_INTEL_IA64                    = 0x00000898,
44                 PROCESSOR_AMD_X8664                     = 0x000022A0
45         } spoolss_ProcessorType;
46
47         typedef [v1_enum] enum {
48                 /* Windows 95, Windows 98, Windows Me, Windows NT4 */
49                 SPOOLSS_MAJOR_VERSION_NT4_95_98_ME      = 0x00000004,
50                 /* Windows 2000, Windows 2003, Windows XP */
51                 SPOOLSS_MAJOR_VERSION_2000_2003_XP      = 0x00000005,
52                 /* Windows Vista, Windows 2008 */
53                 SPOOLSS_MAJOR_VERSION_2008_VISTA        = 0x00000006
54         } spoolss_MajorVersion;
55
56         typedef [v1_enum] enum {
57                 /* Windows 2008, Windows Vista, Windows 2000, Windows NT4, Windows 95 */
58                 SPOOLSS_MINOR_VERSION_0                 = 0x00000000,
59                 /* Windows XP */
60                 SPOOLSS_MINOR_VERSION_XP                = 0x00000001,
61                 /* Windows 2003, Windows XP x64 */
62                 SPOOLSS_MINOR_VERSION_2003_XP64         = 0x00000002,
63                 /* Windows 98 */
64                 SPOOLSS_MINOR_VERSION_98                = 0x0000000a,
65                 /* Windows Me */
66                 SPOOLSS_MINOR_VERSION_ME                = 0x0000005a
67         } spoolss_MinorVersion;
68
69         const int PRINTER_STATUS_OK             = 0x00000000;
70
71         typedef bitmap {
72                 PRINTER_STATUS_PAUSED           = 0x00000001,
73                 PRINTER_STATUS_ERROR            = 0x00000002,
74                 PRINTER_STATUS_PENDING_DELETION = 0x00000004,
75                 PRINTER_STATUS_PAPER_JAM        = 0x00000008,
76                 PRINTER_STATUS_PAPER_OUT        = 0x00000010,
77                 PRINTER_STATUS_MANUAL_FEED      = 0x00000020,
78                 PRINTER_STATUS_PAPER_PROBLEM    = 0x00000040,
79                 PRINTER_STATUS_OFFLINE          = 0x00000080,
80                 PRINTER_STATUS_IO_ACTIVE        = 0x00000100,
81                 PRINTER_STATUS_BUSY             = 0x00000200,
82                 PRINTER_STATUS_PRINTING         = 0x00000400,
83                 PRINTER_STATUS_OUTPUT_BIN_FULL  = 0x00000800,
84                 PRINTER_STATUS_NOT_AVAILABLE    = 0x00001000,
85                 PRINTER_STATUS_WAITING          = 0x00002000,
86                 PRINTER_STATUS_PROCESSING       = 0x00004000,
87                 PRINTER_STATUS_INITIALIZING     = 0x00008000,
88                 PRINTER_STATUS_WARMING_UP       = 0x00010000,
89                 PRINTER_STATUS_TONER_LOW        = 0x00020000,
90                 PRINTER_STATUS_NO_TONER         = 0x00040000,
91                 PRINTER_STATUS_PAGE_PUNT        = 0x00080000,
92                 PRINTER_STATUS_USER_INTERVENTION= 0x00100000,
93                 PRINTER_STATUS_OUT_OF_MEMORY    = 0x00200000,
94                 PRINTER_STATUS_DOOR_OPEN        = 0x00400000,
95                 PRINTER_STATUS_SERVER_UNKNOWN   = 0x00800000,
96                 PRINTER_STATUS_POWER_SAVE       = 0x01000000
97         } spoolss_PrinterStatus;
98
99         /* JOB status codes. */
100
101         const int JOB_STATUS_QUEUED = 0x0000;
102
103         typedef [bitmap32bit] bitmap {
104                 JOB_STATUS_PAUSED               = 0x00000001,
105                 JOB_STATUS_ERROR                = 0x00000002,
106                 JOB_STATUS_DELETING             = 0x00000004,
107                 JOB_STATUS_SPOOLING             = 0x00000008,
108                 JOB_STATUS_PRINTING             = 0x00000010,
109                 JOB_STATUS_OFFLINE              = 0x00000020,
110                 JOB_STATUS_PAPEROUT             = 0x00000040,
111                 JOB_STATUS_PRINTED              = 0x00000080,
112                 JOB_STATUS_DELETED              = 0x00000100,
113                 JOB_STATUS_BLOCKED_DEVQ         = 0x00000200,
114                 JOB_STATUS_USER_INTERVENTION    = 0x00000400,
115                 JOB_STATUS_RESTART              = 0x00000800,
116                 JOB_STATUS_COMPLETE             = 0x00001000
117         } spoolss_JobStatus;
118
119         typedef [public,gensize] struct {
120                 [relative] nstring *printername;
121                 [relative] nstring *servername;
122                 uint32 cjobs;
123                 uint32 total_jobs;
124                 uint32 total_bytes;
125                 spoolss_Time time;
126                 uint32 global_counter;
127                 uint32 total_pages;
128                 uint32 version;
129                 uint32 free_build;
130                 uint32 spooling;
131                 uint32 max_spooling;
132                 uint32 session_counter;
133                 uint32 num_error_out_of_paper;
134                 uint32 num_error_not_ready;
135                 spoolss_JobStatus job_error;
136                 uint32 number_of_processors;
137                 spoolss_ProcessorType processor_type;
138                 uint32 high_part_total_bytes;
139                 uint32 change_id;
140                 WERROR last_error;
141                 spoolss_PrinterStatus status;
142                 uint32 enumerate_network_printers;
143                 uint32 c_setprinter;
144                 spoolss_ProcessorArchitecture processor_architecture;
145                 uint16 processor_level;
146                 uint32 ref_ic;
147                 uint32 reserved2;
148                 uint32 reserved3;
149         } spoolss_PrinterInfo0;
150
151         typedef [bitmap32bit] bitmap {
152                 DEVMODE_ORIENTATION             = 0x00000001,
153                 DEVMODE_PAPERSIZE               = 0x00000002,
154                 DEVMODE_PAPERLENGTH             = 0x00000004,
155                 DEVMODE_PAPERWIDTH              = 0x00000008,
156                 DEVMODE_SCALE                   = 0x00000010,
157                 DEVMODE_POSITION                = 0x00000020,
158                 DEVMODE_NUP                     = 0x00000040,
159                 DEVMODE_COPIES                  = 0x00000100,
160                 DEVMODE_DEFAULTSOURCE           = 0x00000200,
161                 DEVMODE_PRINTQUALITY            = 0x00000400,
162                 DEVMODE_COLOR                   = 0x00000800,
163                 DEVMODE_DUPLEX                  = 0x00001000,
164                 DEVMODE_YRESOLUTION             = 0x00002000,
165                 DEVMODE_TTOPTION                = 0x00004000,
166                 DEVMODE_COLLATE                 = 0x00008000,
167                 DEVMODE_FORMNAME                = 0x00010000,
168                 DEVMODE_LOGPIXELS               = 0x00020000,
169                 DEVMODE_BITSPERPEL              = 0x00040000,
170                 DEVMODE_PELSWIDTH               = 0x00080000,
171                 DEVMODE_PELSHEIGHT              = 0x00100000,
172                 DEVMODE_DISPLAYFLAGS            = 0x00200000,
173                 DEVMODE_DISPLAYFREQUENCY        = 0x00400000,
174                 DEVMODE_ICMMETHOD               = 0x00800000,
175                 DEVMODE_ICMINTENT               = 0x01000000,
176                 DEVMODE_MEDIATYPE               = 0x02000000,
177                 DEVMODE_DITHERTYPE              = 0x04000000,
178                 DEVMODE_PANNINGWIDTH            = 0x08000000,
179                 DEVMODE_PANNINGHEIGHT           = 0x10000000
180         } spoolss_DeviceModeFields;
181
182         typedef [enum16bit] enum {
183                 DMSPEC_NT3              = 0x320,
184                 DMSPEC_WIN95_98_ME      = 0x400,
185                 DMSPEC_NT4_AND_ABOVE    = 0x401
186         } spoolss_DeviceModeSpecVersion;
187
188         typedef [enum16bit] enum {
189                 DMORIENT_PORTRAIT       = 0x0001,
190                 DMORIENT_LANDSCAPE      = 0x0002
191         } spoolss_DeviceModeOrientation;
192
193         typedef [enum16bit] enum {
194                 DMPAPER_LETTER                  = 0x0001, /* Letter, 8 1/2 x 11 inches */
195                 DMPAPER_LETTERSMALL             = 0x0002, /* Letter Small, 8 1/2 x 11 inches */
196                 DMPAPER_TABLOID                 = 0x0003, /* Tabloid, 11 x 17 inches */
197                 DMPAPER_LEDGER                  = 0x0004, /* Ledger, 17 x 11 inches */
198                 DMPAPER_LEGAL                   = 0x0005, /* Legal, 8 1/2 x 14 inches */
199                 DMPAPER_STATEMENT               = 0x0006, /* Statement, 5 1/2 x 8 1/2 inches */
200                 DMPAPER_EXECUTIVE               = 0x0007, /* Executive, 7 1/4 x 10 1/2 inches */
201                 DMPAPER_A3                      = 0x0008, /* A3 sheet, 297 x 420 millimeters */
202                 DMPAPER_A4                      = 0x0009, /* A4 sheet, 210 x 297 millimeters */
203                 DMPAPER_A4SMALL                 = 0x000A, /* A4 small sheet, 210 x 297 millimeters */
204                 DMPAPER_A5                      = 0x000B, /* A5 sheet, 148 x 210 millimeters */
205                 DMPAPER_B4                      = 0x000C, /* B4 sheet, 250 x 354 millimeters */
206                 DMPAPER_B5                      = 0x000D, /* B5 sheet, 182 x 257-millimeter paper */
207                 DMPAPER_FOLIO                   = 0x000E, /* Folio, 8 1/2 x 13-inch paper */
208                 DMPAPER_QUARTO                  = 0x000F, /* Quarto, 215 x 275 millimeter paper */
209                 DMPAPER_10X14                   = 0x0010, /* 10 x 14-inch sheet */
210                 DMPAPER_11X17                   = 0x0011, /* 11 x 17-inch sheet */
211                 DMPAPER_NOTE                    = 0x0012, /* Note, 8 1/2 x 11-inches */
212                 DMPAPER_ENV_9                   = 0x0013, /* #9 Envelope, 3 7/8 x 8 7/8 inches */
213                 DMPAPER_ENV_10                  = 0x0014, /* #10 Envelope, 4 1/8 x 9 1/2 inches */
214                 DMPAPER_ENV_11                  = 0x0015, /* #11 Envelope, 4 1/2 x 10 3/8 inches */
215                 DMPAPER_ENV_12                  = 0x0016, /* #12 Envelope, 4 3/4 x 11 inches */
216                 DMPAPER_ENV_14                  = 0x0017, /* #14 Envelope, 5 x 11 1/2 inches */
217                 DMPAPER_CSHEET                  = 0x0018, /* C Sheet, 17 x 22 inches */
218                 DMPAPER_DSHEET                  = 0x0019, /* D Sheet, 22 x 34 inches */
219                 DMPAPER_ESHEET                  = 0x001A, /* E Sheet, 34 x 44 inches */
220                 DMPAPER_ENV_DL                  = 0x001B, /* DL Envelope, 110 x 220 millimeters */
221                 DMPAPER_ENV_C5                  = 0x001C, /* C5 Envelope, 162 x 229 millimeters */
222                 DMPAPER_ENV_C3                  = 0x001D, /* C3 Envelope, 324 x 458 millimeters */
223                 DMPAPER_ENV_C4                  = 0x001E, /* C4 Envelope, 229 x 324 millimeters */
224                 DMPAPER_ENV_C6                  = 0x001F, /* C6 Envelope, 114 x 162 millimeters */
225                 DMPAPER_ENV_C65                 = 0x0020, /* C65 Envelope, 114 x 229 millimeters */
226                 DMPAPER_ENV_B4                  = 0x0021, /* B4 Envelope, 250 x 353 millimeters */
227                 DMPAPER_ENV_B5                  = 0x0022, /* B5 Envelope, 176 x 250 millimeters */
228                 DMPAPER_ENV_B6                  = 0x0023, /* B6 Envelope, 176 x 125 millimeters */
229                 DMPAPER_ENV_ITALY               = 0x0024, /* Italy Envelope, 110 x 230 millimeters */
230                 DMPAPER_ENV_MONARCH             = 0x0025, /* Monarch Envelope, 3 7/8 x 7 1/2 inches */
231                 DMPAPER_ENV_PERSONAL            = 0x0026, /* 6 3/4 Envelope, 3 5/8 x 6 1/2 inches */
232                 DMPAPER_FANFOLD_US              = 0x0027, /* US Std Fanfold, 14 7/8 x 11 inches */
233                 DMPAPER_FANFOLD_STD_GERMAN      = 0x0028, /* German Std Fanfold, 8 1/2 x 12 inches */
234                 DMPAPER_FANFOLD_LGL_GERMAN      = 0x0029, /* German Legal Fanfold, 8 x 13 inches */
235                 DMPAPER_DBL_JAPANESE_POSTCARD   = 0x0045, /* Double Japanese Postcard, 200 x 148 millimeters */
236                 DMPAPER_A6                      = 0x0046, /* A6 sheet, 105 x 148 millimeters */
237                 DMPAPER_JENV_KAKU2              = 0x0047, /* Japanese Envelope Kaku #2 */
238                 DMPAPER_JENV_KAKU3              = 0x0048, /* Japanese Envelope Kaku #3 */
239                 DMPAPER_JENV_CHOU3              = 0x0049, /* Japanese Envelope Chou #3 */
240                 DMPAPER_JENV_CHOU4              = 0x004A, /* Japanese Envelope Chou #4 */
241                 DMPAPER_LETTER_ROTATED          = 0x004B, /* Letter Rotated, 11 by 8 1/2 inches */
242                 DMPAPER_A3_ROTATED              = 0x004C, /* A3 rotated sheet, 420 x 297 millimeters */
243                 DMPAPER_A4_ROTATED              = 0x004D, /* A4 rotated sheet, 297 x 210 millimeters */
244                 DMPAPER_A5_ROTATED              = 0x004E, /* A5 rotated sheet, 210 x 148 millimeters */
245                 DMPAPER_B4_JIS_ROTATED          = 0x004F, /* B4 (JIS) rotated sheet, 364 x 257 millimeters */
246                 DMPAPER_B5_JIS_ROTATED          = 0x0050, /* B5 (JIS) rotated sheet, 257 x 182 millimeters */
247                 DMPAPER_JAPANESE_POSTCARD_ROTATED = 0x0051, /* Japanese Postcard Rotated, 148 x 100 millimeters */
248                 DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 0x0052, /* Double Japanese Postcard Rotated, 148 x 200 millimeters */
249                 DMPAPER_A6_ROTATED              = 0x0053, /* A6 rotated sheet, 148 x 105 millimeters */
250                 DMPAPER_JENV_KAKU2_ROTATED      = 0x0054, /* Japanese Envelope Kaku #2 Rotated */
251                 DMPAPER_JENV_KAKU3_ROTATED      = 0x0055, /* Japanese Envelope Kaku #3 Rotated */
252                 DMPAPER_JENV_CHOU3_ROTATED      = 0x0056, /* Japanese Envelope Chou #3 Rotated */
253                 DMPAPER_JENV_CHOU4_ROTATED      = 0x0057, /* Japanese Envelope Chou #4 Rotated */
254                 DMPAPER_B6_JIS                  = 0x0058, /* B6 (JIS) sheet, 128 x 182 millimeters */
255                 DMPAPER_B6_JIS_ROTATED          = 0x0059, /* B6 (JIS) rotated sheet, 182 x 128 millimeters */
256                 DMPAPER_12X11                   = 0x005A, /* 12 x 11-inch sheet */
257                 DMPAPER_JENV_YOU4               = 0x005B, /* Japanese Envelope You #4 */
258                 DMPAPER_JENV_YOU4_ROTATED       = 0x005C, /* Japanese Envelope You #4 */
259                 DMPAPER_P16K                    = 0x005D, /* PRC 16K, 146 x 215 millimeters */
260                 DMPAPER_P32K                    = 0x005E, /* PRC 32K, 97 x 151 millimeters */
261                 DMPAPER_P32KBIG                 = 0x005F, /* PRC 32K(Big) 97 x 151 millimeters */
262                 DMPAPER_PENV_1                  = 0x0060, /* PRC Envelope #1, 102 by 165 millimeters */
263                 DMPAPER_PENV_2                  = 0x0061, /* PRC Envelope #2, 102 x 176 millimeters */
264                 DMPAPER_PENV_3                  = 0x0062, /* PRC Envelope #3, 125 x 176 millimeters */
265                 DMPAPER_PENV_4                  = 0x0063, /* PRC Envelope #4, 110 x 208 millimeters */
266                 DMPAPER_PENV_5                  = 0x0064, /* PRC Envelope #5, 110 x 220 millimeters */
267                 DMPAPER_PENV_6                  = 0x0065, /* PRC Envelope #6, 120 x 230 millimeters */
268                 DMPAPER_PENV_7                  = 0x0066, /* PRC Envelope #7, 160 x 230 millimeters */
269                 DMPAPER_PENV_8                  = 0x0067, /* PRC Envelope #8, 120 x 309 millimeters */
270                 DMPAPER_PENV_9                  = 0x0068, /* PRC Envelope #9, 229 x 324 millimeters */
271                 DMPAPER_PENV_10                 = 0x0069, /* PRC Envelope #10, 324 x 458 millimeters */
272                 DMPAPER_P16K_ROTATED            = 0x006A, /* PRC 16K Rotated, 215 x 146 millimeters */
273                 DMPAPER_P32K_ROTATED            = 0x006B, /* PRC 32K Rotated, 151 x 97 millimeters */
274                 DMPAPER_P32KBIG_ROTATED         = 0x006C, /* PRC 32K(Big) Rotated, 151 x 97 millimeters */
275                 DMPAPER_PENV_1_ROTATED          = 0x006D, /* PRC Envelope #1 Rotated, 165 x 102 millimeters */
276                 DMPAPER_PENV_2_ROTATED          = 0x006E, /* PRC Envelope #2 Rotated, 176 x 102 millimeters */
277                 DMPAPER_PENV_3_ROTATED          = 0x006F, /* PRC Envelope #3 Rotated, 176 x 125 millimeters */
278                 DMPAPER_PENV_4_ROTATED          = 0x0070, /* PRC Envelope #4 Rotated, 208 x 110 millimeters */
279                 DMPAPER_PENV_5_ROTATED          = 0x0071, /* PRC Envelope #5 Rotated, 220 x 110 millimeters */
280                 DMPAPER_PENV_6_ROTATED          = 0x0072, /* PRC Envelope #6 Rotated, 230 x 120 millimeters */
281                 DMPAPER_PENV_7_ROTATED          = 0x0073, /* PRC Envelope #7 Rotated, 230 x 160 millimeters */
282                 DMPAPER_PENV_8_ROTATED          = 0x0074, /* PRC Envelope #8 Rotated, 309 x 120 millimeters */
283                 DMPAPER_PENV_9_ROTATED          = 0x0075, /* PRC Envelope #9 Rotated, 324 x 229 millimeters */
284                 DMPAPER_PENV_10_ROTATED         = 0x0076 /* PRC Envelope #10 Rotated, 458 x 324 millimeters */
285         } spoolss_DeviceModePaperSize;
286
287         typedef [enum16bit] enum {
288                 DMBIN_UPPER             = 0x0001,
289                 DMBIN_LOWER             = 0x0002,
290                 DMBIN_MIDDLE            = 0x0003,
291                 DMBIN_MANUAL            = 0x0004,
292                 DMBIN_ENVELOPE          = 0x0005,
293                 DMBIN_ENVMANUAL         = 0x0006,
294                 DMBIN_AUTO              = 0x0007,
295                 DMBIN_TRACTOR           = 0x0008,
296                 DMBIN_SMALLFMT          = 0x0009,
297                 DMBIN_LARGEFMT          = 0x000a,
298                 DMBIN_LARGECAPACITY     = 0x000b,
299                 DMBIN_CASSETTE          = 0x000e,
300                 DMBIN_FORMSOURCE        = 0x000f
301         } spoolss_DeviceModeDefaultSource;
302
303         typedef [enum16bit] enum {
304                 DMRES_HIGH              = 0xfffc,
305                 DMRES_MEDIUM            = 0xfffd,
306                 DMRES_LOW               = 0xfffe,
307                 DMRES_DRAFT             = 0xffff
308         } spoolss_DeviceModePrintQuality;
309
310         typedef [enum16bit] enum {
311                 DMRES_MONOCHROME         = 0x0001,
312                 DMRES_COLOR              = 0x0002
313         } spoolss_DeviceModeColor;
314
315         typedef [enum16bit] enum {
316                 DMDUP_SIMPLEX           = 0x0001,
317                 DMDUP_VERTICAL          = 0x0002,
318                 DMDUP_HORIZONTAL        = 0x0003
319         } spoolss_DeviceModeDuplex;
320
321         typedef [enum16bit] enum {
322                 DMTT_BITMAP             = 0x0001,
323                 DMTT_DOWNLOAD           = 0x0002,
324                 DMTT_SUBDEV             = 0x0003,
325                 DMTT_DOWNLOAD_OUTLINE   = 0x0004
326         } spoolss_DeviceModeTTOption;
327
328         typedef [enum16bit] enum {
329                 DMCOLLATE_FALSE         = 0x0000,
330                 DMCOLLATE_TRUE          = 0x0001
331         } spoolss_DeviceModeCollate;
332
333         typedef [v1_enum] enum {
334                 DMNUP_SYSTEM            = 0x00000001,
335                 DMNUP_ONEUP             = 0x00000002
336         } spoolss_DeviceModeNUp;
337
338         typedef [v1_enum] enum {
339                 DMICMMETHOD_NONE        = 0x00000001,
340                 DMICMMETHOD_SYSTEM      = 0x00000002,
341                 DMICMMETHOD_DRIVER      = 0x00000003,
342                 DMICMMETHOD_DEVICE      = 0x00000004
343         } spoolss_DeviceModeICMMethod;
344
345         typedef [v1_enum] enum {
346                 DMICM_SATURATE          = 0x00000001,
347                 DMICM_CONTRAST          = 0x00000002,
348                 DMICM_COLORIMETRIC      = 0x00000003,
349                 DMICM_ABS_COLORIMETRIC  = 0x00000004
350         } spoolss_DeviceModeICMIntent;
351
352         typedef [v1_enum] enum {
353                 DMMEDIA_STANDARD        = 0x00000001,
354                 DMMEDIA_TRANSPARENCY    = 0x00000002,
355                 DMMEDIA_GLOSSY          = 0x00000003
356         } spoolss_DeviceModeMediaType;
357
358         typedef [v1_enum] enum {
359                 DMDITHER_NONE           = 0x00000001,
360                 DMDITHER_COARSE         = 0x00000002,
361                 DMDITHER_FINE           = 0x00000003,
362                 DMDITHER_LINEART        = 0x00000004,
363                 DMDITHER_ERRORDIFFUSION = 0x00000005,
364                 DMDITHER_RESERVED6      = 0x00000006,
365                 DMDITHER_RESERVED7      = 0x00000007,
366                 DMDITHER_RESERVED8      = 0x00000008,
367                 DMDITHER_RESERVED9      = 0x00000009,
368                 DMDITHER_GRAYSCALE      = 0x0000000A
369         } spoolss_DeviceModeDitherType;
370
371         const int MAXDEVICENAME = 32;
372
373         typedef [public,gensize] struct {
374                 [charset(UTF16)] uint16 devicename[MAXDEVICENAME];
375                 spoolss_DeviceModeSpecVersion specversion;
376                 uint16 driverversion;
377                 uint16 size;
378                 [value(r->driverextra_data.length)] uint16 __driverextra_length;
379                 spoolss_DeviceModeFields fields;
380                 spoolss_DeviceModeOrientation orientation;
381                 spoolss_DeviceModePaperSize papersize;
382                 uint16 paperlength;
383                 uint16 paperwidth;
384                 uint16 scale;
385                 uint16 copies;
386                 spoolss_DeviceModeDefaultSource defaultsource;
387                 spoolss_DeviceModePrintQuality printquality;
388                 spoolss_DeviceModeColor color;
389                 spoolss_DeviceModeDuplex duplex;
390                 uint16 yresolution;
391                 spoolss_DeviceModeTTOption ttoption;
392                 spoolss_DeviceModeCollate collate;
393                 [charset(UTF16)] uint16 formname[MAXDEVICENAME];
394                 uint16 logpixels; /* reserved */
395                 uint32 bitsperpel; /* reserved */
396                 uint32 pelswidth; /* reserved */
397                 uint32 pelsheight; /* reserved */
398                 spoolss_DeviceModeNUp displayflags;
399                 uint32 displayfrequency; /* reserved */
400                 spoolss_DeviceModeICMMethod icmmethod;
401                 spoolss_DeviceModeICMIntent icmintent;
402                 spoolss_DeviceModeMediaType mediatype;
403                 spoolss_DeviceModeDitherType dithertype;
404                 uint32 reserved1;
405                 uint32 reserved2;
406                 uint32 panningwidth; /* reserved */
407                 uint32 panningheight; /* reserved */
408                 [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
409         } spoolss_DeviceMode;
410
411         typedef [public] bitmap {
412                 PRINTER_ENUM_DEFAULT     = 0x00000001,
413                 PRINTER_ENUM_LOCAL       = 0x00000002,
414                 PRINTER_ENUM_CONNECTIONS = 0x00000004,
415                 PRINTER_ENUM_FAVORITE    = 0x00000004,
416                 PRINTER_ENUM_NAME        = 0x00000008,
417                 PRINTER_ENUM_REMOTE      = 0x00000010,
418                 PRINTER_ENUM_SHARED      = 0x00000020,
419                 PRINTER_ENUM_NETWORK     = 0x00000040,
420                 PRINTER_ENUM_EXPAND      = 0x00004000,
421                 PRINTER_ENUM_CONTAINER   = 0x00008000,
422                 PRINTER_ENUM_ICON1       = 0x00010000,
423                 PRINTER_ENUM_ICON2       = 0x00020000,
424                 PRINTER_ENUM_ICON3       = 0x00040000,
425                 PRINTER_ENUM_ICON4       = 0x00080000,
426                 PRINTER_ENUM_ICON5       = 0x00100000,
427                 PRINTER_ENUM_ICON6       = 0x00200000,
428                 PRINTER_ENUM_ICON7       = 0x00400000,
429                 PRINTER_ENUM_ICON8       = 0x00800000,
430                 PRINTER_ENUM_HIDE        = 0x01000000
431         } spoolss_EnumPrinterFlags;
432
433         const int PRINTER_ENUM_ICONMASK = (PRINTER_ENUM_ICON1 |
434                                            PRINTER_ENUM_ICON2 |
435                                            PRINTER_ENUM_ICON3 |
436                                            PRINTER_ENUM_ICON4 |
437                                            PRINTER_ENUM_ICON5 |
438                                            PRINTER_ENUM_ICON6 |
439                                            PRINTER_ENUM_ICON7 |
440                                            PRINTER_ENUM_ICON8); /* 0x00ff0000 */
441
442         typedef bitmap {
443                 PRINTER_ATTRIBUTE_QUEUED                = 0x00000001,
444                 PRINTER_ATTRIBUTE_DIRECT                = 0x00000002,
445                 PRINTER_ATTRIBUTE_DEFAULT               = 0x00000004,
446                 PRINTER_ATTRIBUTE_SHARED                = 0x00000008,
447                 PRINTER_ATTRIBUTE_NETWORK               = 0x00000010,
448                 PRINTER_ATTRIBUTE_HIDDEN                = 0x00000020,
449                 PRINTER_ATTRIBUTE_LOCAL                 = 0x00000040,
450                 PRINTER_ATTRIBUTE_ENABLE_DEVQ           = 0x00000080,
451                 PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS       = 0x00000100,
452                 PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST     = 0x00000200,
453                 PRINTER_ATTRIBUTE_WORK_OFFLINE          = 0x00000400,
454                 PRINTER_ATTRIBUTE_ENABLE_BIDI           = 0x00000800,
455                 PRINTER_ATTRIBUTE_RAW_ONLY              = 0x00001000,
456                 PRINTER_ATTRIBUTE_PUBLISHED             = 0x00002000,
457                 PRINTER_ATTRIBUTE_FAX                   = 0x00004000,
458                 PRINTER_ATTRIBUTE_TS                    = 0x00008000
459         } spoolss_PrinterAttributes;
460
461         typedef [public,gensize] struct {
462                 spoolss_PrinterAttributes flags;
463                 [relative] nstring *description;
464                 [relative] nstring *name;
465                 [relative] nstring *comment;
466         } spoolss_PrinterInfo1;
467
468         typedef [public,gensize] struct {
469                 [relative] nstring *servername;
470                 [relative] nstring *printername;
471                 [relative] nstring *sharename;
472                 [relative] nstring *portname;
473                 [relative] nstring *drivername;
474                 [relative] nstring *comment;
475                 [relative] nstring *location;
476                 [relative,subcontext(0)] spoolss_DeviceMode *devmode;
477                 [relative] nstring *sepfile;
478                 [relative] nstring *printprocessor;
479                 [relative] nstring *datatype;
480                 [relative] nstring *parameters;
481                 [relative,subcontext(0)] security_descriptor *secdesc;
482                 spoolss_PrinterAttributes attributes;
483                 [range(0,99)] uint32 priority;
484                 uint32 defaultpriority;
485                 uint32 starttime;
486                 uint32 untiltime;
487                 spoolss_PrinterStatus status;
488                 uint32 cjobs;
489                 uint32 averageppm;
490         } spoolss_PrinterInfo2;
491
492         typedef [public,gensize] struct {
493                 [relative,subcontext(0)] security_descriptor *secdesc;
494         } spoolss_PrinterInfo3;
495
496         typedef [public,gensize] struct {
497                 [relative] nstring *printername;
498                 [relative] nstring *servername;
499                 spoolss_PrinterAttributes attributes;
500         } spoolss_PrinterInfo4;
501
502         typedef [public,gensize] struct {
503                 [relative] nstring *printername;
504                 [relative] nstring *portname;
505                 spoolss_PrinterAttributes attributes;
506                 uint32 device_not_selected_timeout;
507                 uint32 transmission_retry_timeout;
508         } spoolss_PrinterInfo5;
509
510         typedef [public,gensize] struct {
511                 spoolss_PrinterStatus status;
512         } spoolss_PrinterInfo6;
513
514         typedef bitmap {
515                 DSPRINT_PUBLISH         = 0x00000001,
516                 DSPRINT_UPDATE          = 0x00000002,
517                 DSPRINT_UNPUBLISH       = 0x00000004,
518                 DSPRINT_REPUBLISH       = 0x00000008,
519                 DSPRINT_PENDING         = 0x80000000
520         } spoolss_DsPrintAction;
521
522         typedef [public,gensize] struct {
523                 [relative] nstring *guid; /* text form of printer guid */
524                 spoolss_DsPrintAction action;
525         } spoolss_PrinterInfo7;
526
527         typedef struct {
528                 [relative,subcontext(0)] spoolss_DeviceMode *devmode;
529         } spoolss_DeviceModeInfo;
530
531         typedef [nodiscriminant,relative_base,public,gensize] union {
532                 [case(0)] spoolss_PrinterInfo0 info0;
533                 [case(1)] spoolss_PrinterInfo1 info1;
534                 [case(2)] spoolss_PrinterInfo2 info2;
535                 [case(3)] spoolss_PrinterInfo3 info3;
536                 [case(4)] spoolss_PrinterInfo4 info4;
537                 [case(5)] spoolss_PrinterInfo5 info5;
538                 [case(6)] spoolss_PrinterInfo6 info6;
539                 [case(7)] spoolss_PrinterInfo7 info7;
540                 [case(8)] spoolss_DeviceModeInfo info8;
541                 [case(9)] spoolss_DeviceModeInfo info9;
542                 [default];
543         } spoolss_PrinterInfo;
544
545         /******************/
546         /* Function: 0x00 */
547         /* we are using this as internal parsing code */
548         [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
549                 [in] spoolss_EnumPrinterFlags flags,
550                 [in,unique] [string,charset(UTF16)] uint16 *server,
551                 [in] uint32 level,
552                 [in,unique] DATA_BLOB *buffer,
553                 [in] uint32 offered,
554                 [out,unique] DATA_BLOB *info,
555                 [out,ref] uint32 *needed,
556                 [out,ref] uint32 *count
557         );
558         [public,noopnum,noprint] void __spoolss_EnumPrinters(
559                 [in] uint32 level,
560                 [in] uint32 count,
561                 [out,switch_is(level)] spoolss_PrinterInfo info[count]
562         );
563         [nopull,nopush] WERROR spoolss_EnumPrinters(
564                 [in] spoolss_EnumPrinterFlags flags,
565                 [in,unique] [string,charset(UTF16)] uint16 *server,
566                 [in] uint32 level,
567                 [in,unique] DATA_BLOB *buffer,
568                 [in] uint32 offered,
569                 /* what we have here is a subcontext containing an array of no discriminant unions
570                  * and the array has no size in front
571                  */
572                 [out,ref] uint32 *count,
573                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrinterInfo **info,
574                 [out,ref] uint32 *needed
575         );
576
577         /******************/
578         /* Function: 0x01 */
579         typedef struct {
580                 [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->iconv_convenience, ndr->flags))] uint32 _ndr_size;
581                 [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
582         } spoolss_DevmodeContainer;
583
584         [public] WERROR spoolss_OpenPrinter(
585                 [in,unique] [string,charset(UTF16)] uint16 *printername,
586                 [in,unique] [string,charset(UTF16)] uint16 *datatype,
587                 [in] spoolss_DevmodeContainer devmode_ctr,
588                 [in] spoolss_AccessRights access_mask,
589                 [out,ref] policy_handle *handle
590         );
591
592         /******************/
593         /* Function: 0x02 */
594
595         typedef [public,gensize] struct {
596                 uint32 job_id;
597                 [relative] nstring *printer_name;
598                 [relative] nstring *server_name;
599                 [relative] nstring *user_name;
600                 [relative] nstring *document_name;
601                 [relative] nstring *data_type;
602                 [relative] nstring *text_status;
603                 spoolss_JobStatus status;
604                 [range(0,99)] uint32 priority;
605                 uint32 position;
606                 uint32 total_pages;
607                 uint32 pages_printed;
608                 spoolss_Time submitted;
609         } spoolss_JobInfo1;
610
611         typedef [public,gensize] struct {
612                 uint32 job_id;
613                 [relative] nstring *printer_name;
614                 [relative] nstring *server_name;
615                 [relative] nstring *user_name;
616                 [relative] nstring *document_name;
617                 [relative] nstring *notify_name;
618                 [relative] nstring *data_type;
619                 [relative] nstring *print_processor;
620                 [relative] nstring *parameters;
621                 [relative] nstring *driver_name;
622                 [relative] spoolss_DeviceMode *devmode;
623                 [relative] nstring *text_status;
624                 [relative] security_descriptor *secdesc;
625                 spoolss_JobStatus status;
626                 [range(0,99)] uint32 priority;
627                 uint32 position;
628                 uint32 start_time;
629                 uint32 until_time;
630                 uint32 total_pages;
631                 uint32 size;
632                 spoolss_Time submitted;
633                 uint32 time;
634                 uint32 pages_printed;
635         } spoolss_JobInfo2;
636
637         typedef [public,gensize] struct {
638                 uint32 job_id;
639                 uint32 next_job_id;
640                 uint32 reserved;
641         } spoolss_JobInfo3;
642
643         typedef [public,gensize] struct {
644                 uint32 job_id;
645                 [relative] nstring *printer_name;
646                 [relative] nstring *server_name;
647                 [relative] nstring *user_name;
648                 [relative] nstring *document_name;
649                 [relative] nstring *notify_name;
650                 [relative] nstring *data_type;
651                 [relative] nstring *print_processor;
652                 [relative] nstring *parameters;
653                 [relative] nstring *driver_name;
654                 [relative] spoolss_DeviceMode *devmode;
655                 [relative] nstring *text_status;
656                 [relative] security_descriptor *secdesc;
657                 spoolss_JobStatus status;
658                 [range(0,99)] uint32 priority;
659                 uint32 position;
660                 uint32 start_time;
661                 uint32 until_time;
662                 uint32 total_pages;
663                 uint32 size;
664                 spoolss_Time submitted;
665                 uint32 time;
666                 uint32 pages_printed;
667                 uint32 size_high;
668         } spoolss_JobInfo4;
669
670         typedef [nodiscriminant,relative_base,public,gensize] union {
671                 [case(1)] spoolss_JobInfo1 info1;
672                 [case(2)] spoolss_JobInfo2 info2;
673                 [case(3)] spoolss_JobInfo3 info3;
674                 [case(4)] spoolss_JobInfo4 info4;
675                 [default];
676         } spoolss_JobInfo;
677
678         typedef struct {
679                 uint32 job_id;
680                 [string,charset(UTF16)] uint16 *printer_name;
681                 [string,charset(UTF16)] uint16 *server_name;
682                 [string,charset(UTF16)] uint16 *user_name;
683                 [string,charset(UTF16)] uint16 *document_name;
684                 [string,charset(UTF16)] uint16 *data_type;
685                 [string,charset(UTF16)] uint16 *text_status;
686                 spoolss_JobStatus status;
687                 [range(0,99)] uint32 priority;
688                 uint32 position;
689                 uint32 total_pages;
690                 uint32 pages_printed;
691                 spoolss_Time submitted;
692         } spoolss_SetJobInfo1;
693
694         typedef struct {
695                 uint32 job_id;
696                 [string,charset(UTF16)] uint16 *printer_name;
697                 [string,charset(UTF16)] uint16 *server_name;
698                 [string,charset(UTF16)] uint16 *user_name;
699                 [string,charset(UTF16)] uint16 *document_name;
700                 [string,charset(UTF16)] uint16 *notify_name;
701                 [string,charset(UTF16)] uint16 *data_type;
702                 [string,charset(UTF16)] uint16 *print_processor;
703                 [string,charset(UTF16)] uint16 *parameters;
704                 [string,charset(UTF16)] uint16 *driver_name;
705                 uint32 _devmode_ptr; /* pointer to truncated devicemode */
706                 [string,charset(UTF16)] uint16 *text_status;
707                 uint32 _secdesc_ptr;
708                 spoolss_JobStatus status;
709                 [range(0,99)] uint32 priority;
710                 uint32 position;
711                 uint32 start_time;
712                 uint32 until_time;
713                 uint32 total_pages;
714                 uint32 size;
715                 spoolss_Time submitted;
716                 uint32 time;
717                 uint32 pages_printed;
718         } spoolss_SetJobInfo2;
719
720         typedef struct {
721                 uint32 job_id;
722                 [string,charset(UTF16)] uint16 *printer_name;
723                 [string,charset(UTF16)] uint16 *server_name;
724                 [string,charset(UTF16)] uint16 *user_name;
725                 [string,charset(UTF16)] uint16 *document_name;
726                 [string,charset(UTF16)] uint16 *notify_name;
727                 [string,charset(UTF16)] uint16 *data_type;
728                 [string,charset(UTF16)] uint16 *print_processor;
729                 [string,charset(UTF16)] uint16 *parameters;
730                 [string,charset(UTF16)] uint16 *driver_name;
731                 uint32 _devmode_ptr; /* pointer to truncated devicemode */
732                 [string,charset(UTF16)] uint16 *text_status;
733                 uint32 _secdesc_ptr;
734                 spoolss_JobStatus status;
735                 [range(0,99)] uint32 priority;
736                 uint32 position;
737                 uint32 start_time;
738                 uint32 until_time;
739                 uint32 total_pages;
740                 uint32 size;
741                 spoolss_Time submitted;
742                 uint32 time;
743                 uint32 pages_printed;
744                 uint32 size_high;
745         } spoolss_SetJobInfo4;
746
747         typedef [public] union {
748                 [case(1)] spoolss_SetJobInfo1 *info1;
749                 [case(2)] spoolss_SetJobInfo2 *info2;
750                 [case(3)] spoolss_JobInfo3    *info3;
751                 [case(4)] spoolss_SetJobInfo4 *info4;
752                 [default];
753         } spoolss_SetJobInfo;
754
755         typedef struct {
756                 uint32 level;
757                 [switch_is(level)] spoolss_SetJobInfo info;
758         } spoolss_JobInfoContainer;
759
760         typedef [v1_enum] enum {
761                 SPOOLSS_JOB_CONTROL_PAUSE               = 1,
762                 SPOOLSS_JOB_CONTROL_RESUME              = 2,
763                 SPOOLSS_JOB_CONTROL_CANCEL              = 3,
764                 SPOOLSS_JOB_CONTROL_RESTART             = 4,
765                 SPOOLSS_JOB_CONTROL_DELETE              = 5,
766                 SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER     = 6,
767                 SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED   = 7,
768                 SPOOLSS_JOB_CONTROL_RETAIN              = 8,
769                 SPOOLSS_JOB_CONTROL_RELEASE             = 9
770         } spoolss_JobControl;
771
772         WERROR spoolss_SetJob(
773                 [in,ref] policy_handle *handle,
774                 [in] uint32 job_id,
775                 [in,unique] spoolss_JobInfoContainer *ctr,
776                 [in] spoolss_JobControl command
777         );
778
779         /******************/
780         /* Function: 0x03 */
781         WERROR spoolss_GetJob(
782                 [in,ref] policy_handle *handle,
783                 [in]     uint32 job_id,
784                 [in]     uint32 level,
785                 [in,unique] DATA_BLOB *buffer,
786                 [in]     uint32 offered,
787                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
788                 [out,ref] uint32 *needed
789         );
790
791         /******************/
792         /* Function: 0x04 */
793         [public,noopnum,noprint] WERROR _spoolss_EnumJobs(
794                 [in,ref] policy_handle *handle,
795                 [in]     uint32 firstjob,
796                 [in]     uint32 numjobs,
797                 [in]     uint32 level,
798                 [in,unique] DATA_BLOB *buffer,
799                 [in]     uint32 offered,
800                 [out,unique] DATA_BLOB *info,
801                 [out,ref] uint32 *needed,
802                 [out,ref] uint32 *count
803         );
804         [public,noopnum,noprint] void __spoolss_EnumJobs(
805                 [in] uint32 level,
806                 [in] uint32 count,
807                 [out,switch_is(level)] spoolss_JobInfo info[count]
808         );
809         [nopull,nopush] WERROR spoolss_EnumJobs(
810                 [in,ref] policy_handle *handle,
811                 [in]     uint32 firstjob,
812                 [in]     uint32 numjobs,
813                 [in]     uint32 level,
814                 [in,unique] DATA_BLOB *buffer,
815                 [in]     uint32 offered,
816                 [out,ref] uint32 *count,
817                 [out,ref,switch_is(level),size_is(,*count)] spoolss_JobInfo **info,
818                 [out,ref] uint32 *needed
819         );
820
821         /******************/
822         /* Function: 0x05 */
823         WERROR spoolss_AddPrinter(
824                 [in,unique] [string,charset(UTF16)] uint16 *server,
825                 [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
826                 [in,ref] spoolss_DevmodeContainer *devmode_ctr,
827                 [in,ref] sec_desc_buf *secdesc_ctr,
828                 [out,ref] policy_handle *handle
829         );
830
831         /******************/
832         /* Function: 0x06 */
833         WERROR spoolss_DeletePrinter(
834                 [in] policy_handle *handle
835         );
836
837         /******************/
838         /* Function: 0x07 */
839         typedef [v1_enum] enum {
840                 SPOOLSS_PRINTER_CONTROL_UNPAUSE    = 0,
841                 SPOOLSS_PRINTER_CONTROL_PAUSE      = 1,
842                 SPOOLSS_PRINTER_CONTROL_RESUME     = 2,
843                 SPOOLSS_PRINTER_CONTROL_PURGE      = 3,
844                 SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
845         } spoolss_PrinterControl;
846
847         typedef struct {
848                 [string,charset(UTF16)] uint16 *servername;
849                 [string,charset(UTF16)] uint16 *printername;
850                 uint32 cjobs;
851                 uint32 total_jobs;
852                 uint32 total_bytes;
853                 spoolss_Time time;
854                 uint32 global_counter;
855                 uint32 total_pages;
856                 uint32 version;
857                 uint32 free_build;
858                 uint32 spooling;
859                 uint32 max_spooling;
860                 uint32 session_counter;
861                 uint32 num_error_out_of_paper;
862                 uint32 num_error_not_ready;
863                 uint32 job_error;
864                 uint32 number_of_processors;
865                 spoolss_ProcessorType processor_type;
866                 uint32 high_part_total_bytes;
867                 uint32 change_id;
868                 WERROR last_error;
869                 uint32 status;
870                 uint32 enumerate_network_printers;
871                 uint32 c_setprinter;
872                 spoolss_ProcessorArchitecture processor_architecture;
873                 uint16 processor_level;
874                 uint32 ref_ic;
875                 uint32 reserved2;
876                 uint32 reserved3;
877         } spoolss_SetPrinterInfo0;
878
879         typedef struct {
880                 spoolss_PrinterAttributes flags;
881                 [string,charset(UTF16)] uint16 *description;
882                 [string,charset(UTF16)] uint16 *name;
883                 [string,charset(UTF16)] uint16 *comment;
884         } spoolss_SetPrinterInfo1;
885
886         typedef struct {
887                 [string,charset(UTF16)] uint16 *servername;
888                 [string,charset(UTF16)] uint16 *printername;
889                 [string,charset(UTF16)] uint16 *sharename;
890                 [string,charset(UTF16)] uint16 *portname;
891                 [string,charset(UTF16)] uint16 *drivername;
892                 [string,charset(UTF16)] uint16 *comment;
893                 [string,charset(UTF16)] uint16 *location;
894                 uint32 devmode_ptr;
895                 [string,charset(UTF16)] uint16 *sepfile;
896                 [string,charset(UTF16)] uint16 *printprocessor;
897                 [string,charset(UTF16)] uint16 *datatype;
898                 [string,charset(UTF16)] uint16 *parameters;
899                 uint32 secdesc_ptr;
900                 spoolss_PrinterAttributes attributes;
901                 [range(0,99)] uint32 priority;
902                 uint32 defaultpriority;
903                 uint32 starttime;
904                 uint32 untiltime;
905                 spoolss_PrinterStatus status;
906                 uint32 cjobs;
907                 uint32 averageppm;
908         } spoolss_SetPrinterInfo2;
909
910         typedef struct {
911                 uint32 sec_desc_ptr;
912         } spoolss_SetPrinterInfo3;
913
914         typedef struct {
915                 [string,charset(UTF16)] uint16 *printername;
916                 [string,charset(UTF16)] uint16 *servername;
917                 spoolss_PrinterAttributes attributes;
918         } spoolss_SetPrinterInfo4;
919
920         typedef struct {
921                 [string,charset(UTF16)] uint16 *printername;
922                 [string,charset(UTF16)] uint16 *portname;
923                 spoolss_PrinterAttributes attributes;
924                 uint32 device_not_selected_timeout;
925                 uint32 transmission_retry_timeout;
926         } spoolss_SetPrinterInfo5;
927
928         typedef struct {
929                 spoolss_PrinterStatus status;
930         } spoolss_SetPrinterInfo6;
931
932         typedef struct {
933                 [string,charset(UTF16)] uint16 *guid; /* text form of printer guid */
934                 spoolss_DsPrintAction action;
935         } spoolss_SetPrinterInfo7;
936
937         typedef struct {
938                 uint32 devmode_ptr;
939         } spoolss_SetPrinterInfo8;
940
941         typedef struct {
942                 uint32 devmode_ptr;
943         } spoolss_SetPrinterInfo9;
944
945         typedef [switch_type(uint32)] union {
946                 [case(0)] spoolss_SetPrinterInfo0 *info0;
947                 [case(1)] spoolss_SetPrinterInfo1 *info1;
948                 [case(2)] spoolss_SetPrinterInfo2 *info2;
949                 [case(3)] spoolss_SetPrinterInfo3 *info3;
950                 [case(4)] spoolss_SetPrinterInfo4 *info4;
951                 [case(5)] spoolss_SetPrinterInfo5 *info5;
952                 [case(6)] spoolss_SetPrinterInfo6 *info6;
953                 [case(7)] spoolss_SetPrinterInfo7 *info7;
954                 [case(8)] spoolss_SetPrinterInfo8 *info8;
955                 [case(9)] spoolss_SetPrinterInfo9 *info9;
956                 [default];
957         } spoolss_SetPrinterInfo;
958
959         typedef struct {
960                 uint32 level;
961                 [switch_is(level)] spoolss_SetPrinterInfo info;
962         } spoolss_SetPrinterInfoCtr;
963
964         WERROR spoolss_SetPrinter(
965                 [in,ref] policy_handle *handle,
966                 [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
967                 [in,ref] spoolss_DevmodeContainer *devmode_ctr,
968                 [in,ref] sec_desc_buf *secdesc_ctr,
969                 [in] spoolss_PrinterControl command
970         );
971
972         /******************/
973         /* Function: 0x08 */
974         [public] WERROR spoolss_GetPrinter(
975                 [in,ref] policy_handle *handle,
976                 [in]     uint32 level,
977                 [in,unique] DATA_BLOB *buffer,
978                 [in]     uint32 offered,
979                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
980                 [out,ref] uint32 *needed
981         );
982
983         /******************/
984         /* Function: 0x09 */
985
986         typedef [public] struct {
987                 [value((ndr_size_spoolss_StringArray(r, ndr->iconv_convenience, ndr->flags)-4)/2)] uint32 _ndr_size;
988                 /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string;
989         } spoolss_StringArray;
990
991         typedef struct {
992                 [string,charset(UTF16)] uint16 *driver_name;
993         } spoolss_AddDriverInfo1;
994
995         typedef [v1_enum,public] enum {
996                 SPOOLSS_DRIVER_VERSION_9X       = 0,
997                 SPOOLSS_DRIVER_VERSION_NT35     = 1,
998                 SPOOLSS_DRIVER_VERSION_NT4      = 2,
999                 SPOOLSS_DRIVER_VERSION_200X     = 3
1000         } spoolss_DriverOSVersion;
1001
1002         typedef struct {
1003                 spoolss_DriverOSVersion version;
1004                 [string,charset(UTF16)] uint16 *driver_name;
1005                 [string,charset(UTF16)] uint16 *architecture;
1006                 [string,charset(UTF16)] uint16 *driver_path;
1007                 [string,charset(UTF16)] uint16 *data_file;
1008                 [string,charset(UTF16)] uint16 *config_file;
1009         } spoolss_AddDriverInfo2;
1010
1011         typedef struct {
1012                 spoolss_DriverOSVersion version;
1013                 [string,charset(UTF16)] uint16 *driver_name;
1014                 [string,charset(UTF16)] uint16 *architecture;
1015                 [string,charset(UTF16)] uint16 *driver_path;
1016                 [string,charset(UTF16)] uint16 *data_file;
1017                 [string,charset(UTF16)] uint16 *config_file;
1018                 [string,charset(UTF16)] uint16 *help_file;
1019                 [string,charset(UTF16)] uint16 *monitor_name;
1020                 [string,charset(UTF16)] uint16 *default_datatype;
1021                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
1022                 spoolss_StringArray *dependent_files;
1023         } spoolss_AddDriverInfo3;
1024
1025         typedef struct {
1026                 spoolss_DriverOSVersion version;
1027                 [string,charset(UTF16)] uint16 *driver_name;
1028                 [string,charset(UTF16)] uint16 *architecture;
1029                 [string,charset(UTF16)] uint16 *driver_path;
1030                 [string,charset(UTF16)] uint16 *data_file;
1031                 [string,charset(UTF16)] uint16 *config_file;
1032                 [string,charset(UTF16)] uint16 *help_file;
1033                 [string,charset(UTF16)] uint16 *monitor_name;
1034                 [string,charset(UTF16)] uint16 *default_datatype;
1035                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
1036                 spoolss_StringArray *dependent_files;
1037                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
1038                 spoolss_StringArray *previous_names;
1039         } spoolss_AddDriverInfo4;
1040
1041         typedef [bitmap32bit] bitmap {
1042                 PRINTER_DRIVER_PACKAGE_AWARE = 0x00000002
1043         } spoolss_DriverAttributes;
1044
1045         typedef struct {
1046                 spoolss_DriverOSVersion version;
1047                 [string,charset(UTF16)] uint16 *driver_name;
1048                 [string,charset(UTF16)] uint16 *architecture;
1049                 [string,charset(UTF16)] uint16 *driver_path;
1050                 [string,charset(UTF16)] uint16 *data_file;
1051                 [string,charset(UTF16)] uint16 *config_file;
1052                 spoolss_DriverAttributes driver_attributes;
1053                 uint32 config_version;
1054                 uint32 driver_version;
1055         } spoolss_AddDriverInfo5;
1056
1057         typedef struct {
1058                 spoolss_DriverOSVersion version;
1059                 [string,charset(UTF16)] uint16 *driver_name;
1060                 [string,charset(UTF16)] uint16 *architecture;
1061                 [string,charset(UTF16)] uint16 *driver_path;
1062                 [string,charset(UTF16)] uint16 *data_file;
1063                 [string,charset(UTF16)] uint16 *config_file;
1064                 [string,charset(UTF16)] uint16 *help_file;
1065                 [string,charset(UTF16)] uint16 *monitor_name;
1066                 [string,charset(UTF16)] uint16 *default_datatype;
1067                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
1068                 spoolss_StringArray *dependent_files;
1069                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
1070                 spoolss_StringArray *previous_names;
1071                 NTTIME driver_date;
1072                 hyper driver_version;
1073                 [string,charset(UTF16)] uint16 *manufacturer_name;
1074                 [string,charset(UTF16)] uint16 *manufacturer_url;
1075                 [string,charset(UTF16)] uint16 *hardware_id;
1076                 [string,charset(UTF16)] uint16 *provider;
1077         } spoolss_AddDriverInfo6;
1078
1079         typedef struct {
1080                 spoolss_DriverOSVersion version;
1081                 [string,charset(UTF16)] uint16 *driver_name;
1082                 [string,charset(UTF16)] uint16 *architecture;
1083                 [string,charset(UTF16)] uint16 *driver_path;
1084                 [string,charset(UTF16)] uint16 *data_file;
1085                 [string,charset(UTF16)] uint16 *config_file;
1086                 [string,charset(UTF16)] uint16 *help_file;
1087                 [string,charset(UTF16)] uint16 *monitor_name;
1088                 [string,charset(UTF16)] uint16 *default_datatype;
1089                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
1090                 spoolss_StringArray *dependent_files;
1091                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
1092                 spoolss_StringArray *previous_names;
1093                 NTTIME driver_date;
1094                 hyper driver_version;
1095                 [string,charset(UTF16)] uint16 *manufacturer_name;
1096                 [string,charset(UTF16)] uint16 *manufacturer_url;
1097                 [string,charset(UTF16)] uint16 *hardware_id;
1098                 [string,charset(UTF16)] uint16 *provider;
1099                 [string,charset(UTF16)] uint16 *print_processor;
1100                 [string,charset(UTF16)] uint16 *vendor_setup;
1101                 [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles;
1102                 spoolss_StringArray *color_profiles;
1103                 [string,charset(UTF16)] uint16 *inf_path;
1104                 uint32 printer_driver_attributes;
1105                 [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies;
1106                 spoolss_StringArray *core_driver_dependencies;
1107                 NTTIME min_inbox_driver_ver_date;
1108                 hyper min_inbox_driver_ver_version;
1109         } spoolss_AddDriverInfo8;
1110
1111         typedef [switch_type(uint32)] union {
1112                 [case(1)] spoolss_AddDriverInfo1 *info1;
1113                 [case(2)] spoolss_AddDriverInfo2 *info2;
1114                 [case(3)] spoolss_AddDriverInfo3 *info3;
1115                 [case(4)] spoolss_AddDriverInfo4 *info4;
1116                 [case(6)] spoolss_AddDriverInfo6 *info6;
1117                 [case(8)] spoolss_AddDriverInfo8 *info8;
1118         } spoolss_AddDriverInfo;
1119
1120         typedef struct {
1121                 uint32 level;
1122                 [switch_is(level)] spoolss_AddDriverInfo info;
1123         } spoolss_AddDriverInfoCtr;
1124
1125         WERROR spoolss_AddPrinterDriver(
1126                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1127                 [in,ref] spoolss_AddDriverInfoCtr *info_ctr
1128         );
1129
1130         typedef [public,gensize] struct {
1131                 [relative] nstring *driver_name;
1132         } spoolss_DriverInfo1;
1133
1134         typedef [public,gensize] struct {
1135                 spoolss_DriverOSVersion version;
1136                 [relative] nstring *driver_name;
1137                 [relative] nstring *architecture;
1138                 [relative] nstring *driver_path;
1139                 [relative] nstring *data_file;
1140                 [relative] nstring *config_file;
1141         } spoolss_DriverInfo2;
1142
1143         typedef [public,gensize] struct {
1144                 spoolss_DriverOSVersion version;
1145                 [relative] nstring *driver_name;
1146                 [relative] nstring *architecture;
1147                 [relative] nstring *driver_path;
1148                 [relative] nstring *data_file;
1149                 [relative] nstring *config_file;
1150                 [relative] nstring *help_file;
1151                 [relative] nstring_array *dependent_files;
1152                 [relative] nstring *monitor_name;
1153                 [relative] nstring *default_datatype;
1154         } spoolss_DriverInfo3;
1155
1156         typedef [public,gensize] struct {
1157                 spoolss_DriverOSVersion version;
1158                 [relative] nstring *driver_name;
1159                 [relative] nstring *architecture;
1160                 [relative] nstring *driver_path;
1161                 [relative] nstring *data_file;
1162                 [relative] nstring *config_file;
1163                 [relative] nstring *help_file;
1164                 [relative] nstring_array *dependent_files;
1165                 [relative] nstring *monitor_name;
1166                 [relative] nstring *default_datatype;
1167                 [relative] nstring_array *previous_names;
1168         } spoolss_DriverInfo4;
1169
1170         typedef [public,gensize] struct {
1171                 spoolss_DriverOSVersion version;
1172                 [relative] nstring *driver_name;
1173                 [relative] nstring *architecture;
1174                 [relative] nstring *driver_path;
1175                 [relative] nstring *data_file;
1176                 [relative] nstring *config_file;
1177                 spoolss_DriverAttributes driver_attributes;
1178                 uint32 config_version;
1179                 uint32 driver_version;
1180         } spoolss_DriverInfo5;
1181
1182         typedef [public,gensize] struct {
1183                 spoolss_DriverOSVersion version;
1184                 [relative] nstring *driver_name;
1185                 [relative] nstring *architecture;
1186                 [relative] nstring *driver_path;
1187                 [relative] nstring *data_file;
1188                 [relative] nstring *config_file;
1189                 [relative] nstring *help_file;
1190                 [relative] nstring_array *dependent_files;
1191                 [relative] nstring *monitor_name;
1192                 [relative] nstring *default_datatype;
1193                 [relative] nstring_array *previous_names;
1194                 NTTIME driver_date;
1195                 hyper driver_version;
1196                 [relative] nstring *manufacturer_name;
1197                 [relative] nstring *manufacturer_url;
1198                 [relative] nstring *hardware_id;
1199                 [relative] nstring *provider;
1200         } spoolss_DriverInfo6;
1201
1202         typedef [public,gensize] struct {
1203                 uint32 size;
1204                 spoolss_DriverOSVersion version;
1205                 [relative] nstring *driver_name;
1206                 [relative] nstring *inf_name;
1207                 [relative] nstring *install_source_root;
1208         } spoolss_DriverInfo7;
1209
1210         typedef [public,gensize] struct {
1211                 spoolss_DriverOSVersion version;
1212                 [relative] nstring *driver_name;
1213                 [relative] nstring *architecture;
1214                 [relative] nstring *driver_path;
1215                 [relative] nstring *data_file;
1216                 [relative] nstring *config_file;
1217                 [relative] nstring *help_file;
1218                 [relative] nstring_array *dependent_files;
1219                 [relative] nstring *monitor_name;
1220                 [relative] nstring *default_datatype;
1221                 [relative] nstring_array *previous_names;
1222                 NTTIME driver_date;
1223                 hyper driver_version;
1224                 [relative] nstring *manufacturer_name;
1225                 [relative] nstring *manufacturer_url;
1226                 [relative] nstring *hardware_id;
1227                 [relative] nstring *provider;
1228                 [relative] nstring *print_processor;
1229                 [relative] nstring *vendor_setup;
1230                 [relative] nstring_array *color_profiles;
1231                 [relative] nstring *inf_path;
1232                 uint32 printer_driver_attributes;
1233                 [relative] nstring_array *core_driver_dependencies;
1234                 NTTIME min_inbox_driver_ver_date;
1235                 hyper min_inbox_driver_ver_version;
1236         } spoolss_DriverInfo8;
1237
1238         typedef [v1_enum] enum {
1239                 SPOOLSS_DRIVER_FILE_TYPE_RENDERING      = 0x00000000,
1240                 SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION  = 0x00000001,
1241                 SPOOLSS_DRIVER_FILE_TYPE_DATA           = 0x00000002,
1242                 SPOOLSS_DRIVER_FILE_TYPE_HELP           = 0x00000003,
1243                 SPOOLSS_DRIVER_FILE_TYPE_OTHER          = 0x00000004
1244         } spoolss_DriverFileType;
1245
1246         typedef [public] struct {
1247                 [relative] nstring *file_name;
1248                 spoolss_DriverFileType file_type;
1249                 uint32 file_version;
1250         } spoolss_DriverFileInfo;
1251
1252         typedef [public,gensize,nopush,nopull] struct {
1253                 spoolss_DriverOSVersion version;
1254                 [relative] nstring *driver_name;
1255                 [relative] nstring *architecture;
1256                 [relative] [size_is(file_count)] spoolss_DriverFileInfo *file_info;
1257                 uint32 file_count;
1258                 [relative] nstring *monitor_name;
1259                 [relative] nstring *default_datatype;
1260                 [relative] nstring_array *previous_names;
1261                 NTTIME driver_date;
1262                 hyper driver_version;
1263                 [relative] nstring *manufacturer_name;
1264                 [relative] nstring *manufacturer_url;
1265                 [relative] nstring *hardware_id;
1266                 [relative] nstring *provider;
1267         } spoolss_DriverInfo101;
1268
1269         typedef [nodiscriminant,relative_base,public,gensize] union {
1270                 [case(1)] spoolss_DriverInfo1 info1;
1271                 [case(2)] spoolss_DriverInfo2 info2;
1272                 [case(3)] spoolss_DriverInfo3 info3;
1273                 [case(4)] spoolss_DriverInfo4 info4;
1274                 [case(5)] spoolss_DriverInfo5 info5;
1275                 [case(6)] spoolss_DriverInfo6 info6;
1276                 [case(7)] spoolss_DriverInfo7 info7;
1277                 [case(8)] spoolss_DriverInfo8 info8;
1278                 [case(101)] spoolss_DriverInfo101 info101;
1279                 [default];
1280         } spoolss_DriverInfo;
1281
1282         /******************/
1283         /* Function: 0x0a */
1284         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
1285                 [in,unique] [string,charset(UTF16)] uint16 *server,
1286                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1287                 [in] uint32 level,
1288                 [in,unique] DATA_BLOB *buffer,
1289                 [in] uint32 offered,
1290                 [out,unique] DATA_BLOB *info,
1291                 [out,ref] uint32 *needed,
1292                 [out,ref] uint32 *count
1293         );
1294         [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
1295                 [in] uint32 level,
1296                 [in] uint32 count,
1297                 [out,switch_is(level)] spoolss_DriverInfo info[count]
1298         );
1299         [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
1300                 [in,unique] [string,charset(UTF16)] uint16 *server,
1301                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1302                 [in] uint32 level,
1303                 [in,unique] DATA_BLOB *buffer,
1304                 [in] uint32 offered,
1305                 [out,ref] uint32 *count,
1306                 [out,ref,switch_is(level),size_is(,*count)] spoolss_DriverInfo **info,
1307                 [out,ref] uint32 *needed
1308         );
1309
1310         /******************/
1311         /* Function: 0x0b */
1312         WERROR spoolss_GetPrinterDriver(
1313                 [in,ref] policy_handle *handle,
1314                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
1315                 [in]     uint32 level,
1316                 [in,unique] DATA_BLOB *buffer,
1317                 [in]     uint32 offered,
1318                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
1319                 [out,ref] uint32 *needed
1320         );
1321
1322         /******************/
1323         /* Function: 0x0c */
1324         typedef [public,gensize] struct {
1325                 nstring directory_name;
1326         } spoolss_DriverDirectoryInfo1;
1327
1328         /* NOTE: it's seems that w2k3 completly ignores the level
1329                  in its server code
1330          */
1331         typedef [nodiscriminant,relative_base,gensize,public] union {
1332                 [case(1)] spoolss_DriverDirectoryInfo1 info1;
1333                 [default] spoolss_DriverDirectoryInfo1 info1;
1334         } spoolss_DriverDirectoryInfo;
1335
1336         [public] WERROR spoolss_GetPrinterDriverDirectory(
1337                 [in,unique] [string,charset(UTF16)] uint16 *server,
1338                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1339                 [in] uint32 level,
1340                 [in,unique] DATA_BLOB *buffer,
1341                 [in] uint32 offered,
1342                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
1343                 [out,ref] uint32 *needed
1344         );
1345
1346         /******************/
1347         /* Function: 0x0d */
1348         WERROR spoolss_DeletePrinterDriver(
1349                 [in,unique] [string,charset(UTF16)] uint16 *server,
1350                 [in] [string,charset(UTF16)] uint16 architecture[],
1351                 [in] [string,charset(UTF16)] uint16 driver[]
1352         );
1353
1354         /******************/
1355         /* Function: 0x0e */
1356         WERROR spoolss_AddPrintProcessor(
1357                 [in,unique] [string,charset(UTF16)] uint16 *server,
1358                 [in] [string,charset(UTF16)] uint16 architecture[],
1359                 [in] [string,charset(UTF16)] uint16 path_name[],
1360                 [in] [string,charset(UTF16)] uint16 print_processor_name[]
1361         );
1362
1363         /******************/
1364         /* Function: 0x0f */
1365         typedef [public,gensize] struct {
1366                 [relative] nstring *print_processor_name;
1367         } spoolss_PrintProcessorInfo1;
1368
1369         typedef [nodiscriminant,relative_base,public] union {
1370                 [case(1)] spoolss_PrintProcessorInfo1 info1;
1371                 [default];
1372         } spoolss_PrintProcessorInfo;
1373
1374         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
1375                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1376                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1377                 [in] uint32 level,
1378                 [in,unique] DATA_BLOB *buffer,
1379                 [in] uint32 offered,
1380                 [out,unique] DATA_BLOB *info,
1381                 [out,ref] uint32 *needed,
1382                 [out,ref] uint32 *count
1383         );
1384         [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
1385                 [in] uint32 level,
1386                 [in] uint32 count,
1387                 [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
1388         );
1389         [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
1390                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1391                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1392                 [in] uint32 level,
1393                 [in,unique] DATA_BLOB *buffer,
1394                 [in] uint32 offered,
1395                 [out,ref] uint32 *count,
1396                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcessorInfo **info,
1397                 [out,ref] uint32 *needed
1398         );
1399
1400         /******************/
1401         /* Function: 0x10 */
1402         typedef [public,gensize] struct {
1403                 nstring directory_name;
1404         } spoolss_PrintProcessorDirectoryInfo1;
1405
1406         typedef [nodiscriminant,relative_base,gensize,public] union {
1407                 [case(1)] spoolss_PrintProcessorDirectoryInfo1 info1;
1408                 [default] spoolss_PrintProcessorDirectoryInfo1 info1;
1409         } spoolss_PrintProcessorDirectoryInfo;
1410
1411         WERROR spoolss_GetPrintProcessorDirectory(
1412                 [in,unique] [string,charset(UTF16)] uint16 *server,
1413                 [in,unique] [string,charset(UTF16)] uint16 *environment,
1414                 [in] uint32 level,
1415                 [in,unique] DATA_BLOB *buffer,
1416                 [in] uint32 offered,
1417                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrintProcessorDirectoryInfo *info,
1418                 [out,ref] uint32 *needed
1419         );
1420
1421         /******************/
1422         /* Function: 0x11 */
1423         typedef struct {
1424                 [string,charset(UTF16)] uint16 *document_name;
1425                 [string,charset(UTF16)] uint16 *output_file;
1426                 [string,charset(UTF16)] uint16 *datatype;
1427         } spoolss_DocumentInfo1;
1428
1429         typedef [switch_type(uint32)] union {
1430                 [case(1)] spoolss_DocumentInfo1 *info1;
1431                 [case(2)]; /* TODO */
1432                 [case(3)]; /* TODO */
1433                 [default];
1434         } spoolss_DocumentInfo;
1435
1436         WERROR spoolss_StartDocPrinter(
1437                 [in,ref] policy_handle *handle,
1438                 [in] uint32 level,
1439                 [in,switch_is(level)] spoolss_DocumentInfo info,
1440                 [out,ref] uint32 *job_id
1441         );
1442
1443         /******************/
1444         /* Function: 0x12 */
1445         WERROR spoolss_StartPagePrinter(
1446                 [in,ref] policy_handle *handle
1447         );
1448
1449         /******************/
1450         /* Function: 0x13 */
1451         WERROR spoolss_WritePrinter(
1452                 [in,ref] policy_handle *handle,
1453                 [in] DATA_BLOB data,
1454                 [in,value(r->in.data.length)] uint32 _data_size,
1455                 [out,ref] uint32 *num_written
1456         );
1457
1458         /******************/
1459         /* Function: 0x14 */
1460         WERROR spoolss_EndPagePrinter(
1461                 [in,ref] policy_handle *handle
1462         );
1463
1464         /******************/
1465         /* Function: 0x15 */
1466         WERROR spoolss_AbortPrinter(
1467                 [in,ref] policy_handle *handle
1468         );
1469
1470         /******************/
1471         /* Function: 0x16 */
1472         WERROR spoolss_ReadPrinter(
1473                 [in,ref] policy_handle *handle,
1474                 [out,ref] [size_is(data_size)] uint8 *data,
1475                 [in] uint32 data_size,
1476                 [out,ref] uint32 *_data_size
1477         );
1478
1479         /******************/
1480         /* Function: 0x17 */
1481         WERROR spoolss_EndDocPrinter(
1482                 [in,ref] policy_handle *handle
1483         );
1484
1485         /******************/
1486         /* Function: 0x18 */
1487         WERROR spoolss_AddJob(
1488                 [in,ref] policy_handle *handle,
1489                 [in] uint32 level,
1490                 [in,out,unique] [size_is(offered)] uint8 *buffer,
1491                 [in] uint32 offered,
1492                 [out,ref] uint32 *needed
1493         );
1494
1495         /******************/
1496         /* Function: 0x19 */
1497         WERROR spoolss_ScheduleJob(
1498                 [in,ref] policy_handle *handle,
1499                 [in] uint32 jobid
1500         );
1501
1502         /******************/
1503         /* Function: 0x1a */
1504
1505         const string SPL_ARCH_WIN40             = "WIN40";
1506         const string SPL_ARCH_W32X86            = "W32X86";
1507         const string SPL_ARCH_W32MIPS           = "W32MIPS";
1508         const string SPL_ARCH_W32ALPHA          = "W32ALPHA";
1509         const string SPL_ARCH_W32PPC            = "W32PPC";
1510         const string SPL_ARCH_IA64              = "IA64";
1511         const string SPL_ARCH_X64               = "x64";
1512
1513         const string SPOOLSS_ARCHITECTURE_ALL                   = "All";
1514         const string SPOOLSS_ARCHITECTURE_ALL_CLUSTER           = "AllCluster";
1515         const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
1516         const string SPOOLSS_ARCHITECTURE_IA_64                 = "Windows IA64";
1517         const string SPOOLSS_ARCHITECTURE_x64                   = "Windows x64";
1518         const string SPOOLSS_ARCHITECTURE_4_0                   = "Windows 4.0";
1519         const string SPOOLSS_DEFAULT_SERVER_PATH                = "C:\\WINDOWS\\system32\\spool";
1520
1521         typedef [public,gensize] struct {
1522                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
1523                 uint32 major;
1524                 uint32 minor;
1525                 uint32 build;
1526                 [value(2)] uint32 platform_id;
1527                 [subcontext(0),subcontext_size(256)] nstring extra_string;
1528         } spoolss_OSVersion;
1529
1530         typedef [public,gensize] struct {
1531                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
1532                 uint32 major;
1533                 uint32 minor;
1534                 uint32 build;
1535                 [value(2)] uint32 platform_id;
1536                 [subcontext(0),subcontext_size(256)] nstring extra_string;
1537                 uint16 service_pack_major;
1538                 uint16 service_pack_minor;
1539                 uint16 suite_mask;
1540                 uint8 product_type;
1541                 uint8 reserved;
1542         } spoolss_OSVersionEx;
1543
1544         typedef [nodiscriminant,public] union {
1545                 [case(REG_NONE)];
1546                 [case(REG_SZ)] nstring string;
1547                 [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
1548                 [case(REG_DWORD)] uint32 value;
1549                 [case(REG_MULTI_SZ)] nstring_array string_array;
1550                 [default,flag(NDR_REMAINING)] DATA_BLOB data;
1551         } spoolss_PrinterData;
1552
1553         /* predefined registry key names for printer data */
1554
1555         const string SPOOL_PRINTERDATA_KEY              = "PrinterDriverData";
1556         const string SPOOL_DSSPOOLER_KEY                = "DsSpooler";
1557         const string SPOOL_DSDRIVER_KEY                 = "DsDriver";
1558         const string SPOOL_DSUSER_KEY                   = "DsUser";
1559         const string SPOOL_PNPDATA_KEY                  = "PnPData";
1560         const string SPOOL_OID_KEY                      = "OID";
1561
1562         /* predefined value names for printer data */
1563
1564         const string SPOOL_REG_ASSETNUMBER              = "assetNumber";
1565         const string SPOOL_REG_BYTESPERMINUTE           = "bytesPerMinute";
1566         const string SPOOL_REG_DEFAULTPRIORITY          = "defaultPriority";
1567         const string SPOOL_REG_DESCRIPTION              = "description";
1568         const string SPOOL_REG_DRIVERNAME               = "driverName";
1569         const string SPOOL_REG_DRIVERVERSION            = "driverVersion";
1570         const string SPOOL_REG_FLAGS                    = "flags";
1571         const string SPOOL_REG_LOCATION                 = "location";
1572         const string SPOOL_REG_OPERATINGSYSTEM          = "operatingSystem";
1573         const string SPOOL_REG_OPERATINGSYSTEMHOTFIX    = "operatingSystemHotfix";
1574         const string SPOOL_REG_OPERATINGSYSTEMSERVICEPACK = "operatingSystemServicePack";
1575         const string SPOOL_REG_OPERATINGSYSTEMVERSION   = "operatingSystemVersion";
1576         const string SPOOL_REG_PORTNAME                 = "portName";
1577         const string SPOOL_REG_PRINTATTRIBUTES          = "printAttributes";
1578         const string SPOOL_REG_PRINTBINNAMES            = "printBinNames";
1579         const string SPOOL_REG_PRINTCOLLATE             = "printCollate";
1580         const string SPOOL_REG_PRINTCOLOR               = "printColor";
1581         const string SPOOL_REG_PRINTDUPLEXSUPPORTED     = "printDuplexSupported";
1582         const string SPOOL_REG_PRINTENDTIME             = "printEndTime";
1583         const string SPOOL_REG_PRINTERNAME              = "printerName";
1584         const string SPOOL_REG_PRINTFORMNAME            = "printFormName";
1585         const string SPOOL_REG_PRINTKEEPPRINTEDJOBS     = "printKeepPrintedJobs";
1586         const string SPOOL_REG_PRINTLANGUAGE            = "printLanguage";
1587         const string SPOOL_REG_PRINTMACADDRESS          = "printMACAddress";
1588         const string SPOOL_REG_PRINTMAXCOPIES           = "printMaxCopies";
1589         const string SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED = "printMaxResolutionSupported";
1590         const string SPOOL_REG_PRINTMAXXEXTENT          = "printMaxXExtent";
1591         const string SPOOL_REG_PRINTMAXYEXTENT          = "printMaxYExtent";
1592         const string SPOOL_REG_PRINTMEDIAREADY          = "printMediaReady";
1593         const string SPOOL_REG_PRINTMEDIASUPPORTED      = "printMediaSupported";
1594         const string SPOOL_REG_PRINTMEMORY              = "printMemory";
1595         const string SPOOL_REG_PRINTMINXEXTENT          = "printMinXExtent";
1596         const string SPOOL_REG_PRINTMINYEXTENT          = "printMinYExtent";
1597         const string SPOOL_REG_PRINTNETWORKADDRESS      = "printNetworkAddress";
1598         const string SPOOL_REG_PRINTNOTIFY              = "printNotify";
1599         const string SPOOL_REG_PRINTNUMBERUP            = "printNumberUp";
1600         const string SPOOL_REG_PRINTORIENTATIONSSUPPORTED = "printOrientationsSupported";
1601         const string SPOOL_REG_PRINTOWNER               = "printOwner";
1602         const string SPOOL_REG_PRINTPAGESPERMINUTE      = "printPagesPerMinute";
1603         const string SPOOL_REG_PRINTRATE                = "printRate";
1604         const string SPOOL_REG_PRINTRATEUNIT            = "printRateUnit";
1605         const string SPOOL_REG_PRINTSEPARATORFILE       = "printSeparatorFile";
1606         const string SPOOL_REG_PRINTSHARENAME           = "printShareName";
1607         const string SPOOL_REG_PRINTSPOOLING            = "printSpooling";
1608         const string SPOOL_REGVAL_PRINTWHILESPOOLING    = "PrintWhileSpooling";
1609         const string SPOOL_REGVAL_PRINTAFTERSPOOLED     = "PrintAfterSpooled";
1610         const string SPOOL_REGVAL_PRINTDIRECT           = "PrintDirect";
1611         const string SPOOL_REG_PRINTSTAPLINGSUPPORTED   = "printStaplingSupported";
1612         const string SPOOL_REG_PRINTSTARTTIME           = "printStartTime";
1613         const string SPOOL_REG_PRINTSTATUS              = "printStatus";
1614         const string SPOOL_REG_PRIORITY                 = "priority";
1615         const string SPOOL_REG_SERVERNAME               = "serverName";
1616         const string SPOOL_REG_SHORTSERVERNAME          = "shortServerName";
1617         const string SPOOL_REG_UNCNAME                  = "uNCName";
1618         const string SPOOL_REG_URL                      = "url";
1619         const string SPOOL_REG_VERSIONNUMBER            = "versionNumber";
1620
1621         [noopnum,noprint,public] WERROR _spoolss_GetPrinterData(
1622                 [in,ref] policy_handle *handle,
1623                 [in]     [string,charset(UTF16)] uint16 value_name[],
1624                 [in]     uint32 offered,
1625                 [out,ref] winreg_Type *type,
1626                 [out,ref] DATA_BLOB *data,
1627                 [out,ref] uint32 *needed
1628         );
1629         [noopnum,noprint,public] void __spoolss_GetPrinterData(
1630                 [in] winreg_Type type,
1631                 [out,ref,switch_is(type)] spoolss_PrinterData *data
1632         );
1633         [nopull,nopush,public] WERROR spoolss_GetPrinterData(
1634                 [in,ref] policy_handle *handle,
1635                 [in]     [string,charset(UTF16)] uint16 value_name[],
1636                 [in]     uint32 offered,
1637                 [out,ref] winreg_Type *type,
1638                 [out,ref,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData *data,
1639                 [out,ref] uint32 *needed
1640         );
1641
1642         /******************/
1643         /* Function: 0x1b */
1644         [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
1645                 [in,ref] policy_handle *handle,
1646                 [in] [string,charset(UTF16)] uint16 value_name[],
1647                 [in] winreg_Type type,
1648                 [in] DATA_BLOB data,
1649                 [in] uint32 _offered
1650         );
1651         [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
1652                 [in] winreg_Type type,
1653                 [out,ref,switch_is(type)] spoolss_PrinterData *data
1654         );
1655         [nopush] WERROR spoolss_SetPrinterData(
1656                 [in,ref] policy_handle *handle,
1657                 [in] [string,charset(UTF16)] uint16 value_name[],
1658                 [in] winreg_Type type,
1659                 [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
1660                 [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered
1661         );
1662
1663         /******************/
1664         /* Function: 0x1c */
1665         [todo] WERROR spoolss_WaitForPrinterChange(
1666         );
1667
1668         /******************/
1669         /* Function: 0x1d */
1670         [public] WERROR spoolss_ClosePrinter(
1671                 [in,out,ref]     policy_handle *handle
1672         );
1673
1674         /******************/
1675         /* Function: 0x1e */
1676         typedef [v1_enum] enum {
1677                 SPOOLSS_FORM_USER       = 0,
1678                 SPOOLSS_FORM_BUILTIN    = 1,
1679                 SPOOLSS_FORM_PRINTER    = 2
1680         } spoolss_FormFlags;
1681
1682         typedef struct {
1683                 uint32 width;
1684                 uint32 height;
1685         } spoolss_FormSize;
1686
1687         typedef struct {
1688                 uint32 left;
1689                 uint32 top;
1690                 uint32 right;
1691                 uint32 bottom;
1692         } spoolss_FormArea;
1693
1694         typedef [public,gensize] struct {
1695                 spoolss_FormFlags flags;
1696                 [relative] nstring *form_name;
1697                 spoolss_FormSize size;
1698                 spoolss_FormArea area;
1699         } spoolss_FormInfo1;
1700
1701         typedef [bitmap32bit] bitmap {
1702                 SPOOLSS_FORM_STRING_TYPE_NONE           = 0x00000001,
1703                 SPOOLSS_FORM_STRING_TYPE_MUI_DLL        = 0x00000002,
1704                 SPOOLSS_FORM_STRING_TYPE_LANG_PAIR      = 0x00000004
1705         } spoolss_FormStringType;
1706
1707         typedef [public,gensize] struct {
1708                 spoolss_FormFlags flags;
1709                 [relative] nstring *form_name;
1710                 spoolss_FormSize size;
1711                 spoolss_FormArea area;
1712                 [relative] astring *keyword;
1713                 spoolss_FormStringType string_type;
1714                 [relative] nstring *mui_dll;
1715                 uint32 ressource_id;
1716                 [relative] nstring *display_name;
1717                 uint16 lang_id;
1718                 uint16 unused;
1719         } spoolss_FormInfo2;
1720
1721         typedef [nodiscriminant,relative_base,public,gensize] union {
1722                 [case(1)] spoolss_FormInfo1 info1;
1723                 [case(2)] spoolss_FormInfo2 info2;
1724                 [default];
1725         } spoolss_FormInfo;
1726
1727         typedef struct {
1728                 spoolss_FormFlags flags;
1729                 [string,charset(UTF16)] uint16 *form_name;
1730                 spoolss_FormSize size;
1731                 spoolss_FormArea area;
1732         } spoolss_AddFormInfo1;
1733
1734         typedef struct {
1735                 spoolss_FormFlags flags;
1736                 [string,charset(UTF16)] uint16 *form_name;
1737                 spoolss_FormSize size;
1738                 spoolss_FormArea area;
1739                 [string,charset(DOS)] uint8 *keyword;
1740                 spoolss_FormStringType string_type;
1741                 [string,charset(UTF16)] uint16 *mui_dll;
1742                 uint32 ressource_id;
1743                 [string,charset(UTF16)] uint16 *display_name;
1744                 uint32 lang_id;
1745         } spoolss_AddFormInfo2;
1746
1747         typedef [switch_type(uint32)] union {
1748                 [case(1)] spoolss_AddFormInfo1 *info1;
1749                 [case(2)] spoolss_AddFormInfo2 *info2;
1750         } spoolss_AddFormInfo;
1751
1752         WERROR spoolss_AddForm(
1753                 [in,ref] policy_handle *handle,
1754                 [in] uint32 level,
1755                 [in,switch_is(level)] spoolss_AddFormInfo info
1756         );
1757
1758         /******************/
1759         /* Function: 0x1f */
1760         WERROR spoolss_DeleteForm(
1761                 [in,ref] policy_handle *handle,
1762                 [in] [string,charset(UTF16)] uint16 form_name[]
1763         );
1764
1765         /******************/
1766         /* Function: 0x20 */
1767         WERROR spoolss_GetForm(
1768                 [in,ref] policy_handle *handle,
1769                 [in] [string,charset(UTF16)] uint16 form_name[],
1770                 [in] uint32 level,
1771                 [in,unique] DATA_BLOB *buffer,
1772                 [in] uint32 offered,
1773                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
1774                 [out,ref] uint32 *needed
1775         );
1776
1777         /******************/
1778         /* Function: 0x21 */
1779         WERROR spoolss_SetForm(
1780                 [in,ref] policy_handle *handle,
1781                 [in] [string,charset(UTF16)] uint16 form_name[],
1782                 [in] uint32 level,
1783                 [in,switch_is(level)] spoolss_AddFormInfo info
1784         );
1785
1786         /******************/
1787         /* Function: 0x22 */
1788         [public,noopnum,noprint] WERROR _spoolss_EnumForms(
1789                 [in,ref] policy_handle *handle,
1790                 [in]     uint32 level,
1791                 [in,unique] DATA_BLOB *buffer,
1792                 [in]     uint32 offered,
1793                 [out,unique] DATA_BLOB *info,
1794                 [out,ref] uint32 *needed,
1795                 [out,ref] uint32 *count
1796         );
1797         [public,noopnum,noprint] void __spoolss_EnumForms(
1798                 [in] uint32 level,
1799                 [in] uint32 count,
1800                 [out,switch_is(level)] spoolss_FormInfo info[count]
1801         );
1802         [nopull,nopush] WERROR spoolss_EnumForms(
1803                 [in,ref] policy_handle *handle,
1804                 [in]     uint32 level,
1805                 [in,unique] DATA_BLOB *buffer,
1806                 [in]     uint32 offered,
1807                 [out,ref] uint32 *count,
1808                 [out,ref,switch_is(level),size_is(,*count)] spoolss_FormInfo **info,
1809                 [out,ref] uint32 *needed
1810         );
1811
1812         /*
1813          * Special strings for the OpenPrinter() call.  See the MSDN DDK
1814          * docs on the XcvDataPort() for more details.
1815          */
1816
1817         const string SPL_LOCAL_PORT             = "Local Port";
1818         const string SPL_TCPIP_PORT             = "Standard TCP/IP Port";
1819         const string SPL_XCV_MONITOR_LOCALMON   = ",XcvMonitor Local Port";
1820         const string SPL_XCV_MONITOR_TCPMON     = ",XcvMonitor Standard TCP/IP Port";
1821
1822         typedef [public,gensize] struct {
1823                 [relative] nstring *port_name;
1824         } spoolss_PortInfo1;
1825
1826         typedef bitmap {
1827                 SPOOLSS_PORT_TYPE_WRITE         = 0x00000001,
1828                 SPOOLSS_PORT_TYPE_READ          = 0x00000002,
1829                 SPOOLSS_PORT_TYPE_REDIRECTED    = 0x00000004,
1830                 SPOOLSS_PORT_TYPE_NET_ATTACHED  = 0x00000008
1831         } spoolss_PortType;
1832
1833         typedef [public,gensize] struct {
1834                 [relative] nstring *port_name;
1835                 [relative] nstring *monitor_name;
1836                 [relative] nstring *description;
1837                 spoolss_PortType port_type;
1838                 uint32 reserved;
1839         } spoolss_PortInfo2;
1840
1841         typedef [v1_enum] enum {
1842                 PORT_STATUS_CLEAR               = 0x00000000,
1843                 PORT_STATUS_OFFLINE             = 0x00000001,
1844                 PORT_STATUS_PAPER_JAM           = 0x00000002,
1845                 PORT_STATUS_PAPER_OUT           = 0x00000003,
1846                 PORT_STATUS_OUTPUT_BIN_FULL     = 0x00000004,
1847                 PORT_STATUS_PAPER_PROBLEM       = 0x00000005,
1848                 PORT_STATUS_NO_TONER            = 0x00000006,
1849                 PORT_STATUS_DOOR_OPEN           = 0x00000007,
1850                 PORT_STATUS_USER_INTERVENTION   = 0x00000008,
1851                 PORT_STATUS_OUT_OF_MEMORY       = 0x00000009,
1852                 PORT_STATUS_TONER_LOW           = 0x0000000A,
1853                 PORT_STATUS_WARMING_UP          = 0x0000000B,
1854                 PORT_STATUS_POWER_SAVE          = 0x0000000C
1855         } spoolss_PortStatus;
1856
1857         typedef [v1_enum] enum {
1858                 PORT_STATUS_TYPE_ERROR          = 0x00000001,
1859                 PORT_STATUS_TYPE_WARNING        = 0x00000002,
1860                 PORT_STATUS_TYPE_INFO           = 0x00000003
1861         } spoolss_PortSeverity;
1862
1863         typedef [public,gensize] struct {
1864                 spoolss_PortStatus status;
1865                 [relative] nstring *status_string;
1866                 spoolss_PortSeverity severity;
1867         } spoolss_PortInfo3;
1868
1869         typedef [public,gensize] struct {
1870                 [relative] nstring *port_name;
1871                 DATA_BLOB monitor_data; /* relative ?? */
1872         } spoolss_PortInfoFF;
1873
1874         typedef [nodiscriminant,relative_base,public] union {
1875                 [case(1)] spoolss_PortInfo1 info1;
1876                 [case(2)] spoolss_PortInfo2 info2;
1877                 [case(3)] spoolss_PortInfo3 info3;
1878                 [case(0xff)] spoolss_PortInfoFF infoFF;
1879                 [default];
1880         } spoolss_PortInfo;
1881
1882         /******************/
1883         /* Function: 0x23 */
1884         [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
1885                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1886                 [in] uint32 level,
1887                 [in,unique] DATA_BLOB *buffer,
1888                 [in] uint32 offered,
1889                 [out,unique] DATA_BLOB *info,
1890                 [out,ref] uint32 *needed,
1891                 [out,ref] uint32 *count
1892         );
1893         [public,noopnum,noprint] void __spoolss_EnumPorts(
1894                 [in] uint32 level,
1895                 [in] uint32 count,
1896                 [out,switch_is(level)] spoolss_PortInfo info[count]
1897         );
1898         [nopull,nopush] WERROR spoolss_EnumPorts(
1899                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1900                 [in] uint32 level,
1901                 [in,unique] DATA_BLOB *buffer,
1902                 [in] uint32 offered,
1903                 [out,ref] uint32 *count,
1904                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PortInfo **info,
1905                 [out,ref] uint32 *needed
1906         );
1907
1908         /******************/
1909         /* Function: 0x24 */
1910         typedef [public,gensize] struct {
1911                 [relative] nstring *monitor_name;
1912         } spoolss_MonitorInfo1;
1913
1914         typedef [public,gensize] struct {
1915                 [relative] nstring *monitor_name;
1916                 [relative] nstring *environment;
1917                 [relative] nstring *dll_name;
1918         } spoolss_MonitorInfo2;
1919
1920         typedef [nodiscriminant,relative_base,public] union {
1921                 [case(1)] spoolss_MonitorInfo1 info1;
1922                 [case(2)] spoolss_MonitorInfo2 info2;
1923                 [default];
1924         } spoolss_MonitorInfo;
1925
1926         [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
1927                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1928                 [in] uint32 level,
1929                 [in,unique] DATA_BLOB *buffer,
1930                 [in] uint32 offered,
1931                 [out,unique] DATA_BLOB *info,
1932                 [out,ref] uint32 *needed,
1933                 [out,ref] uint32 *count
1934         );
1935         [public,noopnum,noprint] void __spoolss_EnumMonitors(
1936                 [in] uint32 level,
1937                 [in] uint32 count,
1938                 [out,switch_is(level)] spoolss_MonitorInfo info[count]
1939         );
1940         [nopull,nopush] WERROR spoolss_EnumMonitors(
1941                 [in,unique] [string,charset(UTF16)] uint16 *servername,
1942                 [in] uint32 level,
1943                 [in,unique] DATA_BLOB *buffer,
1944                 [in] uint32 offered,
1945                 [out,ref] uint32 *count,
1946                 [out,ref,switch_is(level),size_is(,*count)] spoolss_MonitorInfo **info,
1947                 [out,ref] uint32 *needed
1948         );
1949
1950         /******************/
1951         /* Function: 0x25 */
1952         WERROR spoolss_AddPort(
1953                [in,unique] [string,charset(UTF16)] uint16 *server_name,
1954                [in] uint32 unknown,
1955                [in] [string,charset(UTF16)] uint16 monitor_name[]
1956         );
1957
1958         /******************/
1959         /* Function: 0x26 */
1960         [todo] WERROR spoolss_ConfigurePort(
1961         );
1962
1963         /******************/
1964         /* Function: 0x27 */
1965         [todo] WERROR spoolss_DeletePort(
1966         );
1967
1968         /******************/
1969         /* Function: 0x28 */
1970         WERROR spoolss_CreatePrinterIC(
1971                 [in,ref] policy_handle *handle,
1972                 [out,ref] policy_handle *gdi_handle,
1973                 [in,ref] spoolss_DevmodeContainer *devmode_ctr
1974         );
1975
1976         /******************/
1977         /* Function: 0x29 */
1978         [todo] WERROR spoolss_PlayGDIScriptOnPrinterIC(
1979         );
1980
1981         /******************/
1982         /* Function: 0x2a */
1983         WERROR spoolss_DeletePrinterIC(
1984                 [in,out,ref] policy_handle *gdi_handle
1985         );
1986
1987         /******************/
1988         /* Function: 0x2b */
1989         [todo] WERROR spoolss_AddPrinterConnection(
1990         );
1991
1992         /******************/
1993         /* Function: 0x2c */
1994         [todo] WERROR spoolss_DeletePrinterConnection(
1995         );
1996
1997         /******************/
1998         /* Function: 0x2d */
1999         [todo] WERROR spoolss_PrinterMessageBox(
2000                 /* Marked as obsolete in MSDN.  "Not necessary and has
2001                    no effect". */
2002         );
2003
2004         /******************/
2005         /* Function: 0x2e */
2006         [todo] WERROR spoolss_AddMonitor(
2007         );
2008
2009         /******************/
2010         /* Function: 0x2f */
2011         [todo] WERROR spoolss_DeleteMonitor(
2012         );
2013
2014         /******************/
2015         /* Function: 0x30 */
2016         [todo] WERROR spoolss_DeletePrintProcessor(
2017         );
2018
2019         /******************/
2020         /* Function: 0x31 */
2021         [todo] WERROR spoolss_AddPrintProvidor(
2022         );
2023
2024         /******************/
2025         /* Function: 0x32 */
2026         [todo] WERROR spoolss_DeletePrintProvidor(
2027         );
2028
2029         /******************/
2030         /* Function: 0x33 */
2031
2032         typedef [public,gensize] struct {
2033                 [relative] nstring *name_array;
2034         } spoolss_PrintProcDataTypesInfo1;
2035
2036         typedef [nodiscriminant,relative_base,public] union {
2037                 [case(1)] spoolss_PrintProcDataTypesInfo1 info1;
2038                 [default];
2039         } spoolss_PrintProcDataTypesInfo;
2040
2041         [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcDataTypes(
2042                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2043                 [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
2044                 [in] uint32 level,
2045                 [in,unique] DATA_BLOB *buffer,
2046                 [in] uint32 offered,
2047                 [out,unique] DATA_BLOB *info,
2048                 [out,ref] uint32 *needed,
2049                 [out,ref] uint32 *count
2050         );
2051         [public,noopnum,noprint] void __spoolss_EnumPrintProcDataTypes(
2052                 [in] uint32 level,
2053                 [in] uint32 count,
2054                 [out,switch_is(level)] spoolss_PrintProcDataTypesInfo info[count]
2055         );
2056         [nopull,nopush] WERROR spoolss_EnumPrintProcDataTypes(
2057                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2058                 [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
2059                 [in] uint32 level,
2060                 [in,unique] DATA_BLOB *buffer,
2061                 [in] uint32 offered,
2062                 [out,ref] uint32 *count,
2063                 [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcDataTypesInfo **info,
2064                 [out,ref] uint32 *needed
2065         );
2066
2067         /******************/
2068         /* Function: 0x34 */
2069         WERROR spoolss_ResetPrinter(
2070                 [in,ref] policy_handle *handle,
2071                 [in,unique] [string,charset(UTF16)] uint16 *data_type,
2072                 [in,ref] spoolss_DevmodeContainer *devmode_ctr
2073         );
2074
2075         /******************/
2076         /* Function: 0x35 */
2077         WERROR spoolss_GetPrinterDriver2(
2078                 [in,ref] policy_handle *handle,
2079                 [in,unique] [string,charset(UTF16)] uint16 *architecture,
2080                 [in]     uint32 level,
2081                 [in,unique] DATA_BLOB *buffer,
2082                 [in]     uint32 offered,
2083                 [in]     uint32 client_major_version,
2084                 [in]     uint32 client_minor_version,
2085                 [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
2086                 [out,ref] uint32 *needed,
2087                 [out,ref] uint32 *server_major_version,
2088                 [out,ref] uint32 *server_minor_version
2089         );
2090
2091         /******************/
2092         /* Function: 0x36 */
2093         [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
2094         );
2095
2096         /******************/
2097         /* Function: 0x37 */
2098         [todo] WERROR spoolss_FindNextPrinterChangeNotification(
2099         );
2100
2101         /******************/
2102         /* Function: 0x38 */
2103         [public] WERROR spoolss_FindClosePrinterNotify(
2104                 [in,ref] policy_handle *handle
2105         );
2106
2107         /******************/
2108         /* Function: 0x39 */
2109         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
2110         );
2111
2112         /******************/
2113         /* Function: 0x3a */
2114         [public] WERROR spoolss_ReplyOpenPrinter(
2115                 [in,string,charset(UTF16)] uint16 server_name[],
2116                 [in] uint32 printer_local,
2117                 [in] winreg_Type type,
2118                 [in,range(0,512)] uint32 bufsize,
2119                 [in,unique,size_is(bufsize)] uint8 *buffer,
2120                 [out,ref] policy_handle *handle
2121         );
2122
2123         /******************/
2124         /* Function: 0x3b */
2125
2126         typedef [bitmap32bit] bitmap {
2127                 PRINTER_CHANGE_ADD_PRINTER                      = 0x00000001,
2128                 PRINTER_CHANGE_SET_PRINTER                      = 0x00000002,
2129                 PRINTER_CHANGE_DELETE_PRINTER                   = 0x00000004,
2130                 PRINTER_CHANGE_FAILED_CONNECTION_PRINTER        = 0x00000008,
2131                 PRINTER_CHANGE_ADD_JOB                          = 0x00000100,
2132                 PRINTER_CHANGE_SET_JOB                          = 0x00000200,
2133                 PRINTER_CHANGE_DELETE_JOB                       = 0x00000400,
2134                 PRINTER_CHANGE_WRITE_JOB                        = 0x00000800,
2135                 PRINTER_CHANGE_ADD_FORM                         = 0x00010000,
2136                 PRINTER_CHANGE_SET_FORM                         = 0x00020000,
2137                 PRINTER_CHANGE_DELETE_FORM                      = 0x00040000,
2138                 PRINTER_CHANGE_ADD_PORT                         = 0x00100000,
2139                 PRINTER_CHANGE_CONFIGURE_PORT                   = 0x00200000,
2140                 PRINTER_CHANGE_DELETE_PORT                      = 0x00400000,
2141                 PRINTER_CHANGE_ADD_PRINT_PROCESSOR              = 0x01000000,
2142                 PRINTER_CHANGE_DELETE_PRINT_PROCESSOR           = 0x04000000,
2143                 PRINTER_CHANGE_SERVER                           = 0x08000000,
2144                 PRINTER_CHANGE_ADD_PRINTER_DRIVER               = 0x10000000,
2145                 PRINTER_CHANGE_SET_PRINTER_DRIVER               = 0x20000000,
2146                 PRINTER_CHANGE_DELETE_PRINTER_DRIVER            = 0x40000000,
2147                 PRINTER_CHANGE_TIMEOUT                          = 0x80000000
2148         } spoolss_PrinterChangeFlags;
2149
2150         const int PRINTER_CHANGE_PRINTER                        = 0x000000FF;
2151
2152         const int PRINTER_CHANGE_JOB                            = 0x0000FF00;
2153
2154         const int PRINTER_CHANGE_FORM                           = (PRINTER_CHANGE_ADD_FORM |
2155                                                                    PRINTER_CHANGE_SET_FORM |
2156                                                                    PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */
2157
2158         const int PRINTER_CHANGE_PORT                           = (PRINTER_CHANGE_ADD_PORT |
2159                                                                    PRINTER_CHANGE_CONFIGURE_PORT |
2160                                                                    PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */
2161
2162         const int PRINTER_CHANGE_PRINT_PROCESSOR                = 0x07000000;
2163
2164         const int PRINTER_CHANGE_PRINTER_DRIVER                 = (PRINTER_CHANGE_ADD_PRINTER_DRIVER |
2165                                                                    PRINTER_CHANGE_SET_PRINTER_DRIVER |
2166                                                                    PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */
2167
2168         const int PRINTER_CHANGE_ALL                            = (PRINTER_CHANGE_PRINTER |
2169                                                                    PRINTER_CHANGE_JOB |
2170                                                                    PRINTER_CHANGE_FORM |
2171                                                                    PRINTER_CHANGE_PORT |
2172                                                                    PRINTER_CHANGE_PRINT_PROCESSOR |
2173                                                                    PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */
2174         WERROR spoolss_RouterReplyPrinter(
2175                 [in,ref] policy_handle *handle,
2176                 [in] spoolss_PrinterChangeFlags flags,
2177                 [in,range(0,512)] uint32 bufsize,
2178                 [in,unique,size_is(bufsize)] uint8 *buffer
2179         );
2180
2181         /******************/
2182         /* Function: 0x3c */
2183         [public] WERROR spoolss_ReplyClosePrinter(
2184                 [in,out,ref] policy_handle *handle
2185         );
2186
2187         /******************/
2188         /* Function: 0x3d */
2189         [todo] WERROR spoolss_AddPortEx(
2190         );
2191
2192         /******************/
2193         /* Function: 0x3e */
2194         [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
2195         );
2196
2197         /******************/
2198         /* Function: 0x3f */
2199         [todo] WERROR spoolss_SpoolerInit(
2200         );
2201
2202         /******************/
2203         /* Function: 0x40 */
2204         [todo] WERROR spoolss_ResetPrinterEx(
2205         );
2206
2207         typedef [enum16bit,public] enum {
2208                 JOB_NOTIFY_FIELD_PRINTER_NAME                   = 0x00,
2209                 JOB_NOTIFY_FIELD_MACHINE_NAME                   = 0x01,
2210                 JOB_NOTIFY_FIELD_PORT_NAME                      = 0x02,
2211                 JOB_NOTIFY_FIELD_USER_NAME                      = 0x03,
2212                 JOB_NOTIFY_FIELD_NOTIFY_NAME                    = 0x04,
2213                 JOB_NOTIFY_FIELD_DATATYPE                       = 0x05,
2214                 JOB_NOTIFY_FIELD_PRINT_PROCESSOR                = 0x06,
2215                 JOB_NOTIFY_FIELD_PARAMETERS                     = 0x07,
2216                 JOB_NOTIFY_FIELD_DRIVER_NAME                    = 0x08,
2217                 JOB_NOTIFY_FIELD_DEVMODE                        = 0x09,
2218                 JOB_NOTIFY_FIELD_STATUS                         = 0x0a,
2219                 JOB_NOTIFY_FIELD_STATUS_STRING                  = 0x0b,
2220                 JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR            = 0x0c,
2221                 JOB_NOTIFY_FIELD_DOCUMENT                       = 0x0d,
2222                 JOB_NOTIFY_FIELD_PRIORITY                       = 0x0e,
2223                 JOB_NOTIFY_FIELD_POSITION                       = 0x0f,
2224                 JOB_NOTIFY_FIELD_SUBMITTED                      = 0x10,
2225                 JOB_NOTIFY_FIELD_START_TIME                     = 0x11,
2226                 JOB_NOTIFY_FIELD_UNTIL_TIME                     = 0x12,
2227                 JOB_NOTIFY_FIELD_TIME                           = 0x13,
2228                 JOB_NOTIFY_FIELD_TOTAL_PAGES                    = 0x14,
2229                 JOB_NOTIFY_FIELD_PAGES_PRINTED                  = 0x15,
2230                 JOB_NOTIFY_FIELD_TOTAL_BYTES                    = 0x16,
2231                 JOB_NOTIFY_FIELD_BYTES_PRINTED                  = 0x17
2232         } spoolss_JobNotifyField;
2233
2234         typedef [enum16bit,public] enum {
2235                 PRINTER_NOTIFY_FIELD_SERVER_NAME                = 0x00,
2236                 PRINTER_NOTIFY_FIELD_PRINTER_NAME               = 0x01,
2237                 PRINTER_NOTIFY_FIELD_SHARE_NAME                 = 0x02,
2238                 PRINTER_NOTIFY_FIELD_PORT_NAME                  = 0x03,
2239                 PRINTER_NOTIFY_FIELD_DRIVER_NAME                = 0x04,
2240                 PRINTER_NOTIFY_FIELD_COMMENT                    = 0x05,
2241                 PRINTER_NOTIFY_FIELD_LOCATION                   = 0x06,
2242                 PRINTER_NOTIFY_FIELD_DEVMODE                    = 0x07,
2243                 PRINTER_NOTIFY_FIELD_SEPFILE                    = 0x08,
2244                 PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR            = 0x09,
2245                 PRINTER_NOTIFY_FIELD_PARAMETERS                 = 0x0a,
2246                 PRINTER_NOTIFY_FIELD_DATATYPE                   = 0x0b,
2247                 PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR        = 0x0c,
2248                 PRINTER_NOTIFY_FIELD_ATTRIBUTES                 = 0x0d,
2249                 PRINTER_NOTIFY_FIELD_PRIORITY                   = 0x0e,
2250                 PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY           = 0x0f,
2251                 PRINTER_NOTIFY_FIELD_START_TIME                 = 0x10,
2252                 PRINTER_NOTIFY_FIELD_UNTIL_TIME                 = 0x11,
2253                 PRINTER_NOTIFY_FIELD_STATUS                     = 0x12,
2254                 PRINTER_NOTIFY_FIELD_STATUS_STRING              = 0x13,
2255                 PRINTER_NOTIFY_FIELD_CJOBS                      = 0x14,
2256                 PRINTER_NOTIFY_FIELD_AVERAGE_PPM                = 0x15,
2257                 PRINTER_NOTIFY_FIELD_TOTAL_PAGES                = 0x16,
2258                 PRINTER_NOTIFY_FIELD_PAGES_PRINTED              = 0x17,
2259                 PRINTER_NOTIFY_FIELD_TOTAL_BYTES                = 0x18,
2260                 PRINTER_NOTIFY_FIELD_BYTES_PRINTED              = 0x19,
2261                 PRINTER_NOTIFY_FIELD_OBJECT_GUID                = 0x1a,
2262                 PRINTER_NOTIFY_FIELD_FRIENDLY_NAME              = 0x1b
2263         } spoolss_PrintNotifyField;
2264
2265         typedef [enum16bit] enum {
2266                 PRINTER_NOTIFY_TYPE     = 0x00,
2267                 JOB_NOTIFY_TYPE         = 0x01
2268         } spoolss_NotifyType;
2269
2270         typedef [nodiscriminant,noprint] union {
2271                 [case(PRINTER_NOTIFY_TYPE)] uint16 field;
2272                 [case(JOB_NOTIFY_TYPE)] uint16 field;
2273                 [default] uint16 field;
2274         } spoolss_Field;
2275
2276         /******************/
2277         /* Function: 0x41 */
2278         typedef struct {
2279                 spoolss_NotifyType type;
2280                 uint16 u1;
2281                 uint32 u2;
2282                 uint32 u3;
2283                 uint32 count;
2284                 [size_is(count),switch_is(type)] spoolss_Field *fields;
2285         } spoolss_NotifyOptionType;
2286
2287         typedef [bitmap32bit] bitmap {
2288                 PRINTER_NOTIFY_OPTIONS_REFRESH  = 0x00000001
2289         } spoolssNotifyOptionFlags;
2290
2291         typedef struct {
2292                 [value(2)] uint32 version;
2293                 spoolssNotifyOptionFlags flags;
2294                 uint32 count;
2295                 [size_is(count)] spoolss_NotifyOptionType *types;
2296         } spoolss_NotifyOption;
2297
2298         [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
2299                 [in,ref] policy_handle *handle,
2300                 [in] spoolss_PrinterChangeFlags flags,
2301                 [in] uint32 options,
2302                 [in,unique] [string,charset(UTF16)] uint16 *local_machine,
2303                 [in] uint32 printer_local,
2304                 [in,unique] spoolss_NotifyOption *notify_options
2305         );
2306
2307         /******************/
2308         /* Function: 0x42 */
2309
2310         typedef struct {
2311                 uint32 size;
2312                 [size_is(size/2),unique,charset(UTF16)] uint16 *string;
2313         } spoolss_NotifyString;
2314
2315         typedef [v1_enum] enum {
2316                 NOTIFY_TABLE_DWORD              = 0x0001,
2317                 NOTIFY_TABLE_STRING             = 0x0002,
2318                 NOTIFY_TABLE_DEVMODE            = 0x0003,
2319                 NOTIFY_TABLE_TIME               = 0x0004,
2320                 NOTIFY_TABLE_SECURITYDESCRIPTOR = 0x0005
2321         } spoolss_NotifyTable;
2322
2323         typedef [switch_type(uint32)] union {
2324                 [case(1)] uint32 integer[2];
2325                 [case(2)] spoolss_NotifyString string;
2326                 [case(3)] spoolss_DevmodeContainer devmode;
2327                 [case(4)] spoolss_TimeCtr time;
2328                 [case(5)] sec_desc_buf sd;
2329         } spoolss_NotifyData;
2330
2331         typedef struct {
2332                 spoolss_NotifyType type;
2333                 [switch_is(type)] spoolss_Field field;
2334                 spoolss_NotifyTable variable_type;
2335                 uint32 job_id;
2336                 [switch_is(variable_type)] spoolss_NotifyData data;
2337         } spoolss_Notify;
2338
2339         typedef struct {
2340                 [value(2)] uint32 version;
2341                 uint32 flags;
2342                 uint32 count;
2343                 [size_is(count)] spoolss_Notify notifies[];
2344         } spoolss_NotifyInfo;
2345
2346         typedef [switch_type(uint32)] union {
2347                 [case(0)] spoolss_NotifyInfo *info0;
2348         } spoolss_ReplyPrinterInfo;
2349
2350         typedef [bitmap32bit] bitmap {
2351                 PRINTER_NOTIFY_INFO_DISCARDED           = 0x00000001,
2352                 PRINTER_NOTIFY_INFO_DISCARDNOTED        = 0x00010000,
2353                 PRINTER_NOTIFY_INFO_COLOR_MISMATCH      = 0x00080000
2354         } spoolss_PrinterNotifyFlags;
2355
2356         WERROR spoolss_RouterReplyPrinterEx(
2357                 [in,ref] policy_handle *handle,
2358                 [in] uint32 color,
2359                 [in] spoolss_PrinterChangeFlags flags,
2360                 [out,ref] spoolss_PrinterNotifyFlags *reply_result,
2361                 [in] uint32 reply_type,
2362                 [in,switch_is(reply_type)] spoolss_ReplyPrinterInfo info
2363         );
2364
2365         /******************/
2366         /* Function: 0x43 */
2367         [public] WERROR spoolss_RouterRefreshPrinterChangeNotify(
2368                 [in,ref] policy_handle *handle,
2369                 [in] uint32 change_low,
2370                 [in,unique] spoolss_NotifyOption *options,
2371                 [out,ref] spoolss_NotifyInfo **info
2372         );
2373
2374         /******************/
2375         /* Function: 0x44 */
2376         [todo] WERROR spoolss_44(
2377         );
2378
2379         typedef struct {
2380                 uint32 size;
2381                 [string,charset(UTF16)] uint16 *client;
2382                 [string,charset(UTF16)] uint16 *user;
2383                 uint32 build;
2384                 spoolss_MajorVersion major;
2385                 spoolss_MinorVersion minor;
2386                 spoolss_ProcessorArchitecture processor;
2387         } spoolss_UserLevel1;
2388
2389         typedef struct {
2390                 uint32 not_used;
2391         } spoolss_UserLevel2;
2392
2393         typedef struct {
2394                 uint32 size;
2395                 uint32 flags;
2396                 uint32 size2;
2397                 [string,charset(UTF16)] uint16 *client;
2398                 [string,charset(UTF16)] uint16 *user;
2399                 uint32 build;
2400                 spoolss_MajorVersion major;
2401                 spoolss_MinorVersion minor;
2402                 spoolss_ProcessorArchitecture processor;
2403                 udlong reserved;
2404         } spoolss_UserLevel3;
2405
2406         typedef [switch_type(uint32)] union {
2407                 [case(1)]  spoolss_UserLevel1 *level1;
2408                 [case(2)]  spoolss_UserLevel2 *level2;
2409                 [case(3)]  spoolss_UserLevel3 *level3;
2410         } spoolss_UserLevel;
2411
2412         typedef struct {
2413                 uint32 level;
2414                 [switch_is(level)] spoolss_UserLevel user_info;
2415         } spoolss_UserLevelCtr;
2416
2417         typedef bitmap {
2418                 SERVER_ACCESS_ADMINISTER        = 0x00000001,
2419                 SERVER_ACCESS_ENUMERATE         = 0x00000002,
2420                 PRINTER_ACCESS_ADMINISTER       = 0x00000004,
2421                 PRINTER_ACCESS_USE              = 0x00000008,
2422                 JOB_ACCESS_ADMINISTER           = 0x00000010,
2423                 JOB_ACCESS_READ                 = 0x00000020
2424         } spoolss_AccessRights;
2425
2426         /* Access rights for print servers */
2427         const int SERVER_ALL_ACCESS     = SEC_STD_REQUIRED |
2428                                           SERVER_ACCESS_ADMINISTER |
2429                                           SERVER_ACCESS_ENUMERATE;
2430
2431         const int SERVER_READ           = SEC_STD_READ_CONTROL |
2432                                           SERVER_ACCESS_ENUMERATE;
2433
2434         const int SERVER_WRITE          = STANDARD_RIGHTS_WRITE_ACCESS |
2435                                           SERVER_ACCESS_ADMINISTER |
2436                                           SERVER_ACCESS_ENUMERATE;
2437
2438         const int SERVER_EXECUTE        = SEC_STD_READ_CONTROL |
2439                                           SERVER_ACCESS_ENUMERATE;
2440
2441         /* Access rights for printers */
2442         const int PRINTER_ALL_ACCESS    = SEC_STD_REQUIRED |
2443                                           PRINTER_ACCESS_ADMINISTER |
2444                                           PRINTER_ACCESS_USE;
2445
2446         const int PRINTER_READ          = SEC_STD_READ_CONTROL |
2447                                           PRINTER_ACCESS_USE;
2448
2449         const int PRINTER_WRITE         = STANDARD_RIGHTS_WRITE_ACCESS |
2450                                           PRINTER_ACCESS_USE;
2451
2452         const int PRINTER_EXECUTE       = SEC_STD_READ_CONTROL |
2453                                           PRINTER_ACCESS_USE;
2454
2455         /* Access rights for jobs */
2456         const int JOB_ALL_ACCESS        = SEC_STD_REQUIRED |
2457                                           JOB_ACCESS_ADMINISTER;
2458
2459         const int JOB_READ              = SEC_STD_READ_CONTROL |
2460                                           JOB_ACCESS_ADMINISTER;
2461
2462         const int JOB_WRITE             = STANDARD_RIGHTS_WRITE_ACCESS |
2463                                           JOB_ACCESS_ADMINISTER;
2464
2465         const int JOB_EXECUTE           = SEC_STD_READ_CONTROL |
2466                                           JOB_ACCESS_ADMINISTER;
2467
2468         /* ACE masks for various print permissions */
2469         const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
2470                                                 PRINTER_ALL_ACCESS;
2471
2472         const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
2473                                                 READ_CONTROL_ACCESS;
2474
2475         const int PRINTER_ACE_PRINT     = GENERIC_EXECUTE_ACCESS |
2476                                           READ_CONTROL_ACCESS |
2477                                           PRINTER_ACCESS_USE;
2478
2479         /******************/
2480         /* Function: 0x45 */
2481         [public] WERROR spoolss_OpenPrinterEx(
2482                 [in,unique]           [string,charset(UTF16)] uint16 *printername,
2483                 [in,unique]           [string,charset(UTF16)] uint16 *datatype,
2484                 [in]                  spoolss_DevmodeContainer devmode_ctr,
2485                 [in]                  spoolss_AccessRights access_mask,
2486                 [in]                  uint32 level,
2487                 [in,switch_is(level)] spoolss_UserLevel userlevel,
2488                 [out,ref]             policy_handle *handle
2489         );
2490
2491         /******************/
2492         /* Function: 0x46 */
2493         WERROR spoolss_AddPrinterEx(
2494                 [in,unique] [string,charset(UTF16)] uint16 *server,
2495                 [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
2496                 [in,ref] spoolss_DevmodeContainer *devmode_ctr,
2497                 [in,ref] sec_desc_buf *secdesc_ctr,
2498                 [in,ref] spoolss_UserLevelCtr *userlevel_ctr,
2499                 [out,ref] policy_handle *handle
2500         );
2501
2502         /******************/
2503         /* Function: 0x47 */
2504         [todo] WERROR spoolss_47(
2505         );
2506
2507         /******************/
2508         /* Function: 0x48 */
2509         WERROR spoolss_EnumPrinterData(
2510                 [in,ref] policy_handle *handle,
2511                 [in]     uint32 enum_index,
2512                 [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[],
2513                 [in]     uint32 value_offered,
2514                 [out,ref] uint32 *value_needed,
2515                 [out,ref] winreg_Type *type,
2516                 [out,ref,size_is(data_offered),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *data,
2517                 [in]     uint32 data_offered,
2518                 [out,ref] uint32 *data_needed
2519         );
2520
2521         /******************/
2522         /* Function: 0x49 */
2523         WERROR spoolss_DeletePrinterData(
2524                 [in,ref] policy_handle *handle,
2525                 [in] [string,charset(UTF16)] uint16 value_name[]
2526         );
2527
2528         /******************/
2529         /* Function: 0x4a */
2530         [todo] WERROR spoolss_4a(
2531         );
2532
2533         /******************/
2534         /* Function: 0x4b */
2535         [todo] WERROR spoolss_4b(
2536         );
2537
2538         /******************/
2539         /* Function: 0x4c */
2540         [todo] WERROR spoolss_4c(
2541         );
2542
2543         /******************/
2544         /* Function: 0x4d */
2545         [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterDataEx(
2546                 [in,ref] policy_handle *handle,
2547                 [in] [string,charset(UTF16)] uint16 key_name[],
2548                 [in] [string,charset(UTF16)] uint16 value_name[],
2549                 [in] winreg_Type type,
2550                 [in] DATA_BLOB data,
2551                 [in] uint32 _offered
2552         );
2553         [noopnum,nopull,noprint,public] void __spoolss_SetPrinterDataEx(
2554                 [in] winreg_Type type,
2555                 [out,ref,switch_is(type)] spoolss_PrinterData *data
2556         );
2557         [nopush] WERROR spoolss_SetPrinterDataEx(
2558                 [in,ref] policy_handle *handle,
2559                 [in] [string,charset(UTF16)] uint16 key_name[],
2560                 [in] [string,charset(UTF16)] uint16 value_name[],
2561                 [in] winreg_Type type,
2562                 [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
2563                 [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered
2564         );
2565
2566         /******************/
2567         /* Function: 0x4e */
2568         [noopnum,noprint,public] WERROR _spoolss_GetPrinterDataEx(
2569                 [in,ref] policy_handle *handle,
2570                 [in]     [string,charset(UTF16)] uint16 key_name[],
2571                 [in]     [string,charset(UTF16)] uint16 value_name[],
2572                 [in]     uint32 offered,
2573                 [out,ref] winreg_Type *type,
2574                 [out,ref] DATA_BLOB *data,
2575                 [out,ref] uint32 *needed
2576         );
2577         [noopnum,noprint,public] void __spoolss_GetPrinterDataEx(
2578                 [in] winreg_Type type,
2579                 [out,ref,switch_is(type)] spoolss_PrinterData *data
2580         );
2581         [nopull,nopush,public] WERROR spoolss_GetPrinterDataEx(
2582                 [in,ref] policy_handle *handle,
2583                 [in]     [string,charset(UTF16)] uint16 key_name[],
2584                 [in]     [string,charset(UTF16)] uint16 value_name[],
2585                 [in]     uint32 offered,
2586                 [out,ref] winreg_Type *type,
2587                 [out,ref,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData *data,
2588                 [out,ref] uint32 *needed
2589         );
2590
2591         /******************/
2592         /* Function: 0x4f */
2593
2594         typedef [relative_base,public,gensize] struct {
2595                 [relative] nstring *value_name;
2596                 [value(2*strlen_m_term(value_name))] uint32 value_name_len;
2597                 winreg_Type type;
2598                 [relative,switch_is(type),subcontext(0),subcontext_size(r->data_length)] spoolss_PrinterData *data;
2599                 [value(ndr_size_spoolss_PrinterData(data, type, ndr->iconv_convenience, ndr->flags))] uint32 data_length;
2600         } spoolss_PrinterEnumValues;
2601
2602         [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx(
2603                 [in,ref] policy_handle *handle,
2604                 [in]     [string,charset(UTF16)] uint16 key_name[],
2605                 [out] DATA_BLOB info,
2606                 [in] uint32 offered,
2607                 [out,ref] uint32 *needed,
2608                 [out,ref] uint32 *count
2609         );
2610         [public,noopnum,noprint] void __spoolss_EnumPrinterDataEx(
2611                 [in] uint32 count,
2612                 [out] spoolss_PrinterEnumValues info[count]
2613         );
2614         [nopull,nopush] WERROR spoolss_EnumPrinterDataEx(
2615                 [in,ref] policy_handle *handle,
2616                 [in]     [string,charset(UTF16)] uint16 key_name[],
2617                 [in] uint32 offered,
2618                 [out,ref] uint32 *count,
2619                 [out,ref,size_is(,*count)] spoolss_PrinterEnumValues **info,
2620                 [out,ref] uint32 *needed
2621         );
2622
2623         typedef [nodiscriminant] union {
2624                 [case(0)];
2625                 [case(1)];
2626                 [default] nstring_array string_array;
2627         } spoolss_KeyNames;
2628
2629         /******************/
2630         /* Function: 0x50 */
2631         [public] WERROR spoolss_EnumPrinterKey(
2632                 [in, ref] policy_handle *handle,
2633                 [in] [string,charset(UTF16)] uint16 key_name[],
2634                 [out,ref] uint32 *_ndr_size,
2635                 [out,ref,subcontext(0),subcontext_size(*_ndr_size*2),switch_is(*_ndr_size)] spoolss_KeyNames *key_buffer,
2636                 [in] uint32 offered,
2637                 [out,ref] uint32 *needed
2638         );
2639
2640         /******************/
2641         /* Function: 0x51 */
2642         WERROR spoolss_DeletePrinterDataEx(
2643                 [in,ref] policy_handle *handle,
2644                 [in] [string,charset(UTF16)] uint16 key_name[],
2645                 [in] [string,charset(UTF16)] uint16 value_name[]
2646         );
2647
2648         /******************/
2649         /* Function: 0x52 */
2650         WERROR spoolss_DeletePrinterKey(
2651                 [in,ref] policy_handle *handle,
2652                 [in] [string,charset(UTF16)] uint16 key_name[]
2653         );
2654
2655         /******************/
2656         /* Function: 0x53 */
2657         [todo] WERROR spoolss_53(
2658         );
2659
2660         /******************/
2661         /* Function: 0x54 */
2662         typedef [public,bitmap32bit] bitmap {
2663                 DPD_DELETE_UNUSED_FILES         = 0x00000001,
2664                 DPD_DELETE_SPECIFIC_VERSION     = 0x00000002,
2665                 DPD_DELETE_ALL_FILES            = 0x00000004
2666         } spoolss_DeleteDriverFlags;
2667
2668         WERROR spoolss_DeletePrinterDriverEx(
2669                 [in,unique] [string,charset(UTF16)] uint16 *server,
2670                 [in] [string,charset(UTF16)] uint16 architecture[],
2671                 [in] [string,charset(UTF16)] uint16 driver[],
2672                 [in] spoolss_DeleteDriverFlags delete_flags,
2673                 [in] uint32 version
2674         );
2675
2676         /******************/
2677         /* Function: 0x55 */
2678         [todo] WERROR spoolss_55(
2679         );
2680
2681         /******************/
2682         /* Function: 0x56 */
2683         [todo] WERROR spoolss_56(
2684         );
2685
2686         /******************/
2687         /* Function: 0x57 */
2688         [todo] WERROR spoolss_57(
2689         );
2690
2691         /******************/
2692         /* Function: 0x58 */
2693
2694         typedef [v1_enum] enum {
2695                 PROTOCOL_RAWTCP_TYPE    = 1,
2696                 PROTOCOL_LPR_TYPE       = 2
2697         } spoolss_PortProtocol;
2698
2699         typedef [public] struct {
2700                 [charset(UTF16)] uint16 portname[64];
2701                 [value(0x00000001)] uint32 version;
2702                 spoolss_PortProtocol protocol;
2703                 [value(sizeof(r))] uint32 size;
2704                 uint32 reserved;
2705                 [charset(UTF16)] uint16 hostaddress[49];
2706                 [charset(UTF16)] uint16 snmpcommunity[33];
2707                 uint32 dblspool;
2708                 [charset(UTF16)] uint16 queue[33];
2709                 [charset(UTF16)] uint16 ip_address[16]; /* s3 had 17 */
2710                 [charset(UTF16)] uint16 hardware_address[13];
2711                 [charset(UTF16)] uint16 device_type[257];
2712                 uint32 port_number;
2713                 boolean32 snmp_enabled;
2714                 uint32 snmp_dev_index;
2715         } spoolss_PortData1;
2716
2717         typedef [public] struct {
2718                 [charset(UTF16)] uint16 portname[64];
2719                 [value(0x00000002)] uint32 version;
2720                 spoolss_PortProtocol protocol;
2721                 [value(sizeof(r))] uint32 size;
2722                 uint32 reserved;
2723                 [charset(UTF16)] uint16 hostaddress[128];
2724                 [charset(UTF16)] uint16 snmpcommunity[33];
2725                 uint32 dblspool;
2726                 [charset(UTF16)] uint16 queue[33];
2727                 [charset(UTF16)] uint16 device_type[257];
2728                 uint32 port_number;
2729                 boolean32 snmp_enabled;
2730                 uint32 snmp_dev_index;
2731                 uint32 port_monitor_mib_index;
2732         } spoolss_PortData2;
2733
2734         typedef [public] struct {
2735                 nstring dll_name;
2736         } spoolss_MonitorUi;
2737
2738         WERROR spoolss_XcvData(
2739                 [in,ref] policy_handle *handle,
2740                 [in] [string,charset(UTF16)] uint16 function_name[],
2741                 [in] DATA_BLOB in_data,
2742                 [in,value(r->in.in_data.length)] uint32 _in_data_length,
2743                 [out,ref] [size_is(out_data_size)] uint8 *out_data,
2744                 [in] uint32 out_data_size,
2745                 [out,ref] uint32 *needed,
2746                 [in,out,ref] uint32 *status_code
2747         );
2748
2749         /******************/
2750         /* Function: 0x59 */
2751
2752         typedef [bitmap32bit] bitmap {
2753                 APD_STRICT_UPGRADE              = 0x00000001,
2754                 APD_STRICT_DOWNGRADE            = 0x00000002,
2755                 APD_COPY_ALL_FILES              = 0x00000004,
2756                 APD_COPY_NEW_FILES              = 0x00000008,
2757                 APD_COPY_FROM_DIRECTORY         = 0x00000010,
2758                 APD_DONT_COPY_FILES_TO_CLUSTER  = 0x00001000,
2759                 APD_COPY_TO_ALL_SPOOLERS        = 0x00002000,
2760                 APD_RETURN_BLOCKING_STATUS_CODE = 0x00010000
2761         } spoolss_AddPrinterDriverExFlags;
2762
2763         [public] WERROR spoolss_AddPrinterDriverEx(
2764                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2765                 [in,ref] spoolss_AddDriverInfoCtr *info_ctr,
2766                 [in] spoolss_AddPrinterDriverExFlags flags
2767         );
2768
2769         /******************/
2770         /* Function: 0x5a */
2771         [todo] WERROR spoolss_5a(
2772         );
2773
2774         /******************/
2775         /* Function: 0x5b */
2776         [todo] WERROR spoolss_5b(
2777         );
2778
2779         /******************/
2780         /* Function: 0x5c */
2781         [todo] WERROR spoolss_5c(
2782         );
2783
2784         /******************/
2785         /* Function: 0x5d */
2786         [todo] WERROR spoolss_5d(
2787         );
2788
2789         /******************/
2790         /* Function: 0x5e */
2791         [todo] WERROR spoolss_5e(
2792         );
2793
2794         /******************/
2795         /* Function: 0x5f */
2796         [todo] WERROR spoolss_5f(
2797         );
2798
2799         /******************/
2800         /* Function: 0x60 */
2801         [todo] WERROR spoolss_60(
2802         );
2803
2804         /******************/
2805         /* Function: 0x61 */
2806         [todo] WERROR spoolss_61(
2807         );
2808
2809         /******************/
2810         /* Function: 0x62 */
2811         [todo] WERROR spoolss_62(
2812         );
2813
2814         /******************/
2815         /* Function: 0x63 */
2816         [todo] WERROR spoolss_63(
2817         );
2818
2819         /******************/
2820         /* Function: 0x64 */
2821         [todo] WERROR spoolss_64(
2822         );
2823
2824         /******************/
2825         /* Function: 0x65 */
2826         [todo] WERROR spoolss_65(
2827         );
2828
2829         /******************/
2830         /* Function: 0x66 */
2831         typedef struct {
2832                 GUID core_driver_guid;
2833                 NTTIME driver_date;
2834                 hyper driver_version;
2835                 [charset(UTF8)] uint8 formname[520];
2836         } spoolss_CorePrinterDriver;
2837
2838         WERROR spoolss_GetCorePrinterDrivers(
2839                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2840                 [in,ref] [string,charset(UTF16)] uint16 *architecture,
2841                 [in] uint32 core_driver_size,
2842                 [in,size_is(core_driver_size)] [charset(UTF16)] uint16 *core_driver_dependencies,
2843                 [in] uint32 core_printer_driver_count,
2844                 [out,size_is(core_printer_driver_count)] spoolss_CorePrinterDriver *core_printer_drivers
2845         );
2846
2847         /******************/
2848         /* Function: 0x67 */
2849         [todo] WERROR spoolss_67(
2850         );
2851
2852         /******************/
2853         /* Function: 0x68 */
2854         WERROR spoolss_GetPrinterDriverPackagePath(
2855                 [in,unique] [string,charset(UTF16)] uint16 *servername,
2856                 [in,ref] [string,charset(UTF16)] uint16 *architecture,
2857                 [in,unique] [string,charset(UTF16)] uint16 *language,
2858                 [in,ref] [string,charset(UTF16)] uint16 *package_id,
2859                 [in,out,unique,size_is(driver_package_cab_size)] [charset(UTF16)] uint16 *driver_package_cab,
2860                 [in] uint32 driver_package_cab_size,
2861                 [out,ref] uint32 *required
2862                 );
2863
2864         /******************/
2865         /* Function: 0x69 */
2866         [todo] WERROR spoolss_69(
2867         );
2868
2869         /******************/
2870         /* Function: 0x6a */
2871         [todo] WERROR spoolss_6a(
2872         );
2873
2874         /******************/
2875         /* Function: 0x6b */
2876         [todo] WERROR spoolss_6b(
2877         );
2878
2879         /******************/
2880         /* Function: 0x6c */
2881         [todo] WERROR spoolss_6c(
2882         );
2883
2884         /******************/
2885         /* Function: 0x6d */
2886         [todo] WERROR spoolss_6d(
2887         );
2888 }