[winspool 5/8] When retrieving PRINTER_INFO_7, the lack of a directory service print queue object is represented with a NULL pointer and a successful return, not an error return.

Jeremy White jwhite at winehq.org
Mon Nov 30 17:04:50 CST 2009


---
 dlls/winspool.drv/info.c       |   18 ++++++++++--------
 dlls/winspool.drv/tests/info.c |    8 +-------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index cbd8f27..9ea6443 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -3514,16 +3514,18 @@ static BOOL WINSPOOL_GetPrinter_7(HKEY hkeyPrinter, PRINTER_INFO_7W *pi7, LPBYTE
 
     *pcbNeeded = 0;
 
-    if (WINSPOOL_GetStringFromReg(hkeyPrinter, ObjectGUIDW, ptr, left, &size, unicode))
+    if (! WINSPOOL_GetStringFromReg(hkeyPrinter, ObjectGUIDW, ptr, left, &size, unicode))
     {
-        if (space && size <= left) {
-            pi7->pszObjectGUID = (LPWSTR)ptr;
-            ptr += size;
-            left -= size;
-        } else
-            space = FALSE;
-        *pcbNeeded += size;
+        ptr = NULL;
+        size = sizeof(pi7->pszObjectGUID);
     }
+    if (space && size <= left) {
+        pi7->pszObjectGUID = (LPWSTR)ptr;
+        ptr += size;
+        left -= size;
+    } else
+        space = FALSE;
+    *pcbNeeded += size;
     if (pi7) {
         /* We do not have a Directory Service */
         pi7->dwAction = DSPRINT_UNPUBLISH;
diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index bd33073..514a02f 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -2260,13 +2260,7 @@ static void test_GetPrinter(void)
         SetLastError(0xdeadbeef);
         filled = -1;
         ret = GetPrinter(hprn, level, buf, needed, &filled);
-        if (level == 7 && needed == sizeof(PRINTER_INFO_7A))
-        {
-            todo_wine
-            ok(ret, "level %d: GetPrinter error %d\n", level, GetLastError());
-        }
-        else
-            ok(needed == filled, "needed %d != filled %d\n", needed, filled);
+        ok(needed == filled, "needed %d != filled %d\n", needed, filled);
 
         if (level == 2)
         {
-- 
1.5.6.5





More information about the wine-patches mailing list