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
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "librpc/gen_ndr/ndr_spoolss.h"
26 #if (_SAMBA_BUILD_ >= 4)
27 #include "param/param.h"
30 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
31 if (!r->in.buffer && r->in.offered != 0) {\
32 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
33 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
34 (unsigned)r->in.offered);\
35 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
36 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
37 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
38 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
40 _r.in.level = r->in.level;\
41 _r.in.buffer = r->in.buffer;\
42 _r.in.offered = r->in.offered;\
43 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
46 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
47 struct ndr_push *_ndr_info;\
48 _r.in.level = r->in.level;\
49 _r.in.buffer = r->in.buffer;\
50 _r.in.offered = r->in.offered;\
52 _r.out.needed = r->out.needed;\
53 _r.out.count = r->out.count;\
54 _r.out.result = r->out.result;\
55 if (r->out.info && *r->out.info && !r->in.buffer) {\
56 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
57 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
60 DATA_BLOB _data_blob_info;\
61 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
62 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
63 _ndr_info->flags= ndr->flags;\
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___##fn(_ndr_info, flags, &__r)); \
71 if (r->in.offered > _ndr_info->offset) {\
72 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
73 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
74 } else if (r->in.offered < _ndr_info->offset) {\
75 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
76 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
77 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
79 _data_blob_info = ndr_push_blob(_ndr_info);\
80 _r.out.info = &_data_blob_info;\
82 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
85 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
87 if (flags & NDR_IN) {\
89 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
91 if (flags & NDR_OUT) {\
93 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
97 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
99 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
100 r->in.level = _r.in.level;\
101 r->in.buffer = _r.in.buffer;\
102 r->in.offered = _r.in.offered;\
103 r->out.needed = _r.out.needed;\
104 r->out.count = _r.out.count;\
105 if (!r->in.buffer && r->in.offered != 0) {\
106 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
107 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
108 (unsigned)r->in.offered);\
109 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
110 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
111 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
112 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
114 NDR_PULL_ALLOC(ndr, r->out.info);\
115 ZERO_STRUCTP(r->out.info);\
118 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
119 _r.in.level = r->in.level;\
120 _r.in.buffer = r->in.buffer;\
121 _r.in.offered = r->in.offered;\
122 _r.out.needed = r->out.needed;\
123 _r.out.count = r->out.count;\
124 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
125 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
126 NDR_PULL_ALLOC(ndr, r->out.info);\
128 *r->out.info = NULL;\
129 r->out.needed = _r.out.needed;\
130 r->out.count = _r.out.count;\
131 r->out.result = _r.out.result;\
133 struct ndr_pull *_ndr_info;\
134 NDR_PULL_ALLOC(ndr, *r->out.info);\
135 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
136 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
137 _ndr_info->flags= ndr->flags;\
138 if (r->in.offered != _ndr_info->data_size) {\
139 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
140 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
141 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
143 if (*r->out.needed <= _ndr_info->data_size) {\
145 __r.in.level = r->in.level;\
146 __r.in.count = *r->out.count;\
147 __r.out.info = NULL;\
148 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
149 *r->out.info = __r.out.info;\
154 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
156 if (flags & NDR_IN) {\
158 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
161 if (flags & NDR_OUT) {\
163 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
167 #define _NDR_CHECK_UINT32(call) do {\
168 enum ndr_err_code _ndr_err; \
170 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
175 /* TODO: set _ndr_info->flags correct */
176 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
178 DATA_BLOB _data_blob_info;\
179 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
180 if (!_ndr_info) return 0;\
181 _ndr_info->flags|=0;\
182 __r.in.level = level;\
183 __r.in.count = count;\
184 __r.out.info = info;\
185 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
186 _data_blob_info = ndr_push_blob(_ndr_info);\
187 return _data_blob_info.length;\
190 /* TODO: set _ndr_info->flags correct */
191 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
193 DATA_BLOB _data_blob_info;\
194 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
195 if (!_ndr_info) return 0;\
196 _ndr_info->flags|=0;\
197 __r.in.count = count;\
198 __r.out.info = info;\
199 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
200 _data_blob_info = ndr_push_blob(_ndr_info);\
201 return _data_blob_info.length;\
208 enum ndr_err_code
ndr_push_spoolss_EnumPrinters(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinters
*r
)
210 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters
,{
211 _r
.in
.flags
= r
->in
.flags
;
212 _r
.in
.server
= r
->in
.server
;
214 _r
.in
.flags
= r
->in
.flags
;
215 _r
.in
.server
= r
->in
.server
;
217 return NDR_ERR_SUCCESS
;
220 enum ndr_err_code
ndr_pull_spoolss_EnumPrinters(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinters
*r
)
222 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters
,{
223 r
->in
.flags
= _r
.in
.flags
;
224 r
->in
.server
= _r
.in
.server
;
226 _r
.in
.flags
= r
->in
.flags
;
227 _r
.in
.server
= r
->in
.server
;
229 return NDR_ERR_SUCCESS
;
232 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_PrinterInfo
*info
)
234 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters
);
240 enum ndr_err_code
ndr_push_spoolss_EnumJobs(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumJobs
*r
)
242 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs
,{
243 _r
.in
.handle
= r
->in
.handle
;
244 _r
.in
.firstjob
= r
->in
.firstjob
;
245 _r
.in
.numjobs
= r
->in
.numjobs
;
247 _r
.in
.handle
= r
->in
.handle
;
248 _r
.in
.firstjob
= r
->in
.firstjob
;
249 _r
.in
.numjobs
= r
->in
.numjobs
;
251 return NDR_ERR_SUCCESS
;
254 enum ndr_err_code
ndr_pull_spoolss_EnumJobs(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumJobs
*r
)
256 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs
,{
257 r
->in
.handle
= _r
.in
.handle
;
258 r
->in
.firstjob
= _r
.in
.firstjob
;
259 r
->in
.numjobs
= _r
.in
.numjobs
;
261 _r
.in
.handle
= r
->in
.handle
;
262 _r
.in
.firstjob
= r
->in
.firstjob
;
263 _r
.in
.numjobs
= r
->in
.numjobs
;
265 return NDR_ERR_SUCCESS
;
268 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_JobInfo
*info
)
270 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs
);
274 spoolss_EnumPrinterDrivers
276 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDrivers
*r
)
278 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers
,{
279 _r
.in
.server
= r
->in
.server
;
280 _r
.in
.environment
= r
->in
.environment
;
282 _r
.in
.server
= r
->in
.server
;
283 _r
.in
.environment
= r
->in
.environment
;
285 return NDR_ERR_SUCCESS
;
288 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDrivers
*r
)
290 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers
,{
291 r
->in
.server
= _r
.in
.server
;
292 r
->in
.environment
= _r
.in
.environment
;
294 _r
.in
.server
= r
->in
.server
;
295 _r
.in
.environment
= r
->in
.environment
;
297 return NDR_ERR_SUCCESS
;
300 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_DriverInfo
*info
)
302 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers
);
308 enum ndr_err_code
ndr_push_spoolss_EnumForms(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumForms
*r
)
310 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms
,{
311 _r
.in
.handle
= r
->in
.handle
;
313 _r
.in
.handle
= r
->in
.handle
;
315 return NDR_ERR_SUCCESS
;
318 enum ndr_err_code
ndr_pull_spoolss_EnumForms(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumForms
*r
)
320 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms
,{
321 r
->in
.handle
= _r
.in
.handle
;
323 _r
.in
.handle
= r
->in
.handle
;
325 return NDR_ERR_SUCCESS
;
328 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_FormInfo
*info
)
330 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms
);
336 enum ndr_err_code
ndr_push_spoolss_EnumPorts(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPorts
*r
)
338 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts
,{
339 _r
.in
.servername
= r
->in
.servername
;
341 _r
.in
.servername
= r
->in
.servername
;
343 return NDR_ERR_SUCCESS
;
346 enum ndr_err_code
ndr_pull_spoolss_EnumPorts(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPorts
*r
)
348 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts
,{
349 r
->in
.servername
= _r
.in
.servername
;
351 _r
.in
.servername
= r
->in
.servername
;
353 return NDR_ERR_SUCCESS
;
356 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_PortInfo
*info
)
358 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts
);
364 enum ndr_err_code
ndr_push_spoolss_EnumMonitors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumMonitors
*r
)
366 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors
,{
367 _r
.in
.servername
= r
->in
.servername
;
369 _r
.in
.servername
= r
->in
.servername
;
371 return NDR_ERR_SUCCESS
;
374 enum ndr_err_code
ndr_pull_spoolss_EnumMonitors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumMonitors
*r
)
376 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors
,{
377 r
->in
.servername
= _r
.in
.servername
;
379 _r
.in
.servername
= r
->in
.servername
;
381 return NDR_ERR_SUCCESS
;
384 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_MonitorInfo
*info
)
386 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors
);
390 spoolss_EnumPrintProcessors
392 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcessors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcessors
*r
)
394 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors
,{
395 _r
.in
.servername
= r
->in
.servername
;
396 _r
.in
.environment
= r
->in
.environment
;
398 _r
.in
.servername
= r
->in
.servername
;
399 _r
.in
.environment
= r
->in
.environment
;
401 return NDR_ERR_SUCCESS
;
404 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcessors
*r
)
406 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors
,{
407 r
->in
.servername
= _r
.in
.servername
;
408 r
->in
.environment
= _r
.in
.environment
;
410 _r
.in
.servername
= r
->in
.servername
;
411 _r
.in
.environment
= r
->in
.environment
;
413 return NDR_ERR_SUCCESS
;
416 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
417 uint32_t level
, uint32_t count
, union spoolss_PrintProcessorInfo
*info
)
419 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors
);
423 spoolss_EnumPrintProcessors
425 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcDataTypes
*r
)
427 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes
,{
428 _r
.in
.servername
= r
->in
.servername
;
429 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
431 _r
.in
.servername
= r
->in
.servername
;
432 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
434 return NDR_ERR_SUCCESS
;
437 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcDataTypes
*r
)
439 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes
,{
440 r
->in
.servername
= _r
.in
.servername
;
441 r
->in
.print_processor_name
= _r
.in
.print_processor_name
;
443 _r
.in
.servername
= r
->in
.servername
;
444 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
446 return NDR_ERR_SUCCESS
;
449 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
450 uint32_t level
, uint32_t count
, union spoolss_PrintProcDataTypesInfo
*info
)
452 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes
);
456 spoolss_EnumPrinterDataEx
459 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDataEx
*r
)
461 struct _spoolss_EnumPrinterDataEx _r
;
462 if (flags
& NDR_IN
) {
463 _r
.in
.handle
= r
->in
.handle
;
464 _r
.in
.key_name
= r
->in
.key_name
;
465 _r
.in
.offered
= r
->in
.offered
;
466 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
468 if (flags
& NDR_OUT
) {
469 struct ndr_push
*_ndr_info
;
470 _r
.in
.handle
= r
->in
.handle
;
471 _r
.in
.key_name
= r
->in
.key_name
;
472 _r
.in
.offered
= r
->in
.offered
;
473 _r
.out
.count
= r
->out
.count
;
474 _r
.out
.needed
= r
->out
.needed
;
475 _r
.out
.result
= r
->out
.result
;
476 _r
.out
.info
= data_blob(NULL
, 0);
477 if (r
->in
.offered
>= *r
->out
.needed
) {
478 struct __spoolss_EnumPrinterDataEx __r
;
479 _ndr_info
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
480 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
481 _ndr_info
->flags
= ndr
->flags
;
482 __r
.in
.count
= *r
->out
.count
;
483 __r
.out
.info
= *r
->out
.info
;
484 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info
, flags
, &__r
));
485 if (r
->in
.offered
> _ndr_info
->offset
) {
486 uint32_t _padding_len
= r
->in
.offered
- _ndr_info
->offset
;
487 NDR_CHECK(ndr_push_zero(_ndr_info
, _padding_len
));
489 _r
.out
.info
= ndr_push_blob(_ndr_info
);
491 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
493 return NDR_ERR_SUCCESS
;
496 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDataEx
*r
)
498 struct _spoolss_EnumPrinterDataEx _r
;
499 if (flags
& NDR_IN
) {
500 _r
.in
.handle
= r
->in
.handle
;
501 _r
.in
.key_name
= r
->in
.key_name
;
503 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
504 r
->in
.handle
= _r
.in
.handle
;
505 r
->in
.key_name
= _r
.in
.key_name
;
506 r
->in
.offered
= _r
.in
.offered
;
507 r
->out
.needed
= _r
.out
.needed
;
508 r
->out
.count
= _r
.out
.count
;
509 NDR_PULL_ALLOC(ndr
, r
->out
.info
);
510 ZERO_STRUCTP(r
->out
.info
);
512 if (flags
& NDR_OUT
) {
513 _r
.in
.handle
= r
->in
.handle
;
514 _r
.in
.key_name
= r
->in
.key_name
;
515 _r
.in
.offered
= r
->in
.offered
;
516 _r
.out
.count
= r
->out
.count
;
517 _r
.out
.needed
= r
->out
.needed
;
518 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
519 if (ndr
->flags
& LIBNDR_FLAG_REF_ALLOC
) {
520 NDR_PULL_ALLOC(ndr
, r
->out
.info
);
523 r
->out
.needed
= _r
.out
.needed
;
524 r
->out
.count
= _r
.out
.count
;
525 r
->out
.result
= _r
.out
.result
;
526 if (_r
.out
.info
.length
) {
527 struct ndr_pull
*_ndr_info
;
528 NDR_PULL_ALLOC(ndr
, *r
->out
.info
);
529 _ndr_info
= ndr_pull_init_blob(&_r
.out
.info
, *r
->out
.info
, ndr
->iconv_convenience
);
530 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
531 _ndr_info
->flags
= ndr
->flags
;
532 if (r
->in
.offered
!= _ndr_info
->data_size
) {
533 return ndr_pull_error(ndr
, NDR_ERR_BUFSIZE
,
534 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
535 (unsigned)r
->in
.offered
, (unsigned)_ndr_info
->data_size
);
537 if (*r
->out
.needed
<= _ndr_info
->data_size
) {
538 struct __spoolss_EnumPrinterDataEx __r
;
539 __r
.in
.count
= *r
->out
.count
;
541 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info
, flags
, &__r
));
542 *r
->out
.info
= __r
.out
.info
;
546 return NDR_ERR_SUCCESS
;
549 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
550 uint32_t count
, struct spoolss_PrinterEnumValues
*info
)
552 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx
);
556 spoolss_GetPrinterData
558 enum ndr_err_code
ndr_push_spoolss_GetPrinterData(struct ndr_push
*ndr
, int flags
, const struct spoolss_GetPrinterData
*r
)
560 struct _spoolss_GetPrinterData _r
;
561 if (flags
& NDR_IN
) {
562 _r
.in
.handle
= r
->in
.handle
;
563 _r
.in
.value_name
= r
->in
.value_name
;
564 _r
.in
.offered
= r
->in
.offered
;
565 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr
, flags
, &_r
));
567 if (flags
& NDR_OUT
) {
568 struct ndr_push
*_ndr_info
;
569 DATA_BLOB blob
= data_blob(NULL
, 0);
570 _r
.in
.handle
= r
->in
.handle
;
571 _r
.in
.value_name
= r
->in
.value_name
;
572 _r
.in
.offered
= r
->in
.offered
;
573 _r
.out
.type
= r
->out
.type
;
575 _r
.out
.needed
= r
->out
.needed
;
576 _r
.out
.result
= r
->out
.result
;
578 struct __spoolss_GetPrinterData __r
;
580 _ndr_info
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
581 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
582 _ndr_info
->flags
= ndr
->flags
;
583 __r
.in
.type
= *r
->out
.type
;
584 __r
.out
.data
= r
->out
.data
;
585 NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info
, flags
, &__r
));
586 if (r
->in
.offered
> _ndr_info
->offset
) {
587 uint32_t _padding_len
= r
->in
.offered
- _ndr_info
->offset
;
588 NDR_CHECK(ndr_push_zero(_ndr_info
, _padding_len
));
590 _blob
= ndr_push_blob(_ndr_info
);
591 _r
.out
.data
= &_blob
;
593 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr
, flags
, &_r
));
595 return NDR_ERR_SUCCESS
;
598 enum ndr_err_code
ndr_pull_spoolss_GetPrinterData(struct ndr_pull
*ndr
, int flags
, struct spoolss_GetPrinterData
*r
)
600 struct _spoolss_GetPrinterData _r
;
601 if (flags
& NDR_IN
) {
602 DATA_BLOB blob
= data_blob(NULL
,0);
605 _r
.in
.handle
= r
->in
.handle
;
606 _r
.in
.value_name
= r
->in
.value_name
;
607 _r
.in
.offered
= r
->in
.offered
;
608 _r
.out
.type
= r
->out
.type
;
610 _r
.out
.needed
= r
->out
.needed
;
611 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr
, flags
, &_r
));
612 r
->in
.handle
= _r
.in
.handle
;
613 r
->in
.value_name
= _r
.in
.value_name
;
614 r
->in
.offered
= _r
.in
.offered
;
615 r
->out
.needed
= _r
.out
.needed
;
617 if (flags
& NDR_OUT
) {
618 DATA_BLOB blob
= data_blob_talloc(ndr
,NULL
,0);
619 _r
.in
.handle
= r
->in
.handle
;
620 _r
.in
.value_name
= r
->in
.value_name
;
621 _r
.in
.offered
= r
->in
.offered
;
622 _r
.out
.type
= r
->out
.type
;
624 _r
.out
.needed
= r
->out
.needed
;
625 _r
.out
.result
= r
->out
.result
;
626 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr
, flags
, &_r
));
627 r
->out
.type
= _r
.out
.type
;
628 if (ndr
->flags
& LIBNDR_FLAG_REF_ALLOC
) {
629 NDR_PULL_ALLOC(ndr
, r
->out
.data
);
631 ZERO_STRUCTP(r
->out
.data
);
632 r
->out
.needed
= _r
.out
.needed
;
633 r
->out
.result
= _r
.out
.result
;
634 if (_r
.out
.data
&& _r
.out
.data
->length
!= r
->in
.offered
) {
635 return ndr_pull_error(ndr
, NDR_ERR_BUFSIZE
,
636 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
637 (unsigned)r
->in
.offered
, (unsigned)_r
.out
.data
->length
);
639 if (_r
.out
.data
&& _r
.out
.data
->length
> 0 && *r
->out
.needed
<= _r
.out
.data
->length
) {
640 struct __spoolss_GetPrinterData __r
;
641 struct ndr_pull
*_ndr_data
= ndr_pull_init_blob(_r
.out
.data
, ndr
, ndr
->iconv_convenience
);
642 NDR_ERR_HAVE_NO_MEMORY(_ndr_data
);
643 _ndr_data
->flags
= ndr
->flags
;
644 __r
.in
.type
= *r
->out
.type
;
645 __r
.out
.data
= r
->out
.data
;
646 NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data
, flags
, &__r
));
647 r
->out
.data
= __r
.out
.data
;
649 *r
->out
.type
= REG_NONE
;
652 return NDR_ERR_SUCCESS
;
656 spoolss_SetPrinterData
658 enum ndr_err_code
ndr_push_spoolss_SetPrinterData(struct ndr_push
*ndr
, int flags
, const struct spoolss_SetPrinterData
*r
)
660 struct _spoolss_SetPrinterData _r
;
661 if (flags
& NDR_IN
) {
662 struct ndr_push
*_ndr_data
;
663 struct __spoolss_SetPrinterData __r
;
664 DATA_BLOB _data_blob_data
;
666 _ndr_data
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
667 NDR_ERR_HAVE_NO_MEMORY(_ndr_data
);
668 _ndr_data
->flags
= ndr
->flags
;
670 __r
.in
.type
= r
->in
.type
;
671 __r
.out
.data
= discard_const_p(union spoolss_PrinterData
, &r
->in
.data
);
672 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data
, NDR_OUT
, &__r
));
673 _data_blob_data
= ndr_push_blob(_ndr_data
);
675 _r
.in
.handle
= r
->in
.handle
;
676 _r
.in
.value_name
= r
->in
.value_name
;
677 _r
.in
.type
= r
->in
.type
;
678 _r
.in
.data
= _data_blob_data
;
679 _r
.in
._offered
= _data_blob_data
.length
;
680 _r
.out
.result
= r
->out
.result
;
681 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr
, flags
, &_r
));
683 if (flags
& NDR_OUT
) {
684 _r
.in
.handle
= r
->in
.handle
;
685 _r
.in
.value_name
= r
->in
.value_name
;
686 _r
.in
.type
= r
->in
.type
;
687 _r
.in
.data
= data_blob(NULL
,0),
688 _r
.in
._offered
= r
->in
._offered
;
689 _r
.out
.result
= r
->out
.result
;
690 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr
, flags
, &_r
));
692 return NDR_ERR_SUCCESS
;
695 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode
*devmode
, struct smb_iconv_convenience
*ic
, uint32_t flags
)
697 if (!devmode
) return 0;
698 return ndr_size_spoolss_DeviceMode(devmode
,ic
,flags
);
701 _PUBLIC_
size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray
*r
, struct smb_iconv_convenience
*ic
, int flags
)
707 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_spoolss_StringArray
, ic
);
710 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
713 _PUBLIC_
enum ndr_err_code
ndr_push_spoolss_DriverInfo101(struct ndr_push
*ndr
, int ndr_flags
, const struct spoolss_DriverInfo101
*r
)
715 uint32_t cntr_file_info_1
;
716 if (ndr_flags
& NDR_SCALARS
) {
717 NDR_CHECK(ndr_push_align(ndr
, 8));
718 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr
, NDR_SCALARS
, r
->version
));
720 uint32_t _flags_save_string
= ndr
->flags
;
721 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
722 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->driver_name
));
723 ndr
->flags
= _flags_save_string
;
726 uint32_t _flags_save_string
= ndr
->flags
;
727 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
728 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->architecture
));
729 ndr
->flags
= _flags_save_string
;
731 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->file_info
));
732 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->file_count
));
734 uint32_t _flags_save_string
= ndr
->flags
;
735 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
736 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->monitor_name
));
737 ndr
->flags
= _flags_save_string
;
740 uint32_t _flags_save_string
= ndr
->flags
;
741 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
742 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->default_datatype
));
743 ndr
->flags
= _flags_save_string
;
746 uint32_t _flags_save_string_array
= ndr
->flags
;
747 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
748 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->previous_names
));
749 ndr
->flags
= _flags_save_string_array
;
751 NDR_CHECK(ndr_push_NTTIME(ndr
, NDR_SCALARS
, r
->driver_date
));
752 NDR_CHECK(ndr_push_hyper(ndr
, NDR_SCALARS
, r
->driver_version
));
754 uint32_t _flags_save_string
= ndr
->flags
;
755 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
756 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->manufacturer_name
));
757 ndr
->flags
= _flags_save_string
;
760 uint32_t _flags_save_string
= ndr
->flags
;
761 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
762 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->manufacturer_url
));
763 ndr
->flags
= _flags_save_string
;
766 uint32_t _flags_save_string
= ndr
->flags
;
767 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
768 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->hardware_id
));
769 ndr
->flags
= _flags_save_string
;
772 uint32_t _flags_save_string
= ndr
->flags
;
773 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
774 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->provider
));
775 ndr
->flags
= _flags_save_string
;
778 if (ndr_flags
& NDR_BUFFERS
) {
780 uint32_t _flags_save_string
= ndr
->flags
;
781 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
782 if (r
->driver_name
) {
783 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->driver_name
));
784 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->driver_name
));
786 ndr
->flags
= _flags_save_string
;
789 uint32_t _flags_save_string
= ndr
->flags
;
790 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
791 if (r
->architecture
) {
792 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->architecture
));
793 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->architecture
));
795 ndr
->flags
= _flags_save_string
;
798 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->file_info
));
800 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->file_count
));
802 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
803 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
805 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
806 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
810 uint32_t _flags_save_string
= ndr
->flags
;
811 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
812 if (r
->monitor_name
) {
813 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->monitor_name
));
814 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->monitor_name
));
816 ndr
->flags
= _flags_save_string
;
819 uint32_t _flags_save_string
= ndr
->flags
;
820 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
821 if (r
->default_datatype
) {
822 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->default_datatype
));
823 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->default_datatype
));
825 ndr
->flags
= _flags_save_string
;
828 uint32_t _flags_save_string_array
= ndr
->flags
;
829 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
830 if (r
->previous_names
) {
831 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->previous_names
));
832 NDR_CHECK(ndr_push_string_array(ndr
, NDR_SCALARS
, r
->previous_names
));
834 ndr
->flags
= _flags_save_string_array
;
837 uint32_t _flags_save_string
= ndr
->flags
;
838 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
839 if (r
->manufacturer_name
) {
840 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->manufacturer_name
));
841 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_name
));
843 ndr
->flags
= _flags_save_string
;
846 uint32_t _flags_save_string
= ndr
->flags
;
847 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
848 if (r
->manufacturer_url
) {
849 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->manufacturer_url
));
850 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_url
));
852 ndr
->flags
= _flags_save_string
;
855 uint32_t _flags_save_string
= ndr
->flags
;
856 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
857 if (r
->hardware_id
) {
858 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->hardware_id
));
859 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->hardware_id
));
861 ndr
->flags
= _flags_save_string
;
864 uint32_t _flags_save_string
= ndr
->flags
;
865 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
867 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->provider
));
868 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->provider
));
870 ndr
->flags
= _flags_save_string
;
873 return NDR_ERR_SUCCESS
;
876 _PUBLIC_
enum ndr_err_code
ndr_pull_spoolss_DriverInfo101(struct ndr_pull
*ndr
, int ndr_flags
, struct spoolss_DriverInfo101
*r
)
878 uint32_t _ptr_driver_name
;
879 TALLOC_CTX
*_mem_save_driver_name_0
;
880 uint32_t _ptr_architecture
;
881 TALLOC_CTX
*_mem_save_architecture_0
;
882 uint32_t _ptr_file_info
;
883 uint32_t cntr_file_info_1
;
884 TALLOC_CTX
*_mem_save_file_info_0
;
885 TALLOC_CTX
*_mem_save_file_info_1
;
886 uint32_t _ptr_monitor_name
;
887 TALLOC_CTX
*_mem_save_monitor_name_0
;
888 uint32_t _ptr_default_datatype
;
889 TALLOC_CTX
*_mem_save_default_datatype_0
;
890 uint32_t _ptr_previous_names
;
891 TALLOC_CTX
*_mem_save_previous_names_0
;
892 uint32_t _ptr_manufacturer_name
;
893 TALLOC_CTX
*_mem_save_manufacturer_name_0
;
894 uint32_t _ptr_manufacturer_url
;
895 TALLOC_CTX
*_mem_save_manufacturer_url_0
;
896 uint32_t _ptr_hardware_id
;
897 TALLOC_CTX
*_mem_save_hardware_id_0
;
898 uint32_t _ptr_provider
;
899 TALLOC_CTX
*_mem_save_provider_0
;
900 if (ndr_flags
& NDR_SCALARS
) {
901 NDR_CHECK(ndr_pull_align(ndr
, 8));
902 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr
, NDR_SCALARS
, &r
->version
));
904 uint32_t _flags_save_string
= ndr
->flags
;
905 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
906 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_driver_name
));
907 if (_ptr_driver_name
) {
908 NDR_PULL_ALLOC(ndr
, r
->driver_name
);
909 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->driver_name
, _ptr_driver_name
));
911 r
->driver_name
= NULL
;
913 ndr
->flags
= _flags_save_string
;
916 uint32_t _flags_save_string
= ndr
->flags
;
917 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
918 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_architecture
));
919 if (_ptr_architecture
) {
920 NDR_PULL_ALLOC(ndr
, r
->architecture
);
921 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->architecture
, _ptr_architecture
));
923 r
->architecture
= NULL
;
925 ndr
->flags
= _flags_save_string
;
927 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_file_info
));
928 if (_ptr_file_info
) {
929 NDR_PULL_ALLOC(ndr
, r
->file_info
);
930 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->file_info
, _ptr_file_info
));
934 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->file_count
));
936 uint32_t _flags_save_string
= ndr
->flags
;
937 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
938 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_monitor_name
));
939 if (_ptr_monitor_name
) {
940 NDR_PULL_ALLOC(ndr
, r
->monitor_name
);
941 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->monitor_name
, _ptr_monitor_name
));
943 r
->monitor_name
= NULL
;
945 ndr
->flags
= _flags_save_string
;
948 uint32_t _flags_save_string
= ndr
->flags
;
949 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
950 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_default_datatype
));
951 if (_ptr_default_datatype
) {
952 NDR_PULL_ALLOC(ndr
, r
->default_datatype
);
953 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->default_datatype
, _ptr_default_datatype
));
955 r
->default_datatype
= NULL
;
957 ndr
->flags
= _flags_save_string
;
960 uint32_t _flags_save_string_array
= ndr
->flags
;
961 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
962 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_previous_names
));
963 if (_ptr_previous_names
) {
964 NDR_PULL_ALLOC(ndr
, r
->previous_names
);
965 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->previous_names
, _ptr_previous_names
));
967 r
->previous_names
= NULL
;
969 ndr
->flags
= _flags_save_string_array
;
971 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->driver_date
));
972 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->driver_version
));
974 uint32_t _flags_save_string
= ndr
->flags
;
975 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
976 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_name
));
977 if (_ptr_manufacturer_name
) {
978 NDR_PULL_ALLOC(ndr
, r
->manufacturer_name
);
979 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_name
, _ptr_manufacturer_name
));
981 r
->manufacturer_name
= NULL
;
983 ndr
->flags
= _flags_save_string
;
986 uint32_t _flags_save_string
= ndr
->flags
;
987 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
988 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_url
));
989 if (_ptr_manufacturer_url
) {
990 NDR_PULL_ALLOC(ndr
, r
->manufacturer_url
);
991 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_url
, _ptr_manufacturer_url
));
993 r
->manufacturer_url
= NULL
;
995 ndr
->flags
= _flags_save_string
;
998 uint32_t _flags_save_string
= ndr
->flags
;
999 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1000 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_hardware_id
));
1001 if (_ptr_hardware_id
) {
1002 NDR_PULL_ALLOC(ndr
, r
->hardware_id
);
1003 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->hardware_id
, _ptr_hardware_id
));
1005 r
->hardware_id
= NULL
;
1007 ndr
->flags
= _flags_save_string
;
1010 uint32_t _flags_save_string
= ndr
->flags
;
1011 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1012 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_provider
));
1013 if (_ptr_provider
) {
1014 NDR_PULL_ALLOC(ndr
, r
->provider
);
1015 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->provider
, _ptr_provider
));
1019 ndr
->flags
= _flags_save_string
;
1022 if (ndr_flags
& NDR_BUFFERS
) {
1024 uint32_t _flags_save_string
= ndr
->flags
;
1025 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1026 if (r
->driver_name
) {
1027 uint32_t _relative_save_offset
;
1028 _relative_save_offset
= ndr
->offset
;
1029 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->driver_name
));
1030 _mem_save_driver_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1031 NDR_PULL_SET_MEM_CTX(ndr
, r
->driver_name
, 0);
1032 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->driver_name
));
1033 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_driver_name_0
, 0);
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
->architecture
) {
1042 uint32_t _relative_save_offset
;
1043 _relative_save_offset
= ndr
->offset
;
1044 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->architecture
));
1045 _mem_save_architecture_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1046 NDR_PULL_SET_MEM_CTX(ndr
, r
->architecture
, 0);
1047 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->architecture
));
1048 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_architecture_0
, 0);
1049 ndr
->offset
= _relative_save_offset
;
1051 ndr
->flags
= _flags_save_string
;
1054 uint32_t _relative_save_offset
;
1055 _relative_save_offset
= ndr
->offset
;
1056 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->file_info
));
1057 _mem_save_file_info_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1058 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1060 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->file_info
));
1062 NDR_CHECK(ndr_token_store(ndr
, &ndr
->array_size_list
, &r
->file_info
, r
->file_count
));
1064 NDR_PULL_ALLOC_N(ndr
, r
->file_info
, ndr_get_array_size(ndr
, &r
->file_info
));
1065 _mem_save_file_info_1
= NDR_PULL_GET_MEM_CTX(ndr
);
1066 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1067 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1068 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
1070 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1071 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
1073 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_1
, 0);
1074 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_0
, 0);
1075 ndr
->offset
= _relative_save_offset
;
1078 uint32_t _flags_save_string
= ndr
->flags
;
1079 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1080 if (r
->monitor_name
) {
1081 uint32_t _relative_save_offset
;
1082 _relative_save_offset
= ndr
->offset
;
1083 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->monitor_name
));
1084 _mem_save_monitor_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1085 NDR_PULL_SET_MEM_CTX(ndr
, r
->monitor_name
, 0);
1086 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->monitor_name
));
1087 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_monitor_name_0
, 0);
1088 ndr
->offset
= _relative_save_offset
;
1090 ndr
->flags
= _flags_save_string
;
1093 uint32_t _flags_save_string
= ndr
->flags
;
1094 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1095 if (r
->default_datatype
) {
1096 uint32_t _relative_save_offset
;
1097 _relative_save_offset
= ndr
->offset
;
1098 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->default_datatype
));
1099 _mem_save_default_datatype_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1100 NDR_PULL_SET_MEM_CTX(ndr
, r
->default_datatype
, 0);
1101 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->default_datatype
));
1102 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_default_datatype_0
, 0);
1103 ndr
->offset
= _relative_save_offset
;
1105 ndr
->flags
= _flags_save_string
;
1108 uint32_t _flags_save_string_array
= ndr
->flags
;
1109 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1110 if (r
->previous_names
) {
1111 uint32_t _relative_save_offset
;
1112 _relative_save_offset
= ndr
->offset
;
1113 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->previous_names
));
1114 _mem_save_previous_names_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1115 NDR_PULL_SET_MEM_CTX(ndr
, r
->previous_names
, 0);
1116 NDR_CHECK(ndr_pull_string_array(ndr
, NDR_SCALARS
, &r
->previous_names
));
1117 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_previous_names_0
, 0);
1118 ndr
->offset
= _relative_save_offset
;
1120 ndr
->flags
= _flags_save_string_array
;
1123 uint32_t _flags_save_string
= ndr
->flags
;
1124 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1125 if (r
->manufacturer_name
) {
1126 uint32_t _relative_save_offset
;
1127 _relative_save_offset
= ndr
->offset
;
1128 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_name
));
1129 _mem_save_manufacturer_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1130 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_name
, 0);
1131 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_name
));
1132 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_name_0
, 0);
1133 ndr
->offset
= _relative_save_offset
;
1135 ndr
->flags
= _flags_save_string
;
1138 uint32_t _flags_save_string
= ndr
->flags
;
1139 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1140 if (r
->manufacturer_url
) {
1141 uint32_t _relative_save_offset
;
1142 _relative_save_offset
= ndr
->offset
;
1143 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_url
));
1144 _mem_save_manufacturer_url_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1145 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_url
, 0);
1146 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_url
));
1147 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_url_0
, 0);
1148 ndr
->offset
= _relative_save_offset
;
1150 ndr
->flags
= _flags_save_string
;
1153 uint32_t _flags_save_string
= ndr
->flags
;
1154 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1155 if (r
->hardware_id
) {
1156 uint32_t _relative_save_offset
;
1157 _relative_save_offset
= ndr
->offset
;
1158 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->hardware_id
));
1159 _mem_save_hardware_id_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1160 NDR_PULL_SET_MEM_CTX(ndr
, r
->hardware_id
, 0);
1161 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->hardware_id
));
1162 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_hardware_id_0
, 0);
1163 ndr
->offset
= _relative_save_offset
;
1165 ndr
->flags
= _flags_save_string
;
1168 uint32_t _flags_save_string
= ndr
->flags
;
1169 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1171 uint32_t _relative_save_offset
;
1172 _relative_save_offset
= ndr
->offset
;
1173 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->provider
));
1174 _mem_save_provider_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1175 NDR_PULL_SET_MEM_CTX(ndr
, r
->provider
, 0);
1176 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->provider
));
1177 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_provider_0
, 0);
1178 ndr
->offset
= _relative_save_offset
;
1180 ndr
->flags
= _flags_save_string
;
1183 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->file_info
, r
->file_count
));
1186 return NDR_ERR_SUCCESS
;
1189 void ndr_print_spoolss_Field(struct ndr_print
*ndr
, const char *name
, const union spoolss_Field
*r
)
1192 level
= ndr_print_get_switch_value(ndr
, r
);
1193 ndr_print_union(ndr
, name
, level
, "spoolss_Field");
1195 case PRINTER_NOTIFY_TYPE
:
1196 ndr_print_spoolss_PrintNotifyField(ndr
, "field", r
->field
);
1199 case JOB_NOTIFY_TYPE
:
1200 ndr_print_spoolss_JobNotifyField(ndr
, "field", r
->field
);
1204 ndr_print_uint16(ndr
, "field", r
->field
);