[PATCH] winspool.drv/tests: add dumping of FORM_INFO_1/2 in test_EnumForms

Marcel Partap mpartap at gmx.net
Sun Dec 9 12:50:56 CST 2007


---
 dlls/winspool.drv/tests/info.c |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index 65d0cf4..28754a0 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -768,7 +768,12 @@ static void test_EnumForms(LPSTR pName)
     DWORD   pcbNeeded;
     DWORD   pcReturned;
     DWORD   level;
-  
+    INT     i;
+    LPSTR   formtype;
+    LPSTR   formtypes[] = { "FORM_USER", "FORM_BUILTIN", "FORM_PRINTER", "FORM_flag_unknown" };
+    #define FORMTYPE_MAX 2
+    PFORM_INFO_1A pFI_1a;
+    PFORM_INFO_2A pFI_2a;
 
     res = OpenPrinter(pName, &hprinter, NULL);
     RETURN_ON_DEACTIVATED_SPOOLER(res)
@@ -785,7 +790,7 @@ static void test_EnumForms(LPSTR pName)
         pcReturned = 0xdeadbeef;
         SetLastError(0xdeadbeef);
         res = EnumFormsA(hprinter, level, NULL, 0, &cbBuf, &pcReturned);
-       
+
         /* EnumForms is not implemented in win9x */
         if (!res && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) continue;
 
@@ -803,7 +808,7 @@ static void test_EnumForms(LPSTR pName)
                 "ERROR_INVALID_LEVEL or '!=0' and 0x0)\n",
                 level, res, GetLastError(), pcReturned);
             continue;
-        }        
+        }
 
         ok((!res) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
             "(%d) returned %d with %d (expected '0' with "
@@ -816,8 +821,31 @@ static void test_EnumForms(LPSTR pName)
         res = EnumFormsA(hprinter, level, buffer, cbBuf, &pcbNeeded, &pcReturned);
         ok(res, "(%d) returned %d with %d (expected '!=0')\n",
                 level, res, GetLastError());
-        /* We can dump the returned Data here */
 
+        if (winetest_debug > 1) {
+            trace("dumping %d forms level %d\n", pcReturned, level);
+            pFI_1a = (PFORM_INFO_1A)buffer;
+            pFI_2a = (PFORM_INFO_2A)buffer;
+            for (i = 0; i < pcReturned; i++)
+            {
+                /* first part is same in FORM_INFO_1 and FORM_INFO_2 */
+                formtype = (pFI_1a->Flags <= FORMTYPE_MAX) ? formtypes[pFI_1a->Flags] : formtypes[3];
+                trace("%u (%s): %.03fmm x %.03fmm, %s\n", i, pFI_1a->pName,
+                      (float)pFI_1a->Size.cx/1000, (float)pFI_1a->Size.cy/1000, formtype);
+
+                if (level == 1) pFI_1a ++;
+                else {
+                    /* output additional FORM_INFO_2 fields */
+                    trace("\tkeyword=%s strtype=%u muidll=%s resid=%u dispname=%s langid=%u\n",
+                          pFI_2a->pKeyword, pFI_2a->StringType, pFI_2a->pMuiDll,
+                          pFI_2a->dwResourceId, pFI_2a->pDisplayName, pFI_2a->wLangId);
+
+                    /* offset pointer pFI_1a by 1*sizeof(FORM_INFO_2A) Bytes */
+                    pFI_2a ++;
+                    pFI_1a = (PFORM_INFO_1A)pFI_2a;
+                }
+            }
+        }
 
         SetLastError(0xdeadbeef);
         res = EnumFormsA(hprinter, level, buffer, cbBuf+1, &pcbNeeded, &pcReturned);
-- 
1.5.3.7


--------------020103020602090201060607--



More information about the wine-patches mailing list