2 Unix SMB/CIFS implementation.
3 test suite for spoolss rpc operations
5 Copyright (C) Gerald (Jerry) Carter 2007
6 Copyright (C) Guenther Deschner 2009-2010
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.
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.
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/>.
28 #define MIN(a,b) ((a)<(b)?(a):(b))
31 void print_devmode(DEVMODE
*pDevModeIn
)
33 if (pDevModeIn
== NULL
) {
34 printf("\tDevice Mode\t= (null)\n");
38 printf("\tDEVMODE:----------\n");
39 printf("\tDeviceName: [%s]\n", pDevModeIn
->dmDeviceName
);
40 printf("\tSpecVersion: %d\n", pDevModeIn
->dmSpecVersion
);
41 printf("\tDriverVersion: %d\n", pDevModeIn
->dmDriverVersion
);
42 printf("\tSize: %d\n", pDevModeIn
->dmSize
);
43 printf("\tDriverExtra: %d\n", pDevModeIn
->dmDriverExtra
);
44 printf("\tFields: 0x%x\n", pDevModeIn
->dmFields
);
46 if (pDevModeIn
->dmFields
& DM_ORIENTATION
)
47 printf("\tOrientation: %d\n", pDevModeIn
->dmOrientation
);
48 if (pDevModeIn
->dmFields
& DM_PAPERSIZE
)
49 printf("\tPaperSize: %d\n", pDevModeIn
->dmPaperSize
);
50 if (pDevModeIn
->dmFields
& DM_PAPERLENGTH
)
51 printf("\tPaperLength: %d\n", pDevModeIn
->dmPaperLength
);
52 if (pDevModeIn
->dmFields
& DM_PAPERWIDTH
)
53 printf("\tPaperWidth: %d\n", pDevModeIn
->dmPaperWidth
);
54 // if (pDevModeIn->dmFields & DM_POSITION)
55 // printf("\tPosition: %d\n", pDevModeIn->dmPosition);
56 if (pDevModeIn
->dmFields
& DM_SCALE
)
57 printf("\tScale: %d\n", pDevModeIn
->dmScale
);
58 if (pDevModeIn
->dmFields
& DM_COPIES
)
59 printf("\tCopies: %d\n", pDevModeIn
->dmCopies
);
60 if (pDevModeIn
->dmFields
& DM_DEFAULTSOURCE
)
61 printf("\tDefaultSource: %d\n", pDevModeIn
->dmDefaultSource
);
62 if (pDevModeIn
->dmFields
& DM_PRINTQUALITY
)
63 printf("\tPrintQuality: %d\n", pDevModeIn
->dmPrintQuality
);
64 if (pDevModeIn
->dmFields
& DM_COLOR
)
65 printf("\tColor: %d\n", pDevModeIn
->dmColor
);
66 if (pDevModeIn
->dmFields
& DM_DUPLEX
)
67 printf("\tDuplex: %d\n", pDevModeIn
->dmDuplex
);
68 if (pDevModeIn
->dmFields
& DM_YRESOLUTION
)
69 printf("\tYResolution: %d\n", pDevModeIn
->dmYResolution
);
70 if (pDevModeIn
->dmFields
& DM_TTOPTION
)
71 printf("\tTTOption: %d\n", pDevModeIn
->dmTTOption
);
72 if (pDevModeIn
->dmFields
& DM_COLLATE
)
73 printf("\tCollate: %d\n", pDevModeIn
->dmCollate
);
74 if (pDevModeIn
->dmFields
& DM_FORMNAME
)
75 printf("\tForm: [%s]\n", pDevModeIn
->dmFormName
);
76 if (pDevModeIn
->dmFields
& DM_LOGPIXELS
)
77 printf("\tLogPixels: %d\n", pDevModeIn
->dmLogPixels
);
78 if (pDevModeIn
->dmFields
& DM_BITSPERPEL
)
79 printf("\tBitsPerPel: %d\n", pDevModeIn
->dmBitsPerPel
);
80 if (pDevModeIn
->dmFields
& DM_PELSWIDTH
)
81 printf("\tPelsWidth: %d\n", pDevModeIn
->dmPelsWidth
);
82 if (pDevModeIn
->dmFields
& DM_PELSHEIGHT
)
83 printf("\tPelsHeight: %d\n", pDevModeIn
->dmPelsHeight
);
84 if (pDevModeIn
->dmFields
& DM_DISPLAYFLAGS
)
85 printf("\tDisplayFlags: %d\n", pDevModeIn
->dmDisplayFlags
);
86 // if (pDevModeIn->dmFields & DM_NUP)
87 // printf("\tNup: %d\n", pDevModeIn->dmNup);
88 if (pDevModeIn
->dmFields
& DM_DISPLAYFREQUENCY
)
89 printf("\tDisplayFrequency:%d\n", pDevModeIn
->dmDisplayFrequency
);
90 if (pDevModeIn
->dmFields
& DM_ICMMETHOD
)
91 printf("\tICMMethod: %d\n", pDevModeIn
->dmICMMethod
);
92 if (pDevModeIn
->dmFields
& DM_ICMINTENT
)
93 printf("\tICMIntent: %d\n", pDevModeIn
->dmICMIntent
);
94 if (pDevModeIn
->dmFields
& DM_MEDIATYPE
)
95 printf("\tMediaType: %d\n", pDevModeIn
->dmMediaType
);
96 if (pDevModeIn
->dmFields
& DM_DITHERTYPE
)
97 printf("\tDitherType: %d\n", pDevModeIn
->dmDitherType
);
98 // if (pDevModeIn->dmFields & DM_PANNINGWIDTH)
99 // printf("\tPanningWidth: %d\n", pDevModeIn->dmPanningWidth);
100 // if (pDevModeIn->dmFields & DM_PANNINGHEIGHT)
101 // printf("\tPanningHeight: %d\n", pDevModeIn->dmPanningHeight);
106 Dump((BYTE
*)pDevModeIn
, sizeof(DEVMODE
), LEADER
);
108 if (pDevModeIn
->dmDriverExtra
) {
109 printf("DriverExtra\n");
110 Dump((BYTE
*)pDevModeIn
+ sizeof(DEVMODE
), pDevModeIn
->dmDriverExtra
, LEADER
);
118 void print_acl(const char* str
, ACL
*acl
)
124 printf("\t\tACL Revision \t\t 0x%x\n", acl
->AclRevision
);
125 printf("\t\tSbz1\t\t 0x%x\n", acl
->Sbz1
);
126 printf("\t\tSbz2\t\t 0x%x\n", acl
->Sbz2
);
127 printf("\t\tACL Size\t\t 0x%x\n", acl
->AclSize
);
128 printf("\t\tACL Count\t\t 0x%x\n", acl
->AceCount
);
133 void PrintLastError();
135 void print_sid(LPSTR str
, PSID sid
)
142 printf("(null sid)\n");
146 if (!ConvertSidToStringSid(sid
, &sid_string
)) {
151 printf("%s\n", sid_string
);
152 LocalFree(sid_string
);
157 void print_secdesc(SECURITY_DESCRIPTOR
*secdesc
)
161 if (secdesc
== NULL
) {
162 printf("\tSecurity Descriptor\t= (null)\n");
166 if (!ConvertSecurityDescriptorToStringSecurityDescriptor(secdesc
, 1, 7, &sd_string
, NULL
)) {
171 printf("%s\n", sd_string
);
172 LocalFree(sd_string
);
175 printf("\tRevision\t= 0x%x\n", secdesc
->Revision
);
176 printf("\tSbz1\t\t= 0x%x\n", secdesc
->Sbz1
);
177 printf("\tControl\t\t= 0x%x\n", secdesc
->Control
);
178 print_sid("\tOwner\t\t= ", secdesc
->Owner
);
179 print_sid("\tGroup\t\t= ",secdesc
->Group
);
180 print_acl("\tSacl\t\t= ", secdesc
->Sacl
);
181 print_acl("\tDacl\t\t= ", secdesc
->Dacl
);
186 void PrintLastError()
191 status
= GetLastError();
193 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS
,
194 NULL
, GetLastError(), MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
), // Default language
195 (LPTSTR
)&lpMsgBuf
, 0, NULL
);
196 printf("ERROR [0x%x] : %s\n", status
, (char*)lpMsgBuf
);
203 void print_job_info_1(PJOB_INFO_1 info
)
205 printf("\tJob ID\t\t= %d\n", info
->JobId
);
206 printf("\tPrinter Name\t= %s\n", info
->pPrinterName
);
207 printf("\tMachine Name\t= %s\n", info
->pMachineName
);
208 printf("\tUser Name\t= %s\n", info
->pUserName
);
209 printf("\tDocument\t= %s\n", info
->pDocument
);
210 printf("\tDatatype\t= %s\n", info
->pDatatype
);
211 printf("\tStatus\t\t= %s\n", info
->pStatus
);
212 printf("\tStatus\t= %d\n", info
->Status
);
213 printf("\tPriority\t= %d\n", info
->Priority
);
214 printf("\tPosition\t= %d\n", info
->Position
);
215 printf("\tTotal Pages\t= %d\n", info
->TotalPages
);
216 printf("\tPages Printed\t= %d\n", info
->PagesPrinted
);
217 printf("\tSubmitted (DD:MM:YY HH:MM:SS)\t= %d:%d:%d %d:%d:%d UTC\n",
218 info
->Submitted
.wDay
, info
->Submitted
.wMonth
,
219 info
->Submitted
.wYear
, info
->Submitted
.wHour
,
220 info
->Submitted
.wMinute
, info
->Submitted
.wSecond
);
225 void print_job_info_2(PJOB_INFO_2 info
)
227 printf("\tJob ID\t\t= %d\n", info
->JobId
);
228 printf("\tPrinter Name\t= %s\n", info
->pPrinterName
);
229 printf("\tMachine Name\t= %s\n", info
->pMachineName
);
230 printf("\tUser Name\t= %s\n", info
->pUserName
);
231 printf("\tDocument\t= %s\n", info
->pDocument
);
232 printf("\tDatatype\t= %s\n", info
->pDatatype
);
233 printf("\tNotify Name\t= %s\n", info
->pNotifyName
);
234 printf("\tPrint Processor\t= %s\n", info
->pPrintProcessor
);
235 printf("\tParameters\t= %s\n", info
->pParameters
);
236 printf("\tDriver Name\t= %s\n", info
->pDriverName
);
237 printf("\tStatus\t\t= %s\n", info
->pStatus
);
238 printf("\tStatus\t\t= %d\n", info
->Status
);
239 printf("\tPriority\t= %d\n", info
->Priority
);
240 printf("\tPosition\t= %d\n", info
->Position
);
241 printf("\tTotal Pages\t= %d\n", info
->TotalPages
);
242 printf("\tPages Printed\t= %d\n", info
->PagesPrinted
);
243 printf("\tStart Time\t= %d\n", info
->StartTime
);
244 printf("\tUntil Time\t= %d\n", info
->UntilTime
);
245 printf("\tTime\t\t= %d\n", info
->Time
);
246 printf("\tSize\t\t= %d\n", info
->Size
);
247 printf("\tSubmitted (DD:MM:YY HH:MM:SS)\t= %d:%d:%d %d:%d:%d UTC\n",
248 info
->Submitted
.wDay
, info
->Submitted
.wMonth
,
249 info
->Submitted
.wYear
, info
->Submitted
.wHour
,
250 info
->Submitted
.wMinute
, info
->Submitted
.wSecond
);
251 printf("\tDevice Mode Information\n");
252 printf("\t-----------------------\n");
253 print_devmode(info
->pDevMode
);
254 printf("\tSecurity Descriptor Information\n");
255 printf("\t-------------------------------\n");
256 print_secdesc(info
->pSecurityDescriptor
);
261 void print_job_info_3(PJOB_INFO_3 info
)
263 printf("\tJob ID\t\t= %d\n", info
->JobId
);
264 printf("\tJob ID Next Job\t= %d\n", info
->NextJobId
);
265 printf("\tReserved (must be 0)\t= %d\n",info
->Reserved
);
270 void print_job_info_4(PJOB_INFO_4 info
)
272 printf("\tJob ID\t\t= %d\n", info
->JobId
);
273 printf("\tPrinter Name\t= %s\n", info
->pPrinterName
);
274 printf("\tMachine Name\t= %s\n", info
->pMachineName
);
275 printf("\tUser Name\t= %s\n", info
->pUserName
);
276 printf("\tDocument\t= %s\n", info
->pDocument
);
277 printf("\tDatatype\t= %s\n", info
->pDatatype
);
278 printf("\tNotify Name\t= %s\n", info
->pNotifyName
);
279 printf("\tPrint Processor\t= %s\n", info
->pPrintProcessor
);
280 printf("\tDriver Name\t= %s\n", info
->pDriverName
);
281 printf("\tStatus\t\t= %s\n", info
->pStatus
);
282 printf("\tStatus\t\t= %d\n", info
->Status
);
283 printf("\tPriority\t= %d\n", info
->Priority
);
284 printf("\tPosition\t= %d\n", info
->Position
);
285 printf("\tTotal Pages\t= %d\n", info
->TotalPages
);
286 printf("\tPages Printed\t= %d\n", info
->PagesPrinted
);
287 printf("\tStart Time\t= %d\n", info
->StartTime
);
288 printf("\tUntil Time\t= %d\n", info
->UntilTime
);
289 printf("\tTime\t\t= %d\n", info
->Time
);
290 printf("\tSize\t\t= %d\n", info
->Size
);
291 printf("\tSize High\t\t= 0x%016x\n", info
->SizeHigh
);
292 printf("\tSubmitted (DD:MM:YY HH:MM:SS)\t= %d:%d:%d %d:%d:%d UTC\n",
293 info
->Submitted
.wDay
, info
->Submitted
.wMonth
,
294 info
->Submitted
.wYear
, info
->Submitted
.wHour
,
295 info
->Submitted
.wMinute
, info
->Submitted
.wSecond
);
296 printf("\tDevice Mode Information\n");
297 printf("\t-----------------------\n");
298 print_devmode(info
->pDevMode
);
299 printf("\tSecurity Descriptor Information\n");
300 printf("\t-------------------------------\n");
301 print_secdesc(info
->pSecurityDescriptor
);
306 void print_job_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
309 PJOB_INFO_1 buffer1
= NULL
;
310 PJOB_INFO_2 buffer2
= NULL
;
311 PJOB_INFO_3 buffer3
= NULL
;
312 PJOB_INFO_4 buffer4
= NULL
;
320 buffer1
= (PJOB_INFO_1
)buffer
;
323 buffer2
= (PJOB_INFO_2
)buffer
;
326 buffer3
= (PJOB_INFO_3
)buffer
;
329 buffer4
= (PJOB_INFO_4
)buffer
;
335 printf("Job Info Level %d:\n", level
);
339 for (i
=0; i
<count
; i
++) {
340 print_job_info_1(&buffer1
[i
]);
345 for (i
=0; i
<count
; i
++) {
346 print_job_info_2(&buffer2
[i
]);
351 for (i
=0; i
<count
; i
++) {
352 print_job_info_3(&buffer3
[i
]);
357 for (i
=0; i
<count
; i
++) {
358 print_job_info_4(&buffer4
[i
]);
367 void print_monitor_info_1(PMONITOR_INFO_1 info
)
369 printf("\tMonitor Name\t= %s\n", info
->pName
);
374 void print_monitor_info_2(PMONITOR_INFO_2 info
)
376 printf("\tMonitor Name\t= %s\n", info
->pName
);
377 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
378 printf("\tDLL Name\t= %s\n", info
->pDLLName
);
383 void print_monitor_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
386 PMONITOR_INFO_1 buffer1
= NULL
;
387 PMONITOR_INFO_2 buffer2
= NULL
;
395 buffer1
= (PMONITOR_INFO_1
)buffer
;
398 buffer2
= (PMONITOR_INFO_2
)buffer
;
404 printf("Monitor Info Level %d:\n", level
);
408 for (i
=0; i
<count
; i
++) {
409 print_monitor_info_1(&buffer1
[i
]);
414 for (i
=0; i
<count
; i
++) {
415 print_monitor_info_2(&buffer2
[i
]);
424 void print_port_info_1(PPORT_INFO_1 info
)
426 printf("\tPort Name\t= %s\n", info
->pName
);
430 void print_port_info_2(PPORT_INFO_2 info
)
432 printf("\tPort Name\t= %s\n", info
->pPortName
);
433 printf("\tMonitor Name\t= %s\n",info
->pMonitorName
);
434 printf("\tDescription\t= %s\n", info
->pDescription
);
435 printf("\tPort Type\t= 0x%08x\n", info
->fPortType
);
436 printf("\tReserved\t= 0x%08x\n", info
->Reserved
);
440 void print_port_info_3(PPORT_INFO_3 info
)
442 printf("\tStatus\t= 0x%08x\n", info
->dwStatus
);
443 printf("\tStatus String\t= %s\n", info
->pszStatus
);
444 printf("\tSeverity\t= 0x%08x\n", info
->dwSeverity
);
448 void print_port_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
451 PPORT_INFO_1 buffer1
= NULL
;
452 PPORT_INFO_2 buffer2
= NULL
;
453 PPORT_INFO_3 buffer3
= NULL
;
461 buffer1
= (PPORT_INFO_1
)buffer
;
464 buffer2
= (PPORT_INFO_2
)buffer
;
467 buffer3
= (PPORT_INFO_3
)buffer
;
473 printf("Port Info Level %d:\n", level
);
477 for (i
=0; i
<count
; i
++) {
478 print_port_info_1(&buffer1
[i
]);
483 for (i
=0; i
<count
; i
++) {
484 print_port_info_2(&buffer2
[i
]);
489 for (i
=0; i
<count
; i
++) {
490 print_port_info_3(&buffer3
[i
]);
499 void print_form_info_1(PFORM_INFO_1 info
)
501 printf("\tForm Name\t= %s\n", info
->pName
);
502 printf("\tFlags\t\t= 0x%x\n", info
->Flags
);
503 printf("\tSize\t\t= %d x %d\n", info
->Size
.cx
, info
->Size
.cy
);
504 printf("\tRectangle\t= [left]%d [right]%d [top]%d [bottom]%d\n",
505 info
->ImageableArea
.left
, info
->ImageableArea
.right
,
506 info
->ImageableArea
.top
, info
->ImageableArea
.bottom
);
511 void print_form_info_2(PFORM_INFO_2 info
)
513 printf("\tForm Name\t= %s\n", info
->pName
);
514 printf("\tFlags\t\t= 0x%x\n", info
->Flags
);
515 printf("\tSize\t\t= %d x %d\n", info
->Size
.cx
, info
->Size
.cy
);
516 printf("\tRectangle\t= [left]%d [right]%d [top]%d [bottom]%d\n",
517 info
->ImageableArea
.left
, info
->ImageableArea
.right
,
518 info
->ImageableArea
.top
, info
->ImageableArea
.bottom
);
519 printf("\tKeyword\t= %s\n", info
->pKeyword
);
520 printf("\tString Type\t= 0x%08x\n", info
->StringType
);
521 printf("\tMui DLL\t= %s\n", info
->pMuiDll
);
522 printf("\tResource Id\t= 0x%08x\n", info
->dwResourceId
);
523 printf("\tDisplay Name\t= %s\n",info
->pDisplayName
);
524 printf("\tLang Id\t= 0x%04x\n", info
->wLangId
);
529 void print_form_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
532 PFORM_INFO_1 buffer1
= NULL
;
533 PFORM_INFO_2 buffer2
= NULL
;
541 buffer1
= (PFORM_INFO_1
)buffer
;
544 buffer2
= (PFORM_INFO_2
)buffer
;
550 printf("Form Info Level %d:\n", level
);
554 for (i
=0; i
<count
; i
++) {
555 print_form_info_1(&buffer1
[i
]);
560 for (i
=0; i
<count
; i
++) {
561 print_form_info_2(&buffer2
[i
]);
570 void print_printer_info_1(PPRINTER_INFO_1 info
)
572 printf("\tPrinter Name\t= %s\n", info
->pName
);
573 printf("\tDescription\t= %s\n", info
->pDescription
);
574 printf("\tComment\t\t= %s\n", info
->pComment
);
575 printf("\tFlags\t\t= 0x%x\n", info
->Flags
);
580 void print_printer_info_2(PPRINTER_INFO_2 info
)
582 printf("\tServer Name\t\t= %s\n", info
->pServerName
);
583 printf("\tPrinter Name\t\t= %s\n", info
->pPrinterName
);
584 printf("\tPort Name\t\t= %s\n", info
->pPortName
);
585 printf("\tShare Name\t\t= %s\n", info
->pShareName
);
586 printf("\tDriver Name\t\t= %s\n", info
->pDriverName
);
587 printf("\tComment\t\t\t= %s\n", info
->pComment
);
588 printf("\tLocation\t\t= %s\n", info
->pLocation
);
589 printf("\tSeparator File\t\t= %s\n", info
->pSepFile
);
590 printf("\tDefault Data Type\t= %s\n", info
->pDatatype
);
591 printf("\tPrint Processor\t\t= %s\n", info
->pPrintProcessor
);
592 printf("\tParameters\t\t= %s\n", info
->pParameters
);
593 printf("\tAttributes\t\t= 0x%x\n", info
->Attributes
);
594 printf("\tPriority\t\t= 0x%x\n", info
->Priority
);
595 printf("\tDefault Priority\t= 0x%x\n", info
->DefaultPriority
);
596 printf("\tStart Time\t\t= 0x%x\n", info
->StartTime
);
597 printf("\tUntil Time\t\t= 0x%x\n", info
->UntilTime
);
598 printf("\tStatus\t\t\t= 0x%x\n", info
->Status
);
599 printf("\tcJobs\t\t\t= 0x%x\n", info
->cJobs
);
600 printf("\tAverage PPM\t\t= 0x%x\n", info
->AveragePPM
);
602 printf("\tDevice Mode Information\n");
603 printf("\t-----------------------\n");
604 print_devmode(info
->pDevMode
);
605 printf("\tSecurity Descriptor Information\n");
606 printf("\t-------------------------------\n");
607 print_secdesc(info
->pSecurityDescriptor
);
611 void print_printer_info_3(PPRINTER_INFO_3 info
)
613 printf("\tSecurity Descriptor Information\n");
614 printf("\t-------------------------------\n");
615 print_secdesc(info
->pSecurityDescriptor
);
619 void print_printer_info_4(PPRINTER_INFO_4 info
)
621 printf("\tServer Name\t\t= %s\n", info
->pServerName
);
622 printf("\tPrinter Name\t\t= %s\n", info
->pPrinterName
);
623 printf("\tAttributes\t\t= 0x%x\n", info
->Attributes
);
627 void print_printer_info_5(PPRINTER_INFO_5 info
)
629 printf("\tPrinter Name\t\t\t= %s\n", info
->pPrinterName
);
630 printf("\tPort Name\t\t\t= %s\n", info
->pPortName
);
631 printf("\tAttributes\t\t\t= 0x%x\n", info
->Attributes
);
632 printf("\tDev NotSelect Timeout\t= 0x%x\n", info
->DeviceNotSelectedTimeout
);
633 printf("\tTX RetryTimeout\t\t= 0x%x\n", info
->TransmissionRetryTimeout
);
637 void print_printer_info_6(PPRINTER_INFO_6 info
)
639 printf("\tStatus\t\t\t= 0x%x\n", info
->dwStatus
);
643 void print_printer_info_7(PPRINTER_INFO_7 info
)
645 printf("\tObject GUID\t\t\t= %s\n", info
->pszObjectGUID
);
646 printf("\tAction\t\t\t= 0x%x\n", info
->dwAction
);
650 void print_printer_info_8(PPRINTER_INFO_8 info
)
652 print_devmode(info
->pDevMode
);
655 void print_printer_info_9(PPRINTER_INFO_9 info
)
657 print_devmode(info
->pDevMode
);
660 void print_printer_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
663 PPRINTER_INFO_1 buffer1
= NULL
;
664 PPRINTER_INFO_2 buffer2
= NULL
;
665 PPRINTER_INFO_3 buffer3
= NULL
;
666 PPRINTER_INFO_4 buffer4
= NULL
;
667 PPRINTER_INFO_5 buffer5
= NULL
;
668 PPRINTER_INFO_6 buffer6
= NULL
;
669 PPRINTER_INFO_7 buffer7
= NULL
;
670 PPRINTER_INFO_8 buffer8
= NULL
;
671 PPRINTER_INFO_9 buffer9
= NULL
;
679 buffer1
= (PPRINTER_INFO_1
)buffer
;
682 buffer2
= (PPRINTER_INFO_2
)buffer
;
685 buffer3
= (PPRINTER_INFO_3
)buffer
;
688 buffer4
= (PPRINTER_INFO_4
)buffer
;
691 buffer5
= (PPRINTER_INFO_5
)buffer
;
694 buffer6
= (PPRINTER_INFO_6
)buffer
;
697 buffer7
= (PPRINTER_INFO_7
)buffer
;
700 buffer8
= (PPRINTER_INFO_8
)buffer
;
703 buffer9
= (PPRINTER_INFO_9
)buffer
;
709 printf("Printer Info Level %d:\n", level
);
713 for (i
=0; i
<count
; i
++) {
714 print_printer_info_1(&buffer1
[i
]);
719 for (i
=0; i
<count
; i
++) {
720 print_printer_info_2(&buffer2
[i
]);
725 for (i
=0; i
<count
; i
++) {
726 print_printer_info_3(&buffer3
[i
]);
731 for (i
=0; i
<count
; i
++) {
732 print_printer_info_4(&buffer4
[i
]);
737 for (i
=0; i
<count
; i
++) {
738 print_printer_info_5(&buffer5
[i
]);
743 for (i
=0; i
<count
; i
++) {
744 print_printer_info_6(&buffer6
[i
]);
749 for (i
=0; i
<count
; i
++) {
750 print_printer_info_7(&buffer7
[i
]);
755 for (i
=0; i
<count
; i
++) {
756 print_printer_info_8(&buffer8
[i
]);
761 for (i
=0; i
<count
; i
++) {
762 print_printer_info_9(&buffer9
[i
]);
771 void print_printprocessor_info_1(PPRINTPROCESSOR_INFO_1 info
)
773 printf("\tPrint Processor Name\t= %s\n", info
->pName
);
778 void print_printprocessor_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
781 PPRINTPROCESSOR_INFO_1 buffer1
= NULL
;
789 buffer1
= (PPRINTPROCESSOR_INFO_1
)buffer
;
795 printf("Print Processor Info Level %d:\n", level
);
799 for (i
=0; i
<count
; i
++) {
800 print_printprocessor_info_1(&buffer1
[i
]);
809 void print_datatypes_info_1(PDATATYPES_INFO_1 info
)
811 printf("\tDataTypes Name\t= %s\n", info
->pName
);
816 void print_datatypes_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
819 PDATATYPES_INFO_1 buffer1
= NULL
;
827 buffer1
= (PDATATYPES_INFO_1
)buffer
;
833 printf("DataTypes Info Level %d:\n", level
);
837 for (i
=0; i
<count
; i
++) {
838 print_datatypes_info_1(&buffer1
[i
]);
847 void print_driver_info_1(PDRIVER_INFO_1 info
)
849 printf("\tDriver Name\t= %s\n\n", info
->pName
);
854 void print_driver_info_2(PDRIVER_INFO_2 info
)
856 printf("\tDriver Name\t= %s\n", info
->pName
);
857 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
858 printf("\tVersion\t\t= %d\n", info
->cVersion
);
859 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
860 printf("\tData File\t= %s\n", info
->pDataFile
);
861 printf("\tConfig File\t= %s\n\n", info
->pConfigFile
);
866 void print_driver_info_3(PDRIVER_INFO_3 info
)
870 printf("\tDriver Name\t= %s\n", info
->pName
);
871 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
872 printf("\tVersion\t\t= %d\n", info
->cVersion
);
873 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
874 printf("\tData File\t= %s\n", info
->pDataFile
);
875 printf("\tConfig File\t= %s\n", info
->pConfigFile
);
876 printf("\tHelp Path\t= %s\n", info
->pHelpFile
);
877 printf("\tMonitor Name\t= %s\n", info
->pMonitorName
);
878 printf("\tData Type\t= %s\n", info
->pDefaultDataType
);
879 ptr
= (char*)info
->pDependentFiles
;
880 while ((ptr
!= NULL
) && (*ptr
!= '\0')) {
881 printf("\tDependent Files\t= %s\n", ptr
);
882 for (;*ptr
!= '\0'; ptr
++)
883 /* printf("%s\n", ptr); */
891 void print_driver_info_4(PDRIVER_INFO_4 info
)
895 printf("\tDriver Name\t= %s\n", info
->pName
);
896 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
897 printf("\tVersion\t\t= %d\n", info
->cVersion
);
898 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
899 printf("\tData File\t= %s\n", info
->pDataFile
);
900 printf("\tConfig File\t= %s\n", info
->pConfigFile
);
901 printf("\tHelp Path\t= %s\n", info
->pHelpFile
);
902 printf("\tMonitor Name\t= %s\n", info
->pMonitorName
);
903 printf("\tData Type\t= %s\n", info
->pDefaultDataType
);
904 printf("\tPrevious Names\t= %s\n", info
->pszzPreviousNames
);
905 ptr
= (char*)info
->pDependentFiles
;
906 while ((ptr
!= NULL
) && (*ptr
!= '\0')) {
907 printf("\tDependent Files\t= %s\n", ptr
);
908 for (;*ptr
!= '\0'; ptr
++)
909 /* printf("%s\n", ptr); */
917 void print_driver_info_5(PDRIVER_INFO_5 info
)
919 printf("\tDriver Name\t= %s\n", info
->pName
);
920 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
921 printf("\tVersion\t\t= %d\n", info
->cVersion
);
922 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
923 printf("\tData File\t= %s\n", info
->pDataFile
);
924 printf("\tConfig File\t= %s\n", info
->pConfigFile
);
925 printf("\tDriver Attributes\t= %d\n", info
->dwDriverAttributes
);
926 printf("\tConfig Version\t= %d\n", info
->dwConfigVersion
);
927 printf("\tDriver Version\t= %d\n", info
->dwDriverVersion
);
932 void print_driver_info_6(PDRIVER_INFO_6 info
)
936 printf("\tDriver Name\t= %s\n", info
->pName
);
937 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
938 printf("\tVersion\t\t= %d\n", info
->cVersion
);
939 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
940 printf("\tData File\t= %s\n", info
->pDataFile
);
941 printf("\tConfig File\t= %s\n", info
->pConfigFile
);
942 printf("\tHelp Path\t= %s\n", info
->pHelpFile
);
943 printf("\tMonitor Name\t= %s\n", info
->pMonitorName
);
944 printf("\tData Type\t= %s\n", info
->pDefaultDataType
);
945 printf("\tPrevious Names\t= %s\n", info
->pszzPreviousNames
);
946 ptr
= (char*)info
->pDependentFiles
;
948 while (*ptr
!= '\0') {
949 printf("\tDependent Files\t= %s\n", ptr
);
950 for (;*ptr
!= '\0'; ptr
++)
951 /* printf("%s\n", ptr); */
956 printf("\tPrevious Names\t= (null)\n");
959 ptr
= (char*)info
->pszzPreviousNames
;
961 while (*ptr
!= '\0') {
962 printf("\tPrevious Names\t= %s\n", ptr
);
963 for (;*ptr
!= '\0'; ptr
++)
964 /* printf("%s\n", ptr); */
969 printf("\tPrevious Names\t= (null)\n");
972 printf("\tDriver Date\t= %d (%08x:%08x)\n",
974 info
->ftDriverDate
.dwLowDateTime
,
975 info
->ftDriverDate
.dwHighDateTime
);
977 print_file_time(&info
->ftDriverDate
);
978 printf("\tDriver Version\t= %d\n", info
->dwlDriverVersion
);
979 printf("\tManufacture Name = %s\n", info
->pszMfgName
);
980 printf("\tOEM URL\t\t= %s\n", info
->pszOEMUrl
);
981 printf("\tHardware ID\t= %s\n", info
->pszHardwareID
);
982 printf("\tProvider\t= %s\n", info
->pszProvider
);
986 static void print_multi_sz(LPSTR multisz
)
990 ptr
= (char *)multisz
;
997 while (*ptr
!= '\0') {
999 for (; *ptr
!= '\0'; ptr
++) {
1000 /* printf("%s\n", ptr); */
1007 void print_driver_info_8(PDRIVER_INFO_8 info
)
1009 printf("\tDriver Name\t= %s\n", info
->pName
);
1010 printf("\tEnvironment\t= %s\n", info
->pEnvironment
);
1011 printf("\tVersion\t\t= %d\n", info
->cVersion
);
1012 printf("\tDriver Path\t= %s\n", info
->pDriverPath
);
1013 printf("\tData File\t= %s\n", info
->pDataFile
);
1014 printf("\tConfig File\t= %s\n", info
->pConfigFile
);
1015 printf("\tHelp Path\t= %s\n", info
->pHelpFile
);
1016 printf("\tMonitor Name\t= %s\n", info
->pMonitorName
);
1017 printf("\tData Type\t= %s\n", info
->pDefaultDataType
);
1018 printf("\tPrevious Names\t=\n");
1019 print_multi_sz(info
->pszzPreviousNames
);
1020 printf("\tDependent Files\t=\n");
1021 print_multi_sz(info
->pDependentFiles
);
1022 printf("\tDriver Date\t= %d (%08x:%08x)\n",
1024 info
->ftDriverDate
.dwLowDateTime
,
1025 info
->ftDriverDate
.dwHighDateTime
);
1027 print_file_time(&info
->ftDriverDate
);
1028 printf("\tDriver Version\t= %d\n", info
->dwlDriverVersion
);
1029 printf("\tManufacture Name = %s\n", info
->pszMfgName
);
1030 printf("\tOEM URL\t\t= %s\n", info
->pszOEMUrl
);
1031 printf("\tHardware ID\t= %s\n", info
->pszHardwareID
);
1032 printf("\tProvider\t= %s\n", info
->pszProvider
);
1033 printf("\tPrint Processor\t= %s\n", info
->pszPrintProcessor
);
1034 printf("\tVendor Setup\t= %s\n", info
->pszVendorSetup
);
1035 printf("\tColor Profiles\t=\n");
1036 print_multi_sz(info
->pszzColorProfiles
);
1037 printf("\tInf Path\t= %s\n", info
->pszInfPath
);
1038 printf("\tPrinter Driver Attributes = %d\n", info
->dwPrinterDriverAttributes
);
1039 printf("\tCore Driver Dependencies\t=\n");
1040 print_multi_sz(info
->pszzCoreDriverDependencies
);
1041 printf("\tMin Inbox Driver VerDate\t= %d (%08x:%08x)\n",
1042 info
->ftMinInboxDriverVerDate
,
1043 info
->ftMinInboxDriverVerDate
.dwLowDateTime
,
1044 info
->ftMinInboxDriverVerDate
.dwHighDateTime
);
1046 print_file_time(&info
->ftMinInboxDriverVerDate
);
1047 printf("\tMin Inbox Driver VerVersion\t= %d\n", info
->dwlMinInboxDriverVerVersion
);
1051 void print_driver_info_bylevel(DWORD level
, LPBYTE buffer
, DWORD count
)
1054 PDRIVER_INFO_1 buffer1
= NULL
;
1055 PDRIVER_INFO_2 buffer2
= NULL
;
1056 PDRIVER_INFO_3 buffer3
= NULL
;
1057 PDRIVER_INFO_4 buffer4
= NULL
;
1058 PDRIVER_INFO_5 buffer5
= NULL
;
1059 PDRIVER_INFO_6 buffer6
= NULL
;
1060 PDRIVER_INFO_8 buffer8
= NULL
;
1068 buffer1
= (PDRIVER_INFO_1
)buffer
;
1071 buffer2
= (PDRIVER_INFO_2
)buffer
;
1074 buffer3
= (PDRIVER_INFO_3
)buffer
;
1077 buffer4
= (PDRIVER_INFO_4
)buffer
;
1080 buffer5
= (PDRIVER_INFO_5
)buffer
;
1083 buffer6
= (PDRIVER_INFO_6
)buffer
;
1086 buffer8
= (PDRIVER_INFO_8
)buffer
;
1092 printf("Driver Info Level %d:\n", level
);
1096 for (i
=0; i
<count
; i
++) {
1097 print_driver_info_1(&buffer1
[i
]);
1102 for (i
=0; i
<count
; i
++) {
1103 print_driver_info_2(&buffer2
[i
]);
1108 for (i
=0; i
<count
; i
++) {
1109 print_driver_info_3(&buffer3
[i
]);
1114 for (i
=0; i
<count
; i
++) {
1115 print_driver_info_4(&buffer4
[i
]);
1120 for (i
=0; i
<count
; i
++) {
1121 print_driver_info_5(&buffer5
[i
]);
1126 for (i
=0; i
<count
; i
++) {
1127 print_driver_info_6(&buffer6
[i
]);
1132 for (i
=0; i
<count
; i
++) {
1133 print_driver_info_8(&buffer8
[i
]);
1142 void print_doc_info_1(PDOC_INFO_1 info
)
1144 printf("\tDocument Name\t= %s\n", info
->pDocName
);
1145 printf("\tOutput Filename\t= %s\n", info
->pOutputFile
);
1146 printf("\tDatatype\t= %s\n", info
->pDatatype
);
1150 void print_printer_keys(LPSTR buffer
)
1158 for (; *p
; p
= CharNext(p
)) {
1164 LPSTR
reg_type_str(DWORD type
)
1172 return "REG_MULTI_SZ";
1174 return "REG_BINARY";
1180 void print_asc(const BYTE
*buf
, DWORD len
)
1183 for (i
=0; i
<len
; i
++) {
1184 printf("%c", isprint(buf
[i
])?buf
[i
]:'.');
1188 static void dump_data(const BYTE
*buf
, int len
)
1191 static const BYTE empty
[16] = { 0, };
1200 (memcmp(&buf
[i
], &empty
, 16) == 0))
1207 printf("[%04X] ",i
);
1211 printf("%02x ", buf
[i
]);
1214 if (i
%8 == 0) printf(" ");
1216 print_asc(&buf
[i
-16],8); printf(" ");
1217 print_asc(&buf
[i
-8],8); printf("\n");
1225 if (n
>8) printf(" ");
1226 while (n
--) printf(" ");
1228 print_asc(&buf
[i
-(i
%16)],n
); printf( " " );
1230 if (n
>0) print_asc(&buf
[i
-n
],n
);
1235 static void dump_printer_data(DWORD size
, LPBYTE buffer
, DWORD type
)
1242 dump_data(buffer
, size
);
1245 dump_data(buffer
, size
);
1248 printf("\t\t%s\n", p
);
1249 for (; *p
; p
= CharNext(p
)) {
1256 printf("\t\t0x%08x\n", (DWORD
)*buffer
);
1259 dump_data(buffer
, size
);
1266 void print_printer_data(LPSTR keyname
, LPSTR valuename
, DWORD size
, LPBYTE buffer
, DWORD type
)
1269 printf("\tKey Name:\t%s\n", keyname
);
1272 printf("\tValue Name:\t%s\n", valuename
);
1273 printf("\tSize:\t\t0x%x (%d)\n", size
, size
);
1274 printf("\tType:\t\t%s\n", reg_type_str(type
));
1276 if (buffer
== NULL
|| size
== 0) {
1280 dump_printer_data(size
, buffer
, type
);
1283 void print_printer_dataw(LPCWSTR keyname
, LPCWSTR valuename
, DWORD size
, LPBYTE buffer
, DWORD type
)
1286 printf("\tKey Name:\t%ls\n", keyname
);
1289 printf("\tValue Name:\t%ls\n", valuename
);
1290 printf("\tSize:\t\t0x%x (%d)\n", size
, size
);
1291 printf("\tType:\t\t%s\n", reg_type_str(type
));
1293 if (buffer
== NULL
|| size
== 0) {
1297 dump_printer_data(size
, buffer
, type
);
1301 void print_printer_enum_values(PRINTER_ENUM_VALUES
*info
)
1303 print_printer_data(NULL
, info
->pValueName
, info
->cbData
, info
->pData
, info
->dwType
);
1306 void print_file_time(const FILETIME
*t
)
1309 LPSTR dayofweek
= NULL
;
1312 if (!FileTimeToSystemTime(t
, &s
)) {
1313 printf("Failed to convert FILETIME to SYSTEMTIME\n");
1316 switch (s
.wDayOfWeek
) {
1383 printf("%s %s %02d %02d:%02d:%02d %04d\n",
1384 dayofweek
, month
, s
.wDay
,
1385 s
.wHour
, s
.wMinute
, s
.wSecond
, s
.wYear
);