libwbclient: Actually implement wbcCredentialCache()
[Samba/nascimento.git] / librpc / ndr / ndr_spoolss_buf.c
blobb8d6f83ab6c17a9815743a62b2a9836b9f4af455
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 __##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)); \
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);\
80 _data_blob_info = ndr_push_blob(_ndr_info);\
81 _r.out.info = &_data_blob_info;\
83 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
84 } while(0)
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);\
92 if (flags & NDR_OUT) {\
93 out;\
94 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
96 } while(0)
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);\
115 NDR_PULL_ALLOC(ndr, r->out.info);\
116 ZERO_STRUCTP(r->out.info);\
117 } while(0)
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);\
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);\
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;\
153 } while(0)
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;\
162 if (flags & NDR_OUT) {\
163 out;\
164 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
166 } while(0)
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; \
174 } while (0)
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)
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)
207 spoolss_EnumPrinters
209 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
211 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
212 _r.in.flags = r->in.flags;
213 _r.in.server = r->in.server;
215 _r.in.flags = r->in.flags;
216 _r.in.server = r->in.server;
218 return NDR_ERR_SUCCESS;
221 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
223 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
224 r->in.flags = _r.in.flags;
225 r->in.server = _r.in.server;
227 _r.in.flags = r->in.flags;
228 _r.in.server = r->in.server;
230 return NDR_ERR_SUCCESS;
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)
235 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
239 spoolss_EnumJobs
241 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
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;
248 _r.in.handle = r->in.handle;
249 _r.in.firstjob = r->in.firstjob;
250 _r.in.numjobs = r->in.numjobs;
252 return NDR_ERR_SUCCESS;
255 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
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;
262 _r.in.handle = r->in.handle;
263 _r.in.firstjob = r->in.firstjob;
264 _r.in.numjobs = r->in.numjobs;
266 return NDR_ERR_SUCCESS;
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)
271 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
275 spoolss_EnumPrinterDrivers
277 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
279 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
280 _r.in.server = r->in.server;
281 _r.in.environment = r->in.environment;
283 _r.in.server = r->in.server;
284 _r.in.environment = r->in.environment;
286 return NDR_ERR_SUCCESS;
289 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
291 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
292 r->in.server = _r.in.server;
293 r->in.environment = _r.in.environment;
295 _r.in.server = r->in.server;
296 _r.in.environment = r->in.environment;
298 return NDR_ERR_SUCCESS;
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)
303 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
307 spoolss_EnumForms
309 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
311 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
312 _r.in.handle = r->in.handle;
314 _r.in.handle = r->in.handle;
316 return NDR_ERR_SUCCESS;
319 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
321 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
322 r->in.handle = _r.in.handle;
324 _r.in.handle = r->in.handle;
326 return NDR_ERR_SUCCESS;
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)
331 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
335 spoolss_EnumPorts
337 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
339 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
340 _r.in.servername= r->in.servername;
342 _r.in.servername= r->in.servername;
344 return NDR_ERR_SUCCESS;
347 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
349 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
350 r->in.servername= _r.in.servername;
352 _r.in.servername= r->in.servername;
354 return NDR_ERR_SUCCESS;
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)
359 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
363 spoolss_EnumMonitors
365 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
367 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
368 _r.in.servername= r->in.servername;
370 _r.in.servername= r->in.servername;
372 return NDR_ERR_SUCCESS;
375 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
377 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
378 r->in.servername= _r.in.servername;
380 _r.in.servername= r->in.servername;
382 return NDR_ERR_SUCCESS;
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)
387 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
391 spoolss_EnumPrintProcessors
393 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
395 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
396 _r.in.servername = r->in.servername;
397 _r.in.environment = r->in.environment;
399 _r.in.servername = r->in.servername;
400 _r.in.environment = r->in.environment;
402 return NDR_ERR_SUCCESS;
405 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
407 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
408 r->in.servername = _r.in.servername;
409 r->in.environment = _r.in.environment;
411 _r.in.servername = r->in.servername;
412 _r.in.environment = r->in.environment;
414 return NDR_ERR_SUCCESS;
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)
420 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
424 spoolss_EnumPrintProcessors
426 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
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;
432 _r.in.servername = r->in.servername;
433 _r.in.print_processor_name = r->in.print_processor_name;
435 return NDR_ERR_SUCCESS;
438 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
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;
444 _r.in.servername = r->in.servername;
445 _r.in.print_processor_name = r->in.print_processor_name;
447 return NDR_ERR_SUCCESS;
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)
453 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
457 spoolss_EnumPrinterDataEx
460 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
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));
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));
490 _r.out.info = ndr_push_blob(_ndr_info);
492 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
494 return NDR_ERR_SUCCESS;
497 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
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);
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);
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);
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;
547 return NDR_ERR_SUCCESS;
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)
553 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
557 spoolss_GetPrinterData
559 enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
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));
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;
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));
591 _blob = ndr_push_blob(_ndr_info);
592 _r.out.data = &_blob;
594 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
596 return NDR_ERR_SUCCESS;
599 enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
601 struct _spoolss_GetPrinterData _r;
602 if (flags & NDR_IN) {
603 DATA_BLOB blob = data_blob(NULL,0);
604 ZERO_STRUCT(r->out);
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;
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);
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);
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;
653 return NDR_ERR_SUCCESS;
657 spoolss_SetPrinterData
659 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
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;
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;
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);
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));
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));
693 return NDR_ERR_SUCCESS;
697 spoolss_GetPrinterDataEx
699 enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r)
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));
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;
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));
733 _blob = ndr_push_blob(_ndr_info);
734 _r.out.data = &_blob;
736 NDR_CHECK(ndr_push__spoolss_GetPrinterDataEx(ndr, flags, &_r));
738 return NDR_ERR_SUCCESS;
741 enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r)
743 struct _spoolss_GetPrinterDataEx _r;
744 if (flags & NDR_IN) {
745 DATA_BLOB blob = data_blob(NULL,0);
746 ZERO_STRUCT(r->out);
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;
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);
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);
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;
798 return NDR_ERR_SUCCESS;
802 spoolss_SetPrinterDataEx
804 enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r)
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;
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;
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);
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));
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));
840 return NDR_ERR_SUCCESS;
843 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
845 if (!devmode) return 0;
846 return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
849 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
851 if (!r) {
852 return 4;
855 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
858 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
859 * structs */
861 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
863 uint32_t cntr_file_info_1;
864 if (ndr_flags & NDR_SCALARS) {
865 NDR_CHECK(ndr_push_align(ndr, 8));
866 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
868 uint32_t _flags_save_string = ndr->flags;
869 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
870 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
871 ndr->flags = _flags_save_string;
874 uint32_t _flags_save_string = ndr->flags;
875 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
876 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
877 ndr->flags = _flags_save_string;
879 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
880 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
882 uint32_t _flags_save_string = ndr->flags;
883 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
884 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
885 ndr->flags = _flags_save_string;
888 uint32_t _flags_save_string = ndr->flags;
889 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
890 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
891 ndr->flags = _flags_save_string;
894 uint32_t _flags_save_string_array = ndr->flags;
895 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
896 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
897 ndr->flags = _flags_save_string_array;
899 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
900 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
902 uint32_t _flags_save_string = ndr->flags;
903 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
904 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
905 ndr->flags = _flags_save_string;
908 uint32_t _flags_save_string = ndr->flags;
909 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
910 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
911 ndr->flags = _flags_save_string;
914 uint32_t _flags_save_string = ndr->flags;
915 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
916 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
917 ndr->flags = _flags_save_string;
920 uint32_t _flags_save_string = ndr->flags;
921 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
922 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
923 ndr->flags = _flags_save_string;
926 if (ndr_flags & NDR_BUFFERS) {
928 uint32_t _flags_save_string = ndr->flags;
929 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
930 if (r->driver_name) {
931 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->driver_name));
932 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
934 ndr->flags = _flags_save_string;
937 uint32_t _flags_save_string = ndr->flags;
938 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
939 if (r->architecture) {
940 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->architecture));
941 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
943 ndr->flags = _flags_save_string;
945 if (r->file_info) {
946 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->file_info));
947 #if 0
948 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
949 #endif
950 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
951 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
953 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
954 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
958 uint32_t _flags_save_string = ndr->flags;
959 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
960 if (r->monitor_name) {
961 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->monitor_name));
962 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
964 ndr->flags = _flags_save_string;
967 uint32_t _flags_save_string = ndr->flags;
968 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
969 if (r->default_datatype) {
970 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->default_datatype));
971 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
973 ndr->flags = _flags_save_string;
976 uint32_t _flags_save_string_array = ndr->flags;
977 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
978 if (r->previous_names) {
979 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->previous_names));
980 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
982 ndr->flags = _flags_save_string_array;
985 uint32_t _flags_save_string = ndr->flags;
986 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
987 if (r->manufacturer_name) {
988 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_name));
989 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
991 ndr->flags = _flags_save_string;
994 uint32_t _flags_save_string = ndr->flags;
995 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
996 if (r->manufacturer_url) {
997 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_url));
998 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
1000 ndr->flags = _flags_save_string;
1003 uint32_t _flags_save_string = ndr->flags;
1004 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1005 if (r->hardware_id) {
1006 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->hardware_id));
1007 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
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 if (r->provider) {
1015 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->provider));
1016 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
1018 ndr->flags = _flags_save_string;
1021 return NDR_ERR_SUCCESS;
1024 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
1026 uint32_t _ptr_driver_name;
1027 TALLOC_CTX *_mem_save_driver_name_0;
1028 uint32_t _ptr_architecture;
1029 TALLOC_CTX *_mem_save_architecture_0;
1030 uint32_t _ptr_file_info;
1031 uint32_t cntr_file_info_1;
1032 TALLOC_CTX *_mem_save_file_info_0;
1033 TALLOC_CTX *_mem_save_file_info_1;
1034 uint32_t _ptr_monitor_name;
1035 TALLOC_CTX *_mem_save_monitor_name_0;
1036 uint32_t _ptr_default_datatype;
1037 TALLOC_CTX *_mem_save_default_datatype_0;
1038 uint32_t _ptr_previous_names;
1039 TALLOC_CTX *_mem_save_previous_names_0;
1040 uint32_t _ptr_manufacturer_name;
1041 TALLOC_CTX *_mem_save_manufacturer_name_0;
1042 uint32_t _ptr_manufacturer_url;
1043 TALLOC_CTX *_mem_save_manufacturer_url_0;
1044 uint32_t _ptr_hardware_id;
1045 TALLOC_CTX *_mem_save_hardware_id_0;
1046 uint32_t _ptr_provider;
1047 TALLOC_CTX *_mem_save_provider_0;
1048 if (ndr_flags & NDR_SCALARS) {
1049 NDR_CHECK(ndr_pull_align(ndr, 8));
1050 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
1052 uint32_t _flags_save_string = ndr->flags;
1053 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1054 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
1055 if (_ptr_driver_name) {
1056 NDR_PULL_ALLOC(ndr, r->driver_name);
1057 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
1058 } else {
1059 r->driver_name = NULL;
1061 ndr->flags = _flags_save_string;
1064 uint32_t _flags_save_string = ndr->flags;
1065 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1066 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
1067 if (_ptr_architecture) {
1068 NDR_PULL_ALLOC(ndr, r->architecture);
1069 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
1070 } else {
1071 r->architecture = NULL;
1073 ndr->flags = _flags_save_string;
1075 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
1076 if (_ptr_file_info) {
1077 NDR_PULL_ALLOC(ndr, r->file_info);
1078 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
1079 } else {
1080 r->file_info = NULL;
1082 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
1084 uint32_t _flags_save_string = ndr->flags;
1085 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1086 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
1087 if (_ptr_monitor_name) {
1088 NDR_PULL_ALLOC(ndr, r->monitor_name);
1089 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
1090 } else {
1091 r->monitor_name = NULL;
1093 ndr->flags = _flags_save_string;
1096 uint32_t _flags_save_string = ndr->flags;
1097 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1098 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
1099 if (_ptr_default_datatype) {
1100 NDR_PULL_ALLOC(ndr, r->default_datatype);
1101 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
1102 } else {
1103 r->default_datatype = NULL;
1105 ndr->flags = _flags_save_string;
1108 uint32_t _flags_save_string_array = ndr->flags;
1109 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1110 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
1111 if (_ptr_previous_names) {
1112 NDR_PULL_ALLOC(ndr, r->previous_names);
1113 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
1114 } else {
1115 r->previous_names = NULL;
1117 ndr->flags = _flags_save_string_array;
1119 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
1120 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
1122 uint32_t _flags_save_string = ndr->flags;
1123 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1124 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
1125 if (_ptr_manufacturer_name) {
1126 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
1127 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
1128 } else {
1129 r->manufacturer_name = NULL;
1131 ndr->flags = _flags_save_string;
1134 uint32_t _flags_save_string = ndr->flags;
1135 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1136 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
1137 if (_ptr_manufacturer_url) {
1138 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
1139 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
1140 } else {
1141 r->manufacturer_url = NULL;
1143 ndr->flags = _flags_save_string;
1146 uint32_t _flags_save_string = ndr->flags;
1147 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1148 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
1149 if (_ptr_hardware_id) {
1150 NDR_PULL_ALLOC(ndr, r->hardware_id);
1151 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
1152 } else {
1153 r->hardware_id = NULL;
1155 ndr->flags = _flags_save_string;
1158 uint32_t _flags_save_string = ndr->flags;
1159 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1160 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
1161 if (_ptr_provider) {
1162 NDR_PULL_ALLOC(ndr, r->provider);
1163 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
1164 } else {
1165 r->provider = NULL;
1167 ndr->flags = _flags_save_string;
1170 if (ndr_flags & NDR_BUFFERS) {
1172 uint32_t _flags_save_string = ndr->flags;
1173 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1174 if (r->driver_name) {
1175 uint32_t _relative_save_offset;
1176 _relative_save_offset = ndr->offset;
1177 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
1178 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1179 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
1180 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
1181 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
1182 ndr->offset = _relative_save_offset;
1184 ndr->flags = _flags_save_string;
1187 uint32_t _flags_save_string = ndr->flags;
1188 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1189 if (r->architecture) {
1190 uint32_t _relative_save_offset;
1191 _relative_save_offset = ndr->offset;
1192 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
1193 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
1194 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
1195 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
1196 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
1197 ndr->offset = _relative_save_offset;
1199 ndr->flags = _flags_save_string;
1201 if (r->file_info) {
1202 uint32_t _relative_save_offset;
1203 _relative_save_offset = ndr->offset;
1204 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
1205 _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
1206 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1207 #if 0
1208 NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
1209 #else
1210 NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
1211 #endif
1212 NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
1213 _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
1214 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
1215 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1216 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
1218 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
1219 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
1221 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
1222 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
1223 ndr->offset = _relative_save_offset;
1226 uint32_t _flags_save_string = ndr->flags;
1227 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1228 if (r->monitor_name) {
1229 uint32_t _relative_save_offset;
1230 _relative_save_offset = ndr->offset;
1231 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
1232 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1233 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
1234 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
1235 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
1236 ndr->offset = _relative_save_offset;
1238 ndr->flags = _flags_save_string;
1241 uint32_t _flags_save_string = ndr->flags;
1242 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1243 if (r->default_datatype) {
1244 uint32_t _relative_save_offset;
1245 _relative_save_offset = ndr->offset;
1246 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
1247 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
1248 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
1249 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
1250 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
1251 ndr->offset = _relative_save_offset;
1253 ndr->flags = _flags_save_string;
1256 uint32_t _flags_save_string_array = ndr->flags;
1257 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1258 if (r->previous_names) {
1259 uint32_t _relative_save_offset;
1260 _relative_save_offset = ndr->offset;
1261 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1262 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1263 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1264 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1265 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1266 ndr->offset = _relative_save_offset;
1268 ndr->flags = _flags_save_string_array;
1271 uint32_t _flags_save_string = ndr->flags;
1272 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1273 if (r->manufacturer_name) {
1274 uint32_t _relative_save_offset;
1275 _relative_save_offset = ndr->offset;
1276 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1277 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1278 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1279 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1280 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1281 ndr->offset = _relative_save_offset;
1283 ndr->flags = _flags_save_string;
1286 uint32_t _flags_save_string = ndr->flags;
1287 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1288 if (r->manufacturer_url) {
1289 uint32_t _relative_save_offset;
1290 _relative_save_offset = ndr->offset;
1291 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1292 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1293 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1294 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1295 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1296 ndr->offset = _relative_save_offset;
1298 ndr->flags = _flags_save_string;
1301 uint32_t _flags_save_string = ndr->flags;
1302 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1303 if (r->hardware_id) {
1304 uint32_t _relative_save_offset;
1305 _relative_save_offset = ndr->offset;
1306 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1307 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1308 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1309 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1310 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1311 ndr->offset = _relative_save_offset;
1313 ndr->flags = _flags_save_string;
1316 uint32_t _flags_save_string = ndr->flags;
1317 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1318 if (r->provider) {
1319 uint32_t _relative_save_offset;
1320 _relative_save_offset = ndr->offset;
1321 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1322 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1323 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1324 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1325 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1326 ndr->offset = _relative_save_offset;
1328 ndr->flags = _flags_save_string;
1330 if (r->file_info) {
1331 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1334 return NDR_ERR_SUCCESS;
1337 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1339 int level;
1340 level = ndr_print_get_switch_value(ndr, r);
1341 ndr_print_union(ndr, name, level, "spoolss_Field");
1342 switch (level) {
1343 case PRINTER_NOTIFY_TYPE:
1344 ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1345 break;
1347 case JOB_NOTIFY_TYPE:
1348 ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1349 break;
1351 default:
1352 ndr_print_uint16(ndr, "field", r->field);
1353 break;
1358 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
1360 if (!r) {
1361 return 0;
1363 return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);