Author: cfinck
Date: Wed May 10 13:03:08 2017
New Revision: 74518
URL: 
http://svn.reactos.org/svn/reactos?rev=74518&view=rev
Log:
[PRINTING]
SetDefaultPrinterW needs to fail with ERROR_INVALID_PRINTER_NAME if the input parameter is
invalid. Also add a test for that.
Modified:
    trunk/reactos/win32ss/printing/base/winspool/printers.c
    trunk/rostests/apitests/winspool/GetDefaultPrinter.c
Modified: trunk/reactos/win32ss/printing/base/winspool/printers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/wins…
==============================================================================
--- trunk/reactos/win32ss/printing/base/winspool/printers.c     [iso-8859-1] (original)
+++ trunk/reactos/win32ss/printing/base/winspool/printers.c     [iso-8859-1] Wed May 10
13:03:08 2017
@@ -817,7 +817,7 @@
         dwErrorCode = (DWORD)RegQueryValueExW(hDevicesKey, pszPrinter, NULL, NULL, NULL,
&cbPrinterValueData);
         if (dwErrorCode == ERROR_FILE_NOT_FOUND)
         {
-            // The caller gave us an invalid printer name, return with
ERROR_FILE_NOT_FOUND.
+            dwErrorCode = ERROR_INVALID_PRINTER_NAME;
             goto Cleanup;
         }
         else if (dwErrorCode != ERROR_SUCCESS)
Modified: trunk/rostests/apitests/winspool/GetDefaultPrinter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/winspool/GetDefa…
==============================================================================
--- trunk/rostests/apitests/winspool/GetDefaultPrinter.c        [iso-8859-1] (original)
+++ trunk/rostests/apitests/winspool/GetDefaultPrinter.c        [iso-8859-1] Wed May 10
13:03:08 2017
@@ -45,5 +45,10 @@
     ok(SetDefaultPrinterW(pwszDefaultPrinter), "SetDefaultPrinterW returns
FALSE!\n");
     ok(GetLastError() == ERROR_SUCCESS, "SetDefaultPrinterW returns error
%lu!\n", GetLastError());
+    // SetDefaultPrinterW with an invalid printer name needs to fail with
ERROR_INVALID_PRINTER_NAME.
+    SetLastError(0xDEADBEEF);
+    ok(!SetDefaultPrinterW(L"INVALID PRINTER NAME!!!"),
"SetDefaultPrinterW returns TRUE!\n");
+    ok(GetLastError() == ERROR_INVALID_PRINTER_NAME, "SetDefaultPrinterW returns
error %lu!\n", GetLastError());
+
     HeapFree(GetProcessHeap(), 0, pwszDefaultPrinter);
 }