if (!prefFailed) { nsCAutoString printerDescription; printerDescription = nsCAutoString(nsDeviceContextSpecOS2::PrnDlg.GetPrintDriver(i)->szDeviceName); printerDescription += " ("; printerDescription += nsCAutoString(nsDeviceContextSpecOS2::PrnDlg.GetDriverType(i)); printerDescription += ")"; pPrefs->SetCharPref(nsPrintfCString(256, "print.printer_%s.printer_description", printer.get()).get(), printerDescription.get()); }
nsresult GlobalPrinters::InitializeGlobalPrinters (){  if (PrintersAreAllocated())     return NS_OK;  mGlobalNumPrinters = 0;  mGlobalNumPrinters = nsDeviceContextSpecOS2::PrnDlg.GetNumPrinters();  if (!mGlobalNumPrinters)     return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;   mGlobalPrinterList = new nsStringArray();  if (!mGlobalPrinterList)      return NS_ERROR_OUT_OF_MEMORY;  int defaultPrinter = nsDeviceContextSpecOS2::PrnDlg.GetDefaultPrinter();  for (int i = 0; i < mGlobalNumPrinters; i++) {    nsXPIDLCString printer;    nsDeviceContextSpecOS2::PrnDlg.GetPrinter(i, getter_Copies(printer));    nsAutoChar16Buffer printerName;    PRInt32 printerNameLength;    nsresult rv = MultiByteToWideChar(0, printer, strlen(printer),                                      printerName, printerNameLength);    if (defaultPrinter == i) {       mGlobalPrinterList->InsertStringAt(nsDependentString(printerName.get()), 0);    } else {       mGlobalPrinterList->AppendString(nsDependentString(printerName.get()));    }  }   return NS_OK;}