Fix for bug 270812: Cannot print after printer was renamed

Patch by Masayuki Nakano,
r=emaijala
sr=bzbarsky
This commit is contained in:
ere%atp.fi 2004-12-06 15:29:25 +00:00
Родитель cbf2ae3323
Коммит c1d97a4b9d
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -861,6 +861,17 @@ ShowNativePrintDialog(HWND aHWnd,
// If there is no name then use the default printer
if (!printerName || (printerName && !*printerName)) {
printerName = GetDefaultPrinterNameFromGlobalPrinters();
} else {
HANDLE hPrinter = NULL;
nsCAutoString printerNameNative;
NS_CopyUnicodeToNative(nsDependentString(printerName), printerNameNative);
LPTSTR tempPrinterName = NS_CONST_CAST(char*, printerNameNative.get());
if(!::OpenPrinter(tempPrinterName, &hPrinter, NULL)) {
// If the last used printer is not found, we should use default printer.
printerName = GetDefaultPrinterNameFromGlobalPrinters();
} else {
::ClosePrinter(hPrinter);
}
}
NS_ASSERTION(printerName, "We have to have a printer name");