add SetPrinterDataExW.exe.
[gd/win32-spoolss/.git] / AddPrinterConnection.c
1 /******************************************************************
2  * SPOOLSS regression testing code for Samba print servers
3  *
4  *****************************************************************/
5
6 #include <windows.h>
7 #include <stdio.h>
8
9
10 int main (int argc, char* argv[])
11 {
12
13         LPVOID  lpMsgBuf;
14
15
16         if (argc < 2)
17         {
18                 fprintf (stderr, "useage: %s <printername>\n", argv[0]);
19                 exit (-1);
20         }
21
22         if (!AddPrinterConnection(argv[1]))
23         {
24                 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
25                         FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(),
26                         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
27                         (LPTSTR) &lpMsgBuf, 0, NULL);
28                 printf ("ERROR : %s\n", (char*)lpMsgBuf);
29                 LocalFree (lpMsgBuf);
30         }
31         else
32         {
33                 printf ("Successfully established connection to [%s].\n", argv[1]);
34         }
35
36         return 0;
37
38 }