s3-net: fix net after spoolss_EnumPrinterDataEx IDL change.
[Samba.git] / source3 / rpc_client / cli_spoolss.c
blob2ca313d1687bd9c55a6cea5addda09a7cf189cd6
1 /*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
5 Copyright (C) Gerald Carter 2001-2005,
6 Copyright (C) Tim Potter 2000-2002,
7 Copyright (C) Andrew Tridgell 1994-2000,
8 Copyright (C) Jean-Francois Micouleau 1999-2000.
9 Copyright (C) Jeremy Allison 2005.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "includes.h"
26 #include "../librpc/gen_ndr/cli_spoolss.h"
28 /**********************************************************************
29 convencience wrapper around rpccli_spoolss_OpenPrinterEx
30 **********************************************************************/
32 WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
33 TALLOC_CTX *mem_ctx,
34 const char *printername,
35 uint32_t access_desired,
36 struct policy_handle *handle)
38 NTSTATUS status;
39 WERROR werror;
40 struct spoolss_DevmodeContainer devmode_ctr;
41 union spoolss_UserLevel userlevel;
42 struct spoolss_UserLevel1 level1;
44 ZERO_STRUCT(devmode_ctr);
46 level1.size = 28;
47 level1.client = talloc_asprintf(mem_ctx, "\\\\%s", global_myname());
48 W_ERROR_HAVE_NO_MEMORY(level1.client);
49 level1.user = cli->auth->user_name;
50 level1.build = 1381;
51 level1.major = 2;
52 level1.minor = 0;
53 level1.processor = 0;
55 userlevel.level1 = &level1;
57 status = rpccli_spoolss_OpenPrinterEx(cli, mem_ctx,
58 printername,
59 NULL,
60 devmode_ctr,
61 access_desired,
62 1, /* level */
63 userlevel,
64 handle,
65 &werror);
67 if (!W_ERROR_IS_OK(werror)) {
68 return werror;
71 if (!NT_STATUS_IS_OK(status)) {
72 return ntstatus_to_werror(status);
75 return WERR_OK;
78 /**********************************************************************
79 convencience wrapper around rpccli_spoolss_GetPrinterDriver
80 **********************************************************************/
82 WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
83 TALLOC_CTX *mem_ctx,
84 struct policy_handle *handle,
85 const char *architecture,
86 uint32_t level,
87 uint32_t offered,
88 union spoolss_DriverInfo *info)
90 NTSTATUS status;
91 WERROR werror;
92 uint32_t needed;
93 DATA_BLOB buffer;
95 if (offered > 0) {
96 buffer = data_blob_talloc_zero(mem_ctx, offered);
97 W_ERROR_HAVE_NO_MEMORY(buffer.data);
100 status = rpccli_spoolss_GetPrinterDriver(cli, mem_ctx,
101 handle,
102 architecture,
103 level,
104 (offered > 0) ? &buffer : NULL,
105 offered,
106 info,
107 &needed,
108 &werror);
109 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
110 offered = needed;
111 buffer = data_blob_talloc_zero(mem_ctx, needed);
112 W_ERROR_HAVE_NO_MEMORY(buffer.data);
114 status = rpccli_spoolss_GetPrinterDriver(cli, mem_ctx,
115 handle,
116 architecture,
117 level,
118 &buffer,
119 offered,
120 info,
121 &needed,
122 &werror);
125 return werror;
128 /**********************************************************************
129 convencience wrapper around rpccli_spoolss_GetPrinterDriver2
130 **********************************************************************/
132 WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli,
133 TALLOC_CTX *mem_ctx,
134 struct policy_handle *handle,
135 const char *architecture,
136 uint32_t level,
137 uint32_t offered,
138 uint32_t client_major_version,
139 uint32_t client_minor_version,
140 union spoolss_DriverInfo *info,
141 uint32_t *server_major_version,
142 uint32_t *server_minor_version)
144 NTSTATUS status;
145 WERROR werror;
146 uint32_t needed;
147 DATA_BLOB buffer;
149 if (offered > 0) {
150 buffer = data_blob_talloc_zero(mem_ctx, offered);
151 W_ERROR_HAVE_NO_MEMORY(buffer.data);
154 status = rpccli_spoolss_GetPrinterDriver2(cli, mem_ctx,
155 handle,
156 architecture,
157 level,
158 (offered > 0) ? &buffer : NULL,
159 offered,
160 client_major_version,
161 client_minor_version,
162 info,
163 &needed,
164 server_major_version,
165 server_minor_version,
166 &werror);
167 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
168 offered = needed;
169 buffer = data_blob_talloc_zero(mem_ctx, needed);
170 W_ERROR_HAVE_NO_MEMORY(buffer.data);
172 status = rpccli_spoolss_GetPrinterDriver2(cli, mem_ctx,
173 handle,
174 architecture,
175 level,
176 &buffer,
177 offered,
178 client_major_version,
179 client_minor_version,
180 info,
181 &needed,
182 server_major_version,
183 server_minor_version,
184 &werror);
187 return werror;
190 /**********************************************************************
191 convencience wrapper around rpccli_spoolss_AddPrinterEx
192 **********************************************************************/
194 WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
195 TALLOC_CTX *mem_ctx,
196 struct spoolss_SetPrinterInfoCtr *info_ctr)
198 WERROR result;
199 NTSTATUS status;
200 struct spoolss_DevmodeContainer devmode_ctr;
201 struct sec_desc_buf secdesc_ctr;
202 struct spoolss_UserLevelCtr userlevel_ctr;
203 struct spoolss_UserLevel1 level1;
204 struct policy_handle handle;
206 ZERO_STRUCT(devmode_ctr);
207 ZERO_STRUCT(secdesc_ctr);
209 level1.size = 28;
210 level1.build = 1381;
211 level1.major = 2;
212 level1.minor = 0;
213 level1.processor = 0;
214 level1.client = talloc_asprintf(mem_ctx, "\\\\%s", global_myname());
215 W_ERROR_HAVE_NO_MEMORY(level1.client);
216 level1.user = cli->auth->user_name;
218 userlevel_ctr.level = 1;
219 userlevel_ctr.user_info.level1 = &level1;
221 status = rpccli_spoolss_AddPrinterEx(cli, mem_ctx,
222 cli->srv_name_slash,
223 info_ctr,
224 &devmode_ctr,
225 &secdesc_ctr,
226 &userlevel_ctr,
227 &handle,
228 &result);
229 return result;
232 /**********************************************************************
233 convencience wrapper around rpccli_spoolss_GetPrinter
234 **********************************************************************/
236 WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
237 TALLOC_CTX *mem_ctx,
238 struct policy_handle *handle,
239 uint32_t level,
240 uint32_t offered,
241 union spoolss_PrinterInfo *info)
243 NTSTATUS status;
244 WERROR werror;
245 DATA_BLOB buffer;
246 uint32_t needed;
248 if (offered > 0) {
249 buffer = data_blob_talloc_zero(mem_ctx, offered);
250 W_ERROR_HAVE_NO_MEMORY(buffer.data);
253 status = rpccli_spoolss_GetPrinter(cli, mem_ctx,
254 handle,
255 level,
256 (offered > 0) ? &buffer : NULL,
257 offered,
258 info,
259 &needed,
260 &werror);
262 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
264 offered = needed;
265 buffer = data_blob_talloc_zero(mem_ctx, offered);
266 W_ERROR_HAVE_NO_MEMORY(buffer.data);
268 status = rpccli_spoolss_GetPrinter(cli, mem_ctx,
269 handle,
270 level,
271 &buffer,
272 offered,
273 info,
274 &needed,
275 &werror);
278 return werror;
281 /**********************************************************************
282 convencience wrapper around rpccli_spoolss_GetJob
283 **********************************************************************/
285 WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli,
286 TALLOC_CTX *mem_ctx,
287 struct policy_handle *handle,
288 uint32_t job_id,
289 uint32_t level,
290 uint32_t offered,
291 union spoolss_JobInfo *info)
293 NTSTATUS status;
294 WERROR werror;
295 uint32_t needed;
296 DATA_BLOB buffer;
298 if (offered > 0) {
299 buffer = data_blob_talloc_zero(mem_ctx, offered);
300 W_ERROR_HAVE_NO_MEMORY(buffer.data);
303 status = rpccli_spoolss_GetJob(cli, mem_ctx,
304 handle,
305 job_id,
306 level,
307 (offered > 0) ? &buffer : NULL,
308 offered,
309 info,
310 &needed,
311 &werror);
313 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
314 offered = needed;
315 buffer = data_blob_talloc_zero(mem_ctx, needed);
316 W_ERROR_HAVE_NO_MEMORY(buffer.data);
318 status = rpccli_spoolss_GetJob(cli, mem_ctx,
319 handle,
320 job_id,
321 level,
322 &buffer,
323 offered,
324 info,
325 &needed,
326 &werror);
329 return werror;
332 /**********************************************************************
333 convencience wrapper around rpccli_spoolss_EnumForms
334 **********************************************************************/
336 WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli,
337 TALLOC_CTX *mem_ctx,
338 struct policy_handle *handle,
339 uint32_t level,
340 uint32_t offered,
341 uint32_t *count,
342 union spoolss_FormInfo **info)
344 NTSTATUS status;
345 WERROR werror;
346 uint32_t needed;
347 DATA_BLOB buffer;
349 if (offered > 0) {
350 buffer = data_blob_talloc_zero(mem_ctx, offered);
351 W_ERROR_HAVE_NO_MEMORY(buffer.data);
354 status = rpccli_spoolss_EnumForms(cli, mem_ctx,
355 handle,
356 level,
357 (offered > 0) ? &buffer : NULL,
358 offered,
359 count,
360 info,
361 &needed,
362 &werror);
364 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
365 offered = needed;
366 buffer = data_blob_talloc_zero(mem_ctx, needed);
367 W_ERROR_HAVE_NO_MEMORY(buffer.data);
369 status = rpccli_spoolss_EnumForms(cli, mem_ctx,
370 handle,
371 level,
372 (offered > 0) ? &buffer : NULL,
373 offered,
374 count,
375 info,
376 &needed,
377 &werror);
380 return werror;
383 /**********************************************************************
384 convencience wrapper around rpccli_spoolss_EnumPrintProcessors
385 **********************************************************************/
387 WERROR rpccli_spoolss_enumprintprocessors(struct rpc_pipe_client *cli,
388 TALLOC_CTX *mem_ctx,
389 const char *servername,
390 const char *environment,
391 uint32_t level,
392 uint32_t offered,
393 uint32_t *count,
394 union spoolss_PrintProcessorInfo **info)
396 NTSTATUS status;
397 WERROR werror;
398 uint32_t needed;
399 DATA_BLOB buffer;
401 if (offered > 0) {
402 buffer = data_blob_talloc_zero(mem_ctx, offered);
403 W_ERROR_HAVE_NO_MEMORY(buffer.data);
406 status = rpccli_spoolss_EnumPrintProcessors(cli, mem_ctx,
407 servername,
408 environment,
409 level,
410 (offered > 0) ? &buffer : NULL,
411 offered,
412 count,
413 info,
414 &needed,
415 &werror);
417 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
418 offered = needed;
419 buffer = data_blob_talloc_zero(mem_ctx, needed);
420 W_ERROR_HAVE_NO_MEMORY(buffer.data);
422 status = rpccli_spoolss_EnumPrintProcessors(cli, mem_ctx,
423 servername,
424 environment,
425 level,
426 (offered > 0) ? &buffer : NULL,
427 offered,
428 count,
429 info,
430 &needed,
431 &werror);
434 return werror;
437 /**********************************************************************
438 convencience wrapper around rpccli_spoolss_EnumPrintProcDataTypes
439 **********************************************************************/
441 WERROR rpccli_spoolss_enumprintprocessordatatypes(struct rpc_pipe_client *cli,
442 TALLOC_CTX *mem_ctx,
443 const char *servername,
444 const char *print_processor_name,
445 uint32_t level,
446 uint32_t offered,
447 uint32_t *count,
448 union spoolss_PrintProcDataTypesInfo **info)
450 NTSTATUS status;
451 WERROR werror;
452 uint32_t needed;
453 DATA_BLOB buffer;
455 if (offered > 0) {
456 buffer = data_blob_talloc_zero(mem_ctx, offered);
457 W_ERROR_HAVE_NO_MEMORY(buffer.data);
460 status = rpccli_spoolss_EnumPrintProcDataTypes(cli, mem_ctx,
461 servername,
462 print_processor_name,
463 level,
464 (offered > 0) ? &buffer : NULL,
465 offered,
466 count,
467 info,
468 &needed,
469 &werror);
471 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
472 offered = needed;
473 buffer = data_blob_talloc_zero(mem_ctx, needed);
474 W_ERROR_HAVE_NO_MEMORY(buffer.data);
476 status = rpccli_spoolss_EnumPrintProcDataTypes(cli, mem_ctx,
477 servername,
478 print_processor_name,
479 level,
480 (offered > 0) ? &buffer : NULL,
481 offered,
482 count,
483 info,
484 &needed,
485 &werror);
488 return werror;
491 /**********************************************************************
492 convencience wrapper around rpccli_spoolss_EnumPorts
493 **********************************************************************/
495 WERROR rpccli_spoolss_enumports(struct rpc_pipe_client *cli,
496 TALLOC_CTX *mem_ctx,
497 const char *servername,
498 uint32_t level,
499 uint32_t offered,
500 uint32_t *count,
501 union spoolss_PortInfo **info)
503 NTSTATUS status;
504 WERROR werror;
505 uint32_t needed;
506 DATA_BLOB buffer;
508 if (offered > 0) {
509 buffer = data_blob_talloc_zero(mem_ctx, offered);
510 W_ERROR_HAVE_NO_MEMORY(buffer.data);
513 status = rpccli_spoolss_EnumPorts(cli, mem_ctx,
514 servername,
515 level,
516 (offered > 0) ? &buffer : NULL,
517 offered,
518 count,
519 info,
520 &needed,
521 &werror);
523 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
524 offered = needed;
525 buffer = data_blob_talloc_zero(mem_ctx, needed);
526 W_ERROR_HAVE_NO_MEMORY(buffer.data);
528 status = rpccli_spoolss_EnumPorts(cli, mem_ctx,
529 servername,
530 level,
531 (offered > 0) ? &buffer : NULL,
532 offered,
533 count,
534 info,
535 &needed,
536 &werror);
539 return werror;
542 /**********************************************************************
543 convencience wrapper around rpccli_spoolss_EnumMonitors
544 **********************************************************************/
546 WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli,
547 TALLOC_CTX *mem_ctx,
548 const char *servername,
549 uint32_t level,
550 uint32_t offered,
551 uint32_t *count,
552 union spoolss_MonitorInfo **info)
554 NTSTATUS status;
555 WERROR werror;
556 uint32_t needed;
557 DATA_BLOB buffer;
559 if (offered > 0) {
560 buffer = data_blob_talloc_zero(mem_ctx, offered);
561 W_ERROR_HAVE_NO_MEMORY(buffer.data);
564 status = rpccli_spoolss_EnumMonitors(cli, mem_ctx,
565 servername,
566 level,
567 (offered > 0) ? &buffer : NULL,
568 offered,
569 count,
570 info,
571 &needed,
572 &werror);
574 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
575 offered = needed;
576 buffer = data_blob_talloc_zero(mem_ctx, needed);
577 W_ERROR_HAVE_NO_MEMORY(buffer.data);
579 status = rpccli_spoolss_EnumMonitors(cli, mem_ctx,
580 servername,
581 level,
582 (offered > 0) ? &buffer : NULL,
583 offered,
584 count,
585 info,
586 &needed,
587 &werror);
590 return werror;
593 /**********************************************************************
594 convencience wrapper around rpccli_spoolss_EnumJobs
595 **********************************************************************/
597 WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
598 TALLOC_CTX *mem_ctx,
599 struct policy_handle *handle,
600 uint32_t firstjob,
601 uint32_t numjobs,
602 uint32_t level,
603 uint32_t offered,
604 uint32_t *count,
605 union spoolss_JobInfo **info)
607 NTSTATUS status;
608 WERROR werror;
609 uint32_t needed;
610 DATA_BLOB buffer;
612 if (offered > 0) {
613 buffer = data_blob_talloc_zero(mem_ctx, offered);
614 W_ERROR_HAVE_NO_MEMORY(buffer.data);
617 status = rpccli_spoolss_EnumJobs(cli, mem_ctx,
618 handle,
619 firstjob,
620 numjobs,
621 level,
622 (offered > 0) ? &buffer : NULL,
623 offered,
624 count,
625 info,
626 &needed,
627 &werror);
629 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
630 offered = needed;
631 buffer = data_blob_talloc_zero(mem_ctx, needed);
632 W_ERROR_HAVE_NO_MEMORY(buffer.data);
634 status = rpccli_spoolss_EnumJobs(cli, mem_ctx,
635 handle,
636 firstjob,
637 numjobs,
638 level,
639 (offered > 0) ? &buffer : NULL,
640 offered,
641 count,
642 info,
643 &needed,
644 &werror);
647 return werror;
650 /**********************************************************************
651 convencience wrapper around rpccli_spoolss_EnumPrinterDrivers
652 **********************************************************************/
654 WERROR rpccli_spoolss_enumprinterdrivers(struct rpc_pipe_client *cli,
655 TALLOC_CTX *mem_ctx,
656 const char *server,
657 const char *environment,
658 uint32_t level,
659 uint32_t offered,
660 uint32_t *count,
661 union spoolss_DriverInfo **info)
663 NTSTATUS status;
664 WERROR werror;
665 uint32_t needed;
666 DATA_BLOB buffer;
668 if (offered > 0) {
669 buffer = data_blob_talloc_zero(mem_ctx, offered);
670 W_ERROR_HAVE_NO_MEMORY(buffer.data);
673 status = rpccli_spoolss_EnumPrinterDrivers(cli, mem_ctx,
674 server,
675 environment,
676 level,
677 (offered > 0) ? &buffer : NULL,
678 offered,
679 count,
680 info,
681 &needed,
682 &werror);
684 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
685 offered = needed;
686 buffer = data_blob_talloc_zero(mem_ctx, needed);
687 W_ERROR_HAVE_NO_MEMORY(buffer.data);
689 status = rpccli_spoolss_EnumPrinterDrivers(cli, mem_ctx,
690 server,
691 environment,
692 level,
693 (offered > 0) ? &buffer : NULL,
694 offered,
695 count,
696 info,
697 &needed,
698 &werror);
701 return werror;
704 /**********************************************************************
705 convencience wrapper around rpccli_spoolss_EnumPrinters
706 **********************************************************************/
708 WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client *cli,
709 TALLOC_CTX *mem_ctx,
710 uint32_t flags,
711 const char *server,
712 uint32_t level,
713 uint32_t offered,
714 uint32_t *count,
715 union spoolss_PrinterInfo **info)
717 NTSTATUS status;
718 WERROR werror;
719 uint32_t needed;
720 DATA_BLOB buffer;
722 if (offered > 0) {
723 buffer = data_blob_talloc_zero(mem_ctx, offered);
724 W_ERROR_HAVE_NO_MEMORY(buffer.data);
727 status = rpccli_spoolss_EnumPrinters(cli, mem_ctx,
728 flags,
729 server,
730 level,
731 (offered > 0) ? &buffer : NULL,
732 offered,
733 count,
734 info,
735 &needed,
736 &werror);
738 if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
739 offered = needed;
740 buffer = data_blob_talloc_zero(mem_ctx, needed);
741 W_ERROR_HAVE_NO_MEMORY(buffer.data);
743 status = rpccli_spoolss_EnumPrinters(cli, mem_ctx,
744 flags,
745 server,
746 level,
747 (offered > 0) ? &buffer : NULL,
748 offered,
749 count,
750 info,
751 &needed,
752 &werror);
755 return werror;
758 /**********************************************************************
759 convencience wrapper around rpccli_spoolss_GetPrinterData
760 **********************************************************************/
762 WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
763 TALLOC_CTX *mem_ctx,
764 struct policy_handle *handle,
765 const char *value_name,
766 uint32_t offered,
767 enum winreg_Type *type,
768 uint32_t *needed_p,
769 uint8_t **data_p)
771 NTSTATUS status;
772 WERROR werror;
773 uint32_t needed;
774 uint8_t *data;
776 data = talloc_zero_array(mem_ctx, uint8_t, offered);
777 W_ERROR_HAVE_NO_MEMORY(data);
779 status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
780 handle,
781 value_name,
782 type,
783 data,
784 offered,
785 &needed,
786 &werror);
788 if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
789 offered = needed;
790 data = talloc_zero_array(mem_ctx, uint8_t, offered);
791 W_ERROR_HAVE_NO_MEMORY(data);
793 status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
794 handle,
795 value_name,
796 type,
797 data,
798 offered,
799 &needed,
800 &werror);
803 *data_p = data;
804 *needed_p = needed;
806 return werror;
809 /**********************************************************************
810 convencience wrapper around rpccli_spoolss_EnumPrinterKey
811 **********************************************************************/
813 WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
814 TALLOC_CTX *mem_ctx,
815 struct policy_handle *handle,
816 const char *key_name,
817 const char ***key_buffer,
818 uint32_t offered)
820 NTSTATUS status;
821 WERROR werror;
822 uint32_t needed;
823 union spoolss_KeyNames _key_buffer;
824 uint32_t _ndr_size;
826 status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
827 handle,
828 key_name,
829 &_ndr_size,
830 &_key_buffer,
831 offered,
832 &needed,
833 &werror);
835 if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
836 offered = needed;
837 status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
838 handle,
839 key_name,
840 &_ndr_size,
841 &_key_buffer,
842 offered,
843 &needed,
844 &werror);
847 *key_buffer = _key_buffer.string_array;
849 return werror;
852 /**********************************************************************
853 convencience wrapper around rpccli_spoolss_EnumPrinterDataEx
854 **********************************************************************/
856 WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli,
857 TALLOC_CTX *mem_ctx,
858 struct policy_handle *handle,
859 const char *key_name,
860 uint32_t offered,
861 uint32_t *count,
862 struct spoolss_PrinterEnumValues **info)
864 NTSTATUS status;
865 WERROR werror;
866 uint32_t needed;
868 status = rpccli_spoolss_EnumPrinterDataEx(cli, mem_ctx,
869 handle,
870 key_name,
871 offered,
872 count,
873 info,
874 &needed,
875 &werror);
877 if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
878 offered = needed;
880 status = rpccli_spoolss_EnumPrinterDataEx(cli, mem_ctx,
881 handle,
882 key_name,
883 offered,
884 count,
885 info,
886 &needed,
887 &werror);
890 return werror;