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/>.
26 #include "librpc/gen_ndr/ndr_spoolss.h"
27 #include "librpc/gen_ndr/ndr_security.h"
28 #if (_SAMBA_BUILD_ >= 4)
29 #include "param/param.h"
32 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
33 if (!r->in.buffer && r->in.offered != 0) {\
34 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
35 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
36 (unsigned)r->in.offered);\
37 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
38 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
39 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
40 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
42 _r.in.level = r->in.level;\
43 _r.in.buffer = r->in.buffer;\
44 _r.in.offered = r->in.offered;\
45 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
48 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
49 struct ndr_push *_ndr_info;\
50 _r.in.level = r->in.level;\
51 _r.in.buffer = r->in.buffer;\
52 _r.in.offered = r->in.offered;\
54 _r.out.needed = r->out.needed;\
55 _r.out.count = r->out.count;\
56 _r.out.result = r->out.result;\
57 if (r->out.info && *r->out.info && !r->in.buffer) {\
58 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
59 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
62 DATA_BLOB _data_blob_info;\
63 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
64 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
65 _ndr_info->flags= ndr->flags;\
67 struct ndr_push *_subndr_info;\
69 __r.in.level = r->in.level;\
70 __r.in.count = *r->out.count;\
71 __r.out.info = *r->out.info;\
72 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
73 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
74 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
76 if (r->in.offered > _ndr_info->offset) {\
77 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
78 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
79 } else if (r->in.offered < _ndr_info->offset) {\
80 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
81 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
82 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
84 _data_blob_info = ndr_push_blob(_ndr_info);\
85 _r.out.info = &_data_blob_info;\
87 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
90 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
92 if (flags & NDR_IN) {\
94 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
96 if (flags & NDR_OUT) {\
98 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
102 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
103 ZERO_STRUCT(r->out);\
104 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
105 r->in.level = _r.in.level;\
106 r->in.buffer = _r.in.buffer;\
107 r->in.offered = _r.in.offered;\
108 r->out.needed = _r.out.needed;\
109 r->out.count = _r.out.count;\
110 if (!r->in.buffer && r->in.offered != 0) {\
111 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
112 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
113 (unsigned)r->in.offered);\
114 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
115 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
116 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
117 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
119 NDR_PULL_ALLOC(ndr, r->out.info);\
120 ZERO_STRUCTP(r->out.info);\
123 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
124 _r.in.level = r->in.level;\
125 _r.in.buffer = r->in.buffer;\
126 _r.in.offered = r->in.offered;\
127 _r.out.needed = r->out.needed;\
128 _r.out.count = r->out.count;\
129 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
130 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
131 NDR_PULL_ALLOC(ndr, r->out.info);\
133 *r->out.info = NULL;\
134 r->out.needed = _r.out.needed;\
135 r->out.count = _r.out.count;\
136 r->out.result = _r.out.result;\
138 struct ndr_pull *_ndr_info;\
139 NDR_PULL_ALLOC(ndr, *r->out.info);\
140 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
141 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
142 _ndr_info->flags= ndr->flags;\
143 if (r->in.offered != _ndr_info->data_size) {\
144 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
145 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
146 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
148 if (*r->out.needed <= _ndr_info->data_size) {\
150 __r.in.level = r->in.level;\
151 __r.in.count = *r->out.count;\
152 __r.out.info = NULL;\
153 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
154 *r->out.info = __r.out.info;\
159 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
161 if (flags & NDR_IN) {\
163 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
166 if (flags & NDR_OUT) {\
168 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
172 #define _NDR_CHECK_UINT32(call) do {\
173 enum ndr_err_code _ndr_err; \
175 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
180 /* TODO: set _ndr_info->flags correct */
181 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
183 DATA_BLOB _data_blob_info;\
184 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
185 if (!_ndr_info) return 0;\
186 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
187 __r.in.level = level;\
188 __r.in.count = count;\
189 __r.out.info = info;\
190 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
191 _data_blob_info = ndr_push_blob(_ndr_info);\
192 return _data_blob_info.length;\
195 /* TODO: set _ndr_info->flags correct */
196 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
198 DATA_BLOB _data_blob_info;\
199 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
200 if (!_ndr_info) return 0;\
201 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
202 __r.in.count = count;\
203 __r.out.info = info;\
204 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
205 _data_blob_info = ndr_push_blob(_ndr_info);\
206 return _data_blob_info.length;\
213 enum ndr_err_code
ndr_push_spoolss_EnumPrinters(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinters
*r
)
215 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters
,{
216 _r
.in
.flags
= r
->in
.flags
;
217 _r
.in
.server
= r
->in
.server
;
219 _r
.in
.flags
= r
->in
.flags
;
220 _r
.in
.server
= r
->in
.server
;
222 return NDR_ERR_SUCCESS
;
225 enum ndr_err_code
ndr_pull_spoolss_EnumPrinters(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinters
*r
)
227 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters
,{
228 r
->in
.flags
= _r
.in
.flags
;
229 r
->in
.server
= _r
.in
.server
;
231 _r
.in
.flags
= r
->in
.flags
;
232 _r
.in
.server
= r
->in
.server
;
234 return NDR_ERR_SUCCESS
;
237 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_PrinterInfo
*info
)
239 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters
);
245 enum ndr_err_code
ndr_push_spoolss_EnumJobs(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumJobs
*r
)
247 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs
,{
248 _r
.in
.handle
= r
->in
.handle
;
249 _r
.in
.firstjob
= r
->in
.firstjob
;
250 _r
.in
.numjobs
= r
->in
.numjobs
;
252 _r
.in
.handle
= r
->in
.handle
;
253 _r
.in
.firstjob
= r
->in
.firstjob
;
254 _r
.in
.numjobs
= r
->in
.numjobs
;
256 return NDR_ERR_SUCCESS
;
259 enum ndr_err_code
ndr_pull_spoolss_EnumJobs(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumJobs
*r
)
261 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs
,{
262 r
->in
.handle
= _r
.in
.handle
;
263 r
->in
.firstjob
= _r
.in
.firstjob
;
264 r
->in
.numjobs
= _r
.in
.numjobs
;
266 _r
.in
.handle
= r
->in
.handle
;
267 _r
.in
.firstjob
= r
->in
.firstjob
;
268 _r
.in
.numjobs
= r
->in
.numjobs
;
270 return NDR_ERR_SUCCESS
;
273 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_JobInfo
*info
)
275 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs
);
279 spoolss_EnumPrinterDrivers
281 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDrivers
*r
)
283 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers
,{
284 _r
.in
.server
= r
->in
.server
;
285 _r
.in
.environment
= r
->in
.environment
;
287 _r
.in
.server
= r
->in
.server
;
288 _r
.in
.environment
= r
->in
.environment
;
290 return NDR_ERR_SUCCESS
;
293 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDrivers
*r
)
295 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers
,{
296 r
->in
.server
= _r
.in
.server
;
297 r
->in
.environment
= _r
.in
.environment
;
299 _r
.in
.server
= r
->in
.server
;
300 _r
.in
.environment
= r
->in
.environment
;
302 return NDR_ERR_SUCCESS
;
305 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_DriverInfo
*info
)
307 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers
);
313 enum ndr_err_code
ndr_push_spoolss_EnumForms(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumForms
*r
)
315 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms
,{
316 _r
.in
.handle
= r
->in
.handle
;
318 _r
.in
.handle
= r
->in
.handle
;
320 return NDR_ERR_SUCCESS
;
323 enum ndr_err_code
ndr_pull_spoolss_EnumForms(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumForms
*r
)
325 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms
,{
326 r
->in
.handle
= _r
.in
.handle
;
328 _r
.in
.handle
= r
->in
.handle
;
330 return NDR_ERR_SUCCESS
;
333 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_FormInfo
*info
)
335 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms
);
341 enum ndr_err_code
ndr_push_spoolss_EnumPorts(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPorts
*r
)
343 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts
,{
344 _r
.in
.servername
= r
->in
.servername
;
346 _r
.in
.servername
= r
->in
.servername
;
348 return NDR_ERR_SUCCESS
;
351 enum ndr_err_code
ndr_pull_spoolss_EnumPorts(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPorts
*r
)
353 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts
,{
354 r
->in
.servername
= _r
.in
.servername
;
356 _r
.in
.servername
= r
->in
.servername
;
358 return NDR_ERR_SUCCESS
;
361 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_PortInfo
*info
)
363 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts
);
369 enum ndr_err_code
ndr_push_spoolss_EnumMonitors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumMonitors
*r
)
371 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors
,{
372 _r
.in
.servername
= r
->in
.servername
;
374 _r
.in
.servername
= r
->in
.servername
;
376 return NDR_ERR_SUCCESS
;
379 enum ndr_err_code
ndr_pull_spoolss_EnumMonitors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumMonitors
*r
)
381 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors
,{
382 r
->in
.servername
= _r
.in
.servername
;
384 _r
.in
.servername
= r
->in
.servername
;
386 return NDR_ERR_SUCCESS
;
389 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
, uint32_t level
, uint32_t count
, union spoolss_MonitorInfo
*info
)
391 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors
);
395 spoolss_EnumPrintProcessors
397 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcessors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcessors
*r
)
399 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors
,{
400 _r
.in
.servername
= r
->in
.servername
;
401 _r
.in
.environment
= r
->in
.environment
;
403 _r
.in
.servername
= r
->in
.servername
;
404 _r
.in
.environment
= r
->in
.environment
;
406 return NDR_ERR_SUCCESS
;
409 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcessors
*r
)
411 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors
,{
412 r
->in
.servername
= _r
.in
.servername
;
413 r
->in
.environment
= _r
.in
.environment
;
415 _r
.in
.servername
= r
->in
.servername
;
416 _r
.in
.environment
= r
->in
.environment
;
418 return NDR_ERR_SUCCESS
;
421 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
422 uint32_t level
, uint32_t count
, union spoolss_PrintProcessorInfo
*info
)
424 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors
);
428 spoolss_EnumPrintProcessors
430 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcDataTypes
*r
)
432 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes
,{
433 _r
.in
.servername
= r
->in
.servername
;
434 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
436 _r
.in
.servername
= r
->in
.servername
;
437 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
439 return NDR_ERR_SUCCESS
;
442 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcDataTypes
*r
)
444 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes
,{
445 r
->in
.servername
= _r
.in
.servername
;
446 r
->in
.print_processor_name
= _r
.in
.print_processor_name
;
448 _r
.in
.servername
= r
->in
.servername
;
449 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
451 return NDR_ERR_SUCCESS
;
454 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
455 uint32_t level
, uint32_t count
, union spoolss_PrintProcDataTypesInfo
*info
)
457 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes
);
461 spoolss_EnumPrinterDataEx
464 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDataEx
*r
)
466 struct _spoolss_EnumPrinterDataEx _r
;
467 if (flags
& NDR_IN
) {
468 _r
.in
.handle
= r
->in
.handle
;
469 _r
.in
.key_name
= r
->in
.key_name
;
470 _r
.in
.offered
= r
->in
.offered
;
471 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
473 if (flags
& NDR_OUT
) {
474 struct ndr_push
*_ndr_info
;
475 _r
.in
.handle
= r
->in
.handle
;
476 _r
.in
.key_name
= r
->in
.key_name
;
477 _r
.in
.offered
= r
->in
.offered
;
478 _r
.out
.count
= r
->out
.count
;
479 _r
.out
.needed
= r
->out
.needed
;
480 _r
.out
.result
= r
->out
.result
;
481 _r
.out
.info
= data_blob(NULL
, 0);
482 if (r
->in
.offered
>= *r
->out
.needed
) {
483 struct __spoolss_EnumPrinterDataEx __r
;
484 _ndr_info
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
485 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
486 _ndr_info
->flags
= ndr
->flags
;
487 __r
.in
.count
= *r
->out
.count
;
488 __r
.out
.info
= *r
->out
.info
;
489 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info
, flags
, &__r
));
490 if (r
->in
.offered
> _ndr_info
->offset
) {
491 uint32_t _padding_len
= r
->in
.offered
- _ndr_info
->offset
;
492 NDR_CHECK(ndr_push_zero(_ndr_info
, _padding_len
));
494 _r
.out
.info
= ndr_push_blob(_ndr_info
);
496 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
498 return NDR_ERR_SUCCESS
;
501 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDataEx
*r
)
503 struct _spoolss_EnumPrinterDataEx _r
;
504 if (flags
& NDR_IN
) {
505 _r
.in
.handle
= r
->in
.handle
;
506 _r
.in
.key_name
= r
->in
.key_name
;
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
);
528 r
->out
.needed
= _r
.out
.needed
;
529 r
->out
.count
= _r
.out
.count
;
530 r
->out
.result
= _r
.out
.result
;
531 if (_r
.out
.info
.length
) {
532 struct ndr_pull
*_ndr_info
;
533 NDR_PULL_ALLOC(ndr
, *r
->out
.info
);
534 _ndr_info
= ndr_pull_init_blob(&_r
.out
.info
, *r
->out
.info
, ndr
->iconv_convenience
);
535 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
536 _ndr_info
->flags
= ndr
->flags
;
537 if (r
->in
.offered
!= _ndr_info
->data_size
) {
538 return ndr_pull_error(ndr
, NDR_ERR_BUFSIZE
,
539 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
540 (unsigned)r
->in
.offered
, (unsigned)_ndr_info
->data_size
);
542 if (*r
->out
.needed
<= _ndr_info
->data_size
) {
543 struct __spoolss_EnumPrinterDataEx __r
;
544 __r
.in
.count
= *r
->out
.count
;
546 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info
, flags
, &__r
));
547 *r
->out
.info
= __r
.out
.info
;
551 return NDR_ERR_SUCCESS
;
554 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX
*mem_ctx
, struct smb_iconv_convenience
*iconv_convenience
,
555 uint32_t count
, struct spoolss_PrinterEnumValues
*info
)
557 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx
);
561 spoolss_GetPrinterData
563 enum ndr_err_code
ndr_push_spoolss_GetPrinterData(struct ndr_push
*ndr
, int flags
, const struct spoolss_GetPrinterData
*r
)
565 struct _spoolss_GetPrinterData _r
;
566 if (flags
& NDR_IN
) {
567 _r
.in
.handle
= r
->in
.handle
;
568 _r
.in
.value_name
= r
->in
.value_name
;
569 _r
.in
.offered
= r
->in
.offered
;
570 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr
, flags
, &_r
));
572 if (flags
& NDR_OUT
) {
573 struct ndr_push
*_ndr_info
;
574 DATA_BLOB blob
= data_blob(NULL
, 0);
575 _r
.in
.handle
= r
->in
.handle
;
576 _r
.in
.value_name
= r
->in
.value_name
;
577 _r
.in
.offered
= r
->in
.offered
;
578 _r
.out
.type
= r
->out
.type
;
580 _r
.out
.needed
= r
->out
.needed
;
581 _r
.out
.result
= r
->out
.result
;
583 struct __spoolss_GetPrinterData __r
;
585 _ndr_info
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
586 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
587 _ndr_info
->flags
= ndr
->flags
;
588 __r
.in
.type
= *r
->out
.type
;
589 __r
.out
.data
= r
->out
.data
;
590 NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info
, flags
, &__r
));
591 if (r
->in
.offered
> _ndr_info
->offset
) {
592 uint32_t _padding_len
= r
->in
.offered
- _ndr_info
->offset
;
593 NDR_CHECK(ndr_push_zero(_ndr_info
, _padding_len
));
595 _blob
= ndr_push_blob(_ndr_info
);
596 _r
.out
.data
= &_blob
;
598 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr
, flags
, &_r
));
600 return NDR_ERR_SUCCESS
;
603 enum ndr_err_code
ndr_pull_spoolss_GetPrinterData(struct ndr_pull
*ndr
, int flags
, struct spoolss_GetPrinterData
*r
)
605 struct _spoolss_GetPrinterData _r
;
606 if (flags
& NDR_IN
) {
607 DATA_BLOB blob
= data_blob(NULL
,0);
610 _r
.in
.handle
= r
->in
.handle
;
611 _r
.in
.value_name
= r
->in
.value_name
;
612 _r
.in
.offered
= r
->in
.offered
;
613 _r
.out
.type
= r
->out
.type
;
615 _r
.out
.needed
= r
->out
.needed
;
616 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr
, flags
, &_r
));
617 r
->in
.handle
= _r
.in
.handle
;
618 r
->in
.value_name
= _r
.in
.value_name
;
619 r
->in
.offered
= _r
.in
.offered
;
620 r
->out
.needed
= _r
.out
.needed
;
622 if (flags
& NDR_OUT
) {
623 DATA_BLOB blob
= data_blob_talloc(ndr
,NULL
,0);
624 _r
.in
.handle
= r
->in
.handle
;
625 _r
.in
.value_name
= r
->in
.value_name
;
626 _r
.in
.offered
= r
->in
.offered
;
627 _r
.out
.type
= r
->out
.type
;
629 _r
.out
.needed
= r
->out
.needed
;
630 _r
.out
.result
= r
->out
.result
;
631 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr
, flags
, &_r
));
632 r
->out
.type
= _r
.out
.type
;
633 if (ndr
->flags
& LIBNDR_FLAG_REF_ALLOC
) {
634 NDR_PULL_ALLOC(ndr
, r
->out
.data
);
636 ZERO_STRUCTP(r
->out
.data
);
637 r
->out
.needed
= _r
.out
.needed
;
638 r
->out
.result
= _r
.out
.result
;
639 if (_r
.out
.data
&& _r
.out
.data
->length
!= r
->in
.offered
) {
640 return ndr_pull_error(ndr
, NDR_ERR_BUFSIZE
,
641 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
642 (unsigned)r
->in
.offered
, (unsigned)_r
.out
.data
->length
);
644 if (_r
.out
.data
&& _r
.out
.data
->length
> 0 && *r
->out
.needed
<= _r
.out
.data
->length
) {
645 struct __spoolss_GetPrinterData __r
;
646 struct ndr_pull
*_ndr_data
= ndr_pull_init_blob(_r
.out
.data
, ndr
, ndr
->iconv_convenience
);
647 NDR_ERR_HAVE_NO_MEMORY(_ndr_data
);
648 _ndr_data
->flags
= ndr
->flags
;
649 __r
.in
.type
= *r
->out
.type
;
650 __r
.out
.data
= r
->out
.data
;
651 NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data
, flags
, &__r
));
652 r
->out
.data
= __r
.out
.data
;
654 *r
->out
.type
= REG_NONE
;
657 return NDR_ERR_SUCCESS
;
661 spoolss_SetPrinterData
663 enum ndr_err_code
ndr_push_spoolss_SetPrinterData(struct ndr_push
*ndr
, int flags
, const struct spoolss_SetPrinterData
*r
)
665 struct _spoolss_SetPrinterData _r
;
666 if (flags
& NDR_IN
) {
667 struct ndr_push
*_ndr_data
;
668 struct __spoolss_SetPrinterData __r
;
669 DATA_BLOB _data_blob_data
;
671 _ndr_data
= ndr_push_init_ctx(ndr
, ndr
->iconv_convenience
);
672 NDR_ERR_HAVE_NO_MEMORY(_ndr_data
);
673 _ndr_data
->flags
= ndr
->flags
;
675 __r
.in
.type
= r
->in
.type
;
676 __r
.out
.data
= discard_const_p(union spoolss_PrinterData
, &r
->in
.data
);
677 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data
, NDR_OUT
, &__r
));
678 _data_blob_data
= ndr_push_blob(_ndr_data
);
680 _r
.in
.handle
= r
->in
.handle
;
681 _r
.in
.value_name
= r
->in
.value_name
;
682 _r
.in
.type
= r
->in
.type
;
683 _r
.in
.data
= _data_blob_data
;
684 _r
.in
._offered
= _data_blob_data
.length
;
685 _r
.out
.result
= r
->out
.result
;
686 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr
, flags
, &_r
));
688 if (flags
& NDR_OUT
) {
689 _r
.in
.handle
= r
->in
.handle
;
690 _r
.in
.value_name
= r
->in
.value_name
;
691 _r
.in
.type
= r
->in
.type
;
692 _r
.in
.data
= data_blob(NULL
,0),
693 _r
.in
._offered
= r
->in
._offered
;
694 _r
.out
.result
= r
->out
.result
;
695 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr
, flags
, &_r
));
697 return NDR_ERR_SUCCESS
;
700 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode
*devmode
, struct smb_iconv_convenience
*ic
, uint32_t flags
)
702 if (!devmode
) return 0;
703 return ndr_size_spoolss_DeviceMode(devmode
,ic
,flags
);
706 _PUBLIC_
size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray
*r
, struct smb_iconv_convenience
*ic
, int flags
)
712 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_spoolss_StringArray
, ic
);
715 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
718 _PUBLIC_
enum ndr_err_code
ndr_push_spoolss_DriverInfo101(struct ndr_push
*ndr
, int ndr_flags
, const struct spoolss_DriverInfo101
*r
)
720 uint32_t cntr_file_info_1
;
721 if (ndr_flags
& NDR_SCALARS
) {
722 NDR_CHECK(ndr_push_align(ndr
, 8));
723 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr
, NDR_SCALARS
, r
->version
));
725 uint32_t _flags_save_string
= ndr
->flags
;
726 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
727 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->driver_name
));
728 ndr
->flags
= _flags_save_string
;
731 uint32_t _flags_save_string
= ndr
->flags
;
732 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
733 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->architecture
));
734 ndr
->flags
= _flags_save_string
;
736 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->file_info
));
737 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->file_count
));
739 uint32_t _flags_save_string
= ndr
->flags
;
740 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
741 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->monitor_name
));
742 ndr
->flags
= _flags_save_string
;
745 uint32_t _flags_save_string
= ndr
->flags
;
746 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
747 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->default_datatype
));
748 ndr
->flags
= _flags_save_string
;
751 uint32_t _flags_save_string_array
= ndr
->flags
;
752 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
753 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->previous_names
));
754 ndr
->flags
= _flags_save_string_array
;
756 NDR_CHECK(ndr_push_NTTIME(ndr
, NDR_SCALARS
, r
->driver_date
));
757 NDR_CHECK(ndr_push_hyper(ndr
, NDR_SCALARS
, r
->driver_version
));
759 uint32_t _flags_save_string
= ndr
->flags
;
760 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
761 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->manufacturer_name
));
762 ndr
->flags
= _flags_save_string
;
765 uint32_t _flags_save_string
= ndr
->flags
;
766 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
767 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->manufacturer_url
));
768 ndr
->flags
= _flags_save_string
;
771 uint32_t _flags_save_string
= ndr
->flags
;
772 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
773 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->hardware_id
));
774 ndr
->flags
= _flags_save_string
;
777 uint32_t _flags_save_string
= ndr
->flags
;
778 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
779 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->provider
));
780 ndr
->flags
= _flags_save_string
;
783 if (ndr_flags
& NDR_BUFFERS
) {
785 uint32_t _flags_save_string
= ndr
->flags
;
786 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
787 if (r
->driver_name
) {
788 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->driver_name
));
789 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->driver_name
));
790 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->driver_name
));
792 ndr
->flags
= _flags_save_string
;
795 uint32_t _flags_save_string
= ndr
->flags
;
796 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
797 if (r
->architecture
) {
798 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->architecture
));
799 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->architecture
));
800 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->architecture
));
802 ndr
->flags
= _flags_save_string
;
805 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->file_info
));
807 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->file_count
));
809 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
810 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
812 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
813 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
815 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->file_info
));
818 uint32_t _flags_save_string
= ndr
->flags
;
819 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
820 if (r
->monitor_name
) {
821 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->monitor_name
));
822 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->monitor_name
));
823 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->monitor_name
));
825 ndr
->flags
= _flags_save_string
;
828 uint32_t _flags_save_string
= ndr
->flags
;
829 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
830 if (r
->default_datatype
) {
831 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->default_datatype
));
832 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->default_datatype
));
833 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->default_datatype
));
835 ndr
->flags
= _flags_save_string
;
838 uint32_t _flags_save_string_array
= ndr
->flags
;
839 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
840 if (r
->previous_names
) {
841 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->previous_names
));
842 NDR_CHECK(ndr_push_string_array(ndr
, NDR_SCALARS
, r
->previous_names
));
843 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->previous_names
));
845 ndr
->flags
= _flags_save_string_array
;
848 uint32_t _flags_save_string
= ndr
->flags
;
849 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
850 if (r
->manufacturer_name
) {
851 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->manufacturer_name
));
852 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_name
));
853 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->manufacturer_name
));
855 ndr
->flags
= _flags_save_string
;
858 uint32_t _flags_save_string
= ndr
->flags
;
859 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
860 if (r
->manufacturer_url
) {
861 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->manufacturer_url
));
862 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_url
));
863 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->manufacturer_url
));
865 ndr
->flags
= _flags_save_string
;
868 uint32_t _flags_save_string
= ndr
->flags
;
869 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
870 if (r
->hardware_id
) {
871 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->hardware_id
));
872 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->hardware_id
));
873 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->hardware_id
));
875 ndr
->flags
= _flags_save_string
;
878 uint32_t _flags_save_string
= ndr
->flags
;
879 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
881 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->provider
));
882 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->provider
));
883 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->provider
));
885 ndr
->flags
= _flags_save_string
;
888 return NDR_ERR_SUCCESS
;
891 _PUBLIC_
enum ndr_err_code
ndr_pull_spoolss_DriverInfo101(struct ndr_pull
*ndr
, int ndr_flags
, struct spoolss_DriverInfo101
*r
)
893 uint32_t _ptr_driver_name
;
894 TALLOC_CTX
*_mem_save_driver_name_0
;
895 uint32_t _ptr_architecture
;
896 TALLOC_CTX
*_mem_save_architecture_0
;
897 uint32_t _ptr_file_info
;
898 uint32_t cntr_file_info_1
;
899 TALLOC_CTX
*_mem_save_file_info_0
;
900 TALLOC_CTX
*_mem_save_file_info_1
;
901 uint32_t _ptr_monitor_name
;
902 TALLOC_CTX
*_mem_save_monitor_name_0
;
903 uint32_t _ptr_default_datatype
;
904 TALLOC_CTX
*_mem_save_default_datatype_0
;
905 uint32_t _ptr_previous_names
;
906 TALLOC_CTX
*_mem_save_previous_names_0
;
907 uint32_t _ptr_manufacturer_name
;
908 TALLOC_CTX
*_mem_save_manufacturer_name_0
;
909 uint32_t _ptr_manufacturer_url
;
910 TALLOC_CTX
*_mem_save_manufacturer_url_0
;
911 uint32_t _ptr_hardware_id
;
912 TALLOC_CTX
*_mem_save_hardware_id_0
;
913 uint32_t _ptr_provider
;
914 TALLOC_CTX
*_mem_save_provider_0
;
915 if (ndr_flags
& NDR_SCALARS
) {
916 NDR_CHECK(ndr_pull_align(ndr
, 8));
917 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr
, NDR_SCALARS
, &r
->version
));
919 uint32_t _flags_save_string
= ndr
->flags
;
920 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
921 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_driver_name
));
922 if (_ptr_driver_name
) {
923 NDR_PULL_ALLOC(ndr
, r
->driver_name
);
924 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->driver_name
, _ptr_driver_name
));
926 r
->driver_name
= NULL
;
928 ndr
->flags
= _flags_save_string
;
931 uint32_t _flags_save_string
= ndr
->flags
;
932 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
933 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_architecture
));
934 if (_ptr_architecture
) {
935 NDR_PULL_ALLOC(ndr
, r
->architecture
);
936 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->architecture
, _ptr_architecture
));
938 r
->architecture
= NULL
;
940 ndr
->flags
= _flags_save_string
;
942 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_file_info
));
943 if (_ptr_file_info
) {
944 NDR_PULL_ALLOC(ndr
, r
->file_info
);
945 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->file_info
, _ptr_file_info
));
949 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->file_count
));
951 uint32_t _flags_save_string
= ndr
->flags
;
952 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
953 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_monitor_name
));
954 if (_ptr_monitor_name
) {
955 NDR_PULL_ALLOC(ndr
, r
->monitor_name
);
956 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->monitor_name
, _ptr_monitor_name
));
958 r
->monitor_name
= NULL
;
960 ndr
->flags
= _flags_save_string
;
963 uint32_t _flags_save_string
= ndr
->flags
;
964 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
965 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_default_datatype
));
966 if (_ptr_default_datatype
) {
967 NDR_PULL_ALLOC(ndr
, r
->default_datatype
);
968 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->default_datatype
, _ptr_default_datatype
));
970 r
->default_datatype
= NULL
;
972 ndr
->flags
= _flags_save_string
;
975 uint32_t _flags_save_string_array
= ndr
->flags
;
976 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
977 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_previous_names
));
978 if (_ptr_previous_names
) {
979 NDR_PULL_ALLOC(ndr
, r
->previous_names
);
980 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->previous_names
, _ptr_previous_names
));
982 r
->previous_names
= NULL
;
984 ndr
->flags
= _flags_save_string_array
;
986 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->driver_date
));
987 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->driver_version
));
989 uint32_t _flags_save_string
= ndr
->flags
;
990 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
991 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_name
));
992 if (_ptr_manufacturer_name
) {
993 NDR_PULL_ALLOC(ndr
, r
->manufacturer_name
);
994 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_name
, _ptr_manufacturer_name
));
996 r
->manufacturer_name
= NULL
;
998 ndr
->flags
= _flags_save_string
;
1001 uint32_t _flags_save_string
= ndr
->flags
;
1002 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1003 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_url
));
1004 if (_ptr_manufacturer_url
) {
1005 NDR_PULL_ALLOC(ndr
, r
->manufacturer_url
);
1006 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_url
, _ptr_manufacturer_url
));
1008 r
->manufacturer_url
= NULL
;
1010 ndr
->flags
= _flags_save_string
;
1013 uint32_t _flags_save_string
= ndr
->flags
;
1014 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1015 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_hardware_id
));
1016 if (_ptr_hardware_id
) {
1017 NDR_PULL_ALLOC(ndr
, r
->hardware_id
);
1018 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->hardware_id
, _ptr_hardware_id
));
1020 r
->hardware_id
= NULL
;
1022 ndr
->flags
= _flags_save_string
;
1025 uint32_t _flags_save_string
= ndr
->flags
;
1026 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1027 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_provider
));
1028 if (_ptr_provider
) {
1029 NDR_PULL_ALLOC(ndr
, r
->provider
);
1030 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->provider
, _ptr_provider
));
1034 ndr
->flags
= _flags_save_string
;
1037 if (ndr_flags
& NDR_BUFFERS
) {
1039 uint32_t _flags_save_string
= ndr
->flags
;
1040 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1041 if (r
->driver_name
) {
1042 uint32_t _relative_save_offset
;
1043 _relative_save_offset
= ndr
->offset
;
1044 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->driver_name
));
1045 _mem_save_driver_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1046 NDR_PULL_SET_MEM_CTX(ndr
, r
->driver_name
, 0);
1047 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->driver_name
));
1048 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_driver_name_0
, 0);
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
->architecture
) {
1057 uint32_t _relative_save_offset
;
1058 _relative_save_offset
= ndr
->offset
;
1059 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->architecture
));
1060 _mem_save_architecture_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1061 NDR_PULL_SET_MEM_CTX(ndr
, r
->architecture
, 0);
1062 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->architecture
));
1063 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_architecture_0
, 0);
1064 ndr
->offset
= _relative_save_offset
;
1066 ndr
->flags
= _flags_save_string
;
1069 uint32_t _relative_save_offset
;
1070 _relative_save_offset
= ndr
->offset
;
1071 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->file_info
));
1072 _mem_save_file_info_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1073 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1075 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->file_info
));
1077 NDR_CHECK(ndr_token_store(ndr
, &ndr
->array_size_list
, &r
->file_info
, r
->file_count
));
1079 NDR_PULL_ALLOC_N(ndr
, r
->file_info
, ndr_get_array_size(ndr
, &r
->file_info
));
1080 _mem_save_file_info_1
= NDR_PULL_GET_MEM_CTX(ndr
);
1081 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1082 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1083 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
1085 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1086 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
1088 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_1
, 0);
1089 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_0
, 0);
1090 ndr
->offset
= _relative_save_offset
;
1093 uint32_t _flags_save_string
= ndr
->flags
;
1094 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1095 if (r
->monitor_name
) {
1096 uint32_t _relative_save_offset
;
1097 _relative_save_offset
= ndr
->offset
;
1098 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->monitor_name
));
1099 _mem_save_monitor_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1100 NDR_PULL_SET_MEM_CTX(ndr
, r
->monitor_name
, 0);
1101 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->monitor_name
));
1102 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_monitor_name_0
, 0);
1103 ndr
->offset
= _relative_save_offset
;
1105 ndr
->flags
= _flags_save_string
;
1108 uint32_t _flags_save_string
= ndr
->flags
;
1109 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1110 if (r
->default_datatype
) {
1111 uint32_t _relative_save_offset
;
1112 _relative_save_offset
= ndr
->offset
;
1113 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->default_datatype
));
1114 _mem_save_default_datatype_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1115 NDR_PULL_SET_MEM_CTX(ndr
, r
->default_datatype
, 0);
1116 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->default_datatype
));
1117 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_default_datatype_0
, 0);
1118 ndr
->offset
= _relative_save_offset
;
1120 ndr
->flags
= _flags_save_string
;
1123 uint32_t _flags_save_string_array
= ndr
->flags
;
1124 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1125 if (r
->previous_names
) {
1126 uint32_t _relative_save_offset
;
1127 _relative_save_offset
= ndr
->offset
;
1128 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->previous_names
));
1129 _mem_save_previous_names_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1130 NDR_PULL_SET_MEM_CTX(ndr
, r
->previous_names
, 0);
1131 NDR_CHECK(ndr_pull_string_array(ndr
, NDR_SCALARS
, &r
->previous_names
));
1132 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_previous_names_0
, 0);
1133 ndr
->offset
= _relative_save_offset
;
1135 ndr
->flags
= _flags_save_string_array
;
1138 uint32_t _flags_save_string
= ndr
->flags
;
1139 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1140 if (r
->manufacturer_name
) {
1141 uint32_t _relative_save_offset
;
1142 _relative_save_offset
= ndr
->offset
;
1143 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_name
));
1144 _mem_save_manufacturer_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1145 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_name
, 0);
1146 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_name
));
1147 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_name_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
->manufacturer_url
) {
1156 uint32_t _relative_save_offset
;
1157 _relative_save_offset
= ndr
->offset
;
1158 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_url
));
1159 _mem_save_manufacturer_url_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1160 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_url
, 0);
1161 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_url
));
1162 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_url_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
);
1170 if (r
->hardware_id
) {
1171 uint32_t _relative_save_offset
;
1172 _relative_save_offset
= ndr
->offset
;
1173 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->hardware_id
));
1174 _mem_save_hardware_id_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1175 NDR_PULL_SET_MEM_CTX(ndr
, r
->hardware_id
, 0);
1176 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->hardware_id
));
1177 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_hardware_id_0
, 0);
1178 ndr
->offset
= _relative_save_offset
;
1180 ndr
->flags
= _flags_save_string
;
1183 uint32_t _flags_save_string
= ndr
->flags
;
1184 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1186 uint32_t _relative_save_offset
;
1187 _relative_save_offset
= ndr
->offset
;
1188 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->provider
));
1189 _mem_save_provider_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1190 NDR_PULL_SET_MEM_CTX(ndr
, r
->provider
, 0);
1191 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->provider
));
1192 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_provider_0
, 0);
1193 ndr
->offset
= _relative_save_offset
;
1195 ndr
->flags
= _flags_save_string
;
1198 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->file_info
, r
->file_count
));
1201 return NDR_ERR_SUCCESS
;
1204 void ndr_print_spoolss_Field(struct ndr_print
*ndr
, const char *name
, const union spoolss_Field
*r
)
1207 level
= ndr_print_get_switch_value(ndr
, r
);
1208 ndr_print_union(ndr
, name
, level
, "spoolss_Field");
1210 case PRINTER_NOTIFY_TYPE
:
1211 ndr_print_spoolss_PrintNotifyField(ndr
, "field", r
->field
);
1214 case JOB_NOTIFY_TYPE
:
1215 ndr_print_spoolss_JobNotifyField(ndr
, "field", r
->field
);
1219 ndr_print_uint16(ndr
, "field", r
->field
);
1225 void ndr_print_spoolss_security_descriptor(struct ndr_print
*ndr
, const char *name
, const struct security_descriptor
*r
)
1227 ndr_print_security_descriptor(ndr
, name
, r
);
1230 enum ndr_err_code
ndr_pull_spoolss_security_descriptor(struct ndr_pull
*ndr
, int ndr_flags
, struct security_descriptor
*r
)
1232 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1233 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NO_RELATIVE_REVERSE
);
1234 NDR_CHECK(ndr_pull_security_descriptor(ndr
, ndr_flags
, r
));
1235 ndr
->flags
= _flags_save_STRUCT
;
1236 return NDR_ERR_SUCCESS
;
1239 enum ndr_err_code
ndr_push_spoolss_security_descriptor(struct ndr_push
*ndr
, int ndr_flags
, const struct security_descriptor
*r
)
1242 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1243 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_LITTLE_ENDIAN
|LIBNDR_FLAG_NO_RELATIVE_REVERSE
);
1244 if (ndr_flags
& NDR_SCALARS
) {
1245 NDR_CHECK(ndr_push_align(ndr
, 4));
1246 NDR_CHECK(ndr_push_security_descriptor_revision(ndr
, NDR_SCALARS
, r
->revision
));
1247 NDR_CHECK(ndr_push_security_descriptor_type(ndr
, NDR_SCALARS
, r
->type
));
1248 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->owner_sid
));
1249 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->group_sid
));
1250 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sacl
));
1251 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->dacl
));
1253 if (ndr_flags
& NDR_BUFFERS
) {
1255 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sacl
));
1256 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sacl
));
1257 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sacl
));
1260 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->dacl
));
1261 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->dacl
));
1262 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->dacl
));
1265 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->owner_sid
));
1266 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->owner_sid
));
1267 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->owner_sid
));
1270 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->group_sid
));
1271 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
1272 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->group_sid
));
1275 ndr
->flags
= _flags_save_STRUCT
;
1277 return NDR_ERR_SUCCESS
;
1280 _PUBLIC_
enum ndr_err_code
ndr_push_spoolss_PrinterInfo2(struct ndr_push
*ndr
, int ndr_flags
, const struct spoolss_PrinterInfo2
*r
)
1282 if (ndr_flags
& NDR_SCALARS
) {
1283 NDR_CHECK(ndr_push_align(ndr
, 4));
1285 uint32_t _flags_save_string
= ndr
->flags
;
1286 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1287 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->servername
));
1288 ndr
->flags
= _flags_save_string
;
1291 uint32_t _flags_save_string
= ndr
->flags
;
1292 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1293 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->printername
));
1294 ndr
->flags
= _flags_save_string
;
1297 uint32_t _flags_save_string
= ndr
->flags
;
1298 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1299 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sharename
));
1300 ndr
->flags
= _flags_save_string
;
1303 uint32_t _flags_save_string
= ndr
->flags
;
1304 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1305 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->portname
));
1306 ndr
->flags
= _flags_save_string
;
1309 uint32_t _flags_save_string
= ndr
->flags
;
1310 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1311 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->drivername
));
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 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->comment
));
1318 ndr
->flags
= _flags_save_string
;
1321 uint32_t _flags_save_string
= ndr
->flags
;
1322 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1323 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->location
));
1324 ndr
->flags
= _flags_save_string
;
1327 uint32_t _flags_save_spoolss_DeviceMode
= ndr
->flags
;
1328 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1329 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->devmode
));
1330 ndr
->flags
= _flags_save_spoolss_DeviceMode
;
1333 uint32_t _flags_save_string
= ndr
->flags
;
1334 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1335 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sepfile
));
1336 ndr
->flags
= _flags_save_string
;
1339 uint32_t _flags_save_string
= ndr
->flags
;
1340 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1341 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->printprocessor
));
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 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->datatype
));
1348 ndr
->flags
= _flags_save_string
;
1351 uint32_t _flags_save_string
= ndr
->flags
;
1352 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1353 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->parameters
));
1354 ndr
->flags
= _flags_save_string
;
1357 uint32_t _flags_save_spoolss_security_descriptor
= ndr
->flags
;
1358 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1359 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->secdesc
));
1360 ndr
->flags
= _flags_save_spoolss_security_descriptor
;
1362 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr
, NDR_SCALARS
, r
->attributes
));
1363 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->priority
));
1364 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->defaultpriority
));
1365 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->starttime
));
1366 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->untiltime
));
1367 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr
, NDR_SCALARS
, r
->status
));
1368 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->cjobs
));
1369 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->averageppm
));
1371 if (ndr_flags
& NDR_BUFFERS
) {
1373 uint32_t _flags_save_string
= ndr
->flags
;
1374 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1375 if (r
->servername
) {
1376 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->servername
));
1377 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->servername
));
1378 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->servername
));
1380 ndr
->flags
= _flags_save_string
;
1383 uint32_t _flags_save_string
= ndr
->flags
;
1384 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1385 if (r
->printername
) {
1386 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->printername
));
1387 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->printername
));
1388 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->printername
));
1390 ndr
->flags
= _flags_save_string
;
1393 uint32_t _flags_save_string
= ndr
->flags
;
1394 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1396 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sharename
));
1397 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->sharename
));
1398 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sharename
));
1400 ndr
->flags
= _flags_save_string
;
1403 uint32_t _flags_save_string
= ndr
->flags
;
1404 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1406 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->portname
));
1407 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->portname
));
1408 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->portname
));
1410 ndr
->flags
= _flags_save_string
;
1413 uint32_t _flags_save_string
= ndr
->flags
;
1414 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1415 if (r
->drivername
) {
1416 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->drivername
));
1417 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->drivername
));
1418 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->drivername
));
1420 ndr
->flags
= _flags_save_string
;
1423 uint32_t _flags_save_string
= ndr
->flags
;
1424 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1426 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->comment
));
1427 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->comment
));
1428 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->comment
));
1430 ndr
->flags
= _flags_save_string
;
1433 uint32_t _flags_save_string
= ndr
->flags
;
1434 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1436 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->location
));
1437 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->location
));
1438 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->location
));
1440 ndr
->flags
= _flags_save_string
;
1443 uint32_t _flags_save_string
= ndr
->flags
;
1444 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1446 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sepfile
));
1447 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->sepfile
));
1448 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sepfile
));
1450 ndr
->flags
= _flags_save_string
;
1453 uint32_t _flags_save_string
= ndr
->flags
;
1454 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1455 if (r
->printprocessor
) {
1456 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->printprocessor
));
1457 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->printprocessor
));
1458 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->printprocessor
));
1460 ndr
->flags
= _flags_save_string
;
1463 uint32_t _flags_save_string
= ndr
->flags
;
1464 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1466 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->datatype
));
1467 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->datatype
));
1468 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->datatype
));
1470 ndr
->flags
= _flags_save_string
;
1473 uint32_t _flags_save_string
= ndr
->flags
;
1474 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1475 if (r
->parameters
) {
1476 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->parameters
));
1477 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->parameters
));
1478 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->parameters
));
1480 ndr
->flags
= _flags_save_string
;
1483 uint32_t _flags_save_spoolss_DeviceMode
= ndr
->flags
;
1484 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1486 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->devmode
));
1488 struct ndr_push
*_ndr_devmode
;
1489 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_devmode
, 0, -1));
1490 NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode
, NDR_SCALARS
, r
->devmode
));
1491 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_devmode
, 0, -1));
1493 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->devmode
));
1495 ndr
->flags
= _flags_save_spoolss_DeviceMode
;
1498 uint32_t _flags_save_spoolss_security_descriptor
= ndr
->flags
;
1499 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1501 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->secdesc
));
1503 struct ndr_push
*_ndr_secdesc
;
1504 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_secdesc
, 0, -1));
1505 NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc
, NDR_SCALARS
|NDR_BUFFERS
, r
->secdesc
));
1506 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_secdesc
, 0, -1));
1508 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->secdesc
));
1510 ndr
->flags
= _flags_save_spoolss_security_descriptor
;
1513 return NDR_ERR_SUCCESS
;