DWORD             dwSizeNeeded = 0; DWORD             dwNumItems   = 0; LPPRINTER_INFO_2  lpInfo        = NULL;
nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
EnumerateNativePrinters(DWORD aWhichPrinters, LPTSTR aPrinterName, PRBool& aIsFound, PRBool& aIsFile){  DWORD             dwSizeNeeded = 0;  DWORD             dwNumItems   = 0;  LPPRINTER_INFO_2  lpInfo        = NULL;  // Get buffer size  if (::EnumPrinters ( aWhichPrinters, NULL, 2, NULL, 0, &dwSizeNeeded, &dwNumItems )) {    return NS_ERROR_FAILURE;  }  // allocate memory  lpInfo = (LPPRINTER_INFO_2)HeapAlloc ( GetProcessHeap (), HEAP_ZERO_MEMORY, dwSizeNeeded );  if ( lpInfo == NULL ) {    return NS_ERROR_OUT_OF_MEMORY;  }  if (::EnumPrinters ( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)lpInfo, dwSizeNeeded, &dwSizeNeeded, &dwNumItems) == 0 ) {    ::HeapFree(GetProcessHeap (), 0, lpInfo);    return NS_OK;  }  for (DWORD i = 0; i < dwNumItems; i++ ) {    if (_tcscmp(lpInfo[i].pPrinterName, aPrinterName) == 0) {      aIsFound = PR_TRUE;      aIsFile  = _tcscmp(lpInfo[i].pPortName, _T("FILE:")) == 0;      break;    }  }  ::HeapFree(GetProcessHeap (), 0, lpInfo);  return NS_OK;}