From 5afae257249d0034d999d5c588732c86732ee9d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Tue, 9 Feb 2010 15:00:54 +0100 Subject: [PATCH] testprogs: print port info levels in EnumPorts() spoolss tests. Guenther --- testprogs/win32/spoolss/printlib.c | 75 ++++++++++++++++++++++++++++++++++++++ testprogs/win32/spoolss/spoolss.c | 4 ++ 2 files changed, 79 insertions(+) diff --git a/testprogs/win32/spoolss/printlib.c b/testprogs/win32/spoolss/printlib.c index 2c84c78395a..0790144db1d 100644 --- a/testprogs/win32/spoolss/printlib.c +++ b/testprogs/win32/spoolss/printlib.c @@ -264,6 +264,81 @@ void print_monitor_info_2(PMONITOR_INFO_2 info) return; } +void print_port_info_1(PPORT_INFO_1 info) +{ + printf("\tPort Name\t= %s\n", info->pName); + return; +} + +void print_port_info_2(PPORT_INFO_2 info) +{ + printf("\tPort Name\t= %s\n", info->pPortName); + printf("\tMonitor Name\t= %s\n",info->pMonitorName); + printf("\tDescription\t= %s\n", info->pDescription); + printf("\tPort Type\t= 0x%08x\n", info->fPortType); + printf("\tReserved\t= 0x%08x\n", info->Reserved); + return; +} + +void print_port_info_3(PPORT_INFO_3 info) +{ + printf("\tStatus\t= 0x%08x\n", info->dwStatus); + printf("\tStatus String\t= %s\n", info->pszStatus); + printf("\tSeverity\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; ipName); diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c index ac3a3138435..90cdc816cdf 100644 --- a/testprogs/win32/spoolss/spoolss.c +++ b/testprogs/win32/spoolss/spoolss.c @@ -312,6 +312,10 @@ static BOOL test_EnumPorts(struct torture_context *tctx, } } + if (tctx->print) { + print_port_info_bylevel(levels[i], buffer, returned); + } + free(buffer); buffer = NULL; } -- 2.11.4.GIT