Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.0 KiB

  1. #include "faxrtp.h"
  2. #pragma hdrstop
  3. BOOL
  4. TiffRoutePrint(
  5. LPCTSTR lpctstrTiffFileName,
  6. PTCHAR ptcPrinter
  7. )
  8. /*++
  9. Routine Description:
  10. Prints TIFF file.
  11. Arguments:
  12. lpctstrTiffFileName [in] - Name of TIFF file to print
  13. ptcPrinter [in] - Printer to print to
  14. Return Value:
  15. TRUE for success, FALSE on error
  16. --*/
  17. {
  18. PTCHAR ptcDevice = NULL;
  19. BOOL bResult;
  20. DEBUG_FUNCTION_NAME(TEXT("TiffRoutePrint"));
  21. if( (ptcDevice = _tcstok( ptcPrinter, TEXT(","))) )
  22. {
  23. if (IsPrinterFaxPrinter( ptcDevice ))
  24. {
  25. //
  26. // return TRUE here so we don't try to route it to this printer again
  27. //
  28. DebugPrintEx (DEBUG_WRN,
  29. TEXT("Attempt to print to our fax printer was blocked"));
  30. FaxLog(
  31. FAXLOG_CATEGORY_INBOUND,
  32. FAXLOG_LEVEL_MIN,
  33. 2,
  34. MSG_FAX_PRINT_TO_FAX,
  35. lpctstrTiffFileName,
  36. ptcDevice
  37. );
  38. return TRUE;
  39. }
  40. }
  41. bResult = TiffPrint (lpctstrTiffFileName, ptcPrinter);
  42. if (bResult)
  43. {
  44. //
  45. // Success
  46. //
  47. FaxLog(
  48. FAXLOG_CATEGORY_INBOUND,
  49. FAXLOG_LEVEL_MAX,
  50. 2,
  51. MSG_FAX_PRINT_SUCCESS,
  52. lpctstrTiffFileName,
  53. ptcPrinter
  54. );
  55. }
  56. else
  57. {
  58. DWORD dwLastError = GetLastError ();
  59. //
  60. // Failure
  61. //
  62. FaxLog(
  63. FAXLOG_CATEGORY_INBOUND,
  64. FAXLOG_LEVEL_MIN,
  65. 3,
  66. MSG_FAX_PRINT_FAILED,
  67. lpctstrTiffFileName,
  68. ptcPrinter,
  69. DWORD2HEX(dwLastError)
  70. );
  71. //
  72. // Restore last error in case FaxLog changed it
  73. //
  74. SetLastError (dwLastError);
  75. }
  76. return bResult;
  77. } // TiffRoutePrint