ULONG defaultPrinter = nsDeviceContextSpecOS2::PrnDlg.GetDefaultPrinter();
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;  nsresult rv;  nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);  BOOL prefFailed = NS_FAILED(rv); // don't return on failure, optional feature  ULONG defaultPrinter = nsDeviceContextSpecOS2::PrnDlg.GetDefaultPrinter();  for (ULONG i = 0; i < mGlobalNumPrinters; i++) {    nsXPIDLCString printer;    nsDeviceContextSpecOS2::PrnDlg.GetPrinter(i, getter_Copies(printer));    nsAutoChar16Buffer printerName;    PRInt32 printerNameLength;    rv = MultiByteToWideChar(0, printer, strlen(printer),                             printerName, printerNameLength);    if (defaultPrinter == i) {       mGlobalPrinterList->InsertStringAt(nsDependentString(printerName.get()), 0);    } else {       mGlobalPrinterList->AppendString(nsDependentString(printerName.get()));    }    // store printer description in prefs for the print dialog    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());    }  }   return NS_OK;}