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"
29 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
30 if (!r->in.buffer && r->in.offered != 0) {\
31 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
32 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
33 (unsigned)r->in.offered);\
34 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
35 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
36 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
37 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
39 _r.in.buffer = r->in.buffer;\
40 _r.in.offered = r->in.offered;\
41 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
44 #define NDR_SPOOLSS_PUSH_ENUM_IN_LEVEL(fn) do { \
45 _r.in.level = r->in.level;\
46 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
49 #define NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn) do { \
50 DATA_BLOB _data_blob_info = data_blob_null;\
51 struct ndr_push *_ndr_info = NULL;\
52 _r.in.level = r->in.level;\
53 _r.in.buffer = r->in.buffer;\
54 _r.in.offered = r->in.offered;\
56 _r.out.needed = r->out.needed;\
57 _r.out.count = r->out.count;\
58 _r.out.result = r->out.result;\
59 if (r->out.info && *r->out.info && !r->in.buffer) {\
60 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
61 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
64 _ndr_info = ndr_push_init_ctx(ndr);\
65 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
66 _ndr_info->flags= ndr->flags;\
68 struct ndr_push *_subndr_info;\
70 __r.in.level = r->in.level;\
71 __r.in.count = *r->out.count;\
72 __r.out.info = *r->out.info;\
73 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
74 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
75 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
77 if (r->in.offered > _ndr_info->offset) {\
78 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
79 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
80 } else if (r->in.offered < _ndr_info->offset) {\
81 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
82 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
83 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
85 _data_blob_info = ndr_push_blob(_ndr_info);\
86 _r.out.info = &_data_blob_info;\
88 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
91 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
92 DATA_BLOB _data_blob_info = data_blob_null;\
93 struct ndr_push *_ndr_info = NULL;\
94 _r.in.buffer = r->in.buffer;\
95 _r.in.offered = r->in.offered;\
97 _r.out.needed = r->out.needed;\
98 _r.out.count = r->out.count;\
99 _r.out.result = r->out.result;\
100 if (r->out.info && *r->out.info && !r->in.buffer) {\
101 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
102 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
105 _ndr_info = ndr_push_init_ctx(ndr);\
106 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
107 _ndr_info->flags= ndr->flags;\
109 struct ndr_push *_subndr_info;\
111 __r.in.count = *r->out.count;\
112 __r.out.info = *r->out.info;\
113 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
114 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
115 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
117 if (r->in.offered > _ndr_info->offset) {\
118 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
119 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
120 } else if (r->in.offered < _ndr_info->offset) {\
121 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
122 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
123 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
125 _data_blob_info = ndr_push_blob(_ndr_info);\
126 _r.out.info = &_data_blob_info;\
128 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
131 #define NDR_SPOOLSS_PUSH_ENUM_LEVEL(fn,in,out) do { \
133 if (flags & NDR_IN) {\
135 NDR_SPOOLSS_PUSH_ENUM_IN_LEVEL(fn);\
137 if (flags & NDR_OUT) {\
139 NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn);\
143 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
145 if (flags & NDR_IN) {\
147 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
149 if (flags & NDR_OUT) {\
151 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
155 #define NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn) do { \
156 ZERO_STRUCT(r->out);\
157 r->in.buffer = _r.in.buffer;\
158 r->in.offered = _r.in.offered;\
159 r->out.needed = _r.out.needed;\
160 r->out.count = _r.out.count;\
161 if (!r->in.buffer && r->in.offered != 0) {\
162 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
163 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
164 (unsigned)r->in.offered);\
165 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
166 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
167 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
168 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
170 NDR_PULL_ALLOC(ndr, r->out.info);\
171 ZERO_STRUCTP(r->out.info);\
174 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
175 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
176 NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \
179 #define NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn) do { \
180 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
181 r->in.level = _r.in.level;\
182 NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \
185 #define NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(fn) do { \
186 _r.in.level = r->in.level;\
187 _r.in.buffer = r->in.buffer;\
188 _r.in.offered = r->in.offered;\
189 _r.out.needed = r->out.needed;\
190 _r.out.count = r->out.count;\
191 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
192 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
193 NDR_PULL_ALLOC(ndr, r->out.info);\
195 *r->out.info = NULL;\
196 r->out.needed = _r.out.needed;\
197 r->out.count = _r.out.count;\
198 r->out.result = _r.out.result;\
200 struct ndr_pull *_ndr_info;\
201 NDR_PULL_ALLOC(ndr, *r->out.info);\
202 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
203 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
204 _ndr_info->flags= ndr->flags;\
205 if (r->in.offered != _ndr_info->data_size) {\
206 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
207 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
208 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
210 if (*r->out.needed <= _ndr_info->data_size) {\
212 __r.in.level = r->in.level;\
213 __r.in.count = *r->out.count;\
214 __r.out.info = NULL;\
215 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
216 *r->out.info = __r.out.info;\
221 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
222 _r.in.buffer = r->in.buffer;\
223 _r.in.offered = r->in.offered;\
224 _r.out.needed = r->out.needed;\
225 _r.out.count = r->out.count;\
226 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
227 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
228 NDR_PULL_ALLOC(ndr, r->out.info);\
230 *r->out.info = NULL;\
231 r->out.needed = _r.out.needed;\
232 r->out.count = _r.out.count;\
233 r->out.result = _r.out.result;\
235 struct ndr_pull *_ndr_info;\
236 NDR_PULL_ALLOC(ndr, *r->out.info);\
237 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
238 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
239 _ndr_info->flags= ndr->flags;\
240 if (r->in.offered != _ndr_info->data_size) {\
241 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
242 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
243 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
245 if (*r->out.needed <= _ndr_info->data_size) {\
247 __r.in.count = *r->out.count;\
248 __r.out.info = NULL;\
249 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
250 *r->out.info = __r.out.info;\
255 #define NDR_SPOOLSS_PULL_ENUM_LEVEL(fn,in,out) do { \
257 if (flags & NDR_IN) {\
259 NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn);\
262 if (flags & NDR_OUT) {\
264 NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(fn);\
268 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
270 if (flags & NDR_IN) {\
272 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
275 if (flags & NDR_OUT) {\
277 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
281 #define _NDR_CHECK_UINT32(call) do {\
282 enum ndr_err_code _ndr_err; \
284 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
289 /* TODO: set _ndr_info->flags correct */
290 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
292 DATA_BLOB _data_blob_info;\
293 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
294 if (!_ndr_info) return 0;\
295 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
296 __r.in.level = level;\
297 __r.in.count = count;\
298 __r.out.info = info;\
299 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
300 _data_blob_info = ndr_push_blob(_ndr_info);\
301 return _data_blob_info.length;\
304 /* TODO: set _ndr_info->flags correct */
305 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
307 DATA_BLOB _data_blob_info;\
308 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
309 if (!_ndr_info) return 0;\
310 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
311 __r.in.count = count;\
312 __r.out.info = info;\
313 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
314 _data_blob_info = ndr_push_blob(_ndr_info);\
315 return _data_blob_info.length;\
322 enum ndr_err_code
ndr_push_spoolss_EnumPrinters(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinters
*r
)
324 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrinters
,{
325 _r
.in
.flags
= r
->in
.flags
;
326 _r
.in
.server
= r
->in
.server
;
328 _r
.in
.flags
= r
->in
.flags
;
329 _r
.in
.server
= r
->in
.server
;
331 return NDR_ERR_SUCCESS
;
334 enum ndr_err_code
ndr_pull_spoolss_EnumPrinters(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinters
*r
)
336 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrinters
,{
337 r
->in
.flags
= _r
.in
.flags
;
338 r
->in
.server
= _r
.in
.server
;
340 _r
.in
.flags
= r
->in
.flags
;
341 _r
.in
.server
= r
->in
.server
;
343 return NDR_ERR_SUCCESS
;
346 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_PrinterInfo
*info
)
348 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters
);
354 enum ndr_err_code
ndr_push_spoolss_EnumJobs(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumJobs
*r
)
356 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumJobs
,{
357 _r
.in
.handle
= r
->in
.handle
;
358 _r
.in
.firstjob
= r
->in
.firstjob
;
359 _r
.in
.numjobs
= r
->in
.numjobs
;
361 _r
.in
.handle
= r
->in
.handle
;
362 _r
.in
.firstjob
= r
->in
.firstjob
;
363 _r
.in
.numjobs
= r
->in
.numjobs
;
365 return NDR_ERR_SUCCESS
;
368 enum ndr_err_code
ndr_pull_spoolss_EnumJobs(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumJobs
*r
)
370 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumJobs
,{
371 r
->in
.handle
= _r
.in
.handle
;
372 r
->in
.firstjob
= _r
.in
.firstjob
;
373 r
->in
.numjobs
= _r
.in
.numjobs
;
375 _r
.in
.handle
= r
->in
.handle
;
376 _r
.in
.firstjob
= r
->in
.firstjob
;
377 _r
.in
.numjobs
= r
->in
.numjobs
;
379 return NDR_ERR_SUCCESS
;
382 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_JobInfo
*info
)
384 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs
);
388 spoolss_EnumPrinterDrivers
390 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDrivers
*r
)
392 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrinterDrivers
,{
393 _r
.in
.server
= r
->in
.server
;
394 _r
.in
.environment
= r
->in
.environment
;
396 _r
.in
.server
= r
->in
.server
;
397 _r
.in
.environment
= r
->in
.environment
;
399 return NDR_ERR_SUCCESS
;
402 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDrivers
*r
)
404 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrinterDrivers
,{
405 r
->in
.server
= _r
.in
.server
;
406 r
->in
.environment
= _r
.in
.environment
;
408 _r
.in
.server
= r
->in
.server
;
409 _r
.in
.environment
= r
->in
.environment
;
411 return NDR_ERR_SUCCESS
;
414 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_DriverInfo
*info
)
416 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers
);
422 enum ndr_err_code
ndr_push_spoolss_EnumForms(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumForms
*r
)
424 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumForms
,{
425 _r
.in
.handle
= r
->in
.handle
;
427 _r
.in
.handle
= r
->in
.handle
;
429 return NDR_ERR_SUCCESS
;
432 enum ndr_err_code
ndr_pull_spoolss_EnumForms(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumForms
*r
)
434 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumForms
,{
435 r
->in
.handle
= _r
.in
.handle
;
437 _r
.in
.handle
= r
->in
.handle
;
439 return NDR_ERR_SUCCESS
;
442 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_FormInfo
*info
)
444 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms
);
450 enum ndr_err_code
ndr_push_spoolss_EnumPorts(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPorts
*r
)
452 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPorts
,{
453 _r
.in
.servername
= r
->in
.servername
;
455 _r
.in
.servername
= r
->in
.servername
;
457 return NDR_ERR_SUCCESS
;
460 enum ndr_err_code
ndr_pull_spoolss_EnumPorts(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPorts
*r
)
462 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPorts
,{
463 r
->in
.servername
= _r
.in
.servername
;
465 _r
.in
.servername
= r
->in
.servername
;
467 return NDR_ERR_SUCCESS
;
470 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_PortInfo
*info
)
472 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts
);
478 enum ndr_err_code
ndr_push_spoolss_EnumMonitors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumMonitors
*r
)
480 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumMonitors
,{
481 _r
.in
.servername
= r
->in
.servername
;
483 _r
.in
.servername
= r
->in
.servername
;
485 return NDR_ERR_SUCCESS
;
488 enum ndr_err_code
ndr_pull_spoolss_EnumMonitors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumMonitors
*r
)
490 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumMonitors
,{
491 r
->in
.servername
= _r
.in
.servername
;
493 _r
.in
.servername
= r
->in
.servername
;
495 return NDR_ERR_SUCCESS
;
498 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX
*mem_ctx
, uint32_t level
, uint32_t count
, union spoolss_MonitorInfo
*info
)
500 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors
);
504 spoolss_EnumPrintProcessors
506 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcessors(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcessors
*r
)
508 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrintProcessors
,{
509 _r
.in
.servername
= r
->in
.servername
;
510 _r
.in
.environment
= r
->in
.environment
;
512 _r
.in
.servername
= r
->in
.servername
;
513 _r
.in
.environment
= r
->in
.environment
;
515 return NDR_ERR_SUCCESS
;
518 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcessors
*r
)
520 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrintProcessors
,{
521 r
->in
.servername
= _r
.in
.servername
;
522 r
->in
.environment
= _r
.in
.environment
;
524 _r
.in
.servername
= r
->in
.servername
;
525 _r
.in
.environment
= r
->in
.environment
;
527 return NDR_ERR_SUCCESS
;
530 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX
*mem_ctx
,
531 uint32_t level
, uint32_t count
, union spoolss_PrintProcessorInfo
*info
)
533 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors
);
537 spoolss_EnumPrintProcessors
539 enum ndr_err_code
ndr_push_spoolss_EnumPrintProcessorDataTypes(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrintProcessorDataTypes
*r
)
541 NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes
,{
542 _r
.in
.servername
= r
->in
.servername
;
543 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
545 _r
.in
.servername
= r
->in
.servername
;
546 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
548 return NDR_ERR_SUCCESS
;
551 enum ndr_err_code
ndr_pull_spoolss_EnumPrintProcessorDataTypes(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrintProcessorDataTypes
*r
)
553 NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes
,{
554 r
->in
.servername
= _r
.in
.servername
;
555 r
->in
.print_processor_name
= _r
.in
.print_processor_name
;
557 _r
.in
.servername
= r
->in
.servername
;
558 _r
.in
.print_processor_name
= r
->in
.print_processor_name
;
560 return NDR_ERR_SUCCESS
;
563 uint32_t ndr_size_spoolss_EnumPrintProcessorDataTypes_info(TALLOC_CTX
*mem_ctx
,
564 uint32_t level
, uint32_t count
, union spoolss_PrintProcDataTypesInfo
*info
)
566 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes
);
570 spoolss_EnumPerMachineConnections
572 enum ndr_err_code
ndr_push_spoolss_EnumPerMachineConnections(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPerMachineConnections
*r
)
574 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPerMachineConnections
,{
575 _r
.in
.server
= r
->in
.server
;
577 _r
.in
.server
= r
->in
.server
;
579 return NDR_ERR_SUCCESS
;
582 enum ndr_err_code
ndr_pull_spoolss_EnumPerMachineConnections(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPerMachineConnections
*r
)
584 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPerMachineConnections
,{
585 r
->in
.server
= _r
.in
.server
;
587 _r
.in
.server
= r
->in
.server
;
589 return NDR_ERR_SUCCESS
;
592 uint32_t ndr_size_spoolss_EnumPerMachineConnections_info(TALLOC_CTX
*mem_ctx
, uint32_t count
, struct spoolss_PrinterInfo4
*info
)
594 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPerMachineConnections
);
598 spoolss_EnumPrinterDataEx
601 enum ndr_err_code
ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push
*ndr
, int flags
, const struct spoolss_EnumPrinterDataEx
*r
)
603 struct _spoolss_EnumPrinterDataEx _r
;
604 if (flags
& NDR_IN
) {
605 _r
.in
.handle
= r
->in
.handle
;
606 _r
.in
.key_name
= r
->in
.key_name
;
607 _r
.in
.offered
= r
->in
.offered
;
608 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
610 if (flags
& NDR_OUT
) {
611 struct ndr_push
*_ndr_info
;
612 _r
.in
.handle
= r
->in
.handle
;
613 _r
.in
.key_name
= r
->in
.key_name
;
614 _r
.in
.offered
= r
->in
.offered
;
615 _r
.out
.count
= r
->out
.count
;
616 _r
.out
.needed
= r
->out
.needed
;
617 _r
.out
.result
= r
->out
.result
;
618 _r
.out
.info
= data_blob(NULL
, 0);
619 if (r
->in
.offered
>= *r
->out
.needed
) {
620 struct ndr_push
*_subndr_info
;
621 struct __spoolss_EnumPrinterDataEx __r
;
622 _ndr_info
= ndr_push_init_ctx(ndr
);
623 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
624 _ndr_info
->flags
= ndr
->flags
;
625 __r
.in
.count
= *r
->out
.count
;
626 __r
.out
.info
= *r
->out
.info
;
627 NDR_CHECK(ndr_push_subcontext_start(_ndr_info
, &_subndr_info
, 0, r
->in
.offered
));
628 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_subndr_info
, flags
, &__r
));
629 NDR_CHECK(ndr_push_subcontext_end(_ndr_info
, _subndr_info
, 0, r
->in
.offered
));
630 if (r
->in
.offered
> _ndr_info
->offset
) {
631 uint32_t _padding_len
= r
->in
.offered
- _ndr_info
->offset
;
632 NDR_CHECK(ndr_push_zero(_ndr_info
, _padding_len
));
634 _r
.out
.info
= ndr_push_blob(_ndr_info
);
636 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
638 return NDR_ERR_SUCCESS
;
641 enum ndr_err_code
ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull
*ndr
, int flags
, struct spoolss_EnumPrinterDataEx
*r
)
643 struct _spoolss_EnumPrinterDataEx _r
;
644 if (flags
& NDR_IN
) {
645 _r
.in
.handle
= r
->in
.handle
;
646 _r
.in
.key_name
= r
->in
.key_name
;
648 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
649 r
->in
.handle
= _r
.in
.handle
;
650 r
->in
.key_name
= _r
.in
.key_name
;
651 r
->in
.offered
= _r
.in
.offered
;
652 r
->out
.needed
= _r
.out
.needed
;
653 r
->out
.count
= _r
.out
.count
;
654 NDR_PULL_ALLOC(ndr
, r
->out
.info
);
655 ZERO_STRUCTP(r
->out
.info
);
657 if (flags
& NDR_OUT
) {
658 _r
.in
.handle
= r
->in
.handle
;
659 _r
.in
.key_name
= r
->in
.key_name
;
660 _r
.in
.offered
= r
->in
.offered
;
661 _r
.out
.count
= r
->out
.count
;
662 _r
.out
.needed
= r
->out
.needed
;
663 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr
, flags
, &_r
));
664 if (ndr
->flags
& LIBNDR_FLAG_REF_ALLOC
) {
665 NDR_PULL_ALLOC(ndr
, r
->out
.info
);
668 r
->out
.needed
= _r
.out
.needed
;
669 r
->out
.count
= _r
.out
.count
;
670 r
->out
.result
= _r
.out
.result
;
671 if (_r
.out
.info
.length
) {
672 struct ndr_pull
*_ndr_info
;
673 NDR_PULL_ALLOC(ndr
, *r
->out
.info
);
674 _ndr_info
= ndr_pull_init_blob(&_r
.out
.info
, *r
->out
.info
);
675 NDR_ERR_HAVE_NO_MEMORY(_ndr_info
);
676 _ndr_info
->flags
= ndr
->flags
;
677 if (r
->in
.offered
!= _ndr_info
->data_size
) {
678 return ndr_pull_error(ndr
, NDR_ERR_BUFSIZE
,
679 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
680 (unsigned)r
->in
.offered
, (unsigned)_ndr_info
->data_size
);
682 if (*r
->out
.needed
<= _ndr_info
->data_size
) {
683 struct __spoolss_EnumPrinterDataEx __r
;
684 __r
.in
.count
= *r
->out
.count
;
686 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info
, flags
, &__r
));
687 *r
->out
.info
= __r
.out
.info
;
691 return NDR_ERR_SUCCESS
;
694 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX
*mem_ctx
,
695 uint32_t count
, struct spoolss_PrinterEnumValues
*info
)
697 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx
);
700 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode
*devmode
, uint32_t flags
)
702 if (!devmode
) return 0;
703 return ndr_size_spoolss_DeviceMode(devmode
, flags
);
706 _PUBLIC_
size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray
*r
, int flags
)
712 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_spoolss_StringArray
);
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
;
782 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
784 if (ndr_flags
& NDR_BUFFERS
) {
786 uint32_t _flags_save_string
= ndr
->flags
;
787 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
788 if (r
->driver_name
) {
789 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->driver_name
));
790 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->driver_name
));
791 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->driver_name
));
793 ndr
->flags
= _flags_save_string
;
796 uint32_t _flags_save_string
= ndr
->flags
;
797 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
798 if (r
->architecture
) {
799 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->architecture
));
800 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->architecture
));
801 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->architecture
));
803 ndr
->flags
= _flags_save_string
;
806 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->file_info
));
808 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, r
->file_count
));
810 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
811 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
813 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
814 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
816 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->file_info
));
819 uint32_t _flags_save_string
= ndr
->flags
;
820 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
821 if (r
->monitor_name
) {
822 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->monitor_name
));
823 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->monitor_name
));
824 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->monitor_name
));
826 ndr
->flags
= _flags_save_string
;
829 uint32_t _flags_save_string
= ndr
->flags
;
830 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
831 if (r
->default_datatype
) {
832 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->default_datatype
));
833 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->default_datatype
));
834 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->default_datatype
));
836 ndr
->flags
= _flags_save_string
;
839 uint32_t _flags_save_string_array
= ndr
->flags
;
840 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
841 if (r
->previous_names
) {
842 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->previous_names
));
843 NDR_CHECK(ndr_push_string_array(ndr
, NDR_SCALARS
, r
->previous_names
));
844 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->previous_names
));
846 ndr
->flags
= _flags_save_string_array
;
849 uint32_t _flags_save_string
= ndr
->flags
;
850 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
851 if (r
->manufacturer_name
) {
852 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->manufacturer_name
));
853 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_name
));
854 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->manufacturer_name
));
856 ndr
->flags
= _flags_save_string
;
859 uint32_t _flags_save_string
= ndr
->flags
;
860 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
861 if (r
->manufacturer_url
) {
862 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->manufacturer_url
));
863 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->manufacturer_url
));
864 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->manufacturer_url
));
866 ndr
->flags
= _flags_save_string
;
869 uint32_t _flags_save_string
= ndr
->flags
;
870 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
871 if (r
->hardware_id
) {
872 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->hardware_id
));
873 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->hardware_id
));
874 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->hardware_id
));
876 ndr
->flags
= _flags_save_string
;
879 uint32_t _flags_save_string
= ndr
->flags
;
880 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
882 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->provider
));
883 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->provider
));
884 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->provider
));
886 ndr
->flags
= _flags_save_string
;
889 return NDR_ERR_SUCCESS
;
892 _PUBLIC_
enum ndr_err_code
ndr_pull_spoolss_DriverInfo101(struct ndr_pull
*ndr
, int ndr_flags
, struct spoolss_DriverInfo101
*r
)
894 uint32_t _ptr_driver_name
;
895 TALLOC_CTX
*_mem_save_driver_name_0
;
896 uint32_t _ptr_architecture
;
897 TALLOC_CTX
*_mem_save_architecture_0
;
898 uint32_t _ptr_file_info
;
899 uint32_t cntr_file_info_1
;
900 TALLOC_CTX
*_mem_save_file_info_0
;
901 TALLOC_CTX
*_mem_save_file_info_1
;
902 uint32_t _ptr_monitor_name
;
903 TALLOC_CTX
*_mem_save_monitor_name_0
;
904 uint32_t _ptr_default_datatype
;
905 TALLOC_CTX
*_mem_save_default_datatype_0
;
906 uint32_t _ptr_previous_names
;
907 TALLOC_CTX
*_mem_save_previous_names_0
;
908 uint32_t _ptr_manufacturer_name
;
909 TALLOC_CTX
*_mem_save_manufacturer_name_0
;
910 uint32_t _ptr_manufacturer_url
;
911 TALLOC_CTX
*_mem_save_manufacturer_url_0
;
912 uint32_t _ptr_hardware_id
;
913 TALLOC_CTX
*_mem_save_hardware_id_0
;
914 uint32_t _ptr_provider
;
915 TALLOC_CTX
*_mem_save_provider_0
;
916 if (ndr_flags
& NDR_SCALARS
) {
917 NDR_CHECK(ndr_pull_align(ndr
, 8));
918 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr
, NDR_SCALARS
, &r
->version
));
920 uint32_t _flags_save_string
= ndr
->flags
;
921 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
922 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_driver_name
));
923 if (_ptr_driver_name
) {
924 NDR_PULL_ALLOC(ndr
, r
->driver_name
);
925 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->driver_name
, _ptr_driver_name
));
927 r
->driver_name
= NULL
;
929 ndr
->flags
= _flags_save_string
;
932 uint32_t _flags_save_string
= ndr
->flags
;
933 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
934 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_architecture
));
935 if (_ptr_architecture
) {
936 NDR_PULL_ALLOC(ndr
, r
->architecture
);
937 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->architecture
, _ptr_architecture
));
939 r
->architecture
= NULL
;
941 ndr
->flags
= _flags_save_string
;
943 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_file_info
));
944 if (_ptr_file_info
) {
945 NDR_PULL_ALLOC(ndr
, r
->file_info
);
946 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->file_info
, _ptr_file_info
));
950 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->file_count
));
952 uint32_t _flags_save_string
= ndr
->flags
;
953 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
954 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_monitor_name
));
955 if (_ptr_monitor_name
) {
956 NDR_PULL_ALLOC(ndr
, r
->monitor_name
);
957 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->monitor_name
, _ptr_monitor_name
));
959 r
->monitor_name
= NULL
;
961 ndr
->flags
= _flags_save_string
;
964 uint32_t _flags_save_string
= ndr
->flags
;
965 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
966 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_default_datatype
));
967 if (_ptr_default_datatype
) {
968 NDR_PULL_ALLOC(ndr
, r
->default_datatype
);
969 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->default_datatype
, _ptr_default_datatype
));
971 r
->default_datatype
= NULL
;
973 ndr
->flags
= _flags_save_string
;
976 uint32_t _flags_save_string_array
= ndr
->flags
;
977 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
978 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_previous_names
));
979 if (_ptr_previous_names
) {
980 NDR_PULL_ALLOC(ndr
, r
->previous_names
);
981 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->previous_names
, _ptr_previous_names
));
983 r
->previous_names
= NULL
;
985 ndr
->flags
= _flags_save_string_array
;
987 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->driver_date
));
988 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->driver_version
));
990 uint32_t _flags_save_string
= ndr
->flags
;
991 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
992 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_name
));
993 if (_ptr_manufacturer_name
) {
994 NDR_PULL_ALLOC(ndr
, r
->manufacturer_name
);
995 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_name
, _ptr_manufacturer_name
));
997 r
->manufacturer_name
= NULL
;
999 ndr
->flags
= _flags_save_string
;
1002 uint32_t _flags_save_string
= ndr
->flags
;
1003 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1004 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_manufacturer_url
));
1005 if (_ptr_manufacturer_url
) {
1006 NDR_PULL_ALLOC(ndr
, r
->manufacturer_url
);
1007 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->manufacturer_url
, _ptr_manufacturer_url
));
1009 r
->manufacturer_url
= NULL
;
1011 ndr
->flags
= _flags_save_string
;
1014 uint32_t _flags_save_string
= ndr
->flags
;
1015 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1016 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_hardware_id
));
1017 if (_ptr_hardware_id
) {
1018 NDR_PULL_ALLOC(ndr
, r
->hardware_id
);
1019 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->hardware_id
, _ptr_hardware_id
));
1021 r
->hardware_id
= NULL
;
1023 ndr
->flags
= _flags_save_string
;
1026 uint32_t _flags_save_string
= ndr
->flags
;
1027 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1028 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_provider
));
1029 if (_ptr_provider
) {
1030 NDR_PULL_ALLOC(ndr
, r
->provider
);
1031 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->provider
, _ptr_provider
));
1035 ndr
->flags
= _flags_save_string
;
1037 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
1039 if (ndr_flags
& NDR_BUFFERS
) {
1041 uint32_t _flags_save_string
= ndr
->flags
;
1042 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1043 if (r
->driver_name
) {
1044 uint32_t _relative_save_offset
;
1045 _relative_save_offset
= ndr
->offset
;
1046 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->driver_name
));
1047 _mem_save_driver_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1048 NDR_PULL_SET_MEM_CTX(ndr
, r
->driver_name
, 0);
1049 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->driver_name
));
1050 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_driver_name_0
, 0);
1051 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1052 ndr
->relative_highest_offset
= ndr
->offset
;
1054 ndr
->offset
= _relative_save_offset
;
1056 ndr
->flags
= _flags_save_string
;
1059 uint32_t _flags_save_string
= ndr
->flags
;
1060 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1061 if (r
->architecture
) {
1062 uint32_t _relative_save_offset
;
1063 _relative_save_offset
= ndr
->offset
;
1064 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->architecture
));
1065 _mem_save_architecture_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1066 NDR_PULL_SET_MEM_CTX(ndr
, r
->architecture
, 0);
1067 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->architecture
));
1068 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_architecture_0
, 0);
1069 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1070 ndr
->relative_highest_offset
= ndr
->offset
;
1072 ndr
->offset
= _relative_save_offset
;
1074 ndr
->flags
= _flags_save_string
;
1077 uint32_t _relative_save_offset
;
1078 _relative_save_offset
= ndr
->offset
;
1079 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->file_info
));
1080 _mem_save_file_info_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1081 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1083 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->file_info
));
1085 NDR_CHECK(ndr_token_store(ndr
, &ndr
->array_size_list
, &r
->file_info
, r
->file_count
));
1087 NDR_PULL_ALLOC_N(ndr
, r
->file_info
, r
->file_count
);
1088 _mem_save_file_info_1
= NDR_PULL_GET_MEM_CTX(ndr
);
1089 NDR_PULL_SET_MEM_CTX(ndr
, r
->file_info
, 0);
1090 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1091 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_SCALARS
, &r
->file_info
[cntr_file_info_1
]));
1093 for (cntr_file_info_1
= 0; cntr_file_info_1
< r
->file_count
; cntr_file_info_1
++) {
1094 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr
, NDR_BUFFERS
, &r
->file_info
[cntr_file_info_1
]));
1096 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_1
, 0);
1097 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_file_info_0
, 0);
1098 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1099 ndr
->relative_highest_offset
= ndr
->offset
;
1101 ndr
->offset
= _relative_save_offset
;
1104 uint32_t _flags_save_string
= ndr
->flags
;
1105 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1106 if (r
->monitor_name
) {
1107 uint32_t _relative_save_offset
;
1108 _relative_save_offset
= ndr
->offset
;
1109 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->monitor_name
));
1110 _mem_save_monitor_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1111 NDR_PULL_SET_MEM_CTX(ndr
, r
->monitor_name
, 0);
1112 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->monitor_name
));
1113 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_monitor_name_0
, 0);
1114 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1115 ndr
->relative_highest_offset
= ndr
->offset
;
1117 ndr
->offset
= _relative_save_offset
;
1119 ndr
->flags
= _flags_save_string
;
1122 uint32_t _flags_save_string
= ndr
->flags
;
1123 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1124 if (r
->default_datatype
) {
1125 uint32_t _relative_save_offset
;
1126 _relative_save_offset
= ndr
->offset
;
1127 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->default_datatype
));
1128 _mem_save_default_datatype_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1129 NDR_PULL_SET_MEM_CTX(ndr
, r
->default_datatype
, 0);
1130 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->default_datatype
));
1131 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_default_datatype_0
, 0);
1132 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1133 ndr
->relative_highest_offset
= ndr
->offset
;
1135 ndr
->offset
= _relative_save_offset
;
1137 ndr
->flags
= _flags_save_string
;
1140 uint32_t _flags_save_string_array
= ndr
->flags
;
1141 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1142 if (r
->previous_names
) {
1143 uint32_t _relative_save_offset
;
1144 _relative_save_offset
= ndr
->offset
;
1145 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->previous_names
));
1146 _mem_save_previous_names_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1147 NDR_PULL_SET_MEM_CTX(ndr
, r
->previous_names
, 0);
1148 NDR_CHECK(ndr_pull_string_array(ndr
, NDR_SCALARS
, &r
->previous_names
));
1149 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_previous_names_0
, 0);
1150 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1151 ndr
->relative_highest_offset
= ndr
->offset
;
1153 ndr
->offset
= _relative_save_offset
;
1155 ndr
->flags
= _flags_save_string_array
;
1158 uint32_t _flags_save_string
= ndr
->flags
;
1159 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1160 if (r
->manufacturer_name
) {
1161 uint32_t _relative_save_offset
;
1162 _relative_save_offset
= ndr
->offset
;
1163 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_name
));
1164 _mem_save_manufacturer_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1165 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_name
, 0);
1166 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_name
));
1167 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_name_0
, 0);
1168 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1169 ndr
->relative_highest_offset
= ndr
->offset
;
1171 ndr
->offset
= _relative_save_offset
;
1173 ndr
->flags
= _flags_save_string
;
1176 uint32_t _flags_save_string
= ndr
->flags
;
1177 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1178 if (r
->manufacturer_url
) {
1179 uint32_t _relative_save_offset
;
1180 _relative_save_offset
= ndr
->offset
;
1181 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->manufacturer_url
));
1182 _mem_save_manufacturer_url_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1183 NDR_PULL_SET_MEM_CTX(ndr
, r
->manufacturer_url
, 0);
1184 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->manufacturer_url
));
1185 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_manufacturer_url_0
, 0);
1186 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1187 ndr
->relative_highest_offset
= ndr
->offset
;
1189 ndr
->offset
= _relative_save_offset
;
1191 ndr
->flags
= _flags_save_string
;
1194 uint32_t _flags_save_string
= ndr
->flags
;
1195 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1196 if (r
->hardware_id
) {
1197 uint32_t _relative_save_offset
;
1198 _relative_save_offset
= ndr
->offset
;
1199 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->hardware_id
));
1200 _mem_save_hardware_id_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1201 NDR_PULL_SET_MEM_CTX(ndr
, r
->hardware_id
, 0);
1202 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->hardware_id
));
1203 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_hardware_id_0
, 0);
1204 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1205 ndr
->relative_highest_offset
= ndr
->offset
;
1207 ndr
->offset
= _relative_save_offset
;
1209 ndr
->flags
= _flags_save_string
;
1212 uint32_t _flags_save_string
= ndr
->flags
;
1213 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1215 uint32_t _relative_save_offset
;
1216 _relative_save_offset
= ndr
->offset
;
1217 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->provider
));
1218 _mem_save_provider_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1219 NDR_PULL_SET_MEM_CTX(ndr
, r
->provider
, 0);
1220 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->provider
));
1221 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_provider_0
, 0);
1222 if (ndr
->offset
> ndr
->relative_highest_offset
) {
1223 ndr
->relative_highest_offset
= ndr
->offset
;
1225 ndr
->offset
= _relative_save_offset
;
1227 ndr
->flags
= _flags_save_string
;
1230 NDR_CHECK(ndr_check_steal_array_size(ndr
, (void*)&r
->file_info
, r
->file_count
));
1233 return NDR_ERR_SUCCESS
;
1236 void ndr_print_spoolss_Field(struct ndr_print
*ndr
, const char *name
, const union spoolss_Field
*r
)
1239 level
= ndr_print_steal_switch_value(ndr
, r
);
1240 ndr_print_union(ndr
, name
, level
, "spoolss_Field");
1242 case PRINTER_NOTIFY_TYPE
:
1243 ndr_print_spoolss_PrintNotifyField(ndr
, "field", r
->field
);
1246 case JOB_NOTIFY_TYPE
:
1247 ndr_print_spoolss_JobNotifyField(ndr
, "field", r
->field
);
1251 ndr_print_uint16(ndr
, "field", r
->field
);
1257 _PUBLIC_
size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData
*r
, uint32_t level
, int flags
)
1262 return ndr_size_union(r
, flags
, level
, (ndr_push_flags_fn_t
)ndr_push_spoolss_PrinterData
);
1265 void ndr_print_spoolss_security_descriptor(struct ndr_print
*ndr
, const char *name
, const struct security_descriptor
*r
)
1267 ndr_print_security_descriptor(ndr
, name
, r
);
1270 enum ndr_err_code
ndr_pull_spoolss_security_descriptor(struct ndr_pull
*ndr
, int ndr_flags
, struct security_descriptor
*r
)
1272 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1273 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NO_RELATIVE_REVERSE
);
1274 NDR_CHECK(ndr_pull_security_descriptor(ndr
, ndr_flags
, r
));
1275 ndr
->flags
= _flags_save_STRUCT
;
1276 return NDR_ERR_SUCCESS
;
1279 enum ndr_err_code
ndr_push_spoolss_security_descriptor(struct ndr_push
*ndr
, int ndr_flags
, const struct security_descriptor
*r
)
1282 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1283 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_LITTLE_ENDIAN
|LIBNDR_FLAG_NO_RELATIVE_REVERSE
);
1284 if (ndr_flags
& NDR_SCALARS
) {
1285 NDR_CHECK(ndr_push_align(ndr
, 5));
1286 NDR_CHECK(ndr_push_security_descriptor_revision(ndr
, NDR_SCALARS
, r
->revision
));
1287 NDR_CHECK(ndr_push_security_descriptor_type(ndr
, NDR_SCALARS
, r
->type
));
1288 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->owner_sid
));
1289 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->group_sid
));
1290 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sacl
));
1291 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->dacl
));
1292 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
1294 if (ndr_flags
& NDR_BUFFERS
) {
1296 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sacl
));
1297 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sacl
));
1298 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sacl
));
1301 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->dacl
));
1302 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->dacl
));
1303 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->dacl
));
1306 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->owner_sid
));
1307 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->owner_sid
));
1308 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->owner_sid
));
1311 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->group_sid
));
1312 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
1313 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->group_sid
));
1316 ndr
->flags
= _flags_save_STRUCT
;
1318 return NDR_ERR_SUCCESS
;
1321 _PUBLIC_
enum ndr_err_code
ndr_push_spoolss_PrinterInfo2(struct ndr_push
*ndr
, int ndr_flags
, const struct spoolss_PrinterInfo2
*r
)
1323 if (ndr_flags
& NDR_SCALARS
) {
1324 NDR_CHECK(ndr_push_align(ndr
, 5));
1326 uint32_t _flags_save_string
= ndr
->flags
;
1327 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1328 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->servername
));
1329 ndr
->flags
= _flags_save_string
;
1332 uint32_t _flags_save_string
= ndr
->flags
;
1333 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1334 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->printername
));
1335 ndr
->flags
= _flags_save_string
;
1338 uint32_t _flags_save_string
= ndr
->flags
;
1339 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1340 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sharename
));
1341 ndr
->flags
= _flags_save_string
;
1344 uint32_t _flags_save_string
= ndr
->flags
;
1345 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1346 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->portname
));
1347 ndr
->flags
= _flags_save_string
;
1350 uint32_t _flags_save_string
= ndr
->flags
;
1351 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1352 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->drivername
));
1353 ndr
->flags
= _flags_save_string
;
1356 uint32_t _flags_save_string
= ndr
->flags
;
1357 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1358 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->comment
));
1359 ndr
->flags
= _flags_save_string
;
1362 uint32_t _flags_save_string
= ndr
->flags
;
1363 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1364 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->location
));
1365 ndr
->flags
= _flags_save_string
;
1368 uint32_t _flags_save_spoolss_DeviceMode
= ndr
->flags
;
1369 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1370 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->devmode
));
1371 ndr
->flags
= _flags_save_spoolss_DeviceMode
;
1374 uint32_t _flags_save_string
= ndr
->flags
;
1375 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1376 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sepfile
));
1377 ndr
->flags
= _flags_save_string
;
1380 uint32_t _flags_save_string
= ndr
->flags
;
1381 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1382 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->printprocessor
));
1383 ndr
->flags
= _flags_save_string
;
1386 uint32_t _flags_save_string
= ndr
->flags
;
1387 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1388 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->datatype
));
1389 ndr
->flags
= _flags_save_string
;
1392 uint32_t _flags_save_string
= ndr
->flags
;
1393 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1394 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->parameters
));
1395 ndr
->flags
= _flags_save_string
;
1398 uint32_t _flags_save_spoolss_security_descriptor
= ndr
->flags
;
1399 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1400 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->secdesc
));
1401 ndr
->flags
= _flags_save_spoolss_security_descriptor
;
1403 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr
, NDR_SCALARS
, r
->attributes
));
1404 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->priority
));
1405 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->defaultpriority
));
1406 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->starttime
));
1407 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->untiltime
));
1408 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr
, NDR_SCALARS
, r
->status
));
1409 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->cjobs
));
1410 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->averageppm
));
1411 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
1413 if (ndr_flags
& NDR_BUFFERS
) {
1415 uint32_t _flags_save_string
= ndr
->flags
;
1416 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1417 if (r
->servername
) {
1418 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->servername
));
1419 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->servername
));
1420 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->servername
));
1422 ndr
->flags
= _flags_save_string
;
1425 uint32_t _flags_save_string
= ndr
->flags
;
1426 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1427 if (r
->printername
) {
1428 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->printername
));
1429 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->printername
));
1430 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->printername
));
1432 ndr
->flags
= _flags_save_string
;
1435 uint32_t _flags_save_string
= ndr
->flags
;
1436 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1438 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sharename
));
1439 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->sharename
));
1440 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sharename
));
1442 ndr
->flags
= _flags_save_string
;
1445 uint32_t _flags_save_string
= ndr
->flags
;
1446 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1448 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->portname
));
1449 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->portname
));
1450 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->portname
));
1452 ndr
->flags
= _flags_save_string
;
1455 uint32_t _flags_save_string
= ndr
->flags
;
1456 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1457 if (r
->drivername
) {
1458 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->drivername
));
1459 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->drivername
));
1460 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->drivername
));
1462 ndr
->flags
= _flags_save_string
;
1465 uint32_t _flags_save_string
= ndr
->flags
;
1466 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1468 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->comment
));
1469 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->comment
));
1470 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->comment
));
1472 ndr
->flags
= _flags_save_string
;
1475 uint32_t _flags_save_string
= ndr
->flags
;
1476 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1478 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->location
));
1479 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->location
));
1480 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->location
));
1482 ndr
->flags
= _flags_save_string
;
1485 uint32_t _flags_save_string
= ndr
->flags
;
1486 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1488 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->sepfile
));
1489 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->sepfile
));
1490 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->sepfile
));
1492 ndr
->flags
= _flags_save_string
;
1495 uint32_t _flags_save_string
= ndr
->flags
;
1496 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1497 if (r
->printprocessor
) {
1498 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->printprocessor
));
1499 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->printprocessor
));
1500 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->printprocessor
));
1502 ndr
->flags
= _flags_save_string
;
1505 uint32_t _flags_save_string
= ndr
->flags
;
1506 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1508 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->datatype
));
1509 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->datatype
));
1510 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->datatype
));
1512 ndr
->flags
= _flags_save_string
;
1515 uint32_t _flags_save_string
= ndr
->flags
;
1516 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
1517 if (r
->parameters
) {
1518 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->parameters
));
1519 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->parameters
));
1520 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->parameters
));
1522 ndr
->flags
= _flags_save_string
;
1525 uint32_t _flags_save_spoolss_DeviceMode
= ndr
->flags
;
1526 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1528 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->devmode
));
1530 struct ndr_push
*_ndr_devmode
;
1531 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_devmode
, 0, -1));
1532 NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode
, NDR_SCALARS
, r
->devmode
));
1533 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_devmode
, 0, -1));
1535 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->devmode
));
1537 ndr
->flags
= _flags_save_spoolss_DeviceMode
;
1540 uint32_t _flags_save_spoolss_security_descriptor
= ndr
->flags
;
1541 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
1543 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->secdesc
));
1545 struct ndr_push
*_ndr_secdesc
;
1546 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_secdesc
, 0, -1));
1547 NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc
, NDR_SCALARS
|NDR_BUFFERS
, r
->secdesc
));
1548 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_secdesc
, 0, -1));
1550 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->secdesc
));
1552 ndr
->flags
= _flags_save_spoolss_security_descriptor
;
1555 return NDR_ERR_SUCCESS
;
1558 _PUBLIC_
void ndr_print_spoolss_Time(struct ndr_print
*ndr
, const char *name
, const struct spoolss_Time
*r
)
1564 tm
.tm_sec
= r
->second
;
1565 tm
.tm_min
= r
->minute
;
1566 tm
.tm_hour
= r
->hour
;
1567 tm
.tm_mday
= r
->day
;
1568 tm
.tm_mon
= r
->month
- 1;
1569 tm
.tm_year
= r
->year
- 1900;
1570 tm
.tm_wday
= r
->day_of_week
;
1576 str
= timestring(ndr
, t
);
1578 ndr_print_struct(ndr
, name
, "spoolss_Time");
1580 ndr_print_string(ndr
, "", str
);
1585 _PUBLIC_
uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type
)
1591 return LIBNDR_FLAG_ALIGN2
;
1593 return LIBNDR_FLAG_ALIGN2
;
1597 return LIBNDR_FLAG_ALIGN4
;
1598 case REG_DWORD_BIG_ENDIAN
:
1599 return LIBNDR_FLAG_ALIGN4
;
1603 return LIBNDR_FLAG_ALIGN2
;
1604 case REG_RESOURCE_LIST
:
1605 return LIBNDR_FLAG_ALIGN2
;
1606 case REG_FULL_RESOURCE_DESCRIPTOR
:
1607 return LIBNDR_FLAG_ALIGN4
;
1608 case REG_RESOURCE_REQUIREMENTS_LIST
:
1609 return LIBNDR_FLAG_ALIGN2
;
1611 return LIBNDR_FLAG_ALIGN8
;