2 Unix SMB/CIFS implementation.
3 test suite for spoolss rpc operations
5 Copyright (C) Guenther Deschner 2009-2010
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 /****************************************************************************
22 ****************************************************************************/
24 #include "testspoolss.h"
28 /****************************************************************************
29 ****************************************************************************/
31 static BOOL
test_OpenPrinter(struct torture_context
*tctx
,
33 LPPRINTER_DEFAULTS defaults
,
36 torture_comment(tctx
, "Testing OpenPrinter(%s)", printername
);
38 if (!OpenPrinter(printername
, handle
, defaults
)) {
40 sprintf(tmp
, "failed to open printer %s, error was: 0x%08x\n",
41 printername
, GetLastError());
42 torture_fail(tctx
, tmp
);
48 /****************************************************************************
49 ****************************************************************************/
51 static BOOL
test_ClosePrinter(struct torture_context
*tctx
,
54 torture_comment(tctx
, "Testing ClosePrinter");
56 if (!ClosePrinter(handle
)) {
58 sprintf(tmp
, "failed to close printer, error was: %s\n",
59 errstr(GetLastError()));
60 torture_fail(tctx
, tmp
);
67 /****************************************************************************
68 ****************************************************************************/
70 static BOOL
test_EnumPrinters(struct torture_context
*tctx
,
73 DWORD levels
[] = { 1, 2, 5 };
74 DWORD success
[] = { 1, 1, 1 };
76 DWORD flags
= PRINTER_ENUM_NAME
;
79 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
86 torture_comment(tctx
, "Testing EnumPrinters level %d", levels
[i
]);
88 EnumPrinters(flags
, servername
, levels
[i
], NULL
, 0, &needed
, &returned
);
90 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
92 buffer
= malloc(needed
);
93 torture_assert(tctx
, buffer
, "malloc failed");
94 if (!EnumPrinters(flags
, servername
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
99 sprintf(tmp
, "EnumPrinters failed level %d on [%s] (buffer size = %d), error: %s\n",
100 levels
[i
], servername
, needed
, errstr(err
));
102 torture_fail(tctx
, tmp
);
104 torture_warning(tctx
, tmp
);
109 print_printer_info_bylevel(levels
[i
], buffer
, returned
);
119 /****************************************************************************
120 ****************************************************************************/
122 static BOOL
test_EnumDrivers(struct torture_context
*tctx
,
126 DWORD levels
[] = { 1, 2, 3, 4, 5, 6 };
127 DWORD success
[] = { 1, 1, 1, 1, 1, 1 };
129 LPBYTE buffer
= NULL
;
131 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
138 torture_comment(tctx
, "Testing EnumPrinterDrivers(%s) level %d",
139 architecture
, levels
[i
]);
141 EnumPrinterDrivers(servername
, architecture
, levels
[i
], NULL
, 0, &needed
, &returned
);
142 err
= GetLastError();
143 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
145 buffer
= malloc(needed
);
146 torture_assert(tctx
, buffer
, "malloc failed");
147 if (!EnumPrinterDrivers(servername
, architecture
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
148 err
= GetLastError();
152 sprintf(tmp
, "EnumPrinterDrivers failed level %d on [%s] (buffer size = %d), error: %s\n",
153 levels
[i
], servername
, needed
, errstr(err
));
155 torture_fail(tctx
, tmp
);
157 torture_warning(tctx
, tmp
);
162 print_driver_info_bylevel(levels
[i
], buffer
, returned
);
172 /****************************************************************************
173 ****************************************************************************/
175 static BOOL
test_GetForm(struct torture_context
*tctx
,
180 DWORD levels
[] = { 1, 2 };
181 DWORD success
[] = { 1, 0 };
183 LPBYTE buffer
= NULL
;
185 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
191 torture_comment(tctx
, "Testing GetForm(%s) level %d", formname
, levels
[i
]);
193 GetForm(handle
, formname
, levels
[i
], NULL
, 0, &needed
);
194 err
= GetLastError();
195 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
197 buffer
= malloc(needed
);
198 torture_assert(tctx
, buffer
, "malloc failed");
199 if (!GetForm(handle
, formname
, levels
[i
], buffer
, needed
, &needed
)) {
200 err
= GetLastError();
204 sprintf(tmp
, "GetForm failed level %d on [%s] (buffer size = %d), error: %s\n",
205 levels
[i
], servername
, needed
, errstr(err
));
207 torture_fail(tctx
, tmp
);
209 torture_warning(tctx
, tmp
);
214 print_form_info_bylevel(levels
[i
], buffer
, 1);
224 /****************************************************************************
225 ****************************************************************************/
227 static BOOL
test_EnumForms(struct torture_context
*tctx
,
231 DWORD levels
[] = { 1, 2 };
232 DWORD success
[] = { 1, 1 };
234 LPBYTE buffer
= NULL
;
236 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
243 torture_comment(tctx
, "Testing EnumForms level %d", levels
[i
]);
245 if (tctx
->samba3
&& levels
[i
] == 2) {
246 torture_comment(tctx
, "skipping level %d enum against samba\n", levels
[i
]);
250 EnumForms(handle
, levels
[i
], NULL
, 0, &needed
, &returned
);
251 err
= GetLastError();
252 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
254 buffer
= malloc(needed
);
255 torture_assert(tctx
, buffer
, "malloc failed");
256 if (!EnumForms(handle
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
257 err
= GetLastError();
261 sprintf(tmp
, "EnumForms failed level %d on [%s] (buffer size = %d), error: %s\n",
262 levels
[i
], servername
, needed
, errstr(err
));
264 torture_fail(tctx
, tmp
);
266 torture_warning(tctx
, tmp
);
271 print_form_info_bylevel(levels
[i
], buffer
, returned
);
281 /****************************************************************************
282 ****************************************************************************/
284 static BOOL
test_EnumPorts(struct torture_context
*tctx
,
287 DWORD levels
[] = { 1, 2 };
288 DWORD success
[] = { 1, 1 };
290 LPBYTE buffer
= NULL
;
292 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
299 torture_comment(tctx
, "Testing EnumPorts level %d", levels
[i
]);
301 EnumPorts(servername
, levels
[i
], NULL
, 0, &needed
, &returned
);
302 err
= GetLastError();
303 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
305 buffer
= malloc(needed
);
306 torture_assert(tctx
, buffer
, "malloc failed");
307 if (!EnumPorts(servername
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
308 err
= GetLastError();
312 sprintf(tmp
, "EnumPorts failed level %d on [%s] (buffer size = %d), error: %s\n",
313 levels
[i
], servername
, needed
, errstr(err
));
315 torture_fail(tctx
, tmp
);
317 torture_warning(tctx
, tmp
);
322 print_port_info_bylevel(levels
[i
], buffer
, returned
);
332 /****************************************************************************
333 ****************************************************************************/
335 static BOOL
test_EnumMonitors(struct torture_context
*tctx
,
338 DWORD levels
[] = { 1, 2 };
339 DWORD success
[] = { 1, 1 };
341 LPBYTE buffer
= NULL
;
343 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
350 torture_comment(tctx
, "Testing EnumMonitors level %d", levels
[i
]);
352 EnumMonitors(servername
, levels
[i
], NULL
, 0, &needed
, &returned
);
353 err
= GetLastError();
354 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
356 buffer
= malloc(needed
);
357 torture_assert(tctx
, buffer
, "malloc failed");
358 if (!EnumMonitors(servername
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
359 err
= GetLastError();
363 sprintf(tmp
, "EnumMonitors failed level %d on [%s] (buffer size = %d), error: %s\n",
364 levels
[i
], servername
, needed
, errstr(err
));
366 torture_fail(tctx
, tmp
);
368 torture_warning(tctx
, tmp
);
373 print_monitor_info_bylevel(levels
[i
], buffer
, returned
);
383 /****************************************************************************
384 ****************************************************************************/
386 static BOOL
test_EnumPrintProcessors(struct torture_context
*tctx
,
390 DWORD levels
[] = { 1 };
391 DWORD success
[] = { 1 };
393 LPBYTE buffer
= NULL
;
395 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
402 torture_comment(tctx
, "Testing EnumPrintProcessors(%s) level %d", architecture
, levels
[i
]);
404 EnumPrintProcessors(servername
, architecture
, levels
[i
], NULL
, 0, &needed
, &returned
);
405 err
= GetLastError();
406 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
408 buffer
= malloc(needed
);
409 torture_assert(tctx
, buffer
, "malloc failed");
410 if (!EnumPrintProcessors(servername
, architecture
, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
411 err
= GetLastError();
415 sprintf(tmp
, "EnumPrintProcessors failed level %d on [%s] (buffer size = %d), error: %s\n",
416 levels
[i
], servername
, needed
, errstr(err
));
418 torture_fail(tctx
, tmp
);
420 torture_warning(tctx
, tmp
);
425 print_printprocessor_info_bylevel(levels
[i
], buffer
, returned
);
435 /****************************************************************************
436 ****************************************************************************/
438 static BOOL
test_EnumPrintProcessorDatatypes(struct torture_context
*tctx
,
441 DWORD levels
[] = { 1 };
442 DWORD success
[] = { 1 };
444 LPBYTE buffer
= NULL
;
446 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
453 torture_comment(tctx
, "Testing EnumPrintProcessorDatatypes level %d", levels
[i
]);
455 EnumPrintProcessorDatatypes(servername
, "winprint", levels
[i
], NULL
, 0, &needed
, &returned
);
456 err
= GetLastError();
457 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
459 buffer
= malloc(needed
);
460 torture_assert(tctx
, buffer
, "malloc failed");
461 if (!EnumPrintProcessorDatatypes(servername
, "winprint", levels
[i
], buffer
, needed
, &needed
, &returned
)) {
462 err
= GetLastError();
466 sprintf(tmp
, "EnumPrintProcessorDatatypes failed level %d on [%s] (buffer size = %d), error: %s\n",
467 levels
[i
], servername
, needed
, errstr(err
));
469 torture_fail(tctx
, tmp
);
471 torture_warning(tctx
, tmp
);
476 print_datatypes_info_bylevel(levels
[i
], buffer
, returned
);
486 /****************************************************************************
487 ****************************************************************************/
489 static BOOL
test_EnumPrinterKey(struct torture_context
*tctx
,
499 torture_comment(tctx
, "Testing EnumPrinterKey(%s)", key
);
501 err
= EnumPrinterKey(handle
, key
, NULL
, 0, &needed
);
502 if (err
== ERROR_MORE_DATA
) {
503 buffer
= (LPTSTR
)malloc(needed
);
504 torture_assert(tctx
, buffer
, "malloc failed");
505 err
= EnumPrinterKey(handle
, key
, buffer
, needed
, &needed
);
508 sprintf(tmp
, "EnumPrinterKey(%s) failed on [%s] (buffer size = %d), error: %s\n",
509 key
, servername
, needed
, errstr(err
));
510 torture_fail(tctx
, tmp
);
514 print_printer_keys(buffer
);
522 /****************************************************************************
523 ****************************************************************************/
525 static BOOL
test_GetPrinter(struct torture_context
*tctx
,
529 DWORD levels
[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
530 DWORD success
[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
532 LPBYTE buffer
= NULL
;
534 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
540 torture_comment(tctx
, "Testing GetPrinter level %d", levels
[i
]);
542 GetPrinter(handle
, levels
[i
], NULL
, 0, &needed
);
543 err
= GetLastError();
544 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
546 buffer
= malloc(needed
);
547 torture_assert(tctx
, buffer
, "malloc failed");
548 if (!GetPrinter(handle
, levels
[i
], buffer
, needed
, &needed
)) {
549 err
= GetLastError();
553 sprintf(tmp
, "GetPrinter failed level %d on [%s] (buffer size = %d), error: %s\n",
554 levels
[i
], printername
, needed
, errstr(err
));
556 torture_fail(tctx
, tmp
);
558 torture_warning(tctx
, tmp
);
563 print_printer_info_bylevel(levels
[i
], buffer
, 1);
573 /****************************************************************************
574 ****************************************************************************/
576 static BOOL
test_GetPrinterDriver(struct torture_context
*tctx
,
581 DWORD levels
[] = { 1, 2, 3, 4, 5, 6, 8 };
582 DWORD success
[] = { 1, 1, 1, 1, 1, 1, 1 };
584 LPBYTE buffer
= NULL
;
586 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
592 torture_comment(tctx
, "Testing GetPrinterDriver(%s) level %d",
593 architecture
, levels
[i
]);
595 GetPrinterDriver(handle
, architecture
, levels
[i
], NULL
, 0, &needed
);
596 err
= GetLastError();
597 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
599 buffer
= malloc(needed
);
600 torture_assert(tctx
, buffer
, "malloc failed");
601 if (!GetPrinterDriver(handle
, architecture
, levels
[i
], buffer
, needed
, &needed
)) {
602 err
= GetLastError();
606 sprintf(tmp
, "GetPrinterDriver failed level %d on [%s] (buffer size = %d), error: %s\n",
607 levels
[i
], printername
, needed
, errstr(err
));
609 torture_fail(tctx
, tmp
);
611 torture_warning(tctx
, tmp
);
616 print_driver_info_bylevel(levels
[i
], buffer
, 1);
627 /****************************************************************************
628 ****************************************************************************/
630 static BOOL
test_EnumJobs(struct torture_context
*tctx
,
634 DWORD levels
[] = { 1, 2, 3, 4 };
635 DWORD success
[] = { 1, 1, 1, 1 };
637 LPBYTE buffer
= NULL
;
639 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
646 torture_comment(tctx
, "Testing EnumJobs level %d", levels
[i
]);
648 if (tctx
->samba3
&& levels
[i
] == 4) {
649 torture_comment(tctx
, "skipping level %d enum against samba\n", levels
[i
]);
653 EnumJobs(handle
, 0, 100, levels
[i
], NULL
, 0, &needed
, &returned
);
654 err
= GetLastError();
655 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
657 buffer
= malloc(needed
);
658 torture_assert(tctx
, buffer
, "malloc failed");
659 if (!EnumJobs(handle
, 0, 100, levels
[i
], buffer
, needed
, &needed
, &returned
)) {
660 err
= GetLastError();
664 sprintf(tmp
, "EnumJobs failed level %d on [%s] (buffer size = %d), error: %s\n",
665 levels
[i
], printername
, needed
, errstr(err
));
667 torture_fail(tctx
, tmp
);
669 torture_warning(tctx
, tmp
);
674 print_job_info_bylevel(levels
[i
], buffer
, returned
);
684 /****************************************************************************
685 ****************************************************************************/
687 static BOOL
test_EnumPrinterData(struct torture_context
*tctx
,
696 DWORD value_offered
= 0, value_needed
;
697 DWORD data_offered
= 0, data_needed
;
700 torture_comment(tctx
, "Testing EnumPrinterData(%d) (value offered: %d, data_offered: %d)\n",
701 index
, value_offered
, data_offered
);
703 err
= EnumPrinterData(handle
, 0, NULL
, 0, &value_needed
, NULL
, NULL
, 0, &data_needed
);
705 sprintf(tmp
, "EnumPrinterData(%d) failed on [%s] (value size = %d, data size = %d), error: %s\n",
706 index
, servername
, value_offered
, data_offered
, errstr(err
));
707 torture_fail(tctx
, tmp
);
710 value_name
= malloc(value_needed
);
711 torture_assert(tctx
, value_name
, "malloc failed");
712 data
= malloc(data_needed
);
713 torture_assert(tctx
, data
, "malloc failed");
715 value_offered
= value_needed
;
716 data_offered
= data_needed
;
723 torture_comment(tctx
, "Testing EnumPrinterData(%d) (value offered: %d, data_offered: %d)\n",
724 index
, value_offered
, data_offered
);
726 err
= EnumPrinterData(handle
, index
++, value_name
, value_offered
, &value_needed
, &type
, data
, data_offered
, &data_needed
);
727 if (err
== ERROR_NO_MORE_ITEMS
) {
731 sprintf(tmp
, "EnumPrinterData(%d) failed on [%s] (value size = %d, data size = %d), error: %s\n",
732 index
, servername
, value_offered
, data_offered
, errstr(err
));
733 torture_fail(tctx
, tmp
);
737 print_printer_data(NULL
, value_name
, data_needed
, data
, type
);
740 } while (err
!= ERROR_NO_MORE_ITEMS
);
748 /****************************************************************************
749 ****************************************************************************/
751 static BOOL
test_EnumPrinterDataEx(struct torture_context
*tctx
,
758 LPBYTE buffer
= NULL
;
764 torture_comment(tctx
, "Testing EnumPrinterDataEx(%s)", keyname
);
766 err
= EnumPrinterDataEx(handle
, keyname
, NULL
, 0, &needed
, &returned
);
767 if (err
== ERROR_MORE_DATA
) {
768 buffer
= malloc(needed
);
769 torture_assert(tctx
, buffer
, "malloc failed");
770 err
= EnumPrinterDataEx(handle
, keyname
, buffer
, needed
, &needed
, &returned
);
773 sprintf(tmp
, "EnumPrinterDataEx(%s) failed on [%s] (buffer size = %d), error: %s\n",
774 keyname
, servername
, needed
, errstr(err
));
775 torture_fail(tctx
, tmp
);
780 LPPRINTER_ENUM_VALUES v
= (LPPRINTER_ENUM_VALUES
)buffer
;
781 for (i
=0; i
< returned
; i
++) {
782 print_printer_enum_values(&v
[i
]);
787 *returned_p
= returned
;
799 /****************************************************************************
800 ****************************************************************************/
802 static BOOL
test_devicemode_equal(struct torture_context
*tctx
,
811 torture_comment(tctx
, "%s\n", __location__
);
815 torture_assert_str_equal(tctx
, (const char *)d1
->dmDeviceName
, (const char *)d2
->dmDeviceName
, "dmDeviceName mismatch");
816 torture_assert_int_equal(tctx
, d1
->dmSpecVersion
, d2
->dmSpecVersion
, "dmSpecVersion mismatch");
817 torture_assert_int_equal(tctx
, d1
->dmDriverVersion
, d2
->dmDriverVersion
, "dmDriverVersion mismatch");
818 torture_assert_int_equal(tctx
, d1
->dmSize
, d2
->dmSize
, "size mismatch");
819 torture_assert_int_equal(tctx
, d1
->dmDriverExtra
, d2
->dmDriverExtra
, "dmDriverExtra mismatch");
820 torture_assert_int_equal(tctx
, d1
->dmFields
, d2
->dmFields
, "dmFields mismatch");
822 torture_assert_int_equal(tctx
, d1
->dmOrientation
, d2
->dmOrientation
, "dmOrientation mismatch");
823 torture_assert_int_equal(tctx
, d1
->dmPaperSize
, d2
->dmPaperSize
, "dmPaperSize mismatch");
824 torture_assert_int_equal(tctx
, d1
->dmPaperLength
, d2
->dmPaperLength
, "dmPaperLength mismatch");
825 torture_assert_int_equal(tctx
, d1
->dmPaperWidth
, d2
->dmPaperWidth
, "dmPaperWidth mismatch");
826 torture_assert_int_equal(tctx
, d1
->dmScale
, d2
->dmScale
, "dmScale mismatch");
827 torture_assert_int_equal(tctx
, d1
->dmCopies
, d2
->dmCopies
, "dmCopies mismatch");
828 torture_assert_int_equal(tctx
, d1
->dmDefaultSource
, d2
->dmDefaultSource
, "dmDefaultSource mismatch");
829 torture_assert_int_equal(tctx
, d1
->dmPrintQuality
, d2
->dmPrintQuality
, "dmPrintQuality mismatch");
831 torture_assert_int_equal(tctx
, d1
->dmColor
, d2
->dmColor
, "dmColor mismatch");
832 torture_assert_int_equal(tctx
, d1
->dmDuplex
, d2
->dmDuplex
, "dmDuplex mismatch");
833 torture_assert_int_equal(tctx
, d1
->dmYResolution
, d2
->dmYResolution
, "dmYResolution mismatch");
834 torture_assert_int_equal(tctx
, d1
->dmTTOption
, d2
->dmTTOption
, "dmTTOption mismatch");
835 torture_assert_int_equal(tctx
, d1
->dmCollate
, d2
->dmCollate
, "dmCollate mismatch");
836 torture_assert_str_equal(tctx
, (const char *)d1
->dmFormName
, (const char *)d2
->dmFormName
, "dmFormName mismatch");
837 torture_assert_int_equal(tctx
, d1
->dmLogPixels
, d2
->dmLogPixels
, "dmLogPixels mismatch");
838 torture_assert_int_equal(tctx
, d1
->dmBitsPerPel
, d2
->dmBitsPerPel
, "dmBitsPerPel mismatch");
839 torture_assert_int_equal(tctx
, d1
->dmPelsWidth
, d2
->dmPelsWidth
, "dmPelsWidth mismatch");
840 torture_assert_int_equal(tctx
, d1
->dmPelsHeight
, d2
->dmPelsHeight
, "dmPelsHeight mismatch");
842 torture_assert_int_equal(tctx
, d1
->dmDisplayFlags
, d2
->dmDisplayFlags
, "dmDisplayFlags mismatch");
844 torture_assert_int_equal(tctx
, d1
->dmDisplayFrequency
, d2
->dmDisplayFrequency
, "dmDisplayFrequency mismatch");
846 torture_assert_int_equal(tctx
, d1
->dmICMMethod
, d2
->dmICMMethod
, "dmICMMethod mismatch");
847 torture_assert_int_equal(tctx
, d1
->dmICMIntent
, d2
->dmICMIntent
, "dmICMIntent mismatch");
848 torture_assert_int_equal(tctx
, d1
->dmMediaType
, d2
->dmMediaType
, "dmMediaType mismatch");
849 torture_assert_int_equal(tctx
, d1
->dmDitherType
, d2
->dmDitherType
, "dmDitherType mismatch");
850 torture_assert_int_equal(tctx
, d1
->dmReserved1
, d2
->dmReserved1
, "dmReserved1 mismatch");
851 torture_assert_int_equal(tctx
, d1
->dmReserved2
, d2
->dmReserved2
, "reserved2 mismatch");
853 torture_assert_int_equal(tctx
, d1
->dmPanningWidth
, d2
->dmPanningWidth
, "dmPanningWidth mismatch");
854 torture_assert_int_equal(tctx
, d1
->dmPanningHeight
, d2
->dmPanningHeight
, "dmPanningHeight mismatch");
856 /* torture_assert_mem_equal(tctx, d1 + d1->dmSize, d2 + d2->dmSize, d1->dmDriverExtra, "private extra data mismatch"); */
861 /****************************************************************************
862 ****************************************************************************/
864 static BOOL
test_DeviceModes(struct torture_context
*tctx
,
868 PPRINTER_INFO_2 info2
= NULL
;
869 PPRINTER_INFO_8 info8
= NULL
;
874 torture_comment(tctx
, "Testing DeviceModes");
876 torture_comment(tctx
, "Testing GetPrinter level %d", 2);
878 GetPrinter(handle
, 2, NULL
, 0, &needed
);
879 err
= GetLastError();
880 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
882 info2
= (PPRINTER_INFO_2
)malloc(needed
);
883 torture_assert(tctx
, (LPBYTE
)info2
, "malloc failed");
884 if (!GetPrinter(handle
, 2, (LPBYTE
)info2
, needed
, &needed
)) {
885 err
= GetLastError();
889 sprintf(tmp
, "GetPrinter failed level %d on [%s] (buffer size = %d), error: %s\n",
890 2, printername
, needed
, errstr(err
));
891 torture_fail(tctx
, tmp
);
895 print_printer_info_2(info2
);
898 torture_comment(tctx
, "Testing GetPrinter level %d", 8);
900 GetPrinter(handle
, 8, NULL
, 0, &needed
);
901 err
= GetLastError();
902 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
904 info8
= (PPRINTER_INFO_8
)malloc(needed
);
905 torture_assert(tctx
, (LPBYTE
)info8
, "malloc failed");
906 if (!GetPrinter(handle
, 8, (LPBYTE
)info8
, needed
, &needed
)) {
907 err
= GetLastError();
911 sprintf(tmp
, "GetPrinter failed level %d on [%s] (buffer size = %d), error: %s\n",
912 8, printername
, needed
, errstr(err
));
913 torture_fail(tctx
, tmp
);
917 print_printer_info_8(info8
);
920 torture_assert(tctx
, test_devicemode_equal(tctx
, info2
->pDevMode
, info8
->pDevMode
), "");
928 /****************************************************************************
929 ****************************************************************************/
931 static BOOL
test_GetJob(struct torture_context
*tctx
,
936 DWORD levels
[] = { 1, 2, 3, 4 };
937 DWORD success
[] = { 1, 1, 1, 1 };
939 LPBYTE buffer
= NULL
;
941 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
947 torture_comment(tctx
, "Testing GetJob(%d) level %d", job_id
, levels
[i
]);
949 if (tctx
->samba3
&& (levels
[i
] == 4) || (levels
[i
] == 3)) {
950 torture_comment(tctx
, "skipping level %d getjob against samba\n", levels
[i
]);
954 GetJob(handle
, job_id
, levels
[i
], NULL
, 0, &needed
);
955 err
= GetLastError();
956 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
958 buffer
= malloc(needed
);
959 torture_assert(tctx
, buffer
, "malloc failed");
960 if (!GetJob(handle
, job_id
, levels
[i
], buffer
, needed
, &needed
)) {
961 err
= GetLastError();
965 sprintf(tmp
, "GetJob failed level %d on [%s] (buffer size = %d), error: %s\n",
966 levels
[i
], printername
, needed
, errstr(err
));
968 torture_fail(tctx
, tmp
);
970 torture_warning(tctx
, tmp
);
975 print_job_info_bylevel(levels
[i
], buffer
, 1);
985 /****************************************************************************
986 ****************************************************************************/
988 static BOOL
test_EachJob(struct torture_context
*tctx
,
993 PJOB_INFO_1 buffer
= NULL
;
1001 torture_comment(tctx
, "Testing Each PrintJob %d");
1003 EnumJobs(handle
, 0, 100, level
, NULL
, 0, &needed
, &returned
);
1004 err
= GetLastError();
1005 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
1007 buffer
= (PJOB_INFO_1
)malloc(needed
);
1008 torture_assert(tctx
, buffer
, "malloc failed");
1009 if (!EnumJobs(handle
, 0, 100, level
, (LPBYTE
)buffer
, needed
, &needed
, &returned
)) {
1010 err
= GetLastError();
1014 sprintf(tmp
, "EnumJobs failed level %d on [%s] (buffer size = %d), error: %s\n",
1015 level
, printername
, needed
, errstr(err
));
1016 torture_fail(tctx
, tmp
);
1020 print_job_info_bylevel(level
, (LPBYTE
)buffer
, returned
);
1023 for (i
=0; i
< returned
; i
++) {
1024 ret
= test_GetJob(tctx
, printername
, handle
, buffer
[i
].JobId
);
1033 /****************************************************************************
1034 ****************************************************************************/
1036 static BOOL
test_OnePrinter(struct torture_context
*tctx
,
1039 LPPRINTER_DEFAULTS defaults
)
1044 torture_comment(tctx
, "Testing Printer %s", printername
);
1046 ret
&= test_OpenPrinter(tctx
, printername
, defaults
, &handle
);
1047 ret
&= test_GetPrinter(tctx
, printername
, handle
);
1048 ret
&= test_GetPrinterDriver(tctx
, printername
, architecture
, handle
);
1049 ret
&= test_EnumForms(tctx
, printername
, handle
);
1050 ret
&= test_EnumJobs(tctx
, printername
, handle
);
1051 ret
&= test_EachJob(tctx
, printername
, handle
);
1052 ret
&= test_EnumPrinterKey(tctx
, printername
, handle
, "");
1053 ret
&= test_EnumPrinterKey(tctx
, printername
, handle
, "PrinterDriverData");
1054 ret
&= test_EnumPrinterData(tctx
, printername
, handle
);
1055 ret
&= test_EnumPrinterDataEx(tctx
, printername
, "PrinterDriverData", handle
, NULL
, NULL
);
1056 ret
&= test_DeviceModes(tctx
, printername
, handle
);
1058 /* don't run these at the moment, behaviour is PrinterData API calls (not
1059 * dcerpc calls) is almost unpredictable - gd */
1060 ret
&= test_PrinterData(tctx
, printername
, handle
);
1061 ret
&= test_PrinterDataW(tctx
, printername
, handle
);
1063 ret
&= test_ClosePrinter(tctx
, handle
);
1068 /****************************************************************************
1069 ****************************************************************************/
1071 static BOOL
test_EachPrinter(struct torture_context
*tctx
,
1074 LPPRINTER_DEFAULTS defaults
)
1081 DWORD flags
= PRINTER_ENUM_NAME
;
1082 PPRINTER_INFO_1 buffer
= NULL
;
1085 torture_comment(tctx
, "Testing EnumPrinters level %d", 1);
1087 EnumPrinters(flags
, servername
, 1, NULL
, 0, &needed
, &returned
);
1088 err
= GetLastError();
1089 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
1091 buffer
= (PPRINTER_INFO_1
)malloc(needed
);
1092 torture_assert(tctx
, buffer
, "malloc failed");
1093 if (!EnumPrinters(flags
, servername
, 1, (LPBYTE
)buffer
, needed
, &needed
, &returned
)) {
1094 err
= GetLastError();
1098 sprintf(tmp
, "EnumPrinters failed level %d on [%s] (buffer size = %d), error: %s\n",
1099 1, servername
, needed
, errstr(err
));
1100 torture_fail(tctx
, tmp
);
1103 for (i
=0; i
< returned
; i
++) {
1104 ret
&= test_OnePrinter(tctx
, buffer
[i
].pName
, architecture
, defaults
);
1112 /****************************************************************************
1113 ****************************************************************************/
1115 static BOOL
test_GetPrintProcessorDirectory(struct torture_context
*tctx
,
1119 DWORD levels
[] = { 1 };
1120 DWORD success
[] = { 1 };
1122 LPBYTE buffer
= NULL
;
1124 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
1130 torture_comment(tctx
, "Testing GetPrintProcessorDirectory(%s) level %d",
1131 architecture
, levels
[i
]);
1133 GetPrintProcessorDirectory(servername
, architecture
, levels
[i
], NULL
, 0, &needed
);
1134 err
= GetLastError();
1135 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
1137 buffer
= malloc(needed
);
1138 torture_assert(tctx
, buffer
, "malloc failed");
1139 if (!GetPrintProcessorDirectory(servername
, architecture
, levels
[i
], buffer
, needed
, &needed
)) {
1140 err
= GetLastError();
1144 sprintf(tmp
, "GetPrintProcessorDirectory failed level %d on [%s] (buffer size = %d), error: %s\n",
1145 levels
[i
], servername
, needed
, errstr(err
));
1147 torture_fail(tctx
, tmp
);
1149 torture_warning(tctx
, tmp
);
1154 printf("\tPrint Processor Directory\t= %s\n\n", (LPSTR
)buffer
);
1164 /****************************************************************************
1165 ****************************************************************************/
1167 static BOOL
test_GetPrinterDriverDirectory(struct torture_context
*tctx
,
1171 DWORD levels
[] = { 1 };
1172 DWORD success
[] = { 1 };
1174 LPBYTE buffer
= NULL
;
1176 for (i
=0; i
< ARRAY_SIZE(levels
); i
++) {
1182 torture_comment(tctx
, "Testing GetPrinterDriverDirectory(%s) level %d",
1183 architecture
, levels
[i
]);
1185 GetPrinterDriverDirectory(servername
, architecture
, levels
[i
], NULL
, 0, &needed
);
1186 err
= GetLastError();
1187 if (err
== ERROR_INSUFFICIENT_BUFFER
) {
1189 buffer
= malloc(needed
);
1190 torture_assert(tctx
, buffer
, "malloc failed");
1191 if (!GetPrinterDriverDirectory(servername
, architecture
, levels
[i
], buffer
, needed
, &needed
)) {
1192 err
= GetLastError();
1196 sprintf(tmp
, "GetPrinterDriverDirectory failed level %d on [%s] (buffer size = %d), error: %s\n",
1197 levels
[i
], servername
, needed
, errstr(err
));
1199 torture_fail(tctx
, tmp
);
1201 torture_warning(tctx
, tmp
);
1206 printf("\tPrinter Driver Directory\t= %s\n\n", (LPSTR
)buffer
);
1216 /****************************************************************************
1217 ****************************************************************************/
1219 static BOOL
test_GetPrinterData(struct torture_context
*tctx
,
1227 LPBYTE buffer
= NULL
;
1233 torture_comment(tctx
, "Testing GetPrinterData(%s)", valuename
);
1235 err
= GetPrinterData(handle
, valuename
, &type
, NULL
, 0, &needed
);
1236 if (err
== ERROR_MORE_DATA
) {
1237 buffer
= (LPBYTE
)malloc(needed
);
1238 torture_assert(tctx
, buffer
, "malloc failed");
1239 err
= GetPrinterData(handle
, valuename
, &type
, buffer
, needed
, &needed
);
1242 sprintf(tmp
, "GetPrinterData(%s) failed on [%s] (buffer size = %d), error: %s\n",
1243 valuename
, servername
, needed
, errstr(err
));
1244 torture_fail(tctx
, tmp
);
1248 print_printer_data("PrinterDriverData", valuename
, needed
, buffer
, type
);
1268 /****************************************************************************
1269 ****************************************************************************/
1271 static BOOL
test_GetPrinterDataEx(struct torture_context
*tctx
,
1280 LPBYTE buffer
= NULL
;
1286 torture_comment(tctx
, "Testing GetPrinterDataEx(%s - %s)", keyname
, valuename
);
1288 err
= GetPrinterDataEx(handle
, keyname
, valuename
, &type
, NULL
, 0, &needed
);
1289 if (err
== ERROR_MORE_DATA
) {
1290 buffer
= (LPBYTE
)malloc(needed
);
1291 torture_assert(tctx
, buffer
, "malloc failed");
1292 err
= GetPrinterDataEx(handle
, keyname
, valuename
, &type
, buffer
, needed
, &needed
);
1295 sprintf(tmp
, "GetPrinterDataEx(%s) failed on [%s] (buffer size = %d), error: %s\n",
1296 valuename
, servername
, needed
, errstr(err
));
1297 torture_fail(tctx
, tmp
);
1301 print_printer_data(keyname
, valuename
, needed
, buffer
, type
);
1321 /****************************************************************************
1322 ****************************************************************************/
1324 static BOOL
test_GetPrinterDataExW(struct torture_context
*tctx
,
1333 LPBYTE buffer
= NULL
;
1339 torture_comment(tctx
, "Testing GetPrinterDataExW(%ls - %ls)", keyname
, valuename
);
1341 err
= GetPrinterDataExW(handle
, keyname
, valuename
, &type
, NULL
, 0, &needed
);
1342 if (err
== ERROR_MORE_DATA
) {
1343 buffer
= (LPBYTE
)malloc(needed
);
1344 torture_assert(tctx
, buffer
, "malloc failed");
1345 err
= GetPrinterDataExW(handle
, keyname
, valuename
, &type
, buffer
, needed
, &needed
);
1348 sprintf(tmp
, "GetPrinterDataExW(%ls) failed on [%s] (buffer size = %d), error: %s\n",
1349 valuename
, servername
, needed
, errstr(err
));
1350 torture_fail(tctx
, tmp
);
1354 print_printer_dataw(keyname
, valuename
, needed
, buffer
, type
);
1375 /****************************************************************************
1376 ****************************************************************************/
1378 static BOOL
test_DeletePrinterDataEx(struct torture_context
*tctx
,
1387 torture_comment(tctx
, "Testing DeletePrinterDataEx(%s - %s)", keyname
, valuename
);
1389 err
= DeletePrinterDataEx(handle
, keyname
, valuename
);
1391 sprintf(tmp
, "DeletePrinterDataEx(%s - %s) failed on [%s], error: %s\n",
1392 keyname
, valuename
, servername
, errstr(err
));
1393 torture_fail(tctx
, tmp
);
1399 /****************************************************************************
1400 ****************************************************************************/
1402 static BOOL
test_DeletePrinterDataExW(struct torture_context
*tctx
,
1411 torture_comment(tctx
, "Testing DeletePrinterDataExW(%ls - %ls)", keyname
, valuename
);
1413 err
= DeletePrinterDataExW(handle
, keyname
, valuename
);
1415 sprintf(tmp
, "DeletePrinterDataExW(%ls - %ls) failed on [%s], error: %s\n",
1416 keyname
, valuename
, servername
, errstr(err
));
1417 torture_fail(tctx
, tmp
);
1424 /****************************************************************************
1425 ****************************************************************************/
1427 static BOOL
test_DeletePrinterKey(struct torture_context
*tctx
,
1435 torture_comment(tctx
, "Testing DeletePrinterKey(%s)", keyname
);
1437 err
= DeletePrinterKey(handle
, keyname
);
1439 sprintf(tmp
, "DeletePrinterKey(%s) failed on [%s], error: %s\n",
1440 keyname
, servername
, errstr(err
));
1441 torture_fail(tctx
, tmp
);
1447 /****************************************************************************
1448 ****************************************************************************/
1450 static BOOL
test_DeletePrinterKeyW(struct torture_context
*tctx
,
1458 torture_comment(tctx
, "Testing DeletePrinterKeyW(%ls)", keyname
);
1460 err
= DeletePrinterKeyW(handle
, keyname
);
1462 sprintf(tmp
, "DeletePrinterKeyW(%ls) failed on [%s], error: %s\n",
1463 keyname
, servername
, errstr(err
));
1464 torture_fail(tctx
, tmp
);
1470 /****************************************************************************
1471 ****************************************************************************/
1473 static BOOL
test_SetPrinterDataEx(struct torture_context
*tctx
,
1485 torture_comment(tctx
, "Testing SetPrinterDataEx(%s - %s)", keyname
, valuename
);
1487 err
= SetPrinterDataEx(handle
, keyname
, valuename
, type
, buffer
, offered
);
1489 sprintf(tmp
, "SetPrinterDataEx(%s) failed on [%s] (buffer size = %d), error: %s\n",
1490 valuename
, servername
, offered
, errstr(err
));
1491 torture_fail(tctx
, tmp
);
1497 /****************************************************************************
1498 ****************************************************************************/
1500 static BOOL
test_SetPrinterDataExW(struct torture_context
*tctx
,
1512 torture_comment(tctx
, "Testing SetPrinterDataExW(%ls - %ls)", keyname
, valuename
);
1514 err
= SetPrinterDataExW(handle
, keyname
, valuename
, type
, buffer
, offered
);
1516 sprintf(tmp
, "SetPrinterDataExW(%ls) failed on [%s] (buffer size = %d), error: %s\n",
1517 valuename
, servername
, offered
, errstr(err
));
1518 torture_fail(tctx
, tmp
);
1525 /****************************************************************************
1526 ****************************************************************************/
1528 static BOOL
test_PrinterData_Server(struct torture_context
*tctx
,
1534 DWORD type
, type_ex
;
1535 LPBYTE buffer
, buffer_ex
;
1536 DWORD size
, size_ex
;
1537 LPSTR valuenames
[] = {
1538 SPLREG_DEFAULT_SPOOL_DIRECTORY
,
1539 SPLREG_MAJOR_VERSION
,
1540 SPLREG_MINOR_VERSION
,
1542 SPLREG_DNS_MACHINE_NAME
,
1543 SPLREG_ARCHITECTURE
,
1547 for (i
=0; i
< ARRAY_SIZE(valuenames
); i
++) {
1548 ret
&= test_GetPrinterData(tctx
, servername
, valuenames
[i
], handle
, &type
, &buffer
, &size
);
1549 ret
&= test_GetPrinterDataEx(tctx
, servername
, "random", valuenames
[i
], handle
, &type_ex
, &buffer_ex
, &size_ex
);
1550 torture_assert_int_equal(tctx
, type
, type_ex
, "type mismatch");
1551 torture_assert_int_equal(tctx
, size
, size_ex
, "size mismatch");
1552 torture_assert_mem_equal(tctx
, buffer
, buffer_ex
, size
, "buffer mismatch");
1560 /****************************************************************************
1561 ****************************************************************************/
1563 static BOOL
PrinterDataEqual(struct torture_context
*tctx
,
1564 DWORD type1
, DWORD type2
,
1565 DWORD size1
, DWORD size2
,
1566 LPBYTE buffer1
, LPBYTE buffer2
)
1568 torture_assert_int_equal(tctx
, type1
, type2
, "type mismatch");
1569 torture_assert_int_equal(tctx
, size1
, size2
, "size mismatch");
1570 torture_assert_mem_equal(tctx
, buffer1
, buffer2
, size1
, "buffer mismatch");
1575 /****************************************************************************
1576 ****************************************************************************/
1578 static BOOL
test_PrinterData(struct torture_context
*tctx
,
1583 LPSTR keyname
= "torture_key";
1584 LPSTR valuename
= "torture_value";
1591 DWORD value
= 12345678;
1592 LPSTR str
= "abcdefghijklmnopqrstuvwxzy";
1595 for (t
=0; t
< ARRAY_SIZE(types
); t
++) {
1596 for (s
=0; s
< strlen(str
); s
++) {
1598 DWORD type
, type_ex
;
1599 LPBYTE buffer
, buffer_ex
;
1600 DWORD size
, size_ex
;
1602 if (types
[t
] == REG_DWORD
) {
1609 memcpy(buffer
, str
, s
);
1614 memcpy(buffer
, &value
, 4);
1619 memcpy(buffer
, str
, s
);
1623 sprintf(tmp
, "type %d untested\n", types
[t
]);
1624 torture_fail(tctx
, tmp
);
1630 torture_comment(tctx
, "Testing PrinterData (type: %s, size: 0x%08x)", reg_type_str(type
), size
);
1632 torture_assert(tctx
,
1633 test_SetPrinterDataEx(tctx
, printername
, keyname
, valuename
, handle
, type
, buffer
, size
),
1634 "failed to call SetPrinterDataEx");
1635 torture_assert(tctx
,
1636 test_GetPrinterDataEx(tctx
, printername
, keyname
, valuename
, handle
, &type_ex
, &buffer_ex
, &size_ex
),
1637 "failed to call GetPrinterDataEx");
1639 if (!PrinterDataEqual(tctx
, type_ex
, type
, size_ex
, size
, buffer_ex
, buffer
)) {
1640 torture_warning(tctx
, "GetPrinterDataEx does not return the same info as we set with SetPrinterDataEx");
1643 ret
&= test_DeletePrinterDataEx(tctx
, printername
, keyname
, valuename
, handle
);
1644 ret
&= test_DeletePrinterKey(tctx
, printername
, keyname
, handle
);
1654 /****************************************************************************
1655 ****************************************************************************/
1657 static BOOL
test_PrinterDataW(struct torture_context
*tctx
,
1662 LPCWSTR keyname
= L
"torture_key";
1663 LPCWSTR valuename
= L
"torture_value";
1670 DWORD value
= 12345678;
1671 LPSTR str
= "abcdefghijklmnopqrstuvwxzy";
1674 for (t
=0; t
< ARRAY_SIZE(types
); t
++) {
1675 for (s
=0; s
< strlen(str
); s
++) {
1677 DWORD type
, type_ex
;
1678 LPBYTE buffer
, buffer_ex
;
1679 DWORD size
, size_ex
;
1681 if (types
[t
] == REG_DWORD
) {
1688 memcpy(buffer
, str
, s
);
1693 memcpy(buffer
, &value
, 4);
1698 memcpy(buffer
, str
, s
);
1702 sprintf(tmp
, "type %d untested\n", types
[t
]);
1703 torture_fail(tctx
, tmp
);
1709 torture_comment(tctx
, "Testing PrinterDataW (type: %s, size: 0x%08x)", reg_type_str(type
), size
);
1711 torture_assert(tctx
,
1712 test_SetPrinterDataExW(tctx
, printername
, keyname
, valuename
, handle
, type
, buffer
, size
),
1713 "failed to call SetPrinterDataExW");
1714 torture_assert(tctx
,
1715 test_GetPrinterDataExW(tctx
, printername
, keyname
, valuename
, handle
, &type_ex
, &buffer_ex
, &size_ex
),
1716 "failed to call GetPrinterDataExW");
1718 if (!PrinterDataEqual(tctx
, type_ex
, type
, size_ex
, size
, buffer_ex
, buffer
)) {
1719 torture_warning(tctx
, "GetPrinterDataExW does not return the same info as we set with SetPrinterDataExW");
1722 ret
&= test_DeletePrinterDataExW(tctx
, printername
, keyname
, valuename
, handle
);
1723 ret
&= test_DeletePrinterKeyW(tctx
, printername
, keyname
, handle
);
1733 /****************************************************************************
1734 ****************************************************************************/
1736 const char *get_string_param(const char *str
)
1740 p
= strchr(str
, '=');
1748 /****************************************************************************
1749 ****************************************************************************/
1751 int main(int argc
, char *argv
[])
1755 LPSTR architecture
= "Windows NT x86";
1756 HANDLE server_handle
;
1757 PRINTER_DEFAULTS defaults_admin
, defaults_use
;
1758 struct torture_context
*tctx
;
1762 fprintf(stderr
, "usage: %s <name> [print] [samba3] [architecture=ARCHITECTURE]\n\n", argv
[0]);
1763 fprintf(stderr
, "\t<name> can be a server or printer name URI\n");
1764 fprintf(stderr
, "\t[print] will print all data that has been retrieved\n");
1765 fprintf(stderr
, "\t from the printserver\n");
1766 fprintf(stderr
, "\t[samba3] will skip some tests samba servers are known\n");
1767 fprintf(stderr
, "\t not to have implemented\n");
1768 fprintf(stderr
, "\t[architecture=X] allows one to define a specific\n");
1769 fprintf(stderr
, "\t architecture to test with. choose between:\n");
1770 fprintf(stderr
, "\t \"Windows NT x86\" or \"Windows x64\"\n");
1774 tctx
= malloc(sizeof(struct torture_context
));
1776 fprintf(stderr
, "out of memory\n");
1779 memset(tctx
, '\0', sizeof(*tctx
));
1781 servername
= argv
[1];
1783 for (i
=1; i
< argc
; i
++) {
1784 if (strcmp(argv
[i
], "print") == 0) {
1787 if (strcmp(argv
[i
], "samba3") == 0) {
1788 tctx
->samba3
= TRUE
;
1790 if (strncmp(argv
[i
], "architecture", strlen("architecture")) == 0) {
1791 architecture
= get_string_param(argv
[i
]);
1795 printf("Running testsuite with architecture: %s\n", architecture
);
1797 defaults_admin
.pDatatype
= NULL
;
1798 defaults_admin
.pDevMode
= NULL
;
1799 defaults_admin
.DesiredAccess
= PRINTER_ACCESS_ADMINISTER
;
1801 defaults_use
.pDatatype
= NULL
;
1802 defaults_use
.pDevMode
= NULL
;
1803 defaults_use
.DesiredAccess
= PRINTER_ACCESS_USE
;
1805 if ((servername
[0] == '\\') && (servername
[1] == '\\')) {
1806 LPSTR p
= servername
+2;
1808 if ((p2
= strchr(p
, '\\')) != NULL
) {
1809 ret
= test_OnePrinter(tctx
, servername
, architecture
, &defaults_admin
);
1814 ret
&= test_EnumPrinters(tctx
, servername
);
1815 ret
&= test_EnumDrivers(tctx
, servername
, architecture
);
1816 ret
&= test_OpenPrinter(tctx
, servername
, NULL
, &server_handle
);
1817 /* ret &= test_EnumPrinterKey(tctx, servername, server_handle, ""); */
1818 ret
&= test_PrinterData_Server(tctx
, servername
, server_handle
);
1819 ret
&= test_EnumForms(tctx
, servername
, server_handle
);
1820 ret
&= test_ClosePrinter(tctx
, server_handle
);
1821 ret
&= test_EnumPorts(tctx
, servername
);
1822 ret
&= test_EnumMonitors(tctx
, servername
);
1823 ret
&= test_EnumPrintProcessors(tctx
, servername
, architecture
);
1824 ret
&= test_EnumPrintProcessorDatatypes(tctx
, servername
);
1825 ret
&= test_GetPrintProcessorDirectory(tctx
, servername
, architecture
);
1826 ret
&= test_GetPrinterDriverDirectory(tctx
, servername
, architecture
);
1827 ret
&= test_EachPrinter(tctx
, servername
, architecture
, &defaults_admin
);
1831 if (tctx
->last_reason
) {
1832 fprintf(stderr
, "failed: %s\n", tctx
->last_reason
);
1838 printf("%s run successfully\n", argv
[0]);