libsmbconf: Convert smbconf_delete_parameter() to sbcErr.
[Samba.git] / librpc / ndr / ndr_spoolss_buf.c
blob14fb222f4ac3487c9472d92e771a5b996b36f202
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);\
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);\
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);\
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);\
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, 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, 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, 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, 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, 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, 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,
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,
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 ndr_push *_subndr_info;
484 struct __spoolss_EnumPrinterDataEx __r;
485 _ndr_info = ndr_push_init_ctx(ndr);
486 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
487 _ndr_info->flags= ndr->flags;
488 __r.in.count = *r->out.count;
489 __r.out.info = *r->out.info;
490 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));
491 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_subndr_info, flags, &__r));
492 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));
493 if (r->in.offered > _ndr_info->offset) {
494 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
495 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
497 _r.out.info = ndr_push_blob(_ndr_info);
499 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
501 return NDR_ERR_SUCCESS;
504 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
506 struct _spoolss_EnumPrinterDataEx _r;
507 if (flags & NDR_IN) {
508 _r.in.handle = r->in.handle;
509 _r.in.key_name = r->in.key_name;
510 ZERO_STRUCT(r->out);
511 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
512 r->in.handle = _r.in.handle;
513 r->in.key_name = _r.in.key_name;
514 r->in.offered = _r.in.offered;
515 r->out.needed = _r.out.needed;
516 r->out.count = _r.out.count;
517 NDR_PULL_ALLOC(ndr, r->out.info);
518 ZERO_STRUCTP(r->out.info);
520 if (flags & NDR_OUT) {
521 _r.in.handle = r->in.handle;
522 _r.in.key_name = r->in.key_name;
523 _r.in.offered = r->in.offered;
524 _r.out.count = r->out.count;
525 _r.out.needed = r->out.needed;
526 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
527 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
528 NDR_PULL_ALLOC(ndr, r->out.info);
530 *r->out.info = NULL;
531 r->out.needed = _r.out.needed;
532 r->out.count = _r.out.count;
533 r->out.result = _r.out.result;
534 if (_r.out.info.length) {
535 struct ndr_pull *_ndr_info;
536 NDR_PULL_ALLOC(ndr, *r->out.info);
537 _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info);
538 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
539 _ndr_info->flags= ndr->flags;
540 if (r->in.offered != _ndr_info->data_size) {
541 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
542 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
543 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
545 if (*r->out.needed <= _ndr_info->data_size) {
546 struct __spoolss_EnumPrinterDataEx __r;
547 __r.in.count = *r->out.count;
548 __r.out.info = NULL;
549 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
550 *r->out.info = __r.out.info;
554 return NDR_ERR_SUCCESS;
557 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx,
558 uint32_t count, struct spoolss_PrinterEnumValues *info)
560 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
563 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags)
565 if (!devmode) return 0;
566 return ndr_size_spoolss_DeviceMode(devmode, flags);
569 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags)
571 if (!r) {
572 return 4;
575 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray);
578 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
579 * structs */
581 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
583 uint32_t cntr_file_info_1;
584 if (ndr_flags & NDR_SCALARS) {
585 NDR_CHECK(ndr_push_align(ndr, 8));
586 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
588 uint32_t _flags_save_string = ndr->flags;
589 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
590 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
591 ndr->flags = _flags_save_string;
594 uint32_t _flags_save_string = ndr->flags;
595 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
596 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
597 ndr->flags = _flags_save_string;
599 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
600 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
602 uint32_t _flags_save_string = ndr->flags;
603 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
604 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
605 ndr->flags = _flags_save_string;
608 uint32_t _flags_save_string = ndr->flags;
609 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
610 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
611 ndr->flags = _flags_save_string;
614 uint32_t _flags_save_string_array = ndr->flags;
615 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
616 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
617 ndr->flags = _flags_save_string_array;
619 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
620 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
622 uint32_t _flags_save_string = ndr->flags;
623 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
624 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
625 ndr->flags = _flags_save_string;
628 uint32_t _flags_save_string = ndr->flags;
629 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
630 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
631 ndr->flags = _flags_save_string;
634 uint32_t _flags_save_string = ndr->flags;
635 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
636 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
637 ndr->flags = _flags_save_string;
640 uint32_t _flags_save_string = ndr->flags;
641 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
642 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
643 ndr->flags = _flags_save_string;
645 NDR_CHECK(ndr_push_trailer_align(ndr, 8));
647 if (ndr_flags & NDR_BUFFERS) {
649 uint32_t _flags_save_string = ndr->flags;
650 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
651 if (r->driver_name) {
652 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
653 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
654 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
656 ndr->flags = _flags_save_string;
659 uint32_t _flags_save_string = ndr->flags;
660 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
661 if (r->architecture) {
662 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
663 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
664 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
666 ndr->flags = _flags_save_string;
668 if (r->file_info) {
669 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
670 #if 0
671 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->file_count));
672 #endif
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_SCALARS, &r->file_info[cntr_file_info_1]));
676 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
677 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
679 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
682 uint32_t _flags_save_string = ndr->flags;
683 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
684 if (r->monitor_name) {
685 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
686 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
687 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
689 ndr->flags = _flags_save_string;
692 uint32_t _flags_save_string = ndr->flags;
693 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
694 if (r->default_datatype) {
695 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
696 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
697 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
699 ndr->flags = _flags_save_string;
702 uint32_t _flags_save_string_array = ndr->flags;
703 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
704 if (r->previous_names) {
705 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
706 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
707 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
709 ndr->flags = _flags_save_string_array;
712 uint32_t _flags_save_string = ndr->flags;
713 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
714 if (r->manufacturer_name) {
715 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
716 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
717 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
719 ndr->flags = _flags_save_string;
722 uint32_t _flags_save_string = ndr->flags;
723 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
724 if (r->manufacturer_url) {
725 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
726 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
727 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
729 ndr->flags = _flags_save_string;
732 uint32_t _flags_save_string = ndr->flags;
733 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
734 if (r->hardware_id) {
735 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
736 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
737 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
739 ndr->flags = _flags_save_string;
742 uint32_t _flags_save_string = ndr->flags;
743 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
744 if (r->provider) {
745 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
746 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
747 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
749 ndr->flags = _flags_save_string;
752 return NDR_ERR_SUCCESS;
755 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
757 uint32_t _ptr_driver_name;
758 TALLOC_CTX *_mem_save_driver_name_0;
759 uint32_t _ptr_architecture;
760 TALLOC_CTX *_mem_save_architecture_0;
761 uint32_t _ptr_file_info;
762 uint32_t cntr_file_info_1;
763 TALLOC_CTX *_mem_save_file_info_0;
764 TALLOC_CTX *_mem_save_file_info_1;
765 uint32_t _ptr_monitor_name;
766 TALLOC_CTX *_mem_save_monitor_name_0;
767 uint32_t _ptr_default_datatype;
768 TALLOC_CTX *_mem_save_default_datatype_0;
769 uint32_t _ptr_previous_names;
770 TALLOC_CTX *_mem_save_previous_names_0;
771 uint32_t _ptr_manufacturer_name;
772 TALLOC_CTX *_mem_save_manufacturer_name_0;
773 uint32_t _ptr_manufacturer_url;
774 TALLOC_CTX *_mem_save_manufacturer_url_0;
775 uint32_t _ptr_hardware_id;
776 TALLOC_CTX *_mem_save_hardware_id_0;
777 uint32_t _ptr_provider;
778 TALLOC_CTX *_mem_save_provider_0;
779 if (ndr_flags & NDR_SCALARS) {
780 NDR_CHECK(ndr_pull_align(ndr, 8));
781 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
783 uint32_t _flags_save_string = ndr->flags;
784 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
785 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
786 if (_ptr_driver_name) {
787 NDR_PULL_ALLOC(ndr, r->driver_name);
788 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
789 } else {
790 r->driver_name = NULL;
792 ndr->flags = _flags_save_string;
795 uint32_t _flags_save_string = ndr->flags;
796 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
797 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
798 if (_ptr_architecture) {
799 NDR_PULL_ALLOC(ndr, r->architecture);
800 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
801 } else {
802 r->architecture = NULL;
804 ndr->flags = _flags_save_string;
806 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
807 if (_ptr_file_info) {
808 NDR_PULL_ALLOC(ndr, r->file_info);
809 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
810 } else {
811 r->file_info = NULL;
813 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
815 uint32_t _flags_save_string = ndr->flags;
816 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
817 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
818 if (_ptr_monitor_name) {
819 NDR_PULL_ALLOC(ndr, r->monitor_name);
820 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
821 } else {
822 r->monitor_name = NULL;
824 ndr->flags = _flags_save_string;
827 uint32_t _flags_save_string = ndr->flags;
828 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
829 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
830 if (_ptr_default_datatype) {
831 NDR_PULL_ALLOC(ndr, r->default_datatype);
832 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
833 } else {
834 r->default_datatype = NULL;
836 ndr->flags = _flags_save_string;
839 uint32_t _flags_save_string_array = ndr->flags;
840 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
841 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
842 if (_ptr_previous_names) {
843 NDR_PULL_ALLOC(ndr, r->previous_names);
844 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
845 } else {
846 r->previous_names = NULL;
848 ndr->flags = _flags_save_string_array;
850 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
851 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
853 uint32_t _flags_save_string = ndr->flags;
854 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
855 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
856 if (_ptr_manufacturer_name) {
857 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
858 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
859 } else {
860 r->manufacturer_name = NULL;
862 ndr->flags = _flags_save_string;
865 uint32_t _flags_save_string = ndr->flags;
866 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
867 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
868 if (_ptr_manufacturer_url) {
869 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
870 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
871 } else {
872 r->manufacturer_url = NULL;
874 ndr->flags = _flags_save_string;
877 uint32_t _flags_save_string = ndr->flags;
878 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
879 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
880 if (_ptr_hardware_id) {
881 NDR_PULL_ALLOC(ndr, r->hardware_id);
882 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
883 } else {
884 r->hardware_id = NULL;
886 ndr->flags = _flags_save_string;
889 uint32_t _flags_save_string = ndr->flags;
890 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
891 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
892 if (_ptr_provider) {
893 NDR_PULL_ALLOC(ndr, r->provider);
894 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
895 } else {
896 r->provider = NULL;
898 ndr->flags = _flags_save_string;
900 NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
902 if (ndr_flags & NDR_BUFFERS) {
904 uint32_t _flags_save_string = ndr->flags;
905 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
906 if (r->driver_name) {
907 uint32_t _relative_save_offset;
908 _relative_save_offset = ndr->offset;
909 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
910 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
911 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
912 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
913 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
914 if (ndr->offset > ndr->relative_highest_offset) {
915 ndr->relative_highest_offset = ndr->offset;
917 ndr->offset = _relative_save_offset;
919 ndr->flags = _flags_save_string;
922 uint32_t _flags_save_string = ndr->flags;
923 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
924 if (r->architecture) {
925 uint32_t _relative_save_offset;
926 _relative_save_offset = ndr->offset;
927 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
928 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
929 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
930 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
931 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
932 if (ndr->offset > ndr->relative_highest_offset) {
933 ndr->relative_highest_offset = ndr->offset;
935 ndr->offset = _relative_save_offset;
937 ndr->flags = _flags_save_string;
939 if (r->file_info) {
940 uint32_t _relative_save_offset;
941 _relative_save_offset = ndr->offset;
942 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
943 _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
944 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
945 #if 0
946 NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
947 #else
948 NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
949 #endif
950 NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
951 _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
952 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
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_SCALARS, &r->file_info[cntr_file_info_1]));
956 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
957 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
959 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
960 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
961 if (ndr->offset > ndr->relative_highest_offset) {
962 ndr->relative_highest_offset = ndr->offset;
964 ndr->offset = _relative_save_offset;
967 uint32_t _flags_save_string = ndr->flags;
968 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
969 if (r->monitor_name) {
970 uint32_t _relative_save_offset;
971 _relative_save_offset = ndr->offset;
972 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
973 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
974 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
975 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
976 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
977 if (ndr->offset > ndr->relative_highest_offset) {
978 ndr->relative_highest_offset = ndr->offset;
980 ndr->offset = _relative_save_offset;
982 ndr->flags = _flags_save_string;
985 uint32_t _flags_save_string = ndr->flags;
986 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
987 if (r->default_datatype) {
988 uint32_t _relative_save_offset;
989 _relative_save_offset = ndr->offset;
990 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
991 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
992 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
993 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
994 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
995 if (ndr->offset > ndr->relative_highest_offset) {
996 ndr->relative_highest_offset = ndr->offset;
998 ndr->offset = _relative_save_offset;
1000 ndr->flags = _flags_save_string;
1003 uint32_t _flags_save_string_array = ndr->flags;
1004 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1005 if (r->previous_names) {
1006 uint32_t _relative_save_offset;
1007 _relative_save_offset = ndr->offset;
1008 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1009 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1010 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1011 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1012 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1013 if (ndr->offset > ndr->relative_highest_offset) {
1014 ndr->relative_highest_offset = ndr->offset;
1016 ndr->offset = _relative_save_offset;
1018 ndr->flags = _flags_save_string_array;
1021 uint32_t _flags_save_string = ndr->flags;
1022 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1023 if (r->manufacturer_name) {
1024 uint32_t _relative_save_offset;
1025 _relative_save_offset = ndr->offset;
1026 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1027 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1028 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1029 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1030 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1031 if (ndr->offset > ndr->relative_highest_offset) {
1032 ndr->relative_highest_offset = ndr->offset;
1034 ndr->offset = _relative_save_offset;
1036 ndr->flags = _flags_save_string;
1039 uint32_t _flags_save_string = ndr->flags;
1040 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1041 if (r->manufacturer_url) {
1042 uint32_t _relative_save_offset;
1043 _relative_save_offset = ndr->offset;
1044 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1045 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1046 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1047 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1048 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1049 if (ndr->offset > ndr->relative_highest_offset) {
1050 ndr->relative_highest_offset = ndr->offset;
1052 ndr->offset = _relative_save_offset;
1054 ndr->flags = _flags_save_string;
1057 uint32_t _flags_save_string = ndr->flags;
1058 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1059 if (r->hardware_id) {
1060 uint32_t _relative_save_offset;
1061 _relative_save_offset = ndr->offset;
1062 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1063 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1064 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1065 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1066 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1067 if (ndr->offset > ndr->relative_highest_offset) {
1068 ndr->relative_highest_offset = ndr->offset;
1070 ndr->offset = _relative_save_offset;
1072 ndr->flags = _flags_save_string;
1075 uint32_t _flags_save_string = ndr->flags;
1076 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1077 if (r->provider) {
1078 uint32_t _relative_save_offset;
1079 _relative_save_offset = ndr->offset;
1080 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1081 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1082 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1083 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1084 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1085 if (ndr->offset > ndr->relative_highest_offset) {
1086 ndr->relative_highest_offset = ndr->offset;
1088 ndr->offset = _relative_save_offset;
1090 ndr->flags = _flags_save_string;
1092 if (r->file_info) {
1093 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1096 return NDR_ERR_SUCCESS;
1099 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1101 int level;
1102 level = ndr_print_get_switch_value(ndr, r);
1103 ndr_print_union(ndr, name, level, "spoolss_Field");
1104 switch (level) {
1105 case PRINTER_NOTIFY_TYPE:
1106 ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1107 break;
1109 case JOB_NOTIFY_TYPE:
1110 ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1111 break;
1113 default:
1114 ndr_print_uint16(ndr, "field", r->field);
1115 break;
1120 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, int flags)
1122 if (!r) {
1123 return 0;
1125 return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData);
1128 void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
1130 ndr_print_security_descriptor(ndr, name, r);
1133 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
1135 uint32_t _flags_save_STRUCT = ndr->flags;
1136 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1137 NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r));
1138 ndr->flags = _flags_save_STRUCT;
1139 return NDR_ERR_SUCCESS;
1142 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
1145 uint32_t _flags_save_STRUCT = ndr->flags;
1146 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1147 if (ndr_flags & NDR_SCALARS) {
1148 NDR_CHECK(ndr_push_align(ndr, 5));
1149 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
1150 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
1151 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
1152 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
1153 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
1154 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
1155 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1157 if (ndr_flags & NDR_BUFFERS) {
1158 if (r->sacl) {
1159 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
1160 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
1161 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
1163 if (r->dacl) {
1164 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
1165 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
1166 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
1168 if (r->owner_sid) {
1169 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
1170 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
1171 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
1173 if (r->group_sid) {
1174 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
1175 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
1176 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
1179 ndr->flags = _flags_save_STRUCT;
1181 return NDR_ERR_SUCCESS;
1184 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo2 *r)
1186 if (ndr_flags & NDR_SCALARS) {
1187 NDR_CHECK(ndr_push_align(ndr, 5));
1189 uint32_t _flags_save_string = ndr->flags;
1190 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1191 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->servername));
1192 ndr->flags = _flags_save_string;
1195 uint32_t _flags_save_string = ndr->flags;
1196 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1197 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printername));
1198 ndr->flags = _flags_save_string;
1201 uint32_t _flags_save_string = ndr->flags;
1202 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1203 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sharename));
1204 ndr->flags = _flags_save_string;
1207 uint32_t _flags_save_string = ndr->flags;
1208 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1209 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->portname));
1210 ndr->flags = _flags_save_string;
1213 uint32_t _flags_save_string = ndr->flags;
1214 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1215 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->drivername));
1216 ndr->flags = _flags_save_string;
1219 uint32_t _flags_save_string = ndr->flags;
1220 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1221 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->comment));
1222 ndr->flags = _flags_save_string;
1225 uint32_t _flags_save_string = ndr->flags;
1226 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1227 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->location));
1228 ndr->flags = _flags_save_string;
1231 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1232 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1233 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
1234 ndr->flags = _flags_save_spoolss_DeviceMode;
1237 uint32_t _flags_save_string = ndr->flags;
1238 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1239 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sepfile));
1240 ndr->flags = _flags_save_string;
1243 uint32_t _flags_save_string = ndr->flags;
1244 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1245 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printprocessor));
1246 ndr->flags = _flags_save_string;
1249 uint32_t _flags_save_string = ndr->flags;
1250 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1251 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->datatype));
1252 ndr->flags = _flags_save_string;
1255 uint32_t _flags_save_string = ndr->flags;
1256 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1257 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
1258 ndr->flags = _flags_save_string;
1261 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1262 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1263 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
1264 ndr->flags = _flags_save_spoolss_security_descriptor;
1266 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes));
1267 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
1268 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority));
1269 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->starttime));
1270 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->untiltime));
1271 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr, NDR_SCALARS, r->status));
1272 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->cjobs));
1273 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->averageppm));
1274 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1276 if (ndr_flags & NDR_BUFFERS) {
1278 uint32_t _flags_save_string = ndr->flags;
1279 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1280 if (r->servername) {
1281 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->servername));
1282 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
1283 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->servername));
1285 ndr->flags = _flags_save_string;
1288 uint32_t _flags_save_string = ndr->flags;
1289 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1290 if (r->printername) {
1291 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printername));
1292 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
1293 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printername));
1295 ndr->flags = _flags_save_string;
1298 uint32_t _flags_save_string = ndr->flags;
1299 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1300 if (r->sharename) {
1301 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sharename));
1302 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
1303 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sharename));
1305 ndr->flags = _flags_save_string;
1308 uint32_t _flags_save_string = ndr->flags;
1309 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1310 if (r->portname) {
1311 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->portname));
1312 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
1313 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->portname));
1315 ndr->flags = _flags_save_string;
1318 uint32_t _flags_save_string = ndr->flags;
1319 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1320 if (r->drivername) {
1321 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->drivername));
1322 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
1323 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->drivername));
1325 ndr->flags = _flags_save_string;
1328 uint32_t _flags_save_string = ndr->flags;
1329 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1330 if (r->comment) {
1331 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->comment));
1332 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
1333 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->comment));
1335 ndr->flags = _flags_save_string;
1338 uint32_t _flags_save_string = ndr->flags;
1339 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1340 if (r->location) {
1341 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->location));
1342 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
1343 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->location));
1345 ndr->flags = _flags_save_string;
1348 uint32_t _flags_save_string = ndr->flags;
1349 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1350 if (r->sepfile) {
1351 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sepfile));
1352 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
1353 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sepfile));
1355 ndr->flags = _flags_save_string;
1358 uint32_t _flags_save_string = ndr->flags;
1359 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1360 if (r->printprocessor) {
1361 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printprocessor));
1362 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
1363 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printprocessor));
1365 ndr->flags = _flags_save_string;
1368 uint32_t _flags_save_string = ndr->flags;
1369 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1370 if (r->datatype) {
1371 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->datatype));
1372 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
1373 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->datatype));
1375 ndr->flags = _flags_save_string;
1378 uint32_t _flags_save_string = ndr->flags;
1379 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1380 if (r->parameters) {
1381 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->parameters));
1382 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
1383 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->parameters));
1385 ndr->flags = _flags_save_string;
1388 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1389 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1390 if (r->devmode) {
1391 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->devmode));
1393 struct ndr_push *_ndr_devmode;
1394 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1));
1395 NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode));
1396 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1));
1398 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->devmode));
1400 ndr->flags = _flags_save_spoolss_DeviceMode;
1403 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1404 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1405 if (r->secdesc) {
1406 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->secdesc));
1408 struct ndr_push *_ndr_secdesc;
1409 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1));
1410 NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
1411 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1));
1413 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->secdesc));
1415 ndr->flags = _flags_save_spoolss_security_descriptor;
1418 return NDR_ERR_SUCCESS;
1421 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
1423 struct tm tm;
1424 time_t t;
1425 char *str;
1427 tm.tm_sec = r->second;
1428 tm.tm_min = r->minute;
1429 tm.tm_hour = r->hour;
1430 tm.tm_mday = r->day;
1431 tm.tm_mon = r->month - 1;
1432 tm.tm_year = r->year - 1900;
1433 tm.tm_wday = r->day_of_week;
1434 tm.tm_yday = 0;
1435 tm.tm_isdst = -1;
1437 t = mktime(&tm);
1439 str = timestring(ndr, t);
1441 ndr_print_struct(ndr, name, "spoolss_Time");
1442 ndr->depth++;
1443 ndr_print_string(ndr, "", str);
1444 ndr->depth--;
1445 talloc_free(str);
1448 _PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type)
1450 switch(type) {
1451 case REG_NONE:
1452 return 0;
1453 case REG_SZ:
1454 return LIBNDR_FLAG_ALIGN2;
1455 case REG_EXPAND_SZ:
1456 return LIBNDR_FLAG_ALIGN2;
1457 case REG_BINARY:
1458 return 0;
1459 case REG_DWORD:
1460 return LIBNDR_FLAG_ALIGN4;
1461 case REG_DWORD_BIG_ENDIAN:
1462 return LIBNDR_FLAG_ALIGN4;
1463 case REG_LINK:
1464 return 0;
1465 case REG_MULTI_SZ:
1466 return LIBNDR_FLAG_ALIGN2;
1467 case REG_RESOURCE_LIST:
1468 return LIBNDR_FLAG_ALIGN2;
1469 case REG_FULL_RESOURCE_DESCRIPTOR:
1470 return LIBNDR_FLAG_ALIGN4;
1471 case REG_RESOURCE_REQUIREMENTS_LIST:
1472 return LIBNDR_FLAG_ALIGN2;
1473 case REG_QWORD:
1474 return LIBNDR_FLAG_ALIGN8;
1477 return 0;