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 dwIndex, pcbValue, type, pcbData;
\r
19 DWORD pcbMaxValue, pcbMaxData;
\r
20 LPTSTR pValueName = NULL;
\r
21 LPBYTE pData = NULL;
\r
27 fprintf (stderr, "useage: %s <printername>\n", argv[0]);
\r
31 /* open the printer */
\r
32 if (!OpenPrinter (argv[1], &printer, NULL))
\r
35 printf ("Printer [%s] opened successfully.\n\n", argv[1]);
\r
38 status = ERROR_SUCCESS;
\r
40 pcbMaxValue = pcbMaxData = 0;
\r
41 status=EnumPrinterData(printer, dwIndex, pValueName, 0, &pcbMaxValue, &type, pData, 0, &pcbMaxData);
\r
42 printf ("\tMax Size of Value = %d\n", pcbMaxValue);
\r
43 printf ("\tMax Size of Data = %d\n", pcbMaxData);
\r
45 if (status != ERROR_SUCCESS)
\r
51 if ((pValueName = (LPTSTR)malloc(pcbMaxValue)) == NULL)
\r
53 fprintf (stderr, "Unable to malloc memory for Value Name!\n");
\r
56 if ((pData = (LPBYTE)malloc(pcbMaxData)) == NULL)
\r
58 fprintf (stderr, "Unable to malloc memory for Value Data!\n");
\r
63 while (status != ERROR_NO_MORE_ITEMS)
\r
65 pcbValue = pcbData = 0;
\r
66 status = EnumPrinterData(printer, dwIndex, pValueName, pcbMaxValue, &pcbValue, &type, pData, pcbMaxData, &pcbData);
\r
68 if (status == ERROR_SUCCESS)
\r
70 printf ("\tValue Name [size] = %s [%d]\n", pValueName, pcbValue);
\r
71 printf ("\tType = %d\n", type);
\r
72 printf ("\tData = 0x%x [%d] bytes\n", pcbData, pcbData);
\r
76 printf ("\t0x%x", *(pData++));
\r
94 /* close the printer */
\r
95 if (!ClosePrinter(printer))
\r
98 printf ("Printer [%s] closed successfully.\n", argv[1]);
\r