nss_winbind: add getgroupmembership for FreeBSD
[Samba.git] / librpc / ndr / ndr_spoolss_buf.c
blob8104ffde00c80bd0ca2ee693eb32a00cb3e0cd04
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"
29 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
30 if (!r->in.buffer && r->in.offered != 0) {\
31 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
32 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
33 (unsigned)r->in.offered);\
34 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
35 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
36 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
37 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
39 _r.in.level = r->in.level;\
40 _r.in.buffer = r->in.buffer;\
41 _r.in.offered = r->in.offered;\
42 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
43 } while(0)
45 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
46 struct ndr_push *_ndr_info;\
47 _r.in.level = r->in.level;\
48 _r.in.buffer = r->in.buffer;\
49 _r.in.offered = r->in.offered;\
50 _r.out.info = NULL;\
51 _r.out.needed = r->out.needed;\
52 _r.out.count = r->out.count;\
53 _r.out.result = r->out.result;\
54 if (r->out.info && *r->out.info && !r->in.buffer) {\
55 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
56 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
58 if (r->in.buffer) {\
59 DATA_BLOB _data_blob_info;\
60 _ndr_info = ndr_push_init_ctx(ndr);\
61 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
62 _ndr_info->flags= ndr->flags;\
63 if (r->out.info) {\
64 struct ndr_push *_subndr_info;\
65 struct __##fn __r;\
66 __r.in.level = r->in.level;\
67 __r.in.count = *r->out.count;\
68 __r.out.info = *r->out.info;\
69 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
70 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
71 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
73 if (r->in.offered > _ndr_info->offset) {\
74 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
75 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
76 } else if (r->in.offered < _ndr_info->offset) {\
77 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
78 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
79 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
81 _data_blob_info = ndr_push_blob(_ndr_info);\
82 _r.out.info = &_data_blob_info;\
84 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
85 } while(0)
87 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
88 struct _##fn _r;\
89 if (flags & NDR_IN) {\
90 in;\
91 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
93 if (flags & NDR_OUT) {\
94 out;\
95 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
97 } while(0)
99 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
100 ZERO_STRUCT(r->out);\
101 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
102 r->in.level = _r.in.level;\
103 r->in.buffer = _r.in.buffer;\
104 r->in.offered = _r.in.offered;\
105 r->out.needed = _r.out.needed;\
106 r->out.count = _r.out.count;\
107 if (!r->in.buffer && r->in.offered != 0) {\
108 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
109 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
110 (unsigned)r->in.offered);\
111 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
112 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
113 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
114 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
116 NDR_PULL_ALLOC(ndr, r->out.info);\
117 ZERO_STRUCTP(r->out.info);\
118 } while(0)
120 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
121 _r.in.level = r->in.level;\
122 _r.in.buffer = r->in.buffer;\
123 _r.in.offered = r->in.offered;\
124 _r.out.needed = r->out.needed;\
125 _r.out.count = r->out.count;\
126 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
127 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
128 NDR_PULL_ALLOC(ndr, r->out.info);\
130 *r->out.info = NULL;\
131 r->out.needed = _r.out.needed;\
132 r->out.count = _r.out.count;\
133 r->out.result = _r.out.result;\
134 if (_r.out.info) {\
135 struct ndr_pull *_ndr_info;\
136 NDR_PULL_ALLOC(ndr, *r->out.info);\
137 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
138 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
139 _ndr_info->flags= ndr->flags;\
140 if (r->in.offered != _ndr_info->data_size) {\
141 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
142 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
143 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
145 if (*r->out.needed <= _ndr_info->data_size) {\
146 struct __##fn __r;\
147 __r.in.level = r->in.level;\
148 __r.in.count = *r->out.count;\
149 __r.out.info = NULL;\
150 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
151 *r->out.info = __r.out.info;\
154 } while(0)
156 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
157 struct _##fn _r;\
158 if (flags & NDR_IN) {\
159 out;\
160 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
161 in;\
163 if (flags & NDR_OUT) {\
164 out;\
165 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
167 } while(0)
169 #define _NDR_CHECK_UINT32(call) do {\
170 enum ndr_err_code _ndr_err; \
171 _ndr_err = call; \
172 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
173 return 0; \
175 } while (0)
177 /* TODO: set _ndr_info->flags correct */
178 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
179 struct __##fn __r;\
180 DATA_BLOB _data_blob_info;\
181 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
182 if (!_ndr_info) return 0;\
183 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
184 __r.in.level = level;\
185 __r.in.count = count;\
186 __r.out.info = info;\
187 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
188 _data_blob_info = ndr_push_blob(_ndr_info);\
189 return _data_blob_info.length;\
190 } while(0)
192 /* TODO: set _ndr_info->flags correct */
193 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
194 struct __##fn __r;\
195 DATA_BLOB _data_blob_info;\
196 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
197 if (!_ndr_info) return 0;\
198 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
199 __r.in.count = count;\
200 __r.out.info = info;\
201 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
202 _data_blob_info = ndr_push_blob(_ndr_info);\
203 return _data_blob_info.length;\
204 } while(0)
208 spoolss_EnumPrinters
210 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
212 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
213 _r.in.flags = r->in.flags;
214 _r.in.server = r->in.server;
216 _r.in.flags = r->in.flags;
217 _r.in.server = r->in.server;
219 return NDR_ERR_SUCCESS;
222 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
224 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
225 r->in.flags = _r.in.flags;
226 r->in.server = _r.in.server;
228 _r.in.flags = r->in.flags;
229 _r.in.server = r->in.server;
231 return NDR_ERR_SUCCESS;
234 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
236 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
240 spoolss_EnumJobs
242 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
244 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
245 _r.in.handle = r->in.handle;
246 _r.in.firstjob = r->in.firstjob;
247 _r.in.numjobs = r->in.numjobs;
249 _r.in.handle = r->in.handle;
250 _r.in.firstjob = r->in.firstjob;
251 _r.in.numjobs = r->in.numjobs;
253 return NDR_ERR_SUCCESS;
256 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
258 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
259 r->in.handle = _r.in.handle;
260 r->in.firstjob = _r.in.firstjob;
261 r->in.numjobs = _r.in.numjobs;
263 _r.in.handle = r->in.handle;
264 _r.in.firstjob = r->in.firstjob;
265 _r.in.numjobs = r->in.numjobs;
267 return NDR_ERR_SUCCESS;
270 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
272 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
276 spoolss_EnumPrinterDrivers
278 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
280 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
281 _r.in.server = r->in.server;
282 _r.in.environment = r->in.environment;
284 _r.in.server = r->in.server;
285 _r.in.environment = r->in.environment;
287 return NDR_ERR_SUCCESS;
290 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
292 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
293 r->in.server = _r.in.server;
294 r->in.environment = _r.in.environment;
296 _r.in.server = r->in.server;
297 _r.in.environment = r->in.environment;
299 return NDR_ERR_SUCCESS;
302 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
304 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
308 spoolss_EnumForms
310 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
312 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
313 _r.in.handle = r->in.handle;
315 _r.in.handle = r->in.handle;
317 return NDR_ERR_SUCCESS;
320 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
322 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
323 r->in.handle = _r.in.handle;
325 _r.in.handle = r->in.handle;
327 return NDR_ERR_SUCCESS;
330 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
332 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
336 spoolss_EnumPorts
338 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
340 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
341 _r.in.servername= r->in.servername;
343 _r.in.servername= r->in.servername;
345 return NDR_ERR_SUCCESS;
348 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
350 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
351 r->in.servername= _r.in.servername;
353 _r.in.servername= r->in.servername;
355 return NDR_ERR_SUCCESS;
358 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
360 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
364 spoolss_EnumMonitors
366 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
368 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
369 _r.in.servername= r->in.servername;
371 _r.in.servername= r->in.servername;
373 return NDR_ERR_SUCCESS;
376 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
378 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
379 r->in.servername= _r.in.servername;
381 _r.in.servername= r->in.servername;
383 return NDR_ERR_SUCCESS;
386 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
388 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
392 spoolss_EnumPrintProcessors
394 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
396 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
397 _r.in.servername = r->in.servername;
398 _r.in.environment = r->in.environment;
400 _r.in.servername = r->in.servername;
401 _r.in.environment = r->in.environment;
403 return NDR_ERR_SUCCESS;
406 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
408 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
409 r->in.servername = _r.in.servername;
410 r->in.environment = _r.in.environment;
412 _r.in.servername = r->in.servername;
413 _r.in.environment = r->in.environment;
415 return NDR_ERR_SUCCESS;
418 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx,
419 uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
421 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
425 spoolss_EnumPrintProcessors
427 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
429 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes,{
430 _r.in.servername = r->in.servername;
431 _r.in.print_processor_name = r->in.print_processor_name;
433 _r.in.servername = r->in.servername;
434 _r.in.print_processor_name = r->in.print_processor_name;
436 return NDR_ERR_SUCCESS;
439 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
441 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes,{
442 r->in.servername = _r.in.servername;
443 r->in.print_processor_name = _r.in.print_processor_name;
445 _r.in.servername = r->in.servername;
446 _r.in.print_processor_name = r->in.print_processor_name;
448 return NDR_ERR_SUCCESS;
451 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx,
452 uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
454 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
458 spoolss_EnumPrinterDataEx
461 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
463 struct _spoolss_EnumPrinterDataEx _r;
464 if (flags & NDR_IN) {
465 _r.in.handle = r->in.handle;
466 _r.in.key_name = r->in.key_name;
467 _r.in.offered = r->in.offered;
468 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
470 if (flags & NDR_OUT) {
471 struct ndr_push *_ndr_info;
472 _r.in.handle = r->in.handle;
473 _r.in.key_name = r->in.key_name;
474 _r.in.offered = r->in.offered;
475 _r.out.count = r->out.count;
476 _r.out.needed = r->out.needed;
477 _r.out.result = r->out.result;
478 _r.out.info = data_blob(NULL, 0);
479 if (r->in.offered >= *r->out.needed) {
480 struct ndr_push *_subndr_info;
481 struct __spoolss_EnumPrinterDataEx __r;
482 _ndr_info = ndr_push_init_ctx(ndr);
483 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
484 _ndr_info->flags= ndr->flags;
485 __r.in.count = *r->out.count;
486 __r.out.info = *r->out.info;
487 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));
488 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_subndr_info, flags, &__r));
489 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));
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);
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,
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, uint32_t flags)
562 if (!devmode) return 0;
563 return ndr_size_spoolss_DeviceMode(devmode, flags);
566 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags)
568 if (!r) {
569 return 4;
572 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray);
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, 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);
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;
1418 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
1420 struct tm tm;
1421 time_t t;
1422 char *str;
1424 tm.tm_sec = r->second;
1425 tm.tm_min = r->minute;
1426 tm.tm_hour = r->hour;
1427 tm.tm_mday = r->day;
1428 tm.tm_mon = r->month - 1;
1429 tm.tm_year = r->year - 1900;
1430 tm.tm_wday = r->day_of_week;
1431 tm.tm_yday = 0;
1432 tm.tm_isdst = -1;
1434 t = mktime(&tm);
1436 str = timestring(ndr, t);
1438 ndr_print_struct(ndr, name, "spoolss_Time");
1439 ndr->depth++;
1440 ndr_print_string(ndr, "", str);
1441 ndr->depth--;
1442 talloc_free(str);
1445 _PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type)
1447 switch(type) {
1448 case REG_NONE:
1449 return 0;
1450 case REG_SZ:
1451 return LIBNDR_FLAG_ALIGN2;
1452 case REG_EXPAND_SZ:
1453 return LIBNDR_FLAG_ALIGN2;
1454 case REG_BINARY:
1455 return 0;
1456 case REG_DWORD:
1457 return LIBNDR_FLAG_ALIGN4;
1458 case REG_DWORD_BIG_ENDIAN:
1459 return LIBNDR_FLAG_ALIGN4;
1460 case REG_LINK:
1461 return 0;
1462 case REG_MULTI_SZ:
1463 return LIBNDR_FLAG_ALIGN2;
1464 case REG_RESOURCE_LIST:
1465 return LIBNDR_FLAG_ALIGN2;
1466 case REG_FULL_RESOURCE_DESCRIPTOR:
1467 return LIBNDR_FLAG_ALIGN4;
1468 case REG_RESOURCE_REQUIREMENTS_LIST:
1469 return LIBNDR_FLAG_ALIGN2;
1470 case REG_QWORD:
1471 return LIBNDR_FLAG_ALIGN8;
1474 return 0;