Skip to content
Snippets Groups Projects
Commit 1e0b41ba authored by Huw D. M. Davies's avatar Huw D. M. Davies Committed by Alexandre Julliard
Browse files

OpenPrinter should fail if pPrinterName is "".

parent de8ba1c1
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment