add SetPrinterDataExW.exe.
[gd/win32-spoolss/.git] / GetPrinterDriverDirectory.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
19         DWORD                   returned, needed, i;
20         LPTSTR                  buffer = NULL;
21
22         if (argc < 2)
23         {
24                 fprintf (stderr, "useage: %s <servername>\n", argv[0]);
25                 exit (-1);
26         }
27
28         printf ("Printer Driver Directory Info Level 1:\n");
29         for (i=0; i<NUM_ARCH; i++)
30         {
31                 GetPrinterDriverDirectory(argv[1], arch[i], 1, (LPBYTE)buffer, 0, &needed);
32                 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
33                 {
34                         fprintf (stderr, "Error getting printer driver directory for [%s] using NULL buffer.\n", argv[1]);
35                         exit (-1);
36                 }
37
38                 if ((buffer = (LPTSTR)malloc(needed)) == NULL)
39                 {
40                         fprintf (stderr, "Unable to malloc memory for directory path!\n");
41                         exit (-1);
42                 }
43                 if (!GetPrinterDriverDirectory(argv[1], arch[i], 1, (LPBYTE)buffer, needed, &returned))
44                 {
45                         fprintf (stderr, "Error getting printer driver directory for [%s].\nSize of buffer = %d\n",
46                                      argv[1], needed);
47                         exit (-1);
48                 }
49
50                 printf ("\t%s Path\t= %s\n\n", arch[i], buffer);
51                 free (buffer);
52         }
53
54         return 0;
55
56 }