OpenPrinter fix

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Sep 4 05:02:17 CDT 2001


	Huw D M Davies <hdavies at codeweavers.com>
	OpenPrinter should fail if pPrinterName is ""
-------------- next part --------------
Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.42
diff -u -r1.42 info.c
--- dlls/winspool/info.c	2001/07/02 19:59:47	1.42
+++ dlls/winspool/info.c	2001/09/04 08:52:28
@@ -725,7 +725,7 @@
     HKEY hkeyPrinters, hkeyPrinter;
 
     if (!lpPrinterName) {
-       WARN("(printerName: NULL, pDefault %p Ret: False\n", pDefault);
+       FIXME("(printerName: NULL, pDefault %p Ret: False\n", pDefault);
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
     }
@@ -741,11 +741,13 @@
 	return FALSE;
     }
 
-    if(RegOpenKeyW(hkeyPrinters, lpPrinterName, &hkeyPrinter)
+    if(lpPrinterName[0] == '\0' || /* explicitly exclude "" */
+       RegOpenKeyW(hkeyPrinters, lpPrinterName, &hkeyPrinter)
        != ERROR_SUCCESS) {
-        ERR("Can't find printer %s in registry\n", debugstr_w(lpPrinterName));
+        TRACE("Can't find printer %s in registry\n",
+	      debugstr_w(lpPrinterName));
 	RegCloseKey(hkeyPrinters);
-        SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError(ERROR_INVALID_PRINTER_NAME);
 	return FALSE;
     }
     RegCloseKey(hkeyPrinter);


More information about the wine-patches mailing list