mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[PRINTING]
SetDefaultPrinterW needs to fail with ERROR_INVALID_PRINTER_NAME if the input parameter is invalid. Also add a test for that. svn path=/trunk/; revision=74518
This commit is contained in:
parent
643b7c9da9
commit
a366e71f50
2 changed files with 6 additions and 1 deletions
|
@ -817,7 +817,7 @@ SetDefaultPrinterW(LPCWSTR pszPrinter)
|
|||
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)
|
||||
|
|
|
@ -45,5 +45,10 @@ START_TEST(GetDefaultPrinter)
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue