1 /******************************************************************
\r
2 * SPOOLSS regression testing code for Samba print servers
\r
4 *****************************************************************/
\r
9 #include "printlib.h"
\r
12 #define MAX_JOBS 100
\r
14 int main (int argc, char* argv[])
\r
18 DWORD type, pcbData;
\r
19 LPBYTE pData = NULL;
\r
25 fprintf (stderr, "useage: %s <printername> <value name>\n", argv[0]);
\r
29 /* open the printer */
\r
30 if (!OpenPrinter (argv[1], &printer, NULL))
\r
32 fprintf (stderr, "Unable to open %s!\n", argv[1]);
\r
37 printf ("Printer [%s] opened successfully.\n\n", argv[1]);
\r
40 status=GetPrinterData(printer, argv[2], &type, pData, 0, &pcbData);
\r
41 if ((status != ERROR_SUCCESS) && (status != ERROR_MORE_DATA))
\r
44 ClosePrinter (printer);
\r
48 if ((pData = (LPBYTE)malloc(pcbData)) == NULL)
\r
50 fprintf (stderr, "Unable to malloc memory for Value Data!\n");
\r
54 status = GetPrinterData(printer, argv[2], &type, pData, pcbData, &pcbData);
\r
55 if (status == ERROR_SUCCESS)
\r
59 printf ("\tValue Name = %s\n", argv[2]);
\r
60 printf ("\tType = %d\n", type);
\r
61 printf ("\tData = 0x%x bytes\n", pcbData);
\r
65 printf ("\t0x%x", *(ptr));
\r
75 printf ("Shifting everything to the right one bit...\n\n");
\r
77 status = SetPrinterData(printer, argv[2], type, pData, pcbData);
\r
78 if (status == ERROR_SUCCESS)
\r
80 printf ("\tValue Name = %s\n", argv[2]);
\r
81 printf ("\tType = %d\n", type);
\r
82 printf ("\tData = 0x%x bytes\n", pcbData);
\r
86 printf ("\t0x%x", *(pData++));
\r
100 /* close the printer */
\r
101 if (!ClosePrinter(printer))
\r
103 fprintf (stderr, "Error closing printer!\n");
\r
108 printf ("Printer [%s] closed successfully.\n", argv[1]);
\r