testprogs: print port info levels in EnumPorts() spoolss tests.
authorGünther Deschner <gd@samba.org>
Tue, 9 Feb 2010 14:00:54 +0000 (15:00 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 9 Feb 2010 15:39:30 +0000 (16:39 +0100)
Guenther

testprogs/win32/spoolss/printlib.c
testprogs/win32/spoolss/spoolss.c

index 2c84c78395aeb15ab396b50568eb72fb56611371..0790144db1d84e0339dbfc4cb6eb4c2da512fa7e 100644 (file)
@@ -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; 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;
+       }
+}
+
 void print_form_info_1(PFORM_INFO_1 info)
 {
        printf("\tForm Name\t= %s\n",   info->pName);
index ac3a3138435bd554574cd32fe48d204b51d64235..90cdc816cdfa267efa287e0ed02fddef417a92d2 100644 (file)
@@ -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;
        }