testprogs: print monitor info levels in EnumMonitors() spoolss tests.
authorGünther Deschner <gd@samba.org>
Tue, 9 Feb 2010 14:24:34 +0000 (15:24 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 9 Feb 2010 15:39:34 +0000 (16:39 +0100)
Guenther

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

index 0790144db1d84e0339dbfc4cb6eb4c2da512fa7e..e696909ed65205ec9e59df7d55d75d62cca8d1e3 100644 (file)
@@ -264,6 +264,47 @@ void print_monitor_info_2(PMONITOR_INFO_2 info)
        return;
 }
 
        return;
 }
 
+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;
+       }
+}
+
 void print_port_info_1(PPORT_INFO_1 info)
 {
        printf("\tPort Name\t= %s\n",   info->pName);
 void print_port_info_1(PPORT_INFO_1 info)
 {
        printf("\tPort Name\t= %s\n",   info->pName);
index 90cdc816cdfa267efa287e0ed02fddef417a92d2..5741e354ef16a8a412caef0c210cc9dce2dbd707 100644 (file)
@@ -363,6 +363,10 @@ static BOOL test_EnumMonitors(struct torture_context *tctx,
                        }
                }
 
                        }
                }
 
+               if (tctx->print) {
+                       print_monitor_info_bylevel(levels[i], buffer, returned);
+               }
+
                free(buffer);
                buffer = NULL;
        }
                free(buffer);
                buffer = NULL;
        }