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