2009-12-17 00:36:18 +03:00
/*
Unix SMB / CIFS implementation .
test suite for spoolss rpc operations
Copyright ( C ) Gerald ( Jerry ) Carter 2007
Copyright ( C ) Guenther Deschner 2009 - 2010
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# include <windows.h>
# include <stdio.h>
2010-01-15 18:36:25 +03:00
# include <assert.h>
2009-12-17 00:36:18 +03:00
void print_devmode ( DEVMODE * pDevModeIn )
{
if ( pDevModeIn = = NULL ) {
printf ( " \t Device Mode \t = (null) \n " ) ;
return ;
}
printf ( " \t DEVMODE:---------- \n " ) ;
printf ( " \t DeviceName: [%s] \n " , pDevModeIn - > dmDeviceName ) ;
printf ( " \t SpecVersion: %d \n " , pDevModeIn - > dmSpecVersion ) ;
printf ( " \t DriverVersion: %d \n " , pDevModeIn - > dmDriverVersion ) ;
printf ( " \t Size: %d \n " , pDevModeIn - > dmSize ) ;
printf ( " \t DriverExtra: %d \n " , pDevModeIn - > dmDriverExtra ) ;
printf ( " \t Fields: 0x%x \n " , pDevModeIn - > dmFields ) ;
if ( pDevModeIn - > dmFields & DM_ORIENTATION )
printf ( " \t Orientation: %d \n " , pDevModeIn - > dmOrientation ) ;
if ( pDevModeIn - > dmFields & DM_PAPERSIZE )
printf ( " \t PaperSize: %d \n " , pDevModeIn - > dmPaperSize ) ;
if ( pDevModeIn - > dmFields & DM_PAPERLENGTH )
printf ( " \t PaperLength: %d \n " , pDevModeIn - > dmPaperLength ) ;
if ( pDevModeIn - > dmFields & DM_PAPERWIDTH )
printf ( " \t PaperWidth: %d \n " , pDevModeIn - > dmPaperWidth ) ;
// if (pDevModeIn->dmFields & DM_POSITION)
// printf("\tPosition: %d\n", pDevModeIn->dmPosition);
if ( pDevModeIn - > dmFields & DM_SCALE )
printf ( " \t Scale: %d \n " , pDevModeIn - > dmScale ) ;
if ( pDevModeIn - > dmFields & DM_COPIES )
printf ( " \t Copies: %d \n " , pDevModeIn - > dmCopies ) ;
if ( pDevModeIn - > dmFields & DM_DEFAULTSOURCE )
printf ( " \t DefaultSource: %d \n " , pDevModeIn - > dmDefaultSource ) ;
if ( pDevModeIn - > dmFields & DM_PRINTQUALITY )
printf ( " \t PrintQuality: %d \n " , pDevModeIn - > dmPrintQuality ) ;
if ( pDevModeIn - > dmFields & DM_COLOR )
printf ( " \t Color: %d \n " , pDevModeIn - > dmColor ) ;
if ( pDevModeIn - > dmFields & DM_DUPLEX )
printf ( " \t Duplex: %d \n " , pDevModeIn - > dmDuplex ) ;
if ( pDevModeIn - > dmFields & DM_YRESOLUTION )
printf ( " \t YResolution: %d \n " , pDevModeIn - > dmYResolution ) ;
if ( pDevModeIn - > dmFields & DM_TTOPTION )
printf ( " \t TTOption: %d \n " , pDevModeIn - > dmTTOption ) ;
if ( pDevModeIn - > dmFields & DM_COLLATE )
printf ( " \t Collate: %d \n " , pDevModeIn - > dmCollate ) ;
if ( pDevModeIn - > dmFields & DM_FORMNAME )
printf ( " \t Form: [%s] \n " , pDevModeIn - > dmFormName ) ;
if ( pDevModeIn - > dmFields & DM_LOGPIXELS )
printf ( " \t LogPixels: %d \n " , pDevModeIn - > dmLogPixels ) ;
if ( pDevModeIn - > dmFields & DM_BITSPERPEL )
printf ( " \t BitsPerPel: %d \n " , pDevModeIn - > dmBitsPerPel ) ;
if ( pDevModeIn - > dmFields & DM_PELSWIDTH )
printf ( " \t PelsWidth: %d \n " , pDevModeIn - > dmPelsWidth ) ;
if ( pDevModeIn - > dmFields & DM_PELSHEIGHT )
printf ( " \t PelsHeight: %d \n " , pDevModeIn - > dmPelsHeight ) ;
if ( pDevModeIn - > dmFields & DM_DISPLAYFLAGS )
printf ( " \t DisplayFlags: %d \n " , pDevModeIn - > dmDisplayFlags ) ;
// if (pDevModeIn->dmFields & DM_NUP)
// printf("\tNup: %d\n", pDevModeIn->dmNup);
if ( pDevModeIn - > dmFields & DM_DISPLAYFREQUENCY )
printf ( " \t DisplayFrequency:%d \n " , pDevModeIn - > dmDisplayFrequency ) ;
if ( pDevModeIn - > dmFields & DM_ICMMETHOD )
printf ( " \t ICMMethod: %d \n " , pDevModeIn - > dmICMMethod ) ;
if ( pDevModeIn - > dmFields & DM_ICMINTENT )
printf ( " \t ICMIntent: %d \n " , pDevModeIn - > dmICMIntent ) ;
if ( pDevModeIn - > dmFields & DM_MEDIATYPE )
printf ( " \t MediaType: %d \n " , pDevModeIn - > dmMediaType ) ;
if ( pDevModeIn - > dmFields & DM_DITHERTYPE )
printf ( " \t DitherType: %d \n " , pDevModeIn - > dmDitherType ) ;
// if (pDevModeIn->dmFields & DM_PANNINGWIDTH)
// printf("\tPanningWidth: %d\n", pDevModeIn->dmPanningWidth);
// if (pDevModeIn->dmFields & DM_PANNINGHEIGHT)
// printf("\tPanningHeight: %d\n", pDevModeIn->dmPanningHeight);
#if 0
if ( bForceIn ) {
printf ( " DEVMODE \n " ) ;
Dump ( ( BYTE * ) pDevModeIn , sizeof ( DEVMODE ) , LEADER ) ;
if ( pDevModeIn - > dmDriverExtra ) {
printf ( " DriverExtra \n " ) ;
Dump ( ( BYTE * ) pDevModeIn + sizeof ( DEVMODE ) , pDevModeIn - > dmDriverExtra , LEADER ) ;
}
}
# endif
return ;
}
void print_acl ( const char * str , ACL * acl )
{
printf ( " %s \n " , str ) ;
if ( acl = = NULL )
return ;
printf ( " \t \t ACL Revision \t \t 0x%x \n " , acl - > AclRevision ) ;
printf ( " \t \t Sbz1 \t \t 0x%x \n " , acl - > Sbz1 ) ;
printf ( " \t \t Sbz2 \t \t 0x%x \n " , acl - > Sbz2 ) ;
printf ( " \t \t ACL Size \t \t 0x%x \n " , acl - > AclSize ) ;
printf ( " \t \t ACL Count \t \t 0x%x \n " , acl - > AceCount ) ;
return ;
}
void print_sid ( const char * str , SID * sid )
{
DWORD i = 0 ;
printf ( " %s \n " , str ) ;
printf ( " 0x%x \n " , sid ) ;
if ( sid = = NULL )
return ;
printf ( " \t \t Revision \t \t 0x%x \n " , sid - > Revision ) ;
printf ( " \t \t SubAuthorityCount \t 0x%x \n " , sid - > SubAuthorityCount ) ;
printf ( " \t \t SubAuthority \n \t " ) ;
while ( i < sid - > SubAuthorityCount ) {
printf ( " \t 0x%x " , sid - > SubAuthority [ i ] ) ;
if ( i % 4 = = 3 )
printf ( " \n \t " ) ;
i + + ;
}
return ;
}
void print_secdesc ( SECURITY_DESCRIPTOR * secdesc )
{
if ( secdesc = = NULL ) {
printf ( " \t Security Descriptor \t = (null) \n " ) ;
return ;
}
printf ( " \t Revision \t = 0x%x \n " , secdesc - > Revision ) ;
printf ( " \t Sbz1 \t \t = 0x%x \n " , secdesc - > Sbz1 ) ;
#if 0
print_sid ( " \t Owner \t \t = " , secdesc - > Owner ) ;
print_sid ( " \t Group \t \t = " , secdesc - > Group ) ;
print_acl ( " \t Sacl \t \t = " , secdesc - > Sacl ) ;
print_acl ( " \t Dacl \t \t = " , secdesc - > Dacl ) ;
# endif
return ;
}
void PrintLastError ( )
{
LPVOID lpMsgBuf ;
DWORD status ;
status = GetLastError ( ) ;
FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS ,
NULL , GetLastError ( ) , MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , // Default language
( LPTSTR ) & lpMsgBuf , 0 , NULL ) ;
printf ( " ERROR [0x%x] : %s \n " , status , ( char * ) lpMsgBuf ) ;
LocalFree ( lpMsgBuf ) ;
return ;
}
void print_job_info_1 ( PJOB_INFO_1 info )
{
printf ( " \t Job ID \t \t = %d \n " , info - > JobId ) ;
printf ( " \t Printer Name \t = %s \n " , info - > pPrinterName ) ;
printf ( " \t Machine Name \t = %s \n " , info - > pMachineName ) ;
printf ( " \t User Name \t = %s \n " , info - > pUserName ) ;
printf ( " \t Document \t = %s \n " , info - > pDocument ) ;
printf ( " \t Datatype \t = %s \n " , info - > pDatatype ) ;
printf ( " \t Status \t \t = %s \n " , info - > pStatus ) ;
printf ( " \t Status \t = %d \n " , info - > Status ) ;
printf ( " \t Priority \t = %d \n " , info - > Priority ) ;
printf ( " \t Position \t = %d \n " , info - > Position ) ;
printf ( " \t Total Pages \t = %d \n " , info - > TotalPages ) ;
printf ( " \t Pages Printed \t = %d \n " , info - > PagesPrinted ) ;
printf ( " \t Submitted (DD:MM:YY HH:MM:SS) \t = %d:%d:%d %d:%d:%d UTC \n " ,
info - > Submitted . wDay , info - > Submitted . wMonth ,
info - > Submitted . wYear , info - > Submitted . wHour ,
info - > Submitted . wMinute , info - > Submitted . wSecond ) ;
return ;
}
void print_job_info_2 ( PJOB_INFO_2 info )
{
printf ( " \t Job ID \t \t = %d \n " , info - > JobId ) ;
printf ( " \t Printer Name \t = %s \n " , info - > pPrinterName ) ;
printf ( " \t Machine Name \t = %s \n " , info - > pMachineName ) ;
printf ( " \t User Name \t = %s \n " , info - > pUserName ) ;
printf ( " \t Document \t = %s \n " , info - > pDocument ) ;
printf ( " \t Datatype \t = %s \n " , info - > pDatatype ) ;
printf ( " \t Notify Name \t = %s \n " , info - > pNotifyName ) ;
printf ( " \t Print Processor \t = %s \n " , info - > pPrintProcessor ) ;
printf ( " \t Parameters \t = %s \n " , info - > pParameters ) ;
printf ( " \t Driver Name \t = %s \n " , info - > pDriverName ) ;
printf ( " \t Status \t \t = %s \n " , info - > pStatus ) ;
printf ( " \t Status \t \t = %d \n " , info - > Status ) ;
printf ( " \t Priority \t = %d \n " , info - > Priority ) ;
printf ( " \t Position \t = %d \n " , info - > Position ) ;
printf ( " \t Total Pages \t = %d \n " , info - > TotalPages ) ;
printf ( " \t Pages Printed \t = %d \n " , info - > PagesPrinted ) ;
printf ( " \t Start Time \t = %d \n " , info - > StartTime ) ;
printf ( " \t Until Time \t = %d \n " , info - > UntilTime ) ;
printf ( " \t Time \t \t = %d \n " , info - > Time ) ;
printf ( " \t Size \t \t = %d \n " , info - > Size ) ;
printf ( " \t Submitted (DD:MM:YY HH:MM:SS) \t = %d:%d:%d %d:%d:%d UTC \n " ,
info - > Submitted . wDay , info - > Submitted . wMonth ,
info - > Submitted . wYear , info - > Submitted . wHour ,
info - > Submitted . wMinute , info - > Submitted . wSecond ) ;
printf ( " \t Device Mode Information \n " ) ;
printf ( " \t ----------------------- \n " ) ;
print_devmode ( info - > pDevMode ) ;
printf ( " \t Security Descriptor Information \n " ) ;
printf ( " \t ------------------------------- \n " ) ;
print_secdesc ( info - > pSecurityDescriptor ) ;
return ;
}
void print_job_info_3 ( PJOB_INFO_3 info )
{
printf ( " \t Job ID \t \t = %d \n " , info - > JobId ) ;
printf ( " \t Job ID Next Job \t = %d \n " , info - > NextJobId ) ;
printf ( " \t Reserved (must be 0) \t = %d \n " , info - > Reserved ) ;
return ;
}
void print_monitor_info_1 ( PMONITOR_INFO_1 info )
{
printf ( " \t Monitor Name \t = %s \n " , info - > pName ) ;
return ;
}
void print_monitor_info_2 ( PMONITOR_INFO_2 info )
{
printf ( " \t Monitor Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t DLL Name \t = %s \n " , info - > pDLLName ) ;
return ;
}
2010-02-09 17:24:34 +03:00
void print_monitor_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PMONITOR_INFO_1 buffer1 = NULL ;
PMONITOR_INFO_2 buffer2 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PMONITOR_INFO_1 ) buffer ;
break ;
case 2 :
buffer2 = ( PMONITOR_INFO_2 ) buffer ;
break ;
default :
break ;
}
printf ( " Monitor Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_monitor_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 2 :
for ( i = 0 ; i < count ; i + + ) {
print_monitor_info_2 ( & buffer2 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2010-02-09 17:00:54 +03:00
void print_port_info_1 ( PPORT_INFO_1 info )
{
printf ( " \t Port Name \t = %s \n " , info - > pName ) ;
return ;
}
void print_port_info_2 ( PPORT_INFO_2 info )
{
printf ( " \t Port Name \t = %s \n " , info - > pPortName ) ;
printf ( " \t Monitor Name \t = %s \n " , info - > pMonitorName ) ;
printf ( " \t Description \t = %s \n " , info - > pDescription ) ;
printf ( " \t Port Type \t = 0x%08x \n " , info - > fPortType ) ;
printf ( " \t Reserved \t = 0x%08x \n " , info - > Reserved ) ;
return ;
}
void print_port_info_3 ( PPORT_INFO_3 info )
{
printf ( " \t Status \t = 0x%08x \n " , info - > dwStatus ) ;
printf ( " \t Status String \t = %s \n " , info - > pszStatus ) ;
printf ( " \t Severity \t = 0x%08x \n " , info - > dwSeverity ) ;
return ;
}
void print_port_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PPORT_INFO_1 buffer1 = NULL ;
PPORT_INFO_2 buffer2 = NULL ;
PPORT_INFO_3 buffer3 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PPORT_INFO_1 ) buffer ;
break ;
case 2 :
buffer2 = ( PPORT_INFO_2 ) buffer ;
break ;
case 3 :
buffer3 = ( PPORT_INFO_3 ) buffer ;
break ;
default :
break ;
}
printf ( " Port Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_port_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 2 :
for ( i = 0 ; i < count ; i + + ) {
print_port_info_2 ( & buffer2 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 3 :
for ( i = 0 ; i < count ; i + + ) {
print_port_info_3 ( & buffer3 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2009-12-17 00:36:18 +03:00
void print_form_info_1 ( PFORM_INFO_1 info )
{
printf ( " \t Form Name \t = %s \n " , info - > pName ) ;
printf ( " \t Flags \t \t = 0x%x \n " , info - > Flags ) ;
printf ( " \t Size \t \t = %d x %d \n " , info - > Size . cx , info - > Size . cy ) ;
printf ( " \t Rectangle \t = [left]%d [right]%d [top]%d [bottom]%d \n " ,
info - > ImageableArea . left , info - > ImageableArea . right ,
info - > ImageableArea . top , info - > ImageableArea . bottom ) ;
return ;
}
2010-02-09 16:49:04 +03:00
void print_form_info_2 ( PFORM_INFO_2 info )
{
printf ( " \t Form Name \t = %s \n " , info - > pName ) ;
printf ( " \t Flags \t \t = 0x%x \n " , info - > Flags ) ;
printf ( " \t Size \t \t = %d x %d \n " , info - > Size . cx , info - > Size . cy ) ;
printf ( " \t Rectangle \t = [left]%d [right]%d [top]%d [bottom]%d \n " ,
info - > ImageableArea . left , info - > ImageableArea . right ,
info - > ImageableArea . top , info - > ImageableArea . bottom ) ;
printf ( " \t Keyword \t = %s \n " , info - > pKeyword ) ;
printf ( " \t String Type \t = 0x%08x \n " , info - > StringType ) ;
printf ( " \t Mui DLL \t = %s \n " , info - > pMuiDll ) ;
printf ( " \t Resource Id \t = 0x%08x \n " , info - > dwResourceId ) ;
printf ( " \t Display Name \t = %s \n " , info - > pDisplayName ) ;
printf ( " \t Lang Id \t = 0x%04x \n " , info - > wLangId ) ;
return ;
}
void print_form_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PFORM_INFO_1 buffer1 = NULL ;
PFORM_INFO_2 buffer2 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PFORM_INFO_1 ) buffer ;
break ;
case 2 :
buffer2 = ( PFORM_INFO_2 ) buffer ;
break ;
default :
break ;
}
printf ( " Form Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_form_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 2 :
for ( i = 0 ; i < count ; i + + ) {
print_form_info_2 ( & buffer2 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2009-12-17 00:36:18 +03:00
void print_printer_info_1 ( PPRINTER_INFO_1 info )
{
printf ( " \t Printer Name \t = %s \n " , info - > pName ) ;
printf ( " \t Description \t = %s \n " , info - > pDescription ) ;
printf ( " \t Comment \t \t = %s \n " , info - > pComment ) ;
printf ( " \t Flags \t \t = 0x%x \n " , info - > Flags ) ;
return ;
}
void print_printer_info_2 ( PPRINTER_INFO_2 info )
{
printf ( " \t Server Name \t \t = %s \n " , info - > pServerName ) ;
printf ( " \t Printer Name \t \t = %s \n " , info - > pPrinterName ) ;
printf ( " \t Port Name \t \t = %s \n " , info - > pPortName ) ;
printf ( " \t Share Name \t \t = %s \n " , info - > pShareName ) ;
printf ( " \t Driver Name \t \t = %s \n " , info - > pDriverName ) ;
printf ( " \t Comment \t \t \t = %s \n " , info - > pComment ) ;
printf ( " \t Location \t \t = %s \n " , info - > pLocation ) ;
printf ( " \t Separator File \t \t = %s \n " , info - > pSepFile ) ;
printf ( " \t Default Data Type \t = %s \n " , info - > pDatatype ) ;
printf ( " \t Print Processor \t \t = %s \n " , info - > pPrintProcessor ) ;
printf ( " \t Parameters \t \t = %s \n " , info - > pParameters ) ;
printf ( " \t Attributes \t \t = 0x%x \n " , info - > Attributes ) ;
printf ( " \t Priority \t \t = 0x%x \n " , info - > Priority ) ;
printf ( " \t Default Priority \t = 0x%x \n " , info - > DefaultPriority ) ;
printf ( " \t Start Time \t \t = 0x%x \n " , info - > StartTime ) ;
printf ( " \t Until Time \t \t = 0x%x \n " , info - > UntilTime ) ;
printf ( " \t Status \t \t \t = 0x%x \n " , info - > Status ) ;
printf ( " \t cJobs \t \t \t = 0x%x \n " , info - > cJobs ) ;
printf ( " \t Average PPM \t \t = 0x%x \n " , info - > AveragePPM ) ;
printf ( " \t Device Mode Information \n " ) ;
printf ( " \t ----------------------- \n " ) ;
print_devmode ( info - > pDevMode ) ;
#if 0
printf ( " \t Security Descriptor Information \n " ) ;
printf ( " \t ------------------------------- \n " ) ;
print_secdesc ( info - > pSecurityDescriptor ) ;
# endif
return ;
}
void print_printer_info_5 ( PPRINTER_INFO_5 info )
{
printf ( " \t Printer Name \t \t \t = %s \n " , info - > pPrinterName ) ;
printf ( " \t Port Name \t \t \t = %s \n " , info - > pPortName ) ;
printf ( " \t Attributes \t \t \t = 0x%x \n " , info - > Attributes ) ;
printf ( " \t Dev NotSelect Timeout \t = 0x%x \n " , info - > DeviceNotSelectedTimeout ) ;
printf ( " \t TX RetryTimeout \t \t = 0x%x \n " , info - > TransmissionRetryTimeout ) ;
return ;
}
void print_printer_info_6 ( PPRINTER_INFO_6 info )
{
printf ( " \t Status \t \t \t = 0x%x \n " , info - > dwStatus ) ;
return ;
}
void print_printer_info_7 ( PPRINTER_INFO_7 info )
{
printf ( " \t Object GUID \t \t \t = %s \n " , info - > pszObjectGUID ) ;
printf ( " \t Action \t \t \t = 0x%x \n " , info - > dwAction ) ;
return ;
}
void print_printer_info_8 ( PPRINTER_INFO_8 info )
{
print_devmode ( info - > pDevMode ) ;
}
void print_printer_info_9 ( PPRINTER_INFO_9 info )
{
print_devmode ( info - > pDevMode ) ;
}
void print_printer_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PPRINTER_INFO_1 buffer1 = NULL ;
PPRINTER_INFO_2 buffer2 = NULL ;
PPRINTER_INFO_3 buffer3 = NULL ;
PPRINTER_INFO_4 buffer4 = NULL ;
PPRINTER_INFO_5 buffer5 = NULL ;
PPRINTER_INFO_6 buffer6 = NULL ;
PPRINTER_INFO_7 buffer7 = NULL ;
PPRINTER_INFO_8 buffer8 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PPRINTER_INFO_1 ) buffer ;
break ;
case 2 :
buffer2 = ( PPRINTER_INFO_2 ) buffer ;
break ;
case 3 :
buffer3 = ( PPRINTER_INFO_3 ) buffer ;
break ;
case 4 :
buffer4 = ( PPRINTER_INFO_4 ) buffer ;
break ;
case 5 :
buffer5 = ( PPRINTER_INFO_5 ) buffer ;
break ;
case 6 :
buffer6 = ( PPRINTER_INFO_6 ) buffer ;
break ;
case 7 :
buffer7 = ( PPRINTER_INFO_7 ) buffer ;
break ;
case 8 :
buffer8 = ( PPRINTER_INFO_8 ) buffer ;
break ;
default :
break ;
}
printf ( " Printer Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 2 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_2 ( & buffer2 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
#if 0
case 3 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_3 ( & buffer3 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 4 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_4 ( & buffer4 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
# endif
case 5 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_5 ( & buffer5 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 6 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_6 ( & buffer6 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 7 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_7 ( & buffer7 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 8 :
for ( i = 0 ; i < count ; i + + ) {
print_printer_info_8 ( & buffer8 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
void print_printprocessor_info_1 ( PPRINTPROCESSOR_INFO_1 info )
{
printf ( " \t Print Processor Name \t = %s \n " , info - > pName ) ;
return ;
}
2010-02-09 17:54:25 +03:00
void print_printprocessor_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PPRINTPROCESSOR_INFO_1 buffer1 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PPRINTPROCESSOR_INFO_1 ) buffer ;
break ;
default :
break ;
}
printf ( " Print Processor Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_printprocessor_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2010-02-09 17:59:29 +03:00
void print_datatypes_info_1 ( PDATATYPES_INFO_1 info )
{
printf ( " \t DataTypes Name \t = %s \n " , info - > pName ) ;
return ;
}
void print_datatypes_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PDATATYPES_INFO_1 buffer1 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PDATATYPES_INFO_1 ) buffer ;
break ;
default :
break ;
}
printf ( " DataTypes Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_datatypes_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2009-12-17 00:36:18 +03:00
void print_driver_info_1 ( PDRIVER_INFO_1 info )
{
printf ( " \t Driver Name \t = %s \n \n " , info - > pName ) ;
return ;
}
void print_driver_info_2 ( PDRIVER_INFO_2 info )
{
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n \n " , info - > pConfigFile ) ;
return ;
}
void print_driver_info_3 ( PDRIVER_INFO_3 info )
{
char * ptr = NULL ;
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n " , info - > pConfigFile ) ;
printf ( " \t Help Path \t = %s \n " , info - > pHelpFile ) ;
printf ( " \t Monitor Name \t = %s \n " , info - > pMonitorName ) ;
printf ( " \t Data Type \t = %s \n " , info - > pDefaultDataType ) ;
ptr = ( char * ) info - > pDependentFiles ;
while ( ( ptr ! = NULL ) & & ( * ptr ! = ' \0 ' ) ) {
printf ( " \t Dependent Files \t = %s \n " , ptr ) ;
for ( ; * ptr ! = ' \0 ' ; ptr + + )
/* printf("%s\n", ptr); */
;
ptr + + ;
}
return ;
}
void print_driver_info_4 ( PDRIVER_INFO_4 info )
{
char * ptr = NULL ;
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n " , info - > pConfigFile ) ;
printf ( " \t Help Path \t = %s \n " , info - > pHelpFile ) ;
printf ( " \t Monitor Name \t = %s \n " , info - > pMonitorName ) ;
printf ( " \t Data Type \t = %s \n " , info - > pDefaultDataType ) ;
printf ( " \t Previous Names \t = %s \n " , info - > pszzPreviousNames ) ;
ptr = ( char * ) info - > pDependentFiles ;
while ( ( ptr ! = NULL ) & & ( * ptr ! = ' \0 ' ) ) {
printf ( " \t Dependent Files \t = %s \n " , ptr ) ;
for ( ; * ptr ! = ' \0 ' ; ptr + + )
/* printf("%s\n", ptr); */
;
ptr + + ;
}
return ;
}
2010-01-20 02:44:16 +03:00
void print_driver_info_5 ( PDRIVER_INFO_5 info )
{
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n " , info - > pConfigFile ) ;
printf ( " \t Driver Attributes \t = %d \n " , info - > dwDriverAttributes ) ;
printf ( " \t Config Version \t = %d \n " , info - > dwConfigVersion ) ;
printf ( " \t Driver Version \t = %d \n " , info - > dwDriverVersion ) ;
return ;
}
2009-12-17 00:36:18 +03:00
void print_driver_info_6 ( PDRIVER_INFO_6 info )
{
char * ptr = NULL ;
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n " , info - > pConfigFile ) ;
printf ( " \t Help Path \t = %s \n " , info - > pHelpFile ) ;
printf ( " \t Monitor Name \t = %s \n " , info - > pMonitorName ) ;
printf ( " \t Data Type \t = %s \n " , info - > pDefaultDataType ) ;
printf ( " \t Previous Names \t = %s \n " , info - > pszzPreviousNames ) ;
ptr = ( char * ) info - > pDependentFiles ;
if ( ptr ! = NULL ) {
while ( * ptr ! = ' \0 ' ) {
printf ( " \t Dependent Files \t = %s \n " , ptr ) ;
for ( ; * ptr ! = ' \0 ' ; ptr + + )
/* printf("%s\n", ptr); */
;
ptr + + ;
}
} else {
printf ( " \t Previous Names \t = (null) \n " ) ;
}
ptr = ( char * ) info - > pszzPreviousNames ;
if ( ptr ! = NULL ) {
while ( * ptr ! = ' \0 ' ) {
printf ( " \t Previous Names \t = %s \n " , ptr ) ;
for ( ; * ptr ! = ' \0 ' ; ptr + + )
/* printf("%s\n", ptr); */
;
ptr + + ;
}
} else {
printf ( " \t Previous Names \t = (null) \n " ) ;
}
printf ( " \t Driver Date \t = %d \n " , info - > ftDriverDate ) ;
printf ( " \t Driver Version \t = %d \n " , info - > dwlDriverVersion ) ;
printf ( " \t Manufacture Name = %s \n " , info - > pszMfgName ) ;
printf ( " \t OEM URL \t \t = %s \n " , info - > pszOEMUrl ) ;
printf ( " \t Hardware ID \t = %s \n " , info - > pszHardwareID ) ;
printf ( " \t Provider \t = %s \n " , info - > pszProvider ) ;
return ;
}
2010-01-20 02:44:16 +03:00
static void print_multi_sz ( LPSTR multisz )
{
char * ptr = NULL ;
ptr = ( char * ) multisz ;
if ( ! ptr ) {
printf ( " (null) \n " ) ;
return ;
}
while ( * ptr ! = ' \0 ' ) {
printf ( " %s \n " , ptr ) ;
for ( ; * ptr ! = ' \0 ' ; ptr + + ) {
/* printf("%s\n", ptr); */
;
}
ptr + + ;
}
}
void print_driver_info_8 ( PDRIVER_INFO_8 info )
{
printf ( " \t Driver Name \t = %s \n " , info - > pName ) ;
printf ( " \t Environment \t = %s \n " , info - > pEnvironment ) ;
printf ( " \t Version \t \t = %d \n " , info - > cVersion ) ;
printf ( " \t Driver Path \t = %s \n " , info - > pDriverPath ) ;
printf ( " \t Data File \t = %s \n " , info - > pDataFile ) ;
printf ( " \t Config File \t = %s \n " , info - > pConfigFile ) ;
printf ( " \t Help Path \t = %s \n " , info - > pHelpFile ) ;
printf ( " \t Monitor Name \t = %s \n " , info - > pMonitorName ) ;
printf ( " \t Data Type \t = %s \n " , info - > pDefaultDataType ) ;
printf ( " \t Previous Names \t = \n " ) ;
print_multi_sz ( info - > pszzPreviousNames ) ;
printf ( " \t Dependent Files \t = \n " ) ;
print_multi_sz ( info - > pDependentFiles ) ;
printf ( " \t Driver Date \t = %d \n " , info - > ftDriverDate ) ;
printf ( " \t Driver Version \t = %d \n " , info - > dwlDriverVersion ) ;
printf ( " \t Manufacture Name = %s \n " , info - > pszMfgName ) ;
printf ( " \t OEM URL \t \t = %s \n " , info - > pszOEMUrl ) ;
printf ( " \t Hardware ID \t = %s \n " , info - > pszHardwareID ) ;
printf ( " \t Provider \t = %s \n " , info - > pszProvider ) ;
printf ( " \t Print Processor \t = %s \n " , info - > pszPrintProcessor ) ;
printf ( " \t Vendor Setup \t = %s \n " , info - > pszVendorSetup ) ;
printf ( " \t Color Profiles \t = \n " ) ;
print_multi_sz ( info - > pszzColorProfiles ) ;
printf ( " \t Inf Path \t = %s \n " , info - > pszInfPath ) ;
printf ( " \t Printer Driver Attributes = %d \n " , info - > dwPrinterDriverAttributes ) ;
printf ( " \t Core Driver Dependencies \t = \n " ) ;
print_multi_sz ( info - > pszzCoreDriverDependencies ) ;
printf ( " \t Min Inbox Driver VerDate \t = %d \n " , info - > ftMinInboxDriverVerDate ) ;
printf ( " \t Min Inbox Driver VerVersion \t = %d \n " , info - > dwlMinInboxDriverVerVersion ) ;
return ;
}
void print_driver_info_bylevel ( DWORD level , LPBYTE buffer , DWORD count )
{
DWORD i ;
PDRIVER_INFO_1 buffer1 = NULL ;
PDRIVER_INFO_2 buffer2 = NULL ;
PDRIVER_INFO_3 buffer3 = NULL ;
PDRIVER_INFO_4 buffer4 = NULL ;
PDRIVER_INFO_5 buffer5 = NULL ;
PDRIVER_INFO_6 buffer6 = NULL ;
PDRIVER_INFO_8 buffer8 = NULL ;
if ( ! buffer ) {
return ;
}
switch ( level ) {
case 1 :
buffer1 = ( PDRIVER_INFO_1 ) buffer ;
break ;
case 2 :
buffer2 = ( PDRIVER_INFO_2 ) buffer ;
break ;
case 3 :
buffer3 = ( PDRIVER_INFO_3 ) buffer ;
break ;
case 4 :
buffer4 = ( PDRIVER_INFO_4 ) buffer ;
break ;
case 5 :
buffer5 = ( PDRIVER_INFO_5 ) buffer ;
break ;
case 6 :
buffer6 = ( PDRIVER_INFO_6 ) buffer ;
break ;
case 8 :
buffer8 = ( PDRIVER_INFO_8 ) buffer ;
break ;
default :
break ;
}
printf ( " Driver Info Level %d: \n " , level ) ;
switch ( level ) {
case 1 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_1 ( & buffer1 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 2 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_2 ( & buffer2 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 3 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_3 ( & buffer3 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 4 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_4 ( & buffer4 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 5 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_5 ( & buffer5 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 6 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_6 ( & buffer6 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
case 8 :
for ( i = 0 ; i < count ; i + + ) {
print_driver_info_8 ( & buffer8 [ i ] ) ;
printf ( " \n " ) ;
}
break ;
default :
break ;
}
}
2009-12-17 00:36:18 +03:00
void print_doc_info_1 ( PDOC_INFO_1 info )
{
printf ( " \t Document Name \t = %s \n " , info - > pDocName ) ;
printf ( " \t Output Filename \t = %s \n " , info - > pOutputFile ) ;
printf ( " \t Datatype \t = %s \n " , info - > pDatatype ) ;
return ;
}
2010-01-15 18:36:25 +03:00
void print_printer_keys ( LPSTR buffer )
2009-12-17 00:36:18 +03:00
{
2010-01-15 18:36:25 +03:00
LPSTR p = NULL ;
2009-12-17 00:36:18 +03:00
2010-01-15 18:36:25 +03:00
p = buffer ;
2009-12-17 00:36:18 +03:00
2010-01-15 18:36:25 +03:00
while ( p & & * p ) {
printf ( " %s \n " , p ) ;
for ( ; * p ; p = CharNext ( p ) ) {
p = CharNext ( p ) ;
}
2009-12-17 00:36:18 +03:00
}
2010-01-15 18:36:25 +03:00
}
2009-12-17 00:36:18 +03:00
2010-01-15 18:36:25 +03:00
static LPSTR reg_type_str ( DWORD type )
{
switch ( type ) {
case REG_DWORD :
return " REG_DWORD " ;
case REG_SZ :
return " REG_SZ " ;
case REG_MULTI_SZ :
return " REG_MULTI_SZ " ;
case REG_BINARY :
return " REG_BINARY " ;
default :
return NULL ;
}
2009-12-17 00:36:18 +03:00
}
2010-01-11 17:40:16 +03:00
2010-01-15 18:36:25 +03:00
void print_printer_data ( LPSTR keyname , LPSTR valuename , DWORD size , LPBYTE buffer , DWORD type )
2010-01-11 17:40:16 +03:00
{
2010-01-15 18:36:25 +03:00
DWORD i = 0 ;
2010-01-11 17:40:16 +03:00
LPSTR p = NULL ;
2010-01-15 18:36:25 +03:00
if ( keyname ) {
printf ( " \t Key Name: \t %s \n " , keyname ) ;
}
2010-01-11 17:40:16 +03:00
2010-01-15 18:36:25 +03:00
printf ( " \t Value Name: \t %s \n " , valuename ) ;
printf ( " \t Size: 0x%x (%d) \n " , size , size ) ;
printf ( " \t Type: \t \t %s \n " , reg_type_str ( type ) ) ;
switch ( type ) {
case REG_SZ :
printf ( " \t \t %s \n " , ( LPSTR ) buffer ) ;
break ;
case REG_MULTI_SZ :
p = ( LPSTR ) buffer ;
while ( p & & * p ) {
printf ( " %s \n " , p ) ;
for ( ; * p ; p = CharNext ( p ) ) {
p = CharNext ( p ) ;
}
2010-01-11 17:40:16 +03:00
}
2010-01-15 18:36:25 +03:00
break ;
case REG_DWORD :
assert ( size = = 4 ) ;
printf ( " \t \t 0x%08x \n " , ( DWORD ) * buffer ) ;
break ;
case REG_BINARY :
for ( i = 0 ; i < size ; i + + ) {
printf ( " \t 0x%x " , buffer [ i ] ) ;
if ( i % 4 = = 3 ) {
printf ( " \n " ) ;
}
}
break ;
default :
break ;
2010-01-11 17:40:16 +03:00
}
}
2010-01-15 18:36:25 +03:00
void print_printer_enum_values ( PRINTER_ENUM_VALUES * info )
{
print_printer_data ( NULL , info - > pValueName , info - > cbData , info - > pData , info - > dwType ) ;
}