diff options
author | Günther Deschner <gd@samba.org> | 2010-12-23 14:43:10 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-12-23 23:40:21 +0100 |
commit | 821b2a9d1197d927ab6081bcd953a0540888dcf3 (patch) | |
tree | 8fef72d21770fda9262e4ee075ff9476dd46dea8 /testprogs/win32/spoolss | |
parent | 37c4ced9bdf6ccca2b00e1189fbdf90cb9836dc7 (diff) | |
download | samba-821b2a9d1197d927ab6081bcd953a0540888dcf3.tar.gz samba-821b2a9d1197d927ab6081bcd953a0540888dcf3.tar.bz2 samba-821b2a9d1197d927ab6081bcd953a0540888dcf3.zip |
testprogs: testspoolss.exe: pretty print FILETIME in driver info 6 and 8.
Guenther
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Thu Dec 23 23:40:21 CET 2010 on sn-devel-104
Diffstat (limited to 'testprogs/win32/spoolss')
-rw-r--r-- | testprogs/win32/spoolss/printlib.c | 102 | ||||
-rw-r--r-- | testprogs/win32/spoolss/printlib_proto.h | 2 |
2 files changed, 101 insertions, 3 deletions
diff --git a/testprogs/win32/spoolss/printlib.c b/testprogs/win32/spoolss/printlib.c index 829ac40d67..1dd1277c31 100644 --- a/testprogs/win32/spoolss/printlib.c +++ b/testprogs/win32/spoolss/printlib.c @@ -969,7 +969,12 @@ void print_driver_info_6(PDRIVER_INFO_6 info) printf("\tPrevious Names\t= (null)\n"); } - printf("\tDriver Date\t= %d\n", info->ftDriverDate); + printf("\tDriver Date\t= %d (%08x:%08x)\n", + info->ftDriverDate, + info->ftDriverDate.dwLowDateTime, + info->ftDriverDate.dwHighDateTime); + printf("\t\t"); + print_file_time(&info->ftDriverDate); printf("\tDriver Version\t= %d\n", info->dwlDriverVersion); printf("\tManufacture Name = %s\n", info->pszMfgName); printf("\tOEM URL\t\t= %s\n", info->pszOEMUrl); @@ -1014,7 +1019,12 @@ void print_driver_info_8(PDRIVER_INFO_8 info) print_multi_sz(info->pszzPreviousNames); printf("\tDependent Files\t=\n"); print_multi_sz(info->pDependentFiles); - printf("\tDriver Date\t= %d\n", info->ftDriverDate); + printf("\tDriver Date\t= %d (%08x:%08x)\n", + info->ftDriverDate, + info->ftDriverDate.dwLowDateTime, + info->ftDriverDate.dwHighDateTime); + printf("\t\t"); + print_file_time(&info->ftDriverDate); printf("\tDriver Version\t= %d\n", info->dwlDriverVersion); printf("\tManufacture Name = %s\n", info->pszMfgName); printf("\tOEM URL\t\t= %s\n", info->pszOEMUrl); @@ -1028,7 +1038,12 @@ void print_driver_info_8(PDRIVER_INFO_8 info) printf("\tPrinter Driver Attributes = %d\n", info->dwPrinterDriverAttributes); printf("\tCore Driver Dependencies\t=\n"); print_multi_sz(info->pszzCoreDriverDependencies); - printf("\tMin Inbox Driver VerDate\t= %d\n", info->ftMinInboxDriverVerDate); + printf("\tMin Inbox Driver VerDate\t= %d (%08x:%08x)\n", + info->ftMinInboxDriverVerDate, + info->ftMinInboxDriverVerDate.dwLowDateTime, + info->ftMinInboxDriverVerDate.dwHighDateTime); + printf("\t\t"); + print_file_time(&info->ftMinInboxDriverVerDate); printf("\tMin Inbox Driver VerVersion\t= %d\n", info->dwlMinInboxDriverVerVersion); return; } @@ -1288,3 +1303,84 @@ void print_printer_enum_values(PRINTER_ENUM_VALUES *info) print_printer_data(NULL, info->pValueName, info->cbData, info->pData, info->dwType); } +void print_file_time(const FILETIME *t) +{ + SYSTEMTIME s; + LPSTR dayofweek = NULL; + LPSTR month = NULL; + + if (!FileTimeToSystemTime(t, &s)) { + printf("Failed to convert FILETIME to SYSTEMTIME\n"); + return; + } + switch (s.wDayOfWeek) { + case 0: + dayofweek = "Sun"; + break; + case 1: + dayofweek = "Mon"; + break; + case 2: + dayofweek = "Tue"; + break; + case 3: + dayofweek = "Wed"; + break; + case 4: + dayofweek = "Thu"; + break; + case 5: + dayofweek = "Fri"; + break; + case 6: + dayofweek = "Sat"; + break; + default: + break; + } + + switch (s.wMonth) { + case 1: + month = "Jan"; + break; + case 2: + month = "Feb"; + break; + case 3: + month = "Mar"; + break; + case 4: + month = "Apr"; + break; + case 5: + month = "May"; + break; + case 6: + month = "Jun"; + break; + case 7: + month = "Jul"; + break; + case 8: + month = "Aug"; + break; + case 9: + month = "Sep"; + break; + case 10: + month = "Oct"; + break; + case 11: + month = "Nov"; + break; + case 12: + month = "Dec"; + break; + default: + break; + } + + printf("%s %s %02d %02d:%02d:%02d %04d\n", + dayofweek, month, s.wDay, + s.wHour, s.wMinute, s.wSecond, s.wYear); +} diff --git a/testprogs/win32/spoolss/printlib_proto.h b/testprogs/win32/spoolss/printlib_proto.h index 8e44d3be86..704cdbfaea 100644 --- a/testprogs/win32/spoolss/printlib_proto.h +++ b/testprogs/win32/spoolss/printlib_proto.h @@ -58,6 +58,8 @@ LPSTR reg_type_str(DWORD type); void print_printer_data(LPSTR keyname, LPSTR valuename, DWORD size, LPBYTE buffer, DWORD type); void print_printer_dataw(LPCWSTR keyname, LPCWSTR valuename, DWORD size, LPBYTE buffer, DWORD type); void print_printer_enum_values(PRINTER_ENUM_VALUES *info); +void print_file_time(const FILETIME *t); + #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) |