Update README to say GPLv2 or later and remove references to bzr.
[jerry/slag.git] / win32 / spoolss / GetPrinterDriverDirectory.c
1 /******************************************************************\r
2  * SPOOLSS regression testing code for Samba print servers\r
3  * \r
4  *****************************************************************/\r
5 \r
6 #include <windows.h>\r
7 #include <stdio.h>\r
8 \r
9 #define NUM_ARCH        5\r
10 const LPTSTR arch [NUM_ARCH] = {        "Windows 4.0",\r
11                                                         "Windows NT x86",\r
12                                                         "Windows NT R4000",\r
13                                                         "Windows NT PowerPC",\r
14                                                         "Windows NT Alpha_AXP"  };\r
15 \r
16 int main (int argc, char* argv[])\r
17 {\r
18         \r
19         DWORD                   returned, needed, i;\r
20         LPTSTR                  buffer = NULL;\r
21 \r
22         if (argc < 2)\r
23         {\r
24                 fprintf (stderr, "useage: %s <servername>\n", argv[0]);\r
25                 exit (-1);\r
26         }\r
27 \r
28         printf ("Printer Driver Directory Info Level 1:\n");\r
29         for (i=0; i<NUM_ARCH; i++)\r
30         {\r
31                 GetPrinterDriverDirectory(argv[1], arch[i], 1, (LPBYTE)buffer, 0, &needed);\r
32                 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)\r
33                 {\r
34                         fprintf (stderr, "Error getting printer driver directory for [%s] using NULL buffer.\n", argv[1]);\r
35                         exit (-1);\r
36                 }\r
37 \r
38                 if ((buffer = (LPBYTE)malloc(needed)) == NULL)\r
39                 {\r
40                         fprintf (stderr, "Unable to malloc memory for directory path!\n");\r
41                         exit (-1);\r
42                 }\r
43                 if (!GetPrinterDriverDirectory(argv[1], arch[i], 1, (LPBYTE)buffer, needed, &returned))\r
44                 {\r
45                         fprintf (stderr, "Error getting printer driver directory for [%s].\nSize of buffer = %d\n", \r
46                                      argv[1], needed);\r
47                         exit (-1);\r
48                 }\r
49 \r
50                 printf ("\t%s Path\t= %s\n\n", arch[i], buffer);\r
51                 free (buffer);\r
52         }\r
53 \r
54         return 0;\r
55 \r
56 }