testprogs: add EnumPrinterKey test to spoolss test.
[ira/wip.git] / testprogs / win32 / spoolss / printlib.c
1 /*
2    Unix SMB/CIFS implementation.
3    test suite for spoolss rpc operations
4
5    Copyright (C) Gerald (Jerry) Carter 2007
6    Copyright (C) Guenther Deschner 2009-2010
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include <windows.h>
23 #include <stdio.h>
24
25 void print_devmode(DEVMODE *pDevModeIn)
26 {
27         if (pDevModeIn == NULL) {
28                 printf("\tDevice Mode\t= (null)\n");
29                 return;
30         }
31
32         printf("\tDEVMODE:----------\n");
33         printf("\tDeviceName:      [%s]\n", pDevModeIn->dmDeviceName);
34         printf("\tSpecVersion:     %d\n",   pDevModeIn->dmSpecVersion);
35         printf("\tDriverVersion:   %d\n",   pDevModeIn->dmDriverVersion);
36         printf("\tSize:            %d\n",   pDevModeIn->dmSize);
37         printf("\tDriverExtra:     %d\n",   pDevModeIn->dmDriverExtra);
38         printf("\tFields:          0x%x\n", pDevModeIn->dmFields);
39
40         if (pDevModeIn->dmFields & DM_ORIENTATION)
41                 printf("\tOrientation:     %d\n", pDevModeIn->dmOrientation);
42         if (pDevModeIn->dmFields & DM_PAPERSIZE)
43                 printf("\tPaperSize:       %d\n", pDevModeIn->dmPaperSize);
44         if (pDevModeIn->dmFields & DM_PAPERLENGTH)
45                 printf("\tPaperLength:     %d\n", pDevModeIn->dmPaperLength);
46         if (pDevModeIn->dmFields & DM_PAPERWIDTH)
47                 printf("\tPaperWidth:      %d\n", pDevModeIn->dmPaperWidth);
48 //      if (pDevModeIn->dmFields & DM_POSITION)
49 //              printf("\tPosition:        %d\n", pDevModeIn->dmPosition);
50         if (pDevModeIn->dmFields & DM_SCALE)
51                 printf("\tScale:           %d\n", pDevModeIn->dmScale);
52         if (pDevModeIn->dmFields & DM_COPIES)
53                 printf("\tCopies:          %d\n", pDevModeIn->dmCopies );
54         if (pDevModeIn->dmFields & DM_DEFAULTSOURCE)
55                 printf("\tDefaultSource:   %d\n", pDevModeIn->dmDefaultSource);
56         if (pDevModeIn->dmFields & DM_PRINTQUALITY)
57                 printf("\tPrintQuality:    %d\n", pDevModeIn->dmPrintQuality);
58         if (pDevModeIn->dmFields & DM_COLOR)
59                 printf("\tColor:           %d\n", pDevModeIn->dmColor);
60         if (pDevModeIn->dmFields & DM_DUPLEX)
61                 printf("\tDuplex:          %d\n", pDevModeIn->dmDuplex);
62         if (pDevModeIn->dmFields & DM_YRESOLUTION)
63                 printf("\tYResolution:     %d\n", pDevModeIn->dmYResolution);
64         if (pDevModeIn->dmFields & DM_TTOPTION)
65                 printf("\tTTOption:        %d\n", pDevModeIn->dmTTOption);
66         if (pDevModeIn->dmFields & DM_COLLATE)
67                 printf("\tCollate:         %d\n", pDevModeIn->dmCollate);
68         if (pDevModeIn->dmFields & DM_FORMNAME)
69                 printf("\tForm:            [%s]\n", pDevModeIn->dmFormName);
70         if (pDevModeIn->dmFields & DM_LOGPIXELS)
71                 printf("\tLogPixels:       %d\n", pDevModeIn->dmLogPixels);
72         if (pDevModeIn->dmFields & DM_BITSPERPEL)
73                 printf("\tBitsPerPel:      %d\n", pDevModeIn->dmBitsPerPel);
74         if (pDevModeIn->dmFields & DM_PELSWIDTH)
75                 printf("\tPelsWidth:       %d\n", pDevModeIn->dmPelsWidth);
76         if (pDevModeIn->dmFields & DM_PELSHEIGHT)
77                 printf("\tPelsHeight:      %d\n", pDevModeIn->dmPelsHeight);
78         if (pDevModeIn->dmFields & DM_DISPLAYFLAGS)
79                 printf("\tDisplayFlags:    %d\n", pDevModeIn->dmDisplayFlags);
80 //      if (pDevModeIn->dmFields & DM_NUP)
81 //              printf("\tNup:             %d\n", pDevModeIn->dmNup);
82         if (pDevModeIn->dmFields & DM_DISPLAYFREQUENCY)
83                 printf("\tDisplayFrequency:%d\n", pDevModeIn->dmDisplayFrequency);
84         if (pDevModeIn->dmFields & DM_ICMMETHOD)
85                 printf("\tICMMethod:       %d\n", pDevModeIn->dmICMMethod);
86         if (pDevModeIn->dmFields & DM_ICMINTENT)
87                 printf("\tICMIntent:       %d\n", pDevModeIn->dmICMIntent);
88         if (pDevModeIn->dmFields & DM_MEDIATYPE)
89                 printf("\tMediaType:       %d\n", pDevModeIn->dmMediaType);
90         if (pDevModeIn->dmFields & DM_DITHERTYPE)
91                 printf("\tDitherType:      %d\n", pDevModeIn->dmDitherType);
92 //      if (pDevModeIn->dmFields & DM_PANNINGWIDTH)
93 //              printf("\tPanningWidth:    %d\n", pDevModeIn->dmPanningWidth);
94 //      if (pDevModeIn->dmFields & DM_PANNINGHEIGHT)
95 //              printf("\tPanningHeight:   %d\n", pDevModeIn->dmPanningHeight);
96
97 #if 0
98         if (bForceIn) {
99                 printf("DEVMODE\n");
100                 Dump((BYTE*)pDevModeIn, sizeof(DEVMODE), LEADER);
101
102                 if (pDevModeIn->dmDriverExtra) {
103                         printf("DriverExtra\n");
104                         Dump((BYTE*)pDevModeIn + sizeof(DEVMODE), pDevModeIn->dmDriverExtra, LEADER);
105                 }
106         }
107 #endif
108
109         return;
110 }
111
112 void print_acl(const char* str, ACL *acl)
113 {
114         printf("%s\n", str);
115         if (acl == NULL)
116                 return;
117
118         printf("\t\tACL Revision \t\t 0x%x\n", acl->AclRevision);
119         printf("\t\tSbz1\t\t 0x%x\n", acl->Sbz1);
120         printf("\t\tSbz2\t\t 0x%x\n", acl->Sbz2);
121         printf("\t\tACL Size\t\t 0x%x\n", acl->AclSize);
122         printf("\t\tACL Count\t\t 0x%x\n", acl->AceCount);
123
124         return;
125 }
126
127 void print_sid(const char* str, SID *sid)
128 {
129         DWORD   i = 0;
130
131         printf("%s\n", str);
132         printf("0x%x\n", sid);
133         if (sid == NULL)
134                 return;
135         printf("\t\tRevision\t\t0x%x\n", sid->Revision);
136         printf("\t\tSubAuthorityCount\t0x%x\n", sid->SubAuthorityCount);
137         printf("\t\tSubAuthority\n\t");
138         while (i < sid->SubAuthorityCount) {
139                 printf("\t0x%x", sid->SubAuthority[i]);
140                 if (i%4 == 3)
141                         printf("\n\t");
142                 i++;
143         }
144
145         return;
146 }
147
148 void print_secdesc(SECURITY_DESCRIPTOR *secdesc)
149 {
150         if (secdesc == NULL) {
151                 printf("\tSecurity Descriptor\t= (null)\n");
152                 return;
153         }
154
155         printf("\tRevision\t= 0x%x\n", secdesc->Revision);
156         printf("\tSbz1\t\t= 0x%x\n", secdesc->Sbz1);
157 #if 0
158         print_sid("\tOwner\t\t= ", secdesc->Owner);
159         print_sid("\tGroup\t\t= ",secdesc->Group);
160         print_acl("\tSacl\t\t= ", secdesc->Sacl);
161         print_acl("\tDacl\t\t= ", secdesc->Dacl);
162 #endif
163         return;
164 }
165
166 void PrintLastError()
167 {
168         LPVOID lpMsgBuf;
169         DWORD status;
170
171         status = GetLastError();
172
173         FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
174                       NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
175                       (LPTSTR)&lpMsgBuf, 0, NULL);
176         printf("ERROR  [0x%x] : %s\n", status, (char*)lpMsgBuf);
177         LocalFree(lpMsgBuf);
178
179         return;
180 }
181
182
183 void print_job_info_1(PJOB_INFO_1 info)
184 {
185         printf("\tJob ID\t\t= %d\n",            info->JobId);
186         printf("\tPrinter Name\t= %s\n",        info->pPrinterName);
187         printf("\tMachine Name\t= %s\n",        info->pMachineName);
188         printf("\tUser Name\t= %s\n",           info->pUserName);
189         printf("\tDocument\t= %s\n",            info->pDocument);
190         printf("\tDatatype\t= %s\n",            info->pDatatype);
191         printf("\tStatus\t\t= %s\n",            info->pStatus);
192         printf("\tStatus\t= %d\n",              info->Status);
193         printf("\tPriority\t= %d\n",            info->Priority);
194         printf("\tPosition\t= %d\n",            info->Position);
195         printf("\tTotal Pages\t= %d\n", info->TotalPages);
196         printf("\tPages Printed\t= %d\n",       info->PagesPrinted);
197         printf("\tSubmitted (DD:MM:YY HH:MM:SS)\t= %d:%d:%d %d:%d:%d UTC\n",
198                 info->Submitted.wDay, info->Submitted.wMonth,
199                 info->Submitted.wYear, info->Submitted.wHour,
200                 info->Submitted.wMinute, info->Submitted.wSecond);
201
202         return;
203 }
204
205 void print_job_info_2(PJOB_INFO_2 info)
206 {
207         printf("\tJob ID\t\t= %d\n",            info->JobId);
208         printf("\tPrinter Name\t= %s\n",        info->pPrinterName);
209         printf("\tMachine Name\t= %s\n",        info->pMachineName);
210         printf("\tUser Name\t= %s\n",           info->pUserName);
211         printf("\tDocument\t= %s\n",            info->pDocument);
212         printf("\tDatatype\t= %s\n",            info->pDatatype);
213         printf("\tNotify Name\t= %s\n",         info->pNotifyName);
214         printf("\tPrint Processor\t= %s\n",     info->pPrintProcessor);
215         printf("\tParameters\t= %s\n",          info->pParameters);
216         printf("\tDriver Name\t= %s\n",         info->pDriverName);
217         printf("\tStatus\t\t= %s\n",            info->pStatus);
218         printf("\tStatus\t\t= %d\n",            info->Status);
219         printf("\tPriority\t= %d\n",            info->Priority);
220         printf("\tPosition\t= %d\n",            info->Position);
221         printf("\tTotal Pages\t= %d\n",         info->TotalPages);
222         printf("\tPages Printed\t= %d\n",       info->PagesPrinted);
223         printf("\tStart Time\t= %d\n",          info->StartTime);
224         printf("\tUntil Time\t= %d\n",          info->UntilTime);
225         printf("\tTime\t\t= %d\n",              info->Time);
226         printf("\tSize\t\t= %d\n",              info->Size);
227         printf("\tSubmitted (DD:MM:YY HH:MM:SS)\t= %d:%d:%d %d:%d:%d UTC\n",
228                 info->Submitted.wDay, info->Submitted.wMonth,
229                 info->Submitted.wYear, info->Submitted.wHour,
230                 info->Submitted.wMinute, info->Submitted.wSecond);
231         printf("\tDevice Mode Information\n");
232         printf("\t-----------------------\n");
233         print_devmode(info->pDevMode);
234         printf("\tSecurity Descriptor Information\n");
235         printf("\t-------------------------------\n");
236         print_secdesc(info->pSecurityDescriptor);
237
238         return;
239 }
240
241 void print_job_info_3(PJOB_INFO_3 info)
242 {
243         printf("\tJob ID\t\t= %d\n",            info->JobId);
244         printf("\tJob ID Next Job\t= %d\n",     info->NextJobId);
245         printf("\tReserved (must be 0)\t= %d\n",info->Reserved);
246
247         return;
248 }
249
250 void print_monitor_info_1(PMONITOR_INFO_1 info)
251 {
252         printf("\tMonitor Name\t= %s\n",        info->pName);
253
254         return;
255 }
256
257 void print_monitor_info_2(PMONITOR_INFO_2 info)
258 {
259         printf("\tMonitor Name\t= %s\n",        info->pName);
260         printf("\tEnvironment\t= %s\n",         info->pEnvironment);
261         printf("\tDLL Name\t= %s\n",            info->pDLLName);
262
263         return;
264 }
265
266 void print_form_info_1(PFORM_INFO_1 info)
267 {
268         printf("\tForm Name\t= %s\n",   info->pName);
269         printf("\tFlags\t\t= 0x%x\n",   info->Flags);
270         printf("\tSize\t\t= %d x %d\n", info->Size.cx, info->Size.cy);
271         printf("\tRectangle\t= [left]%d [right]%d [top]%d [bottom]%d\n",
272                         info->ImageableArea.left, info->ImageableArea.right,
273                         info->ImageableArea.top, info->ImageableArea.bottom);
274
275         return;
276 }
277
278 void print_printer_info_1(PPRINTER_INFO_1 info)
279 {
280         printf("\tPrinter Name\t= %s\n",        info->pName);
281         printf("\tDescription\t= %s\n",         info->pDescription);
282         printf("\tComment\t\t= %s\n",           info->pComment);
283         printf("\tFlags\t\t= 0x%x\n",           info->Flags);
284
285         return;
286 }
287
288 void print_printer_info_2(PPRINTER_INFO_2 info)
289 {
290         printf("\tServer Name\t\t= %s\n",       info->pServerName);
291         printf("\tPrinter Name\t\t= %s\n",      info->pPrinterName);
292         printf("\tPort Name\t\t= %s\n",         info->pPortName);
293         printf("\tShare Name\t\t= %s\n",        info->pShareName);
294         printf("\tDriver Name\t\t= %s\n",       info->pDriverName);
295         printf("\tComment\t\t\t= %s\n",         info->pComment);
296         printf("\tLocation\t\t= %s\n",          info->pLocation);
297         printf("\tSeparator File\t\t= %s\n",    info->pSepFile);
298         printf("\tDefault Data Type\t= %s\n",   info->pDatatype);
299         printf("\tPrint Processor\t\t= %s\n",   info->pPrintProcessor);
300         printf("\tParameters\t\t= %s\n",        info->pParameters);
301         printf("\tAttributes\t\t= 0x%x\n",      info->Attributes);
302         printf("\tPriority\t\t= 0x%x\n",        info->Priority);
303         printf("\tDefault Priority\t= 0x%x\n",  info->DefaultPriority);
304         printf("\tStart Time\t\t= 0x%x\n",      info->StartTime);
305         printf("\tUntil Time\t\t= 0x%x\n",      info->UntilTime);
306         printf("\tStatus\t\t\t= 0x%x\n",        info->Status);
307         printf("\tcJobs\t\t\t= 0x%x\n",         info->cJobs);
308         printf("\tAverage PPM\t\t= 0x%x\n",     info->AveragePPM);
309
310         printf("\tDevice Mode Information\n");
311         printf("\t-----------------------\n");
312         print_devmode(info->pDevMode);
313 #if 0
314         printf("\tSecurity Descriptor Information\n");
315         printf("\t-------------------------------\n");
316         print_secdesc(info->pSecurityDescriptor);
317 #endif
318         return;
319 }
320
321 void print_printer_info_5(PPRINTER_INFO_5 info)
322 {
323         printf("\tPrinter Name\t\t\t= %s\n",            info->pPrinterName);
324         printf("\tPort Name\t\t\t= %s\n",               info->pPortName);
325         printf("\tAttributes\t\t\t= 0x%x\n",            info->Attributes);
326         printf("\tDev NotSelect Timeout\t= 0x%x\n",     info->DeviceNotSelectedTimeout);
327         printf("\tTX RetryTimeout\t\t= 0x%x\n",         info->TransmissionRetryTimeout);
328         return;
329 }
330
331 void print_printer_info_6(PPRINTER_INFO_6 info)
332 {
333         printf("\tStatus\t\t\t= 0x%x\n",                info->dwStatus);
334         return;
335 }
336
337 void print_printer_info_7(PPRINTER_INFO_7 info)
338 {
339         printf("\tObject GUID\t\t\t= %s\n",             info->pszObjectGUID);
340         printf("\tAction\t\t\t= 0x%x\n",                info->dwAction);
341         return;
342 }
343
344 void print_printer_info_8(PPRINTER_INFO_8 info)
345 {
346         print_devmode(info->pDevMode);
347 }
348
349 void print_printer_info_9(PPRINTER_INFO_9 info)
350 {
351         print_devmode(info->pDevMode);
352 }
353
354 void print_printer_info_bylevel(DWORD level, LPBYTE buffer, DWORD count)
355 {
356         DWORD i;
357         PPRINTER_INFO_1 buffer1 = NULL;
358         PPRINTER_INFO_2 buffer2 = NULL;
359         PPRINTER_INFO_3 buffer3 = NULL;
360         PPRINTER_INFO_4 buffer4 = NULL;
361         PPRINTER_INFO_5 buffer5 = NULL;
362         PPRINTER_INFO_6 buffer6 = NULL;
363         PPRINTER_INFO_7 buffer7 = NULL;
364         PPRINTER_INFO_8 buffer8 = NULL;
365
366         if (!buffer) {
367                 return;
368         }
369
370         switch (level) {
371         case 1:
372                 buffer1 = (PPRINTER_INFO_1)buffer;
373                 break;
374         case 2:
375                 buffer2 = (PPRINTER_INFO_2)buffer;
376                 break;
377         case 3:
378                 buffer3 = (PPRINTER_INFO_3)buffer;
379                 break;
380         case 4:
381                 buffer4 = (PPRINTER_INFO_4)buffer;
382                 break;
383         case 5:
384                 buffer5 = (PPRINTER_INFO_5)buffer;
385                 break;
386         case 6:
387                 buffer6 = (PPRINTER_INFO_6)buffer;
388                 break;
389         case 7:
390                 buffer7 = (PPRINTER_INFO_7)buffer;
391                 break;
392         case 8:
393                 buffer8 = (PPRINTER_INFO_8)buffer;
394                 break;
395         default:
396                 break;
397         }
398
399         printf("Printer Info Level %d:\n", level);
400
401         switch (level) {
402         case 1:
403                 for (i=0; i<count; i++) {
404                         print_printer_info_1(&buffer1[i]);
405                         printf("\n");
406                 }
407                 break;
408         case 2:
409                 for (i=0; i<count; i++) {
410                         print_printer_info_2(&buffer2[i]);
411                         printf("\n");
412                 }
413                 break;
414 #if 0
415         case 3:
416                 for (i=0; i<count; i++) {
417                         print_printer_info_3(&buffer3[i]);
418                         printf("\n");
419                 }
420                 break;
421         case 4:
422                 for (i=0; i<count; i++) {
423                         print_printer_info_4(&buffer4[i]);
424                         printf("\n");
425                 }
426                 break;
427 #endif
428         case 5:
429                 for (i=0; i<count; i++) {
430                         print_printer_info_5(&buffer5[i]);
431                         printf("\n");
432                 }
433                 break;
434         case 6:
435                 for (i=0; i<count; i++) {
436                         print_printer_info_6(&buffer6[i]);
437                         printf("\n");
438                 }
439                 break;
440         case 7:
441                 for (i=0; i<count; i++) {
442                         print_printer_info_7(&buffer7[i]);
443                         printf("\n");
444                 }
445                 break;
446         case 8:
447                 for (i=0; i<count; i++) {
448                         print_printer_info_8(&buffer8[i]);
449                         printf("\n");
450                 }
451                 break;
452         default:
453                 break;
454         }
455 }
456
457 void print_printprocessor_info_1(PPRINTPROCESSOR_INFO_1 info)
458 {
459         printf("\tPrint Processor Name\t= %s\n", info->pName);
460
461         return;
462 }
463
464 void print_driver_info_1(PDRIVER_INFO_1 info)
465 {
466         printf("\tDriver Name\t= %s\n\n",       info->pName);
467
468         return;
469 }
470
471 void print_driver_info_2(PDRIVER_INFO_2 info)
472 {
473         printf("\tDriver Name\t= %s\n",         info->pName);
474         printf("\tEnvironment\t= %s\n",         info->pEnvironment);
475         printf("\tVersion\t\t= %d\n",           info->cVersion);
476         printf("\tDriver Path\t= %s\n",         info->pDriverPath);
477         printf("\tData File\t= %s\n",           info->pDataFile);
478         printf("\tConfig File\t= %s\n\n",       info->pConfigFile);
479
480         return;
481 }
482
483 void print_driver_info_3(PDRIVER_INFO_3 info)
484 {
485         char *ptr = NULL;
486
487         printf("\tDriver Name\t= %s\n",         info->pName);
488         printf("\tEnvironment\t= %s\n",         info->pEnvironment);
489         printf("\tVersion\t\t= %d\n",           info->cVersion);
490         printf("\tDriver Path\t= %s\n",         info->pDriverPath);
491         printf("\tData File\t= %s\n",           info->pDataFile);
492         printf("\tConfig File\t= %s\n",         info->pConfigFile);
493         printf("\tHelp Path\t= %s\n",           info->pHelpFile);
494         printf("\tMonitor Name\t= %s\n",        info->pMonitorName);
495         printf("\tData Type\t= %s\n",           info->pDefaultDataType);
496         ptr = (char*)info->pDependentFiles;
497         while ((ptr != NULL) && (*ptr != '\0')) {
498                 printf("\tDependent Files\t= %s\n", ptr);
499                 for (;*ptr != '\0'; ptr++)
500                         /* printf("%s\n", ptr); */
501                         ;
502                 ptr++;
503         }
504
505         return;
506 }
507
508 void print_driver_info_4(PDRIVER_INFO_4 info)
509 {
510         char *ptr = NULL;
511
512         printf("\tDriver Name\t= %s\n",         info->pName);
513         printf("\tEnvironment\t= %s\n",         info->pEnvironment);
514         printf("\tVersion\t\t= %d\n",           info->cVersion);
515         printf("\tDriver Path\t= %s\n",         info->pDriverPath);
516         printf("\tData File\t= %s\n",           info->pDataFile);
517         printf("\tConfig File\t= %s\n",         info->pConfigFile);
518         printf("\tHelp Path\t= %s\n",           info->pHelpFile);
519         printf("\tMonitor Name\t= %s\n",        info->pMonitorName);
520         printf("\tData Type\t= %s\n",           info->pDefaultDataType);
521         printf("\tPrevious Names\t= %s\n",      info->pszzPreviousNames);
522         ptr = (char*)info->pDependentFiles;
523         while ((ptr != NULL) && (*ptr != '\0')) {
524                 printf("\tDependent Files\t= %s\n", ptr);
525                 for (;*ptr != '\0'; ptr++)
526                         /* printf("%s\n", ptr); */
527                         ;
528                 ptr++;
529         }
530
531         return;
532 }
533
534 void print_driver_info_6(PDRIVER_INFO_6 info)
535 {
536         char *ptr = NULL;
537
538         printf("\tDriver Name\t= %s\n",         info->pName);
539         printf("\tEnvironment\t= %s\n",         info->pEnvironment);
540         printf("\tVersion\t\t= %d\n",           info->cVersion);
541         printf("\tDriver Path\t= %s\n",         info->pDriverPath);
542         printf("\tData File\t= %s\n",           info->pDataFile);
543         printf("\tConfig File\t= %s\n",         info->pConfigFile);
544         printf("\tHelp Path\t= %s\n",           info->pHelpFile);
545         printf("\tMonitor Name\t= %s\n",        info->pMonitorName);
546         printf("\tData Type\t= %s\n",           info->pDefaultDataType);
547         printf("\tPrevious Names\t= %s\n",      info->pszzPreviousNames);
548         ptr = (char*)info->pDependentFiles;
549         if (ptr != NULL) {
550                 while (*ptr != '\0') {
551                         printf("\tDependent Files\t= %s\n", ptr);
552                         for (;*ptr != '\0'; ptr++)
553                                 /* printf("%s\n", ptr); */
554                                 ;
555                         ptr++;
556                 }
557         } else {
558                 printf("\tPrevious Names\t= (null)\n");
559         }
560
561         ptr = (char*)info->pszzPreviousNames;
562         if (ptr != NULL) {
563                 while (*ptr != '\0') {
564                         printf("\tPrevious Names\t= %s\n", ptr);
565                         for (;*ptr != '\0'; ptr++)
566                                 /* printf("%s\n", ptr); */
567                                 ;
568                         ptr++;
569                 }
570         } else {
571                 printf("\tPrevious Names\t= (null)\n");
572         }
573
574         printf("\tDriver Date\t= %d\n",         info->ftDriverDate);
575         printf("\tDriver Version\t= %d\n",      info->dwlDriverVersion);
576         printf("\tManufacture Name = %s\n",     info->pszMfgName);
577         printf("\tOEM URL\t\t= %s\n",           info->pszOEMUrl);
578         printf("\tHardware ID\t= %s\n",         info->pszHardwareID);
579         printf("\tProvider\t= %s\n",            info->pszProvider);
580         return;
581 }
582
583 void print_doc_info_1(PDOC_INFO_1 info)
584 {
585         printf("\tDocument Name\t= %s\n",       info->pDocName);
586         printf("\tOutput Filename\t= %s\n",     info->pOutputFile);
587         printf("\tDatatype\t= %s\n",            info->pDatatype);
588         return;
589 }
590
591 void print_printer_enum_values(PRINTER_ENUM_VALUES *info)
592 {
593         DWORD i = 0;
594
595         printf("\tValue Name\t= %s [0x%x]\n",   info->pValueName, info->cbValueName);
596         printf("\tType\t\t= 0x%x\n",            info->dwType);
597         printf("\tSize\t\t= 0x%x\n",            info->cbData);
598
599         while (i < info->cbData) {
600                 printf("\t0x%x", *(info->pData++));
601                 if (i%4 == 3)
602                         printf("\n");
603                 i++;
604         }
605         printf("\n");
606
607         return;
608 }
609
610 void print_printer_keys(LPSTR buffer)
611 {
612         LPSTR p = NULL;
613
614         p = buffer;
615
616         while (p && *p) {
617                 printf("%s\n", p);
618                 for (; *p; p = CharNext(p)) {
619                         p = CharNext(p);
620                 }
621         }
622 }