DWORD             dwSizeNeeded; DWORD             dwNumItems; LPPRINTER_INFO_2 lpInfo = NULL;
nsresult rv = NS_ERROR_FAILURE;
EnumerateNativePrinters(DWORD aWhichPrinters, LPTSTR aPrinterName, PRBool& aIsFound, PRBool& aIsFile){  DWORD             dwSizeNeeded;  DWORD             dwNumItems;  LPPRINTER_INFO_2 lpInfo = NULL;  // Get buffer size  ::EnumPrinters ( aWhichPrinters, NULL, 2, NULL, 0, &dwSizeNeeded, &dwNumItems );  // 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 ) {    return NS_OK;  }  for (DWORD i = 0; i < dwNumItems; i++ ) {    if (_tcscmp(lpInfo[i].pPrinterName, aPrinterName)) {      aIsFound = PR_TRUE;      aIsFile  = _tcscmp(lpInfo[i].pPortName, _T("FILE:")) == 0;      break;    }  }  HeapFree(GetProcessHeap (), 0, lpInfo);  return NS_OK;}