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