84d430534fc603521b05c8768ec0e3aaf8c50c64
[ira/wip.git] / librpc / ndr / ndr_spoolss_buf.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    routines for marshalling/unmarshalling spoolss subcontext buffer structures
5
6    Copyright (C) Andrew Tridgell 2003
7    Copyright (C) Tim Potter 2003
8    Copyright (C) Guenther Deschner 2009
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24
25 #include "includes.h"
26 #include "librpc/gen_ndr/ndr_spoolss.h"
27 #if (_SAMBA_BUILD_ >= 4)
28 #include "param/param.h"
29 #endif
30
31 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
32         if (!r->in.buffer && r->in.offered != 0) {\
33                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
34                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
35                         (unsigned)r->in.offered);\
36         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
37                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
38                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
39                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
40         }\
41         _r.in.level     = r->in.level;\
42         _r.in.buffer    = r->in.buffer;\
43         _r.in.offered   = r->in.offered;\
44         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
45 } while(0)
46
47 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
48         struct ndr_push *_ndr_info;\
49         _r.in.level     = r->in.level;\
50         _r.in.buffer    = r->in.buffer;\
51         _r.in.offered   = r->in.offered;\
52         _r.out.info     = NULL;\
53         _r.out.needed   = r->out.needed;\
54         _r.out.count    = r->out.count;\
55         _r.out.result   = r->out.result;\
56         if (r->out.info && *r->out.info && !r->in.buffer) {\
57                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
58                         "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
59         }\
60         if (r->in.buffer) {\
61                 DATA_BLOB _data_blob_info;\
62                 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
63                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
64                 _ndr_info->flags= ndr->flags;\
65                 if (r->out.info) {\
66                         struct __##fn __r;\
67                         __r.in.level    = r->in.level;\
68                         __r.in.count    = *r->out.count;\
69                         __r.out.info    = *r->out.info;\
70                         NDR_CHECK(ndr_push___##fn(_ndr_info, flags, &__r)); \
71                 }\
72                 if (r->in.offered > _ndr_info->offset) {\
73                         uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
74                         NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
75                 } else if (r->in.offered < _ndr_info->offset) {\
76                         return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
77                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
78                                 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
79                 }\
80                 _data_blob_info = ndr_push_blob(_ndr_info);\
81                 _r.out.info     = &_data_blob_info;\
82         }\
83         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
84 } while(0)
85
86 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
87         struct _##fn _r;\
88         if (flags & NDR_IN) {\
89                 in;\
90                 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
91         }\
92         if (flags & NDR_OUT) {\
93                 out;\
94                 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
95         }\
96 } while(0)
97
98 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
99         ZERO_STRUCT(r->out);\
100         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
101         r->in.level     = _r.in.level;\
102         r->in.buffer    = _r.in.buffer;\
103         r->in.offered   = _r.in.offered;\
104         r->out.needed   = _r.out.needed;\
105         r->out.count    = _r.out.count;\
106         if (!r->in.buffer && r->in.offered != 0) {\
107                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
108                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
109                         (unsigned)r->in.offered);\
110         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
111                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
112                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
113                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
114         }\
115         NDR_PULL_ALLOC(ndr, r->out.info);\
116         ZERO_STRUCTP(r->out.info);\
117 } while(0)
118
119 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
120         _r.in.level     = r->in.level;\
121         _r.in.buffer    = r->in.buffer;\
122         _r.in.offered   = r->in.offered;\
123         _r.out.needed   = r->out.needed;\
124         _r.out.count    = r->out.count;\
125         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
126         if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
127                 NDR_PULL_ALLOC(ndr, r->out.info);\
128         }\
129         *r->out.info = NULL;\
130         r->out.needed   = _r.out.needed;\
131         r->out.count    = _r.out.count;\
132         r->out.result   = _r.out.result;\
133         if (_r.out.info) {\
134                 struct ndr_pull *_ndr_info;\
135                 NDR_PULL_ALLOC(ndr, *r->out.info);\
136                 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
137                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
138                 _ndr_info->flags= ndr->flags;\
139                 if (r->in.offered != _ndr_info->data_size) {\
140                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
141                                 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
142                                 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
143                 }\
144                 if (*r->out.needed <= _ndr_info->data_size) {\
145                         struct __##fn __r;\
146                         __r.in.level    = r->in.level;\
147                         __r.in.count    = *r->out.count;\
148                         __r.out.info    = NULL;\
149                         NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
150                         *r->out.info    = __r.out.info;\
151                 }\
152         }\
153 } while(0)
154
155 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
156         struct _##fn _r;\
157         if (flags & NDR_IN) {\
158                 out;\
159                 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
160                 in;\
161         }\
162         if (flags & NDR_OUT) {\
163                 out;\
164                 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
165         }\
166 } while(0)
167
168 #define _NDR_CHECK_UINT32(call) do {\
169         enum ndr_err_code _ndr_err; \
170         _ndr_err = call; \
171         if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
172                 return 0; \
173         }\
174 } while (0)
175
176 /* TODO: set _ndr_info->flags correct */
177 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
178         struct __##fn __r;\
179         DATA_BLOB _data_blob_info;\
180         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
181         if (!_ndr_info) return 0;\
182         _ndr_info->flags|=0;\
183         __r.in.level    = level;\
184         __r.in.count    = count;\
185         __r.out.info    = info;\
186         _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
187         _data_blob_info = ndr_push_blob(_ndr_info);\
188         return _data_blob_info.length;\
189 } while(0)
190
191 /* TODO: set _ndr_info->flags correct */
192 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
193         struct __##fn __r;\
194         DATA_BLOB _data_blob_info;\
195         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
196         if (!_ndr_info) return 0;\
197         _ndr_info->flags|=0;\
198         __r.in.count    = count;\
199         __r.out.info    = info;\
200         _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
201         _data_blob_info = ndr_push_blob(_ndr_info);\
202         return _data_blob_info.length;\
203 } while(0)
204
205
206 /*
207   spoolss_EnumPrinters
208 */
209 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
210 {
211         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
212                 _r.in.flags     = r->in.flags;
213                 _r.in.server    = r->in.server;
214         },{
215                 _r.in.flags     = r->in.flags;
216                 _r.in.server    = r->in.server;
217         });
218         return NDR_ERR_SUCCESS;
219 }
220
221 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
222 {
223         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
224                 r->in.flags     = _r.in.flags;
225                 r->in.server    = _r.in.server;
226         },{
227                 _r.in.flags     = r->in.flags;
228                 _r.in.server    = r->in.server;
229         });
230         return NDR_ERR_SUCCESS;
231 }
232
233 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
234 {
235         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
236 }
237
238 /*
239   spoolss_EnumJobs
240 */
241 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
242 {
243         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
244                 _r.in.handle    = r->in.handle;
245                 _r.in.firstjob  = r->in.firstjob;
246                 _r.in.numjobs   = r->in.numjobs;
247         },{
248                 _r.in.handle    = r->in.handle;
249                 _r.in.firstjob  = r->in.firstjob;
250                 _r.in.numjobs   = r->in.numjobs;
251         });
252         return NDR_ERR_SUCCESS;
253 }
254
255 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
256 {
257         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
258                 r->in.handle    = _r.in.handle;
259                 r->in.firstjob  = _r.in.firstjob;
260                 r->in.numjobs   = _r.in.numjobs;
261         },{
262                 _r.in.handle    = r->in.handle;
263                 _r.in.firstjob  = r->in.firstjob;
264                 _r.in.numjobs   = r->in.numjobs;
265         });
266         return NDR_ERR_SUCCESS;
267 }
268
269 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
270 {
271         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
272 }
273
274 /*
275   spoolss_EnumPrinterDrivers
276 */
277 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
278 {
279         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
280                 _r.in.server            = r->in.server;
281                 _r.in.environment       = r->in.environment;
282         },{
283                 _r.in.server            = r->in.server;
284                 _r.in.environment       = r->in.environment;
285         });
286         return NDR_ERR_SUCCESS;
287 }
288
289 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
290 {
291         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
292                 r->in.server            = _r.in.server;
293                 r->in.environment       = _r.in.environment;
294         },{
295                 _r.in.server            = r->in.server;
296                 _r.in.environment       = r->in.environment;
297         });
298         return NDR_ERR_SUCCESS;
299 }
300
301 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
302 {
303         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
304 }
305
306 /*
307   spoolss_EnumForms
308 */
309 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
310 {
311         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
312                 _r.in.handle    = r->in.handle;
313         },{
314                 _r.in.handle    = r->in.handle;
315         });
316         return NDR_ERR_SUCCESS;
317 }
318
319 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
320 {
321         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
322                 r->in.handle    = _r.in.handle;
323         },{
324                 _r.in.handle    = r->in.handle;
325         });
326         return NDR_ERR_SUCCESS;
327 }
328
329 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
330 {
331         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
332 }
333
334 /*
335   spoolss_EnumPorts
336 */
337 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
338 {
339         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
340                 _r.in.servername= r->in.servername;
341         },{
342                 _r.in.servername= r->in.servername;
343         });
344         return NDR_ERR_SUCCESS;
345 }
346
347 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
348 {
349         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
350                 r->in.servername= _r.in.servername;
351         },{
352                 _r.in.servername= r->in.servername;
353         });
354         return NDR_ERR_SUCCESS;
355 }
356
357 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
358 {
359         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
360 }
361
362 /*
363   spoolss_EnumMonitors
364 */
365 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
366 {
367         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
368                 _r.in.servername= r->in.servername;
369         },{
370                 _r.in.servername= r->in.servername;
371         });
372         return NDR_ERR_SUCCESS;
373 }
374
375 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
376 {
377         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
378                 r->in.servername= _r.in.servername;
379         },{
380                 _r.in.servername= r->in.servername;
381         });
382         return NDR_ERR_SUCCESS;
383 }
384
385 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
386 {
387         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
388 }
389
390 /*
391   spoolss_EnumPrintProcessors
392 */
393 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
394 {
395         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
396                 _r.in.servername        = r->in.servername;
397                 _r.in.environment       = r->in.environment;
398         },{
399                 _r.in.servername        = r->in.servername;
400                 _r.in.environment       = r->in.environment;
401         });
402         return NDR_ERR_SUCCESS;
403 }
404
405 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
406 {
407         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
408                 r->in.servername        = _r.in.servername;
409                 r->in.environment       = _r.in.environment;
410         },{
411                 _r.in.servername        = r->in.servername;
412                 _r.in.environment       = r->in.environment;
413         });
414         return NDR_ERR_SUCCESS;
415 }
416
417 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
418                                                    uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
419 {
420         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
421 }
422
423 /*
424   spoolss_EnumPrintProcessors
425 */
426 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
427 {
428         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes,{
429                 _r.in.servername                = r->in.servername;
430                 _r.in.print_processor_name      = r->in.print_processor_name;
431         },{
432                 _r.in.servername                = r->in.servername;
433                 _r.in.print_processor_name      = r->in.print_processor_name;
434         });
435         return NDR_ERR_SUCCESS;
436 }
437
438 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
439 {
440         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes,{
441                 r->in.servername                = _r.in.servername;
442                 r->in.print_processor_name      = _r.in.print_processor_name;
443         },{
444                 _r.in.servername                = r->in.servername;
445                 _r.in.print_processor_name      = r->in.print_processor_name;
446         });
447         return NDR_ERR_SUCCESS;
448 }
449
450 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
451                                                       uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
452 {
453         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
454 }
455
456 /*
457   spoolss_EnumPrinterDataEx
458 */
459
460 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
461 {
462         struct _spoolss_EnumPrinterDataEx _r;
463         if (flags & NDR_IN) {
464                 _r.in.handle    = r->in.handle;
465                 _r.in.key_name  = r->in.key_name;
466                 _r.in.offered   = r->in.offered;
467                 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
468         }
469         if (flags & NDR_OUT) {
470                 struct ndr_push *_ndr_info;
471                 _r.in.handle    = r->in.handle;
472                 _r.in.key_name  = r->in.key_name;
473                 _r.in.offered   = r->in.offered;
474                 _r.out.count    = r->out.count;
475                 _r.out.needed   = r->out.needed;
476                 _r.out.result   = r->out.result;
477                 _r.out.info     = data_blob(NULL, 0);
478                 if (r->in.offered >= *r->out.needed) {
479                         struct __spoolss_EnumPrinterDataEx __r;
480                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
481                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
482                         _ndr_info->flags= ndr->flags;
483                         __r.in.count    = *r->out.count;
484                         __r.out.info    = *r->out.info;
485                         NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
486                         if (r->in.offered > _ndr_info->offset) {
487                                 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
488                                 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
489                         }
490                         _r.out.info = ndr_push_blob(_ndr_info);
491                 }
492                 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
493         }
494         return NDR_ERR_SUCCESS;
495 }
496
497 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
498 {
499         struct _spoolss_EnumPrinterDataEx _r;
500         if (flags & NDR_IN) {
501                 _r.in.handle    = r->in.handle;
502                 _r.in.key_name  = r->in.key_name;
503                 ZERO_STRUCT(r->out);
504                 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
505                 r->in.handle    = _r.in.handle;
506                 r->in.key_name  = _r.in.key_name;
507                 r->in.offered   = _r.in.offered;
508                 r->out.needed   = _r.out.needed;
509                 r->out.count    = _r.out.count;
510                 NDR_PULL_ALLOC(ndr, r->out.info);
511                 ZERO_STRUCTP(r->out.info);
512         }
513         if (flags & NDR_OUT) {
514                 _r.in.handle    = r->in.handle;
515                 _r.in.key_name  = r->in.key_name;
516                 _r.in.offered   = r->in.offered;
517                 _r.out.count    = r->out.count;
518                 _r.out.needed   = r->out.needed;
519                 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
520                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
521                         NDR_PULL_ALLOC(ndr, r->out.info);
522                 }
523                 *r->out.info    = NULL;
524                 r->out.needed   = _r.out.needed;
525                 r->out.count    = _r.out.count;
526                 r->out.result   = _r.out.result;
527                 if (_r.out.info.length) {
528                         struct ndr_pull *_ndr_info;
529                         NDR_PULL_ALLOC(ndr, *r->out.info);
530                         _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
531                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
532                         _ndr_info->flags= ndr->flags;
533                         if (r->in.offered != _ndr_info->data_size) {
534                                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
535                                         "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
536                                         (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
537                         }
538                         if (*r->out.needed <= _ndr_info->data_size) {
539                                 struct __spoolss_EnumPrinterDataEx __r;
540                                 __r.in.count    = *r->out.count;
541                                 __r.out.info    = NULL;
542                                 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
543                                 *r->out.info    = __r.out.info;
544                         }
545                 }
546         }
547         return NDR_ERR_SUCCESS;
548 }
549
550 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
551                                                  uint32_t count, struct spoolss_PrinterEnumValues *info)
552 {
553         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
554 }
555
556 /*
557   spoolss_GetPrinterData
558 */
559 enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
560 {
561         struct _spoolss_GetPrinterData _r;
562         if (flags & NDR_IN) {
563                 _r.in.handle    = r->in.handle;
564                 _r.in.value_name= r->in.value_name;
565                 _r.in.offered   = r->in.offered;
566                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
567         }
568         if (flags & NDR_OUT) {
569                 struct ndr_push *_ndr_info;
570                 DATA_BLOB blob = data_blob(NULL, 0);
571                 _r.in.handle    = r->in.handle;
572                 _r.in.value_name= r->in.value_name;
573                 _r.in.offered   = r->in.offered;
574                 _r.out.type     = r->out.type;
575                 _r.out.data     = &blob;
576                 _r.out.needed   = r->out.needed;
577                 _r.out.result   = r->out.result;
578                 {
579                         struct __spoolss_GetPrinterData __r;
580                         DATA_BLOB _blob;
581                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
582                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
583                         _ndr_info->flags= ndr->flags;
584                         __r.in.type     = *r->out.type;
585                         __r.out.data    = r->out.data;
586                         NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r));
587                         if (r->in.offered > _ndr_info->offset) {
588                                 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
589                                 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
590                         }
591                         _blob = ndr_push_blob(_ndr_info);
592                         _r.out.data = &_blob;
593                 }
594                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
595         }
596         return NDR_ERR_SUCCESS;
597 }
598
599 enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
600 {
601         struct _spoolss_GetPrinterData _r;
602         if (flags & NDR_IN) {
603                 DATA_BLOB blob = data_blob(NULL,0);
604                 ZERO_STRUCT(r->out);
605
606                 _r.in.handle    = r->in.handle;
607                 _r.in.value_name= r->in.value_name;
608                 _r.in.offered   = r->in.offered;
609                 _r.out.type     = r->out.type;
610                 _r.out.data     = &blob;
611                 _r.out.needed   = r->out.needed;
612                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
613                 r->in.handle    = _r.in.handle;
614                 r->in.value_name= _r.in.value_name;
615                 r->in.offered   = _r.in.offered;
616                 r->out.needed   = _r.out.needed;
617         }
618         if (flags & NDR_OUT) {
619                 DATA_BLOB blob = data_blob_talloc(ndr,NULL,0);
620                 _r.in.handle    = r->in.handle;
621                 _r.in.value_name= r->in.value_name;
622                 _r.in.offered   = r->in.offered;
623                 _r.out.type     = r->out.type;
624                 _r.out.data     = &blob;
625                 _r.out.needed   = r->out.needed;
626                 _r.out.result   = r->out.result;
627                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
628                 r->out.type     = _r.out.type;
629                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
630                         NDR_PULL_ALLOC(ndr, r->out.data);
631                 }
632                 ZERO_STRUCTP(r->out.data);
633                 r->out.needed   = _r.out.needed;
634                 r->out.result   = _r.out.result;
635                 if (_r.out.data && _r.out.data->length != r->in.offered) {
636                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
637                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
638                                 (unsigned)r->in.offered, (unsigned)_r.out.data->length);
639                 }
640                 if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) {
641                         struct __spoolss_GetPrinterData __r;
642                         struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience);
643                         NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
644                         _ndr_data->flags= ndr->flags;
645                         __r.in.type     = *r->out.type;
646                         __r.out.data    = r->out.data;
647                         NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
648                         r->out.data     = __r.out.data;
649                 } else {
650                         *r->out.type    = REG_NONE;
651                 }
652         }
653         return NDR_ERR_SUCCESS;
654 }
655
656 /*
657   spoolss_SetPrinterData
658 */
659 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
660 {
661         struct _spoolss_SetPrinterData _r;
662         if (flags & NDR_IN) {
663                 struct ndr_push *_ndr_data;
664                 struct __spoolss_SetPrinterData __r;
665                 DATA_BLOB _data_blob_data;
666
667                 _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
668                 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
669                 _ndr_data->flags= ndr->flags;
670
671                 __r.in.type     = r->in.type;
672                 __r.out.data    = discard_const_p(union spoolss_PrinterData, &r->in.data);
673                 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
674                 _data_blob_data = ndr_push_blob(_ndr_data);
675
676                 _r.in.handle    = r->in.handle;
677                 _r.in.value_name= r->in.value_name;
678                 _r.in.type      = r->in.type;
679                 _r.in.data      = _data_blob_data;
680                 _r.in._offered  = _data_blob_data.length;
681                 _r.out.result   = r->out.result;
682                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
683         }
684         if (flags & NDR_OUT) {
685                 _r.in.handle    = r->in.handle;
686                 _r.in.value_name= r->in.value_name;
687                 _r.in.type      = r->in.type;
688                 _r.in.data      = data_blob(NULL,0),
689                 _r.in._offered  = r->in._offered;
690                 _r.out.result   = r->out.result;
691                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
692         }
693         return NDR_ERR_SUCCESS;
694 }
695
696 /*
697   spoolss_GetPrinterDataEx
698 */
699 enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r)
700 {
701         struct _spoolss_GetPrinterDataEx _r;
702         if (flags & NDR_IN) {
703                 _r.in.handle    = r->in.handle;
704                 _r.in.key_name  = r->in.key_name;
705                 _r.in.value_name= r->in.value_name;
706                 _r.in.offered   = r->in.offered;
707                 NDR_CHECK(ndr_push__spoolss_GetPrinterDataEx(ndr, flags, &_r));
708         }
709         if (flags & NDR_OUT) {
710                 struct ndr_push *_ndr_info;
711                 DATA_BLOB blob = data_blob(NULL, 0);
712                 _r.in.handle    = r->in.handle;
713                 _r.in.key_name  = r->in.key_name;
714                 _r.in.value_name= r->in.value_name;
715                 _r.in.offered   = r->in.offered;
716                 _r.out.type     = r->out.type;
717                 _r.out.data     = &blob;
718                 _r.out.needed   = r->out.needed;
719                 _r.out.result   = r->out.result;
720                 {
721                         struct __spoolss_GetPrinterDataEx __r;
722                         DATA_BLOB _blob;
723                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
724                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
725                         _ndr_info->flags= ndr->flags;
726                         __r.in.type     = *r->out.type;
727                         __r.out.data    = r->out.data;
728                         NDR_CHECK(ndr_push___spoolss_GetPrinterDataEx(_ndr_info, flags, &__r));
729                         if (r->in.offered > _ndr_info->offset) {
730                                 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
731                                 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
732                         }
733                         _blob = ndr_push_blob(_ndr_info);
734                         _r.out.data = &_blob;
735                 }
736                 NDR_CHECK(ndr_push__spoolss_GetPrinterDataEx(ndr, flags, &_r));
737         }
738         return NDR_ERR_SUCCESS;
739 }
740
741 enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r)
742 {
743         struct _spoolss_GetPrinterDataEx _r;
744         if (flags & NDR_IN) {
745                 DATA_BLOB blob = data_blob(NULL,0);
746                 ZERO_STRUCT(r->out);
747
748                 _r.in.handle    = r->in.handle;
749                 _r.in.key_name  = r->in.key_name;
750                 _r.in.value_name= r->in.value_name;
751                 _r.in.offered   = r->in.offered;
752                 _r.out.type     = r->out.type;
753                 _r.out.data     = &blob;
754                 _r.out.needed   = r->out.needed;
755                 NDR_CHECK(ndr_pull__spoolss_GetPrinterDataEx(ndr, flags, &_r));
756                 r->in.handle    = _r.in.handle;
757                 r->in.key_name  = _r.in.key_name;
758                 r->in.value_name= _r.in.value_name;
759                 r->in.offered   = _r.in.offered;
760                 r->out.needed   = _r.out.needed;
761         }
762         if (flags & NDR_OUT) {
763                 DATA_BLOB blob = data_blob_talloc(ndr,NULL,0);
764                 _r.in.handle    = r->in.handle;
765                 _r.in.key_name  = r->in.key_name;
766                 _r.in.value_name= r->in.value_name;
767                 _r.in.offered   = r->in.offered;
768                 _r.out.type     = r->out.type;
769                 _r.out.data     = &blob;
770                 _r.out.needed   = r->out.needed;
771                 _r.out.result   = r->out.result;
772                 NDR_CHECK(ndr_pull__spoolss_GetPrinterDataEx(ndr, flags, &_r));
773                 r->out.type     = _r.out.type;
774                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
775                         NDR_PULL_ALLOC(ndr, r->out.data);
776                 }
777                 ZERO_STRUCTP(r->out.data);
778                 r->out.needed   = _r.out.needed;
779                 r->out.result   = _r.out.result;
780                 if (_r.out.data && _r.out.data->length != r->in.offered) {
781                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
782                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
783                                 (unsigned)r->in.offered, (unsigned)_r.out.data->length);
784                 }
785                 if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) {
786                         struct __spoolss_GetPrinterDataEx __r;
787                         struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience);
788                         NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
789                         _ndr_data->flags= ndr->flags;
790                         __r.in.type     = *r->out.type;
791                         __r.out.data    = r->out.data;
792                         NDR_CHECK(ndr_pull___spoolss_GetPrinterDataEx(_ndr_data, flags, &__r));
793                         r->out.data     = __r.out.data;
794                 } else {
795                         *r->out.type    = REG_NONE;
796                 }
797         }
798         return NDR_ERR_SUCCESS;
799 }
800
801 /*
802   spoolss_SetPrinterDataEx
803 */
804 enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r)
805 {
806         struct _spoolss_SetPrinterDataEx _r;
807         if (flags & NDR_IN) {
808                 struct ndr_push *_ndr_data;
809                 struct __spoolss_SetPrinterDataEx __r;
810                 DATA_BLOB _data_blob_data;
811
812                 _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
813                 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
814                 _ndr_data->flags= ndr->flags;
815
816                 __r.in.type     = r->in.type;
817                 __r.out.data    = discard_const_p(union spoolss_PrinterData, &r->in.data);
818                 NDR_CHECK(ndr_push___spoolss_SetPrinterDataEx(_ndr_data, NDR_OUT, &__r));
819                 _data_blob_data = ndr_push_blob(_ndr_data);
820
821                 _r.in.handle    = r->in.handle;
822                 _r.in.key_name  = r->in.key_name;
823                 _r.in.value_name= r->in.value_name;
824                 _r.in.type      = r->in.type;
825                 _r.in.data      = _data_blob_data;
826                 _r.in._offered  = _data_blob_data.length;
827                 _r.out.result   = r->out.result;
828                 NDR_CHECK(ndr_push__spoolss_SetPrinterDataEx(ndr, flags, &_r));
829         }
830         if (flags & NDR_OUT) {
831                 _r.in.handle    = r->in.handle;
832                 _r.in.key_name  = r->in.key_name;
833                 _r.in.value_name= r->in.value_name;
834                 _r.in.type      = r->in.type;
835                 _r.in.data      = data_blob(NULL,0),
836                 _r.in._offered  = r->in._offered;
837                 _r.out.result   = r->out.result;
838                 NDR_CHECK(ndr_push__spoolss_SetPrinterDataEx(ndr, flags, &_r));
839         }
840         return NDR_ERR_SUCCESS;
841 }
842
843 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
844 {
845         if (!devmode) return 0;
846         return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
847 }
848
849 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
850 {
851         if (!r) {
852                 return 4;
853         }
854
855         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
856 }
857
858 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_StringArray2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_StringArray2 *r)
859 {
860         if (ndr_flags & NDR_SCALARS) {
861                 uint32_t _ndr_size;
862                 _ndr_size = ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags);
863                 NDR_CHECK(ndr_push_align(ndr, 4));
864                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size));
865                 if (_ndr_size > 0) {
866                         uint32_t _flags_save_string_array = ndr->flags;
867                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
868                         {
869                                 struct ndr_push *_ndr_string;
870                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_string, 0, _ndr_size * 2));
871                                 NDR_CHECK(ndr_push_string_array(_ndr_string, NDR_SCALARS, r->string));
872                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_string, 0, _ndr_size * 2));
873                         }
874                         ndr->flags = _flags_save_string_array;
875                 }
876                 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
877         }
878         if (ndr_flags & NDR_BUFFERS) {
879         }
880         return NDR_ERR_SUCCESS;
881 }
882
883 _PUBLIC_ size_t ndr_size_spoolss_StringArray2(const struct spoolss_StringArray2 *r, struct smb_iconv_convenience *ic, int flags)
884 {
885         uint32_t i;
886
887         if (!r || !r->string) {
888                 return 0;
889         }
890
891         for (i=0; r->string[i]; i++) {
892                 ;;
893         }
894
895         return (ndr_size_string_array(r->string, i, LIBNDR_FLAG_STR_NULLTERM) + 1);
896 }
897
898 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_StringArray2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_StringArray2 *r)
899 {
900         if (ndr_flags & NDR_SCALARS) {
901                 NDR_CHECK(ndr_pull_align(ndr, 4));
902                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
903                 if (r->_ndr_size) {
904                         uint32_t _flags_save_string_array = ndr->flags;
905                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
906                         {
907                                 struct ndr_pull *_ndr_string;
908                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_string, 0, r->_ndr_size * 2));
909                                 NDR_CHECK(ndr_pull_string_array(_ndr_string, NDR_SCALARS, &r->string));
910                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_string, 0, r->_ndr_size * 2));
911                         }
912                         ndr->flags = _flags_save_string_array;
913                 } else {
914                         r->string = NULL;
915                 }
916                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
917         }
918         if (ndr_flags & NDR_BUFFERS) {
919         }
920         return NDR_ERR_SUCCESS;
921 }
922
923 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
924  * structs */
925
926 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
927 {
928         uint32_t cntr_file_info_1;
929         if (ndr_flags & NDR_SCALARS) {
930                 NDR_CHECK(ndr_push_align(ndr, 8));
931                 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
932                 {
933                         uint32_t _flags_save_string = ndr->flags;
934                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
935                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
936                         ndr->flags = _flags_save_string;
937                 }
938                 {
939                         uint32_t _flags_save_string = ndr->flags;
940                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
941                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
942                         ndr->flags = _flags_save_string;
943                 }
944                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
945                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
946                 {
947                         uint32_t _flags_save_string = ndr->flags;
948                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
949                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
950                         ndr->flags = _flags_save_string;
951                 }
952                 {
953                         uint32_t _flags_save_string = ndr->flags;
954                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
955                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
956                         ndr->flags = _flags_save_string;
957                 }
958                 {
959                         uint32_t _flags_save_string_array = ndr->flags;
960                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
961                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
962                         ndr->flags = _flags_save_string_array;
963                 }
964                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
965                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
966                 {
967                         uint32_t _flags_save_string = ndr->flags;
968                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
969                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
970                         ndr->flags = _flags_save_string;
971                 }
972                 {
973                         uint32_t _flags_save_string = ndr->flags;
974                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
975                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
976                         ndr->flags = _flags_save_string;
977                 }
978                 {
979                         uint32_t _flags_save_string = ndr->flags;
980                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
981                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
982                         ndr->flags = _flags_save_string;
983                 }
984                 {
985                         uint32_t _flags_save_string = ndr->flags;
986                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
987                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
988                         ndr->flags = _flags_save_string;
989                 }
990         }
991         if (ndr_flags & NDR_BUFFERS) {
992                 {
993                         uint32_t _flags_save_string = ndr->flags;
994                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
995                         if (r->driver_name) {
996                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->driver_name));
997                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
998                         }
999                         ndr->flags = _flags_save_string;
1000                 }
1001                 {
1002                         uint32_t _flags_save_string = ndr->flags;
1003                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1004                         if (r->architecture) {
1005                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->architecture));
1006                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
1007                         }
1008                         ndr->flags = _flags_save_string;
1009                 }
1010                 if (r->file_info) {
1011                         NDR_CHECK(ndr_push_relative_ptr2(ndr, r->file_info));
1012 #if 0
1013                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
1014 #endif
1015                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1016                                 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
1017                         }
1018                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1019                                 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
1020                         }
1021                 }
1022                 {
1023                         uint32_t _flags_save_string = ndr->flags;
1024                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1025                         if (r->monitor_name) {
1026                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->monitor_name));
1027                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
1028                         }
1029                         ndr->flags = _flags_save_string;
1030                 }
1031                 {
1032                         uint32_t _flags_save_string = ndr->flags;
1033                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1034                         if (r->default_datatype) {
1035                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->default_datatype));
1036                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
1037                         }
1038                         ndr->flags = _flags_save_string;
1039                 }
1040                 {
1041                         uint32_t _flags_save_string_array = ndr->flags;
1042                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1043                         if (r->previous_names) {
1044                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->previous_names));
1045                                 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
1046                         }
1047                         ndr->flags = _flags_save_string_array;
1048                 }
1049                 {
1050                         uint32_t _flags_save_string = ndr->flags;
1051                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1052                         if (r->manufacturer_name) {
1053                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_name));
1054                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
1055                         }
1056                         ndr->flags = _flags_save_string;
1057                 }
1058                 {
1059                         uint32_t _flags_save_string = ndr->flags;
1060                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1061                         if (r->manufacturer_url) {
1062                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_url));
1063                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
1064                         }
1065                         ndr->flags = _flags_save_string;
1066                 }
1067                 {
1068                         uint32_t _flags_save_string = ndr->flags;
1069                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1070                         if (r->hardware_id) {
1071                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->hardware_id));
1072                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
1073                         }
1074                         ndr->flags = _flags_save_string;
1075                 }
1076                 {
1077                         uint32_t _flags_save_string = ndr->flags;
1078                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1079                         if (r->provider) {
1080                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->provider));
1081                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
1082                         }
1083                         ndr->flags = _flags_save_string;
1084                 }
1085         }
1086         return NDR_ERR_SUCCESS;
1087 }
1088
1089 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
1090 {
1091         uint32_t _ptr_driver_name;
1092         TALLOC_CTX *_mem_save_driver_name_0;
1093         uint32_t _ptr_architecture;
1094         TALLOC_CTX *_mem_save_architecture_0;
1095         uint32_t _ptr_file_info;
1096         uint32_t cntr_file_info_1;
1097         TALLOC_CTX *_mem_save_file_info_0;
1098         TALLOC_CTX *_mem_save_file_info_1;
1099         uint32_t _ptr_monitor_name;
1100         TALLOC_CTX *_mem_save_monitor_name_0;
1101         uint32_t _ptr_default_datatype;
1102         TALLOC_CTX *_mem_save_default_datatype_0;
1103         uint32_t _ptr_previous_names;
1104         TALLOC_CTX *_mem_save_previous_names_0;
1105         uint32_t _ptr_manufacturer_name;
1106         TALLOC_CTX *_mem_save_manufacturer_name_0;
1107         uint32_t _ptr_manufacturer_url;
1108         TALLOC_CTX *_mem_save_manufacturer_url_0;
1109         uint32_t _ptr_hardware_id;
1110         TALLOC_CTX *_mem_save_hardware_id_0;
1111         uint32_t _ptr_provider;
1112         TALLOC_CTX *_mem_save_provider_0;
1113         if (ndr_flags & NDR_SCALARS) {
1114                 NDR_CHECK(ndr_pull_align(ndr, 8));
1115                 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
1116                 {
1117                         uint32_t _flags_save_string = ndr->flags;
1118                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1119                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
1120                         if (_ptr_driver_name) {
1121                                 NDR_PULL_ALLOC(ndr, r->driver_name);
1122                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
1123                         } else {
1124                                 r->driver_name = NULL;
1125                         }
1126                         ndr->flags = _flags_save_string;
1127                 }
1128                 {
1129                         uint32_t _flags_save_string = ndr->flags;
1130                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1131                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
1132                         if (_ptr_architecture) {
1133                                 NDR_PULL_ALLOC(ndr, r->architecture);
1134                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
1135                         } else {
1136                                 r->architecture = NULL;
1137                         }
1138                         ndr->flags = _flags_save_string;
1139                 }
1140                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
1141                 if (_ptr_file_info) {
1142                         NDR_PULL_ALLOC(ndr, r->file_info);
1143                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
1144                 } else {
1145                         r->file_info = NULL;
1146                 }
1147                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
1148                 {
1149                         uint32_t _flags_save_string = ndr->flags;
1150                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1151                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
1152                         if (_ptr_monitor_name) {
1153                                 NDR_PULL_ALLOC(ndr, r->monitor_name);
1154                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
1155                         } else {
1156                                 r->monitor_name = NULL;
1157                         }
1158                         ndr->flags = _flags_save_string;
1159                 }
1160                 {
1161                         uint32_t _flags_save_string = ndr->flags;
1162                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1163                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
1164                         if (_ptr_default_datatype) {
1165                                 NDR_PULL_ALLOC(ndr, r->default_datatype);
1166                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
1167                         } else {
1168                                 r->default_datatype = NULL;
1169                         }
1170                         ndr->flags = _flags_save_string;
1171                 }
1172                 {
1173                         uint32_t _flags_save_string_array = ndr->flags;
1174                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1175                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
1176                         if (_ptr_previous_names) {
1177                                 NDR_PULL_ALLOC(ndr, r->previous_names);
1178                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
1179                         } else {
1180                                 r->previous_names = NULL;
1181                         }
1182                         ndr->flags = _flags_save_string_array;
1183                 }
1184                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
1185                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
1186                 {
1187                         uint32_t _flags_save_string = ndr->flags;
1188                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1189                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
1190                         if (_ptr_manufacturer_name) {
1191                                 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
1192                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
1193                         } else {
1194                                 r->manufacturer_name = NULL;
1195                         }
1196                         ndr->flags = _flags_save_string;
1197                 }
1198                 {
1199                         uint32_t _flags_save_string = ndr->flags;
1200                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1201                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
1202                         if (_ptr_manufacturer_url) {
1203                                 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
1204                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
1205                         } else {
1206                                 r->manufacturer_url = NULL;
1207                         }
1208                         ndr->flags = _flags_save_string;
1209                 }
1210                 {
1211                         uint32_t _flags_save_string = ndr->flags;
1212                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1213                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
1214                         if (_ptr_hardware_id) {
1215                                 NDR_PULL_ALLOC(ndr, r->hardware_id);
1216                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
1217                         } else {
1218                                 r->hardware_id = NULL;
1219                         }
1220                         ndr->flags = _flags_save_string;
1221                 }
1222                 {
1223                         uint32_t _flags_save_string = ndr->flags;
1224                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1225                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
1226                         if (_ptr_provider) {
1227                                 NDR_PULL_ALLOC(ndr, r->provider);
1228                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
1229                         } else {
1230                                 r->provider = NULL;
1231                         }
1232                         ndr->flags = _flags_save_string;
1233                 }
1234         }
1235         if (ndr_flags & NDR_BUFFERS) {
1236                 {
1237                         uint32_t _flags_save_string = ndr->flags;
1238                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1239                         if (r->driver_name) {
1240                                 uint32_t _relative_save_offset;
1241                                 _relative_save_offset = ndr->offset;
1242                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
1243                                 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1244                                 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
1245                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
1246                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
1247                                 ndr->offset = _relative_save_offset;
1248                         }
1249                         ndr->flags = _flags_save_string;
1250                 }
1251                 {
1252                         uint32_t _flags_save_string = ndr->flags;
1253                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1254                         if (r->architecture) {
1255                                 uint32_t _relative_save_offset;
1256                                 _relative_save_offset = ndr->offset;
1257                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
1258                                 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
1259                                 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
1260                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
1261                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
1262                                 ndr->offset = _relative_save_offset;
1263                         }
1264                         ndr->flags = _flags_save_string;
1265                 }
1266                 if (r->file_info) {
1267                         uint32_t _relative_save_offset;
1268                         _relative_save_offset = ndr->offset;
1269                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
1270                         _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
1271                         NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1272 #if 0
1273                         NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
1274 #else
1275                         NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
1276 #endif
1277                         NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
1278                         _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
1279                         NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1280                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1281                                 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
1282                         }
1283                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1284                                 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
1285                         }
1286                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
1287                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
1288                         ndr->offset = _relative_save_offset;
1289                 }
1290                 {
1291                         uint32_t _flags_save_string = ndr->flags;
1292                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1293                         if (r->monitor_name) {
1294                                 uint32_t _relative_save_offset;
1295                                 _relative_save_offset = ndr->offset;
1296                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
1297                                 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1298                                 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
1299                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
1300                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
1301                                 ndr->offset = _relative_save_offset;
1302                         }
1303                         ndr->flags = _flags_save_string;
1304                 }
1305                 {
1306                         uint32_t _flags_save_string = ndr->flags;
1307                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1308                         if (r->default_datatype) {
1309                                 uint32_t _relative_save_offset;
1310                                 _relative_save_offset = ndr->offset;
1311                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
1312                                 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
1313                                 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
1314                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
1315                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
1316                                 ndr->offset = _relative_save_offset;
1317                         }
1318                         ndr->flags = _flags_save_string;
1319                 }
1320                 {
1321                         uint32_t _flags_save_string_array = ndr->flags;
1322                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1323                         if (r->previous_names) {
1324                                 uint32_t _relative_save_offset;
1325                                 _relative_save_offset = ndr->offset;
1326                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1327                                 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1328                                 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1329                                 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1330                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1331                                 ndr->offset = _relative_save_offset;
1332                         }
1333                         ndr->flags = _flags_save_string_array;
1334                 }
1335                 {
1336                         uint32_t _flags_save_string = ndr->flags;
1337                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1338                         if (r->manufacturer_name) {
1339                                 uint32_t _relative_save_offset;
1340                                 _relative_save_offset = ndr->offset;
1341                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1342                                 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1343                                 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1344                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1345                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1346                                 ndr->offset = _relative_save_offset;
1347                         }
1348                         ndr->flags = _flags_save_string;
1349                 }
1350                 {
1351                         uint32_t _flags_save_string = ndr->flags;
1352                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1353                         if (r->manufacturer_url) {
1354                                 uint32_t _relative_save_offset;
1355                                 _relative_save_offset = ndr->offset;
1356                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1357                                 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1358                                 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1359                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1360                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1361                                 ndr->offset = _relative_save_offset;
1362                         }
1363                         ndr->flags = _flags_save_string;
1364                 }
1365                 {
1366                         uint32_t _flags_save_string = ndr->flags;
1367                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1368                         if (r->hardware_id) {
1369                                 uint32_t _relative_save_offset;
1370                                 _relative_save_offset = ndr->offset;
1371                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1372                                 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1373                                 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1374                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1375                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1376                                 ndr->offset = _relative_save_offset;
1377                         }
1378                         ndr->flags = _flags_save_string;
1379                 }
1380                 {
1381                         uint32_t _flags_save_string = ndr->flags;
1382                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1383                         if (r->provider) {
1384                                 uint32_t _relative_save_offset;
1385                                 _relative_save_offset = ndr->offset;
1386                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1387                                 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1388                                 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1389                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1390                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1391                                 ndr->offset = _relative_save_offset;
1392                         }
1393                         ndr->flags = _flags_save_string;
1394                 }
1395                 if (r->file_info) {
1396                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1397                 }
1398         }
1399         return NDR_ERR_SUCCESS;
1400 }
1401
1402 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1403 {
1404         int level;
1405         level = ndr_print_get_switch_value(ndr, r);
1406         ndr_print_union(ndr, name, level, "spoolss_Field");
1407         switch (level) {
1408                 case PRINTER_NOTIFY_TYPE:
1409                         ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1410                 break;
1411
1412                 case JOB_NOTIFY_TYPE:
1413                         ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1414                 break;
1415
1416                 default:
1417                         ndr_print_uint16(ndr, "field", r->field);
1418                 break;
1419
1420         }
1421 }
1422