spoolss: use subcontext in NDR_SPOOLSS_PUSH_ENUM_OUT macro.
[Samba/gbeck.git] / librpc / ndr / ndr_spoolss_buf.c
blob80b661f84aa85ddd70a4580d0d098838e9e8de80
1 /*
2 Unix SMB/CIFS implementation.
4 routines for marshalling/unmarshalling spoolss subcontext buffer structures
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Tim Potter 2003
8 Copyright (C) Guenther Deschner 2009
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.
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.
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/>.
25 #include "includes.h"
26 #include "librpc/gen_ndr/ndr_spoolss.h"
27 #if (_SAMBA_BUILD_ >= 4)
28 #include "param/param.h"
29 #endif
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);\
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)
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");\
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 ndr_push *_subndr_info;\
67 struct __##fn __r;\
68 __r.in.level = r->in.level;\
69 __r.in.count = *r->out.count;\
70 __r.out.info = *r->out.info;\
71 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
72 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
73 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
75 if (r->in.offered > _ndr_info->offset) {\
76 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
77 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
78 } else if (r->in.offered < _ndr_info->offset) {\
79 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
80 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
81 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
83 _data_blob_info = ndr_push_blob(_ndr_info);\
84 _r.out.info = &_data_blob_info;\
86 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
87 } while(0)
89 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
90 struct _##fn _r;\
91 if (flags & NDR_IN) {\
92 in;\
93 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
95 if (flags & NDR_OUT) {\
96 out;\
97 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
99 } while(0)
101 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
102 ZERO_STRUCT(r->out);\
103 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
104 r->in.level = _r.in.level;\
105 r->in.buffer = _r.in.buffer;\
106 r->in.offered = _r.in.offered;\
107 r->out.needed = _r.out.needed;\
108 r->out.count = _r.out.count;\
109 if (!r->in.buffer && r->in.offered != 0) {\
110 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
111 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
112 (unsigned)r->in.offered);\
113 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
114 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
115 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
116 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
118 NDR_PULL_ALLOC(ndr, r->out.info);\
119 ZERO_STRUCTP(r->out.info);\
120 } while(0)
122 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
123 _r.in.level = r->in.level;\
124 _r.in.buffer = r->in.buffer;\
125 _r.in.offered = r->in.offered;\
126 _r.out.needed = r->out.needed;\
127 _r.out.count = r->out.count;\
128 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
129 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
130 NDR_PULL_ALLOC(ndr, r->out.info);\
132 *r->out.info = NULL;\
133 r->out.needed = _r.out.needed;\
134 r->out.count = _r.out.count;\
135 r->out.result = _r.out.result;\
136 if (_r.out.info) {\
137 struct ndr_pull *_ndr_info;\
138 NDR_PULL_ALLOC(ndr, *r->out.info);\
139 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
140 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
141 _ndr_info->flags= ndr->flags;\
142 if (r->in.offered != _ndr_info->data_size) {\
143 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
144 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
145 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
147 if (*r->out.needed <= _ndr_info->data_size) {\
148 struct __##fn __r;\
149 __r.in.level = r->in.level;\
150 __r.in.count = *r->out.count;\
151 __r.out.info = NULL;\
152 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
153 *r->out.info = __r.out.info;\
156 } while(0)
158 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
159 struct _##fn _r;\
160 if (flags & NDR_IN) {\
161 out;\
162 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
163 in;\
165 if (flags & NDR_OUT) {\
166 out;\
167 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
169 } while(0)
171 #define _NDR_CHECK_UINT32(call) do {\
172 enum ndr_err_code _ndr_err; \
173 _ndr_err = call; \
174 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
175 return 0; \
177 } while (0)
179 /* TODO: set _ndr_info->flags correct */
180 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
181 struct __##fn __r;\
182 DATA_BLOB _data_blob_info;\
183 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
184 if (!_ndr_info) return 0;\
185 _ndr_info->flags|=0;\
186 __r.in.level = level;\
187 __r.in.count = count;\
188 __r.out.info = info;\
189 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
190 _data_blob_info = ndr_push_blob(_ndr_info);\
191 return _data_blob_info.length;\
192 } while(0)
194 /* TODO: set _ndr_info->flags correct */
195 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
196 struct __##fn __r;\
197 DATA_BLOB _data_blob_info;\
198 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
199 if (!_ndr_info) return 0;\
200 _ndr_info->flags|=0;\
201 __r.in.count = count;\
202 __r.out.info = info;\
203 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
204 _data_blob_info = ndr_push_blob(_ndr_info);\
205 return _data_blob_info.length;\
206 } while(0)
210 spoolss_EnumPrinters
212 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
214 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
215 _r.in.flags = r->in.flags;
216 _r.in.server = r->in.server;
218 _r.in.flags = r->in.flags;
219 _r.in.server = r->in.server;
221 return NDR_ERR_SUCCESS;
224 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
226 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
227 r->in.flags = _r.in.flags;
228 r->in.server = _r.in.server;
230 _r.in.flags = r->in.flags;
231 _r.in.server = r->in.server;
233 return NDR_ERR_SUCCESS;
236 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)
238 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
242 spoolss_EnumJobs
244 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
246 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
247 _r.in.handle = r->in.handle;
248 _r.in.firstjob = r->in.firstjob;
249 _r.in.numjobs = r->in.numjobs;
251 _r.in.handle = r->in.handle;
252 _r.in.firstjob = r->in.firstjob;
253 _r.in.numjobs = r->in.numjobs;
255 return NDR_ERR_SUCCESS;
258 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
260 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
261 r->in.handle = _r.in.handle;
262 r->in.firstjob = _r.in.firstjob;
263 r->in.numjobs = _r.in.numjobs;
265 _r.in.handle = r->in.handle;
266 _r.in.firstjob = r->in.firstjob;
267 _r.in.numjobs = r->in.numjobs;
269 return NDR_ERR_SUCCESS;
272 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)
274 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
278 spoolss_EnumPrinterDrivers
280 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
282 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
283 _r.in.server = r->in.server;
284 _r.in.environment = r->in.environment;
286 _r.in.server = r->in.server;
287 _r.in.environment = r->in.environment;
289 return NDR_ERR_SUCCESS;
292 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
294 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
295 r->in.server = _r.in.server;
296 r->in.environment = _r.in.environment;
298 _r.in.server = r->in.server;
299 _r.in.environment = r->in.environment;
301 return NDR_ERR_SUCCESS;
304 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)
306 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
310 spoolss_EnumForms
312 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
314 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
315 _r.in.handle = r->in.handle;
317 _r.in.handle = r->in.handle;
319 return NDR_ERR_SUCCESS;
322 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
324 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
325 r->in.handle = _r.in.handle;
327 _r.in.handle = r->in.handle;
329 return NDR_ERR_SUCCESS;
332 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)
334 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
338 spoolss_EnumPorts
340 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
342 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
343 _r.in.servername= r->in.servername;
345 _r.in.servername= r->in.servername;
347 return NDR_ERR_SUCCESS;
350 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
352 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
353 r->in.servername= _r.in.servername;
355 _r.in.servername= r->in.servername;
357 return NDR_ERR_SUCCESS;
360 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)
362 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
366 spoolss_EnumMonitors
368 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
370 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
371 _r.in.servername= r->in.servername;
373 _r.in.servername= r->in.servername;
375 return NDR_ERR_SUCCESS;
378 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
380 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
381 r->in.servername= _r.in.servername;
383 _r.in.servername= r->in.servername;
385 return NDR_ERR_SUCCESS;
388 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)
390 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
394 spoolss_EnumPrintProcessors
396 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
398 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
399 _r.in.servername = r->in.servername;
400 _r.in.environment = r->in.environment;
402 _r.in.servername = r->in.servername;
403 _r.in.environment = r->in.environment;
405 return NDR_ERR_SUCCESS;
408 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
410 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
411 r->in.servername = _r.in.servername;
412 r->in.environment = _r.in.environment;
414 _r.in.servername = r->in.servername;
415 _r.in.environment = r->in.environment;
417 return NDR_ERR_SUCCESS;
420 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
421 uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
423 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
427 spoolss_EnumPrintProcessors
429 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
431 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes,{
432 _r.in.servername = r->in.servername;
433 _r.in.print_processor_name = r->in.print_processor_name;
435 _r.in.servername = r->in.servername;
436 _r.in.print_processor_name = r->in.print_processor_name;
438 return NDR_ERR_SUCCESS;
441 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
443 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes,{
444 r->in.servername = _r.in.servername;
445 r->in.print_processor_name = _r.in.print_processor_name;
447 _r.in.servername = r->in.servername;
448 _r.in.print_processor_name = r->in.print_processor_name;
450 return NDR_ERR_SUCCESS;
453 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
454 uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
456 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
460 spoolss_EnumPrinterDataEx
463 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
465 struct _spoolss_EnumPrinterDataEx _r;
466 if (flags & NDR_IN) {
467 _r.in.handle = r->in.handle;
468 _r.in.key_name = r->in.key_name;
469 _r.in.offered = r->in.offered;
470 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
472 if (flags & NDR_OUT) {
473 struct ndr_push *_ndr_info;
474 _r.in.handle = r->in.handle;
475 _r.in.key_name = r->in.key_name;
476 _r.in.offered = r->in.offered;
477 _r.out.count = r->out.count;
478 _r.out.needed = r->out.needed;
479 _r.out.result = r->out.result;
480 _r.out.info = data_blob(NULL, 0);
481 if (r->in.offered >= *r->out.needed) {
482 struct __spoolss_EnumPrinterDataEx __r;
483 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
484 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
485 _ndr_info->flags= ndr->flags;
486 __r.in.count = *r->out.count;
487 __r.out.info = *r->out.info;
488 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
489 if (r->in.offered > _ndr_info->offset) {
490 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
491 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
493 _r.out.info = ndr_push_blob(_ndr_info);
495 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
497 return NDR_ERR_SUCCESS;
500 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
502 struct _spoolss_EnumPrinterDataEx _r;
503 if (flags & NDR_IN) {
504 _r.in.handle = r->in.handle;
505 _r.in.key_name = r->in.key_name;
506 ZERO_STRUCT(r->out);
507 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
508 r->in.handle = _r.in.handle;
509 r->in.key_name = _r.in.key_name;
510 r->in.offered = _r.in.offered;
511 r->out.needed = _r.out.needed;
512 r->out.count = _r.out.count;
513 NDR_PULL_ALLOC(ndr, r->out.info);
514 ZERO_STRUCTP(r->out.info);
516 if (flags & NDR_OUT) {
517 _r.in.handle = r->in.handle;
518 _r.in.key_name = r->in.key_name;
519 _r.in.offered = r->in.offered;
520 _r.out.count = r->out.count;
521 _r.out.needed = r->out.needed;
522 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
523 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
524 NDR_PULL_ALLOC(ndr, r->out.info);
526 *r->out.info = NULL;
527 r->out.needed = _r.out.needed;
528 r->out.count = _r.out.count;
529 r->out.result = _r.out.result;
530 if (_r.out.info.length) {
531 struct ndr_pull *_ndr_info;
532 NDR_PULL_ALLOC(ndr, *r->out.info);
533 _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
534 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
535 _ndr_info->flags= ndr->flags;
536 if (r->in.offered != _ndr_info->data_size) {
537 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
538 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
539 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
541 if (*r->out.needed <= _ndr_info->data_size) {
542 struct __spoolss_EnumPrinterDataEx __r;
543 __r.in.count = *r->out.count;
544 __r.out.info = NULL;
545 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
546 *r->out.info = __r.out.info;
550 return NDR_ERR_SUCCESS;
553 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
554 uint32_t count, struct spoolss_PrinterEnumValues *info)
556 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
560 spoolss_GetPrinterData
562 enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
564 struct _spoolss_GetPrinterData _r;
565 if (flags & NDR_IN) {
566 _r.in.handle = r->in.handle;
567 _r.in.value_name= r->in.value_name;
568 _r.in.offered = r->in.offered;
569 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
571 if (flags & NDR_OUT) {
572 struct ndr_push *_ndr_info;
573 DATA_BLOB blob = data_blob(NULL, 0);
574 _r.in.handle = r->in.handle;
575 _r.in.value_name= r->in.value_name;
576 _r.in.offered = r->in.offered;
577 _r.out.type = r->out.type;
578 _r.out.data = &blob;
579 _r.out.needed = r->out.needed;
580 _r.out.result = r->out.result;
582 struct __spoolss_GetPrinterData __r;
583 DATA_BLOB _blob;
584 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
585 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
586 _ndr_info->flags= ndr->flags;
587 __r.in.type = *r->out.type;
588 __r.out.data = r->out.data;
589 NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r));
590 if (r->in.offered > _ndr_info->offset) {
591 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
592 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
594 _blob = ndr_push_blob(_ndr_info);
595 _r.out.data = &_blob;
597 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
599 return NDR_ERR_SUCCESS;
602 enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
604 struct _spoolss_GetPrinterData _r;
605 if (flags & NDR_IN) {
606 DATA_BLOB blob = data_blob(NULL,0);
607 ZERO_STRUCT(r->out);
609 _r.in.handle = r->in.handle;
610 _r.in.value_name= r->in.value_name;
611 _r.in.offered = r->in.offered;
612 _r.out.type = r->out.type;
613 _r.out.data = &blob;
614 _r.out.needed = r->out.needed;
615 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
616 r->in.handle = _r.in.handle;
617 r->in.value_name= _r.in.value_name;
618 r->in.offered = _r.in.offered;
619 r->out.needed = _r.out.needed;
621 if (flags & NDR_OUT) {
622 DATA_BLOB blob = data_blob_talloc(ndr,NULL,0);
623 _r.in.handle = r->in.handle;
624 _r.in.value_name= r->in.value_name;
625 _r.in.offered = r->in.offered;
626 _r.out.type = r->out.type;
627 _r.out.data = &blob;
628 _r.out.needed = r->out.needed;
629 _r.out.result = r->out.result;
630 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
631 r->out.type = _r.out.type;
632 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
633 NDR_PULL_ALLOC(ndr, r->out.data);
635 ZERO_STRUCTP(r->out.data);
636 r->out.needed = _r.out.needed;
637 r->out.result = _r.out.result;
638 if (_r.out.data && _r.out.data->length != r->in.offered) {
639 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
640 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
641 (unsigned)r->in.offered, (unsigned)_r.out.data->length);
643 if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) {
644 struct __spoolss_GetPrinterData __r;
645 struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience);
646 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
647 _ndr_data->flags= ndr->flags;
648 __r.in.type = *r->out.type;
649 __r.out.data = r->out.data;
650 NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
651 r->out.data = __r.out.data;
652 } else {
653 *r->out.type = REG_NONE;
656 return NDR_ERR_SUCCESS;
660 spoolss_SetPrinterData
662 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
664 struct _spoolss_SetPrinterData _r;
665 if (flags & NDR_IN) {
666 struct ndr_push *_ndr_data;
667 struct __spoolss_SetPrinterData __r;
668 DATA_BLOB _data_blob_data;
670 _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
671 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
672 _ndr_data->flags= ndr->flags;
674 __r.in.type = r->in.type;
675 __r.out.data = discard_const_p(union spoolss_PrinterData, &r->in.data);
676 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
677 _data_blob_data = ndr_push_blob(_ndr_data);
679 _r.in.handle = r->in.handle;
680 _r.in.value_name= r->in.value_name;
681 _r.in.type = r->in.type;
682 _r.in.data = _data_blob_data;
683 _r.in._offered = _data_blob_data.length;
684 _r.out.result = r->out.result;
685 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
687 if (flags & NDR_OUT) {
688 _r.in.handle = r->in.handle;
689 _r.in.value_name= r->in.value_name;
690 _r.in.type = r->in.type;
691 _r.in.data = data_blob(NULL,0),
692 _r.in._offered = r->in._offered;
693 _r.out.result = r->out.result;
694 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
696 return NDR_ERR_SUCCESS;
699 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
701 if (!devmode) return 0;
702 return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
705 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
707 if (!r) {
708 return 4;
711 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
714 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
715 * structs */
717 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
719 uint32_t cntr_file_info_1;
720 if (ndr_flags & NDR_SCALARS) {
721 NDR_CHECK(ndr_push_align(ndr, 8));
722 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
724 uint32_t _flags_save_string = ndr->flags;
725 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
726 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
727 ndr->flags = _flags_save_string;
730 uint32_t _flags_save_string = ndr->flags;
731 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
732 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
733 ndr->flags = _flags_save_string;
735 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
736 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
738 uint32_t _flags_save_string = ndr->flags;
739 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
740 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
741 ndr->flags = _flags_save_string;
744 uint32_t _flags_save_string = ndr->flags;
745 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
746 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
747 ndr->flags = _flags_save_string;
750 uint32_t _flags_save_string_array = ndr->flags;
751 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
752 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
753 ndr->flags = _flags_save_string_array;
755 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
756 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
758 uint32_t _flags_save_string = ndr->flags;
759 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
760 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
761 ndr->flags = _flags_save_string;
764 uint32_t _flags_save_string = ndr->flags;
765 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
766 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
767 ndr->flags = _flags_save_string;
770 uint32_t _flags_save_string = ndr->flags;
771 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
772 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
773 ndr->flags = _flags_save_string;
776 uint32_t _flags_save_string = ndr->flags;
777 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
778 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
779 ndr->flags = _flags_save_string;
782 if (ndr_flags & NDR_BUFFERS) {
784 uint32_t _flags_save_string = ndr->flags;
785 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
786 if (r->driver_name) {
787 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
788 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
789 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
791 ndr->flags = _flags_save_string;
794 uint32_t _flags_save_string = ndr->flags;
795 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
796 if (r->architecture) {
797 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
798 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
799 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
801 ndr->flags = _flags_save_string;
803 if (r->file_info) {
804 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
805 #if 0
806 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
807 #endif
808 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
809 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
811 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
812 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
814 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
817 uint32_t _flags_save_string = ndr->flags;
818 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
819 if (r->monitor_name) {
820 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
821 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
822 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
824 ndr->flags = _flags_save_string;
827 uint32_t _flags_save_string = ndr->flags;
828 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
829 if (r->default_datatype) {
830 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
831 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
832 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
834 ndr->flags = _flags_save_string;
837 uint32_t _flags_save_string_array = ndr->flags;
838 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
839 if (r->previous_names) {
840 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
841 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
842 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
844 ndr->flags = _flags_save_string_array;
847 uint32_t _flags_save_string = ndr->flags;
848 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
849 if (r->manufacturer_name) {
850 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
851 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
852 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
854 ndr->flags = _flags_save_string;
857 uint32_t _flags_save_string = ndr->flags;
858 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
859 if (r->manufacturer_url) {
860 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
861 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
862 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
864 ndr->flags = _flags_save_string;
867 uint32_t _flags_save_string = ndr->flags;
868 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
869 if (r->hardware_id) {
870 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
871 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
872 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
874 ndr->flags = _flags_save_string;
877 uint32_t _flags_save_string = ndr->flags;
878 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
879 if (r->provider) {
880 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
881 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
882 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
884 ndr->flags = _flags_save_string;
887 return NDR_ERR_SUCCESS;
890 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
892 uint32_t _ptr_driver_name;
893 TALLOC_CTX *_mem_save_driver_name_0;
894 uint32_t _ptr_architecture;
895 TALLOC_CTX *_mem_save_architecture_0;
896 uint32_t _ptr_file_info;
897 uint32_t cntr_file_info_1;
898 TALLOC_CTX *_mem_save_file_info_0;
899 TALLOC_CTX *_mem_save_file_info_1;
900 uint32_t _ptr_monitor_name;
901 TALLOC_CTX *_mem_save_monitor_name_0;
902 uint32_t _ptr_default_datatype;
903 TALLOC_CTX *_mem_save_default_datatype_0;
904 uint32_t _ptr_previous_names;
905 TALLOC_CTX *_mem_save_previous_names_0;
906 uint32_t _ptr_manufacturer_name;
907 TALLOC_CTX *_mem_save_manufacturer_name_0;
908 uint32_t _ptr_manufacturer_url;
909 TALLOC_CTX *_mem_save_manufacturer_url_0;
910 uint32_t _ptr_hardware_id;
911 TALLOC_CTX *_mem_save_hardware_id_0;
912 uint32_t _ptr_provider;
913 TALLOC_CTX *_mem_save_provider_0;
914 if (ndr_flags & NDR_SCALARS) {
915 NDR_CHECK(ndr_pull_align(ndr, 8));
916 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
918 uint32_t _flags_save_string = ndr->flags;
919 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
920 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
921 if (_ptr_driver_name) {
922 NDR_PULL_ALLOC(ndr, r->driver_name);
923 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
924 } else {
925 r->driver_name = NULL;
927 ndr->flags = _flags_save_string;
930 uint32_t _flags_save_string = ndr->flags;
931 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
932 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
933 if (_ptr_architecture) {
934 NDR_PULL_ALLOC(ndr, r->architecture);
935 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
936 } else {
937 r->architecture = NULL;
939 ndr->flags = _flags_save_string;
941 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
942 if (_ptr_file_info) {
943 NDR_PULL_ALLOC(ndr, r->file_info);
944 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
945 } else {
946 r->file_info = NULL;
948 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
950 uint32_t _flags_save_string = ndr->flags;
951 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
952 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
953 if (_ptr_monitor_name) {
954 NDR_PULL_ALLOC(ndr, r->monitor_name);
955 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
956 } else {
957 r->monitor_name = NULL;
959 ndr->flags = _flags_save_string;
962 uint32_t _flags_save_string = ndr->flags;
963 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
964 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
965 if (_ptr_default_datatype) {
966 NDR_PULL_ALLOC(ndr, r->default_datatype);
967 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
968 } else {
969 r->default_datatype = NULL;
971 ndr->flags = _flags_save_string;
974 uint32_t _flags_save_string_array = ndr->flags;
975 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
976 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
977 if (_ptr_previous_names) {
978 NDR_PULL_ALLOC(ndr, r->previous_names);
979 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
980 } else {
981 r->previous_names = NULL;
983 ndr->flags = _flags_save_string_array;
985 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
986 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
988 uint32_t _flags_save_string = ndr->flags;
989 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
990 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
991 if (_ptr_manufacturer_name) {
992 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
993 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
994 } else {
995 r->manufacturer_name = NULL;
997 ndr->flags = _flags_save_string;
1000 uint32_t _flags_save_string = ndr->flags;
1001 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1002 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
1003 if (_ptr_manufacturer_url) {
1004 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
1005 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
1006 } else {
1007 r->manufacturer_url = NULL;
1009 ndr->flags = _flags_save_string;
1012 uint32_t _flags_save_string = ndr->flags;
1013 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1014 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
1015 if (_ptr_hardware_id) {
1016 NDR_PULL_ALLOC(ndr, r->hardware_id);
1017 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
1018 } else {
1019 r->hardware_id = NULL;
1021 ndr->flags = _flags_save_string;
1024 uint32_t _flags_save_string = ndr->flags;
1025 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1026 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
1027 if (_ptr_provider) {
1028 NDR_PULL_ALLOC(ndr, r->provider);
1029 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
1030 } else {
1031 r->provider = NULL;
1033 ndr->flags = _flags_save_string;
1036 if (ndr_flags & NDR_BUFFERS) {
1038 uint32_t _flags_save_string = ndr->flags;
1039 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1040 if (r->driver_name) {
1041 uint32_t _relative_save_offset;
1042 _relative_save_offset = ndr->offset;
1043 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
1044 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1045 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
1046 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
1047 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
1048 ndr->offset = _relative_save_offset;
1050 ndr->flags = _flags_save_string;
1053 uint32_t _flags_save_string = ndr->flags;
1054 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1055 if (r->architecture) {
1056 uint32_t _relative_save_offset;
1057 _relative_save_offset = ndr->offset;
1058 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
1059 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
1060 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
1061 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
1062 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
1063 ndr->offset = _relative_save_offset;
1065 ndr->flags = _flags_save_string;
1067 if (r->file_info) {
1068 uint32_t _relative_save_offset;
1069 _relative_save_offset = ndr->offset;
1070 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
1071 _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
1072 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1073 #if 0
1074 NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
1075 #else
1076 NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
1077 #endif
1078 NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
1079 _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
1080 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1081 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1082 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
1084 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1085 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
1087 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
1088 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
1089 ndr->offset = _relative_save_offset;
1092 uint32_t _flags_save_string = ndr->flags;
1093 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1094 if (r->monitor_name) {
1095 uint32_t _relative_save_offset;
1096 _relative_save_offset = ndr->offset;
1097 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
1098 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1099 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
1100 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
1101 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
1102 ndr->offset = _relative_save_offset;
1104 ndr->flags = _flags_save_string;
1107 uint32_t _flags_save_string = ndr->flags;
1108 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1109 if (r->default_datatype) {
1110 uint32_t _relative_save_offset;
1111 _relative_save_offset = ndr->offset;
1112 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
1113 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
1114 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
1115 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
1116 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
1117 ndr->offset = _relative_save_offset;
1119 ndr->flags = _flags_save_string;
1122 uint32_t _flags_save_string_array = ndr->flags;
1123 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1124 if (r->previous_names) {
1125 uint32_t _relative_save_offset;
1126 _relative_save_offset = ndr->offset;
1127 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1128 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1129 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1130 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1131 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1132 ndr->offset = _relative_save_offset;
1134 ndr->flags = _flags_save_string_array;
1137 uint32_t _flags_save_string = ndr->flags;
1138 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1139 if (r->manufacturer_name) {
1140 uint32_t _relative_save_offset;
1141 _relative_save_offset = ndr->offset;
1142 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1143 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1144 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1145 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1146 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1147 ndr->offset = _relative_save_offset;
1149 ndr->flags = _flags_save_string;
1152 uint32_t _flags_save_string = ndr->flags;
1153 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1154 if (r->manufacturer_url) {
1155 uint32_t _relative_save_offset;
1156 _relative_save_offset = ndr->offset;
1157 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1158 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1159 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1160 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1161 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1162 ndr->offset = _relative_save_offset;
1164 ndr->flags = _flags_save_string;
1167 uint32_t _flags_save_string = ndr->flags;
1168 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1169 if (r->hardware_id) {
1170 uint32_t _relative_save_offset;
1171 _relative_save_offset = ndr->offset;
1172 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1173 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1174 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1175 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1176 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1177 ndr->offset = _relative_save_offset;
1179 ndr->flags = _flags_save_string;
1182 uint32_t _flags_save_string = ndr->flags;
1183 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1184 if (r->provider) {
1185 uint32_t _relative_save_offset;
1186 _relative_save_offset = ndr->offset;
1187 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1188 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1189 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1190 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1191 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1192 ndr->offset = _relative_save_offset;
1194 ndr->flags = _flags_save_string;
1196 if (r->file_info) {
1197 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1200 return NDR_ERR_SUCCESS;
1203 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1205 int level;
1206 level = ndr_print_get_switch_value(ndr, r);
1207 ndr_print_union(ndr, name, level, "spoolss_Field");
1208 switch (level) {
1209 case PRINTER_NOTIFY_TYPE:
1210 ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1211 break;
1213 case JOB_NOTIFY_TYPE:
1214 ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1215 break;
1217 default:
1218 ndr_print_uint16(ndr, "field", r->field);
1219 break;