s4:torture/libnet: make use of dcerpc_binding_handle stubs
[Samba/nascimento.git] / librpc / ndr / ndr_spoolss_buf.c
blobf8a67063be55b79f0c0a59e4b6ecc32950b55e01
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 #include "librpc/gen_ndr/ndr_security.h"
28 #if (_SAMBA_BUILD_ >= 4)
29 #include "param/param.h"
30 #endif
32 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
33 if (!r->in.buffer && r->in.offered != 0) {\
34 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
35 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
36 (unsigned)r->in.offered);\
37 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
38 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
39 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
40 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
42 _r.in.level = r->in.level;\
43 _r.in.buffer = r->in.buffer;\
44 _r.in.offered = r->in.offered;\
45 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
46 } while(0)
48 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
49 struct ndr_push *_ndr_info;\
50 _r.in.level = r->in.level;\
51 _r.in.buffer = r->in.buffer;\
52 _r.in.offered = r->in.offered;\
53 _r.out.info = NULL;\
54 _r.out.needed = r->out.needed;\
55 _r.out.count = r->out.count;\
56 _r.out.result = r->out.result;\
57 if (r->out.info && *r->out.info && !r->in.buffer) {\
58 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
59 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
61 if (r->in.buffer) {\
62 DATA_BLOB _data_blob_info;\
63 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
64 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
65 _ndr_info->flags= ndr->flags;\
66 if (r->out.info) {\
67 struct ndr_push *_subndr_info;\
68 struct __##fn __r;\
69 __r.in.level = r->in.level;\
70 __r.in.count = *r->out.count;\
71 __r.out.info = *r->out.info;\
72 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
73 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
74 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
76 if (r->in.offered > _ndr_info->offset) {\
77 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
78 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
79 } else if (r->in.offered < _ndr_info->offset) {\
80 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
81 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
82 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
84 _data_blob_info = ndr_push_blob(_ndr_info);\
85 _r.out.info = &_data_blob_info;\
87 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
88 } while(0)
90 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
91 struct _##fn _r;\
92 if (flags & NDR_IN) {\
93 in;\
94 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
96 if (flags & NDR_OUT) {\
97 out;\
98 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
100 } while(0)
102 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
103 ZERO_STRUCT(r->out);\
104 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
105 r->in.level = _r.in.level;\
106 r->in.buffer = _r.in.buffer;\
107 r->in.offered = _r.in.offered;\
108 r->out.needed = _r.out.needed;\
109 r->out.count = _r.out.count;\
110 if (!r->in.buffer && r->in.offered != 0) {\
111 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
112 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
113 (unsigned)r->in.offered);\
114 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
115 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
116 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
117 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
119 NDR_PULL_ALLOC(ndr, r->out.info);\
120 ZERO_STRUCTP(r->out.info);\
121 } while(0)
123 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
124 _r.in.level = r->in.level;\
125 _r.in.buffer = r->in.buffer;\
126 _r.in.offered = r->in.offered;\
127 _r.out.needed = r->out.needed;\
128 _r.out.count = r->out.count;\
129 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
130 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
131 NDR_PULL_ALLOC(ndr, r->out.info);\
133 *r->out.info = NULL;\
134 r->out.needed = _r.out.needed;\
135 r->out.count = _r.out.count;\
136 r->out.result = _r.out.result;\
137 if (_r.out.info) {\
138 struct ndr_pull *_ndr_info;\
139 NDR_PULL_ALLOC(ndr, *r->out.info);\
140 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
141 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
142 _ndr_info->flags= ndr->flags;\
143 if (r->in.offered != _ndr_info->data_size) {\
144 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
145 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
146 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
148 if (*r->out.needed <= _ndr_info->data_size) {\
149 struct __##fn __r;\
150 __r.in.level = r->in.level;\
151 __r.in.count = *r->out.count;\
152 __r.out.info = NULL;\
153 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
154 *r->out.info = __r.out.info;\
157 } while(0)
159 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
160 struct _##fn _r;\
161 if (flags & NDR_IN) {\
162 out;\
163 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
164 in;\
166 if (flags & NDR_OUT) {\
167 out;\
168 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
170 } while(0)
172 #define _NDR_CHECK_UINT32(call) do {\
173 enum ndr_err_code _ndr_err; \
174 _ndr_err = call; \
175 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
176 return 0; \
178 } while (0)
180 /* TODO: set _ndr_info->flags correct */
181 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
182 struct __##fn __r;\
183 DATA_BLOB _data_blob_info;\
184 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
185 if (!_ndr_info) return 0;\
186 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
187 __r.in.level = level;\
188 __r.in.count = count;\
189 __r.out.info = info;\
190 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
191 _data_blob_info = ndr_push_blob(_ndr_info);\
192 return _data_blob_info.length;\
193 } while(0)
195 /* TODO: set _ndr_info->flags correct */
196 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
197 struct __##fn __r;\
198 DATA_BLOB _data_blob_info;\
199 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
200 if (!_ndr_info) return 0;\
201 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
202 __r.in.count = count;\
203 __r.out.info = info;\
204 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
205 _data_blob_info = ndr_push_blob(_ndr_info);\
206 return _data_blob_info.length;\
207 } while(0)
211 spoolss_EnumPrinters
213 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
215 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
216 _r.in.flags = r->in.flags;
217 _r.in.server = r->in.server;
219 _r.in.flags = r->in.flags;
220 _r.in.server = r->in.server;
222 return NDR_ERR_SUCCESS;
225 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
227 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
228 r->in.flags = _r.in.flags;
229 r->in.server = _r.in.server;
231 _r.in.flags = r->in.flags;
232 _r.in.server = r->in.server;
234 return NDR_ERR_SUCCESS;
237 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)
239 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
243 spoolss_EnumJobs
245 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
247 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
248 _r.in.handle = r->in.handle;
249 _r.in.firstjob = r->in.firstjob;
250 _r.in.numjobs = r->in.numjobs;
252 _r.in.handle = r->in.handle;
253 _r.in.firstjob = r->in.firstjob;
254 _r.in.numjobs = r->in.numjobs;
256 return NDR_ERR_SUCCESS;
259 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
261 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
262 r->in.handle = _r.in.handle;
263 r->in.firstjob = _r.in.firstjob;
264 r->in.numjobs = _r.in.numjobs;
266 _r.in.handle = r->in.handle;
267 _r.in.firstjob = r->in.firstjob;
268 _r.in.numjobs = r->in.numjobs;
270 return NDR_ERR_SUCCESS;
273 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)
275 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
279 spoolss_EnumPrinterDrivers
281 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
283 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
284 _r.in.server = r->in.server;
285 _r.in.environment = r->in.environment;
287 _r.in.server = r->in.server;
288 _r.in.environment = r->in.environment;
290 return NDR_ERR_SUCCESS;
293 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
295 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
296 r->in.server = _r.in.server;
297 r->in.environment = _r.in.environment;
299 _r.in.server = r->in.server;
300 _r.in.environment = r->in.environment;
302 return NDR_ERR_SUCCESS;
305 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)
307 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
311 spoolss_EnumForms
313 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
315 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
316 _r.in.handle = r->in.handle;
318 _r.in.handle = r->in.handle;
320 return NDR_ERR_SUCCESS;
323 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
325 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
326 r->in.handle = _r.in.handle;
328 _r.in.handle = r->in.handle;
330 return NDR_ERR_SUCCESS;
333 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)
335 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
339 spoolss_EnumPorts
341 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
343 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
344 _r.in.servername= r->in.servername;
346 _r.in.servername= r->in.servername;
348 return NDR_ERR_SUCCESS;
351 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
353 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
354 r->in.servername= _r.in.servername;
356 _r.in.servername= r->in.servername;
358 return NDR_ERR_SUCCESS;
361 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)
363 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
367 spoolss_EnumMonitors
369 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
371 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
372 _r.in.servername= r->in.servername;
374 _r.in.servername= r->in.servername;
376 return NDR_ERR_SUCCESS;
379 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
381 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
382 r->in.servername= _r.in.servername;
384 _r.in.servername= r->in.servername;
386 return NDR_ERR_SUCCESS;
389 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)
391 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
395 spoolss_EnumPrintProcessors
397 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
399 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
400 _r.in.servername = r->in.servername;
401 _r.in.environment = r->in.environment;
403 _r.in.servername = r->in.servername;
404 _r.in.environment = r->in.environment;
406 return NDR_ERR_SUCCESS;
409 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
411 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
412 r->in.servername = _r.in.servername;
413 r->in.environment = _r.in.environment;
415 _r.in.servername = r->in.servername;
416 _r.in.environment = r->in.environment;
418 return NDR_ERR_SUCCESS;
421 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
422 uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
424 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
428 spoolss_EnumPrintProcessors
430 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
432 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes,{
433 _r.in.servername = r->in.servername;
434 _r.in.print_processor_name = r->in.print_processor_name;
436 _r.in.servername = r->in.servername;
437 _r.in.print_processor_name = r->in.print_processor_name;
439 return NDR_ERR_SUCCESS;
442 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
444 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes,{
445 r->in.servername = _r.in.servername;
446 r->in.print_processor_name = _r.in.print_processor_name;
448 _r.in.servername = r->in.servername;
449 _r.in.print_processor_name = r->in.print_processor_name;
451 return NDR_ERR_SUCCESS;
454 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
455 uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
457 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
461 spoolss_EnumPrinterDataEx
464 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
466 struct _spoolss_EnumPrinterDataEx _r;
467 if (flags & NDR_IN) {
468 _r.in.handle = r->in.handle;
469 _r.in.key_name = r->in.key_name;
470 _r.in.offered = r->in.offered;
471 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
473 if (flags & NDR_OUT) {
474 struct ndr_push *_ndr_info;
475 _r.in.handle = r->in.handle;
476 _r.in.key_name = r->in.key_name;
477 _r.in.offered = r->in.offered;
478 _r.out.count = r->out.count;
479 _r.out.needed = r->out.needed;
480 _r.out.result = r->out.result;
481 _r.out.info = data_blob(NULL, 0);
482 if (r->in.offered >= *r->out.needed) {
483 struct __spoolss_EnumPrinterDataEx __r;
484 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
485 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
486 _ndr_info->flags= ndr->flags;
487 __r.in.count = *r->out.count;
488 __r.out.info = *r->out.info;
489 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
490 if (r->in.offered > _ndr_info->offset) {
491 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
492 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
494 _r.out.info = ndr_push_blob(_ndr_info);
496 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
498 return NDR_ERR_SUCCESS;
501 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
503 struct _spoolss_EnumPrinterDataEx _r;
504 if (flags & NDR_IN) {
505 _r.in.handle = r->in.handle;
506 _r.in.key_name = r->in.key_name;
507 ZERO_STRUCT(r->out);
508 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
509 r->in.handle = _r.in.handle;
510 r->in.key_name = _r.in.key_name;
511 r->in.offered = _r.in.offered;
512 r->out.needed = _r.out.needed;
513 r->out.count = _r.out.count;
514 NDR_PULL_ALLOC(ndr, r->out.info);
515 ZERO_STRUCTP(r->out.info);
517 if (flags & NDR_OUT) {
518 _r.in.handle = r->in.handle;
519 _r.in.key_name = r->in.key_name;
520 _r.in.offered = r->in.offered;
521 _r.out.count = r->out.count;
522 _r.out.needed = r->out.needed;
523 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
524 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
525 NDR_PULL_ALLOC(ndr, r->out.info);
527 *r->out.info = NULL;
528 r->out.needed = _r.out.needed;
529 r->out.count = _r.out.count;
530 r->out.result = _r.out.result;
531 if (_r.out.info.length) {
532 struct ndr_pull *_ndr_info;
533 NDR_PULL_ALLOC(ndr, *r->out.info);
534 _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
535 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
536 _ndr_info->flags= ndr->flags;
537 if (r->in.offered != _ndr_info->data_size) {
538 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
539 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
540 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
542 if (*r->out.needed <= _ndr_info->data_size) {
543 struct __spoolss_EnumPrinterDataEx __r;
544 __r.in.count = *r->out.count;
545 __r.out.info = NULL;
546 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
547 *r->out.info = __r.out.info;
551 return NDR_ERR_SUCCESS;
554 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
555 uint32_t count, struct spoolss_PrinterEnumValues *info)
557 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
560 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
562 if (!devmode) return 0;
563 return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
566 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
568 if (!r) {
569 return 4;
572 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
575 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
576 * structs */
578 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
580 uint32_t cntr_file_info_1;
581 if (ndr_flags & NDR_SCALARS) {
582 NDR_CHECK(ndr_push_align(ndr, 8));
583 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
585 uint32_t _flags_save_string = ndr->flags;
586 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
587 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
588 ndr->flags = _flags_save_string;
591 uint32_t _flags_save_string = ndr->flags;
592 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
593 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
594 ndr->flags = _flags_save_string;
596 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
597 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
599 uint32_t _flags_save_string = ndr->flags;
600 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
601 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
602 ndr->flags = _flags_save_string;
605 uint32_t _flags_save_string = ndr->flags;
606 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
607 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
608 ndr->flags = _flags_save_string;
611 uint32_t _flags_save_string_array = ndr->flags;
612 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
613 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
614 ndr->flags = _flags_save_string_array;
616 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
617 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
619 uint32_t _flags_save_string = ndr->flags;
620 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
621 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
622 ndr->flags = _flags_save_string;
625 uint32_t _flags_save_string = ndr->flags;
626 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
627 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
628 ndr->flags = _flags_save_string;
631 uint32_t _flags_save_string = ndr->flags;
632 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
633 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
634 ndr->flags = _flags_save_string;
637 uint32_t _flags_save_string = ndr->flags;
638 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
639 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
640 ndr->flags = _flags_save_string;
642 NDR_CHECK(ndr_push_trailer_align(ndr, 8));
644 if (ndr_flags & NDR_BUFFERS) {
646 uint32_t _flags_save_string = ndr->flags;
647 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
648 if (r->driver_name) {
649 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
650 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
651 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
653 ndr->flags = _flags_save_string;
656 uint32_t _flags_save_string = ndr->flags;
657 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
658 if (r->architecture) {
659 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
660 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
661 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
663 ndr->flags = _flags_save_string;
665 if (r->file_info) {
666 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
667 #if 0
668 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->file_count));
669 #endif
670 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
671 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
673 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
674 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
676 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
679 uint32_t _flags_save_string = ndr->flags;
680 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
681 if (r->monitor_name) {
682 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
683 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
684 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
686 ndr->flags = _flags_save_string;
689 uint32_t _flags_save_string = ndr->flags;
690 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
691 if (r->default_datatype) {
692 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
693 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
694 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
696 ndr->flags = _flags_save_string;
699 uint32_t _flags_save_string_array = ndr->flags;
700 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
701 if (r->previous_names) {
702 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
703 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
704 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
706 ndr->flags = _flags_save_string_array;
709 uint32_t _flags_save_string = ndr->flags;
710 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
711 if (r->manufacturer_name) {
712 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
713 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
714 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
716 ndr->flags = _flags_save_string;
719 uint32_t _flags_save_string = ndr->flags;
720 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
721 if (r->manufacturer_url) {
722 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
723 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
724 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
726 ndr->flags = _flags_save_string;
729 uint32_t _flags_save_string = ndr->flags;
730 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
731 if (r->hardware_id) {
732 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
733 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
734 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
736 ndr->flags = _flags_save_string;
739 uint32_t _flags_save_string = ndr->flags;
740 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
741 if (r->provider) {
742 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
743 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
744 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
746 ndr->flags = _flags_save_string;
749 return NDR_ERR_SUCCESS;
752 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
754 uint32_t _ptr_driver_name;
755 TALLOC_CTX *_mem_save_driver_name_0;
756 uint32_t _ptr_architecture;
757 TALLOC_CTX *_mem_save_architecture_0;
758 uint32_t _ptr_file_info;
759 uint32_t cntr_file_info_1;
760 TALLOC_CTX *_mem_save_file_info_0;
761 TALLOC_CTX *_mem_save_file_info_1;
762 uint32_t _ptr_monitor_name;
763 TALLOC_CTX *_mem_save_monitor_name_0;
764 uint32_t _ptr_default_datatype;
765 TALLOC_CTX *_mem_save_default_datatype_0;
766 uint32_t _ptr_previous_names;
767 TALLOC_CTX *_mem_save_previous_names_0;
768 uint32_t _ptr_manufacturer_name;
769 TALLOC_CTX *_mem_save_manufacturer_name_0;
770 uint32_t _ptr_manufacturer_url;
771 TALLOC_CTX *_mem_save_manufacturer_url_0;
772 uint32_t _ptr_hardware_id;
773 TALLOC_CTX *_mem_save_hardware_id_0;
774 uint32_t _ptr_provider;
775 TALLOC_CTX *_mem_save_provider_0;
776 if (ndr_flags & NDR_SCALARS) {
777 NDR_CHECK(ndr_pull_align(ndr, 8));
778 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
780 uint32_t _flags_save_string = ndr->flags;
781 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
782 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
783 if (_ptr_driver_name) {
784 NDR_PULL_ALLOC(ndr, r->driver_name);
785 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
786 } else {
787 r->driver_name = NULL;
789 ndr->flags = _flags_save_string;
792 uint32_t _flags_save_string = ndr->flags;
793 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
794 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
795 if (_ptr_architecture) {
796 NDR_PULL_ALLOC(ndr, r->architecture);
797 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
798 } else {
799 r->architecture = NULL;
801 ndr->flags = _flags_save_string;
803 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
804 if (_ptr_file_info) {
805 NDR_PULL_ALLOC(ndr, r->file_info);
806 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
807 } else {
808 r->file_info = NULL;
810 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
812 uint32_t _flags_save_string = ndr->flags;
813 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
814 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
815 if (_ptr_monitor_name) {
816 NDR_PULL_ALLOC(ndr, r->monitor_name);
817 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
818 } else {
819 r->monitor_name = NULL;
821 ndr->flags = _flags_save_string;
824 uint32_t _flags_save_string = ndr->flags;
825 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
826 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
827 if (_ptr_default_datatype) {
828 NDR_PULL_ALLOC(ndr, r->default_datatype);
829 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
830 } else {
831 r->default_datatype = NULL;
833 ndr->flags = _flags_save_string;
836 uint32_t _flags_save_string_array = ndr->flags;
837 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
838 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
839 if (_ptr_previous_names) {
840 NDR_PULL_ALLOC(ndr, r->previous_names);
841 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
842 } else {
843 r->previous_names = NULL;
845 ndr->flags = _flags_save_string_array;
847 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
848 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
850 uint32_t _flags_save_string = ndr->flags;
851 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
852 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
853 if (_ptr_manufacturer_name) {
854 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
855 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
856 } else {
857 r->manufacturer_name = NULL;
859 ndr->flags = _flags_save_string;
862 uint32_t _flags_save_string = ndr->flags;
863 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
864 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
865 if (_ptr_manufacturer_url) {
866 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
867 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
868 } else {
869 r->manufacturer_url = NULL;
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_pull_generic_ptr(ndr, &_ptr_hardware_id));
877 if (_ptr_hardware_id) {
878 NDR_PULL_ALLOC(ndr, r->hardware_id);
879 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
880 } else {
881 r->hardware_id = NULL;
883 ndr->flags = _flags_save_string;
886 uint32_t _flags_save_string = ndr->flags;
887 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
888 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
889 if (_ptr_provider) {
890 NDR_PULL_ALLOC(ndr, r->provider);
891 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
892 } else {
893 r->provider = NULL;
895 ndr->flags = _flags_save_string;
897 NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
899 if (ndr_flags & NDR_BUFFERS) {
901 uint32_t _flags_save_string = ndr->flags;
902 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
903 if (r->driver_name) {
904 uint32_t _relative_save_offset;
905 _relative_save_offset = ndr->offset;
906 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
907 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
908 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
909 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
910 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
911 if (ndr->offset > ndr->relative_highest_offset) {
912 ndr->relative_highest_offset = ndr->offset;
914 ndr->offset = _relative_save_offset;
916 ndr->flags = _flags_save_string;
919 uint32_t _flags_save_string = ndr->flags;
920 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
921 if (r->architecture) {
922 uint32_t _relative_save_offset;
923 _relative_save_offset = ndr->offset;
924 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
925 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
926 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
927 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
928 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
929 if (ndr->offset > ndr->relative_highest_offset) {
930 ndr->relative_highest_offset = ndr->offset;
932 ndr->offset = _relative_save_offset;
934 ndr->flags = _flags_save_string;
936 if (r->file_info) {
937 uint32_t _relative_save_offset;
938 _relative_save_offset = ndr->offset;
939 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
940 _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
941 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
942 #if 0
943 NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
944 #else
945 NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
946 #endif
947 NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
948 _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
949 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
950 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
951 NDR_CHECK(ndr_pull_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_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
956 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
957 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
958 if (ndr->offset > ndr->relative_highest_offset) {
959 ndr->relative_highest_offset = ndr->offset;
961 ndr->offset = _relative_save_offset;
964 uint32_t _flags_save_string = ndr->flags;
965 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
966 if (r->monitor_name) {
967 uint32_t _relative_save_offset;
968 _relative_save_offset = ndr->offset;
969 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
970 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
971 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
972 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
973 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
974 if (ndr->offset > ndr->relative_highest_offset) {
975 ndr->relative_highest_offset = ndr->offset;
977 ndr->offset = _relative_save_offset;
979 ndr->flags = _flags_save_string;
982 uint32_t _flags_save_string = ndr->flags;
983 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
984 if (r->default_datatype) {
985 uint32_t _relative_save_offset;
986 _relative_save_offset = ndr->offset;
987 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
988 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
989 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
990 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
991 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
992 if (ndr->offset > ndr->relative_highest_offset) {
993 ndr->relative_highest_offset = ndr->offset;
995 ndr->offset = _relative_save_offset;
997 ndr->flags = _flags_save_string;
1000 uint32_t _flags_save_string_array = ndr->flags;
1001 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1002 if (r->previous_names) {
1003 uint32_t _relative_save_offset;
1004 _relative_save_offset = ndr->offset;
1005 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1006 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1007 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1008 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1009 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1010 if (ndr->offset > ndr->relative_highest_offset) {
1011 ndr->relative_highest_offset = ndr->offset;
1013 ndr->offset = _relative_save_offset;
1015 ndr->flags = _flags_save_string_array;
1018 uint32_t _flags_save_string = ndr->flags;
1019 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1020 if (r->manufacturer_name) {
1021 uint32_t _relative_save_offset;
1022 _relative_save_offset = ndr->offset;
1023 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1024 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1025 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1026 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1027 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1028 if (ndr->offset > ndr->relative_highest_offset) {
1029 ndr->relative_highest_offset = ndr->offset;
1031 ndr->offset = _relative_save_offset;
1033 ndr->flags = _flags_save_string;
1036 uint32_t _flags_save_string = ndr->flags;
1037 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1038 if (r->manufacturer_url) {
1039 uint32_t _relative_save_offset;
1040 _relative_save_offset = ndr->offset;
1041 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1042 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1043 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1044 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1045 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1046 if (ndr->offset > ndr->relative_highest_offset) {
1047 ndr->relative_highest_offset = ndr->offset;
1049 ndr->offset = _relative_save_offset;
1051 ndr->flags = _flags_save_string;
1054 uint32_t _flags_save_string = ndr->flags;
1055 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1056 if (r->hardware_id) {
1057 uint32_t _relative_save_offset;
1058 _relative_save_offset = ndr->offset;
1059 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1060 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1061 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1062 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1063 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1064 if (ndr->offset > ndr->relative_highest_offset) {
1065 ndr->relative_highest_offset = ndr->offset;
1067 ndr->offset = _relative_save_offset;
1069 ndr->flags = _flags_save_string;
1072 uint32_t _flags_save_string = ndr->flags;
1073 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1074 if (r->provider) {
1075 uint32_t _relative_save_offset;
1076 _relative_save_offset = ndr->offset;
1077 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1078 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1079 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1080 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1081 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1082 if (ndr->offset > ndr->relative_highest_offset) {
1083 ndr->relative_highest_offset = ndr->offset;
1085 ndr->offset = _relative_save_offset;
1087 ndr->flags = _flags_save_string;
1089 if (r->file_info) {
1090 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1093 return NDR_ERR_SUCCESS;
1096 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1098 int level;
1099 level = ndr_print_get_switch_value(ndr, r);
1100 ndr_print_union(ndr, name, level, "spoolss_Field");
1101 switch (level) {
1102 case PRINTER_NOTIFY_TYPE:
1103 ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1104 break;
1106 case JOB_NOTIFY_TYPE:
1107 ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1108 break;
1110 default:
1111 ndr_print_uint16(ndr, "field", r->field);
1112 break;
1117 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
1119 if (!r) {
1120 return 0;
1122 return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
1125 void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
1127 ndr_print_security_descriptor(ndr, name, r);
1130 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
1132 uint32_t _flags_save_STRUCT = ndr->flags;
1133 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1134 NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r));
1135 ndr->flags = _flags_save_STRUCT;
1136 return NDR_ERR_SUCCESS;
1139 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
1142 uint32_t _flags_save_STRUCT = ndr->flags;
1143 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1144 if (ndr_flags & NDR_SCALARS) {
1145 NDR_CHECK(ndr_push_align(ndr, 5));
1146 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
1147 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
1148 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
1149 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
1150 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
1151 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
1152 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1154 if (ndr_flags & NDR_BUFFERS) {
1155 if (r->sacl) {
1156 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
1157 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
1158 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
1160 if (r->dacl) {
1161 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
1162 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
1163 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
1165 if (r->owner_sid) {
1166 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
1167 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
1168 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
1170 if (r->group_sid) {
1171 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
1172 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
1173 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
1176 ndr->flags = _flags_save_STRUCT;
1178 return NDR_ERR_SUCCESS;
1181 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo2 *r)
1183 if (ndr_flags & NDR_SCALARS) {
1184 NDR_CHECK(ndr_push_align(ndr, 5));
1186 uint32_t _flags_save_string = ndr->flags;
1187 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1188 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->servername));
1189 ndr->flags = _flags_save_string;
1192 uint32_t _flags_save_string = ndr->flags;
1193 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1194 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printername));
1195 ndr->flags = _flags_save_string;
1198 uint32_t _flags_save_string = ndr->flags;
1199 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1200 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sharename));
1201 ndr->flags = _flags_save_string;
1204 uint32_t _flags_save_string = ndr->flags;
1205 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1206 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->portname));
1207 ndr->flags = _flags_save_string;
1210 uint32_t _flags_save_string = ndr->flags;
1211 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1212 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->drivername));
1213 ndr->flags = _flags_save_string;
1216 uint32_t _flags_save_string = ndr->flags;
1217 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1218 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->comment));
1219 ndr->flags = _flags_save_string;
1222 uint32_t _flags_save_string = ndr->flags;
1223 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1224 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->location));
1225 ndr->flags = _flags_save_string;
1228 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1229 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1230 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
1231 ndr->flags = _flags_save_spoolss_DeviceMode;
1234 uint32_t _flags_save_string = ndr->flags;
1235 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1236 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sepfile));
1237 ndr->flags = _flags_save_string;
1240 uint32_t _flags_save_string = ndr->flags;
1241 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1242 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printprocessor));
1243 ndr->flags = _flags_save_string;
1246 uint32_t _flags_save_string = ndr->flags;
1247 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1248 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->datatype));
1249 ndr->flags = _flags_save_string;
1252 uint32_t _flags_save_string = ndr->flags;
1253 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1254 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
1255 ndr->flags = _flags_save_string;
1258 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1259 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1260 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
1261 ndr->flags = _flags_save_spoolss_security_descriptor;
1263 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes));
1264 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
1265 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority));
1266 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->starttime));
1267 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->untiltime));
1268 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr, NDR_SCALARS, r->status));
1269 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->cjobs));
1270 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->averageppm));
1271 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1273 if (ndr_flags & NDR_BUFFERS) {
1275 uint32_t _flags_save_string = ndr->flags;
1276 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1277 if (r->servername) {
1278 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->servername));
1279 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
1280 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->servername));
1282 ndr->flags = _flags_save_string;
1285 uint32_t _flags_save_string = ndr->flags;
1286 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1287 if (r->printername) {
1288 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printername));
1289 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
1290 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printername));
1292 ndr->flags = _flags_save_string;
1295 uint32_t _flags_save_string = ndr->flags;
1296 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1297 if (r->sharename) {
1298 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sharename));
1299 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
1300 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sharename));
1302 ndr->flags = _flags_save_string;
1305 uint32_t _flags_save_string = ndr->flags;
1306 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1307 if (r->portname) {
1308 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->portname));
1309 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
1310 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->portname));
1312 ndr->flags = _flags_save_string;
1315 uint32_t _flags_save_string = ndr->flags;
1316 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1317 if (r->drivername) {
1318 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->drivername));
1319 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
1320 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->drivername));
1322 ndr->flags = _flags_save_string;
1325 uint32_t _flags_save_string = ndr->flags;
1326 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1327 if (r->comment) {
1328 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->comment));
1329 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
1330 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->comment));
1332 ndr->flags = _flags_save_string;
1335 uint32_t _flags_save_string = ndr->flags;
1336 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1337 if (r->location) {
1338 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->location));
1339 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
1340 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->location));
1342 ndr->flags = _flags_save_string;
1345 uint32_t _flags_save_string = ndr->flags;
1346 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1347 if (r->sepfile) {
1348 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sepfile));
1349 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
1350 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sepfile));
1352 ndr->flags = _flags_save_string;
1355 uint32_t _flags_save_string = ndr->flags;
1356 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1357 if (r->printprocessor) {
1358 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printprocessor));
1359 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
1360 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printprocessor));
1362 ndr->flags = _flags_save_string;
1365 uint32_t _flags_save_string = ndr->flags;
1366 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1367 if (r->datatype) {
1368 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->datatype));
1369 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
1370 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->datatype));
1372 ndr->flags = _flags_save_string;
1375 uint32_t _flags_save_string = ndr->flags;
1376 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1377 if (r->parameters) {
1378 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->parameters));
1379 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
1380 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->parameters));
1382 ndr->flags = _flags_save_string;
1385 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1386 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1387 if (r->devmode) {
1388 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->devmode));
1390 struct ndr_push *_ndr_devmode;
1391 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1));
1392 NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode));
1393 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1));
1395 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->devmode));
1397 ndr->flags = _flags_save_spoolss_DeviceMode;
1400 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1401 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1402 if (r->secdesc) {
1403 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->secdesc));
1405 struct ndr_push *_ndr_secdesc;
1406 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1));
1407 NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
1408 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1));
1410 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->secdesc));
1412 ndr->flags = _flags_save_spoolss_security_descriptor;
1415 return NDR_ERR_SUCCESS;