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