add SetPrinterDataExW.exe.
[gd/win32-spoolss/.git] / EnumPrintProcessors.c
1 /******************************************************************
2  * SPOOLSS regression testing code for Samba print servers
3  *
4  *****************************************************************/
5
6 #include <windows.h>
7 #include <stdio.h>
8 #include "printlib.h"
9
10 #define NUM_ARCH        5
11 const LPTSTR arch [NUM_ARCH] = {        "Windows 4.0",
12                                                         "Windows NT x86",
13                                                         "Windows NT R4000",
14                                                         "Windows NT PowerPC",
15                                                         "Windows NT Alpha_AXP"  };
16
17 int main (int argc, char* argv[])
18 {
19         DWORD   needed, returned, i, j;
20         PPRINTPROCESSOR_INFO_1  buffer1 = NULL;
21
22         if (argc < 2)
23         {
24                 fprintf (stderr, "useage: %s <servername>\n", argv[0]);
25                 exit (-1);
26         }
27
28         for (i=0; i<NUM_ARCH; i++)
29         {
30                 printf ("[%s]\n", arch[i]);
31
32                 needed = 0;
33                 EnumPrintProcessors(argv[1], arch[i], 1, (LPBYTE)buffer1, 0, &needed, &returned);
34                 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
35                 {
36                         fprintf (stderr, "Error EnumPrintProcessors Info Level 1 for [%s] using NULL buffer.\n", argv[1]);
37                         continue;
38                 }
39
40                 if ((buffer1 = (PPRINTPROCESSOR_INFO_1)malloc(needed)) == NULL)
41                 {
42                         fprintf (stderr, "Unable to malloc memory for buffer!\n");
43                         exit (-1);
44                 }
45                 if (!EnumPrintProcessors(argv[1], arch[i], 1, (LPBYTE)buffer1, needed, &needed, &returned))
46                 {
47                         fprintf (stderr, "Error getting print processor information for [%s].\nSize of buffer = %d\n",
48                                         argv[1], needed);
49                 }
50                 printf ("Print Processor Info 1:\n");
51                 for (j=0; j<returned; j++)
52                 {
53                         print_printprocessor_info_1 (&buffer1[j]);
54                         printf ("\n");
55                 }
56                 free (buffer1);
57         }
58
59
60         return 0;
61
62 }