From 1e0b41ba1c472e0051a54275b4abd3d1e45cd90b Mon Sep 17 00:00:00 2001 From: Huw D M Davies <hdavies@codeweavers.com> Date: Fri, 7 Sep 2001 15:26:51 +0000 Subject: [PATCH] OpenPrinter should fail if pPrinterName is "". --- dlls/winspool/info.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index f97e46160b0..557e32c551b 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -725,7 +725,7 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, 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 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, 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); -- GitLab