1 /******************************************************************
\r
2 * SPOOLSS regression testing code for Samba print servers
\r
4 *****************************************************************/
\r
9 #include "printlib.h"
\r
11 int main (int argc, char* argv[])
\r
15 DWORD type, pcbData;
\r
16 LPBYTE pData = NULL;
\r
22 fprintf (stderr, "useage: %s <printername> <value name>\n", argv[0]);
\r
26 /* open the server */
\r
27 if (!OpenPrinter (argv[1], &printer, NULL))
\r
30 printf ("Printer [%s] opened successfully.\n\n", argv[1]);
\r
33 status=GetPrinterDataEx(printer, "PrinterDriverData", argv[2], &type, pData, 0, &pcbData);
\r
34 if ((status != ERROR_SUCCESS) && (status != ERROR_MORE_DATA))
\r
37 ClosePrinter (printer);
\r
41 if ((pData = (LPBYTE)malloc(pcbData)) == NULL)
\r
43 fprintf (stderr, "Unable to malloc memory for Value Data!\n");
\r
47 status = GetPrinterDataEx(printer, "PrinterDriverData", argv[2], &type, pData, pcbData, &pcbData);
\r
48 if (status == ERROR_SUCCESS)
\r
52 printf ("\tValue Name = %s\n", argv[2]);
\r
53 printf ("\tType = %d\n", type);
\r
54 printf ("\tData = 0x%x bytes\n", pcbData);
\r
58 printf ("\t0x%x", *(ptr));
\r
68 printf ("Shifting everything to the right one bit...\n\n");
\r
70 status = SetPrinterDataEx(printer, "PrinterDriverData", argv[2], type, pData, pcbData);
\r
71 if (status == ERROR_SUCCESS)
\r
73 printf ("\tValue Name = %s\n", argv[2]);
\r
74 printf ("\tType = %d\n", type);
\r
75 printf ("\tData = 0x%x bytes\n", pcbData);
\r
79 printf ("\t0x%x", *(pData++));
\r
93 /* close the server */
\r
94 if (!ClosePrinter(printer))
\r
97 printf ("Printer [%s] closed successfully.\n", argv[1]);
\r