Source code of Windows XP (NT5)
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.

166 lines
4.2 KiB

  1. //****************************************************************************
  2. // Generic Win 3.1 fax printer driver support
  3. //
  4. // 02-jan-95 nandurir created.
  5. // 14-mar-95 reedb Use GDI hooks to move most functionality to UI.
  6. // 16-aug-95 reedb Move to kernel mode. Many declarations and
  7. // definitions moved from FAXCOMM.H to this file.
  8. //
  9. //****************************************************************************
  10. #include "stddef.h"
  11. #include "windows.h"
  12. #include "winddi.h"
  13. #include "faxcomm.h"
  14. #include "winspool.h"
  15. // The following include is to pickup the definitions for
  16. // the DrvUpgradePrinter private API. These definitions should be in public.
  17. #include <splapip.h>
  18. // WOWFAX component file names.
  19. #define WOWFAX_DLL_NAME L"WOWFAX.DLL"
  20. #define WOWFAXUI_DLL_NAME L"WOWFAXUI.DLL"
  21. // String table constants:
  22. #define WOWFAX_MAX_USER_MSG_LEN 256
  23. #define WOWFAX_UNKNOWN_PROB_STR 0x100
  24. #define WOWFAX_NAME_STR 0x101
  25. #define WOWFAX_NOWOW_STR 0x102
  26. #define WOWFAX_SELF_CONFIG_STR 0x103
  27. #define WOWFAX_ENABLE_CONFIG_STR 0x104
  28. // Dialog constants:
  29. #define IDD_NULLPROP 0x200
  30. #define IDD_DOCPROP 0x201
  31. // Text control constants:
  32. #define IDC_STATIC -1
  33. #define IDC_FEEDBACK 0x300
  34. // InterProcCommHandler command constants
  35. #define DRVFAX_SETMAPDATA 0x1
  36. #define DRVFAX_SENDTOWOW 0x2
  37. #define DRVFAX_SENDNOTIFYWOW 0x3
  38. #define DRVFAX_CREATEMAP 0x4
  39. #define DRVFAX_DESTROYMAP 0x5
  40. #define DRVFAX_CALLWOW 0x6
  41. // Logging macros
  42. /* XLATOFF */
  43. // #define IFLOG(l) if (l==iFaxLogLevel && (iFaxLogLevel&1) || l<=iFaxLogLevel && !(iFaxLogLevel&1) || l == 0)
  44. #undef LOG
  45. #ifdef NOLOG
  46. #define LOG(l,args)
  47. #define SETREQLOG(l)
  48. #else
  49. #define SETREQLOG(l) iReqFaxLogLevel = l
  50. #define LOG(l,args) {SETREQLOG(l) ; faxlogprintf args;}
  51. #endif
  52. #if DBG
  53. extern INT iReqFaxLogLevel;
  54. #define LOGDEBUG(l,args) LOG(l,args)
  55. #else
  56. #define LOGDEBUG(l,args)
  57. #endif
  58. /* XLATON */
  59. //
  60. // This structure is used to hold 16-bit fax driver data stored
  61. // in the registry.
  62. //
  63. typedef struct _REGFAXDRVINFO16 {
  64. LPTSTR lpDeviceName;
  65. LPTSTR lpDriverName;
  66. LPTSTR lpPortName;
  67. } REGFAXDRVINFO16, *LPREGFAXDRVINFO16;
  68. // The the escapes in the following escape range all need a valid HDC.
  69. // Range is inclusive lower, exclusive upper bound. See GDISPOOL.H for
  70. // the actual escape definitions.
  71. #define DOCUMENTEVENT_HDCFIRST 5
  72. #define DOCUMENTEVENT_HDCLAST 11
  73. // Prototypes for public functions implemented in WFSHEETS.C:
  74. PVOID MyGetPrinter(HANDLE hPrinter, DWORD level);
  75. // Prototypes for public functions implemented in WFUPGRAD.C:
  76. BOOL DoUpgradePrinter(DWORD dwLevel, LPDRIVER_UPGRADE_INFO_1W lpDrvUpgradeInfo);
  77. // Prototypes for public functions implemented in WFHELPERS.C:
  78. LPREGFAXDRVINFO16 Get16BitDriverInfoFromRegistry(PWSTR pDeviceName);
  79. VOID faxlogprintf(LPTSTR pszFmt, ...);
  80. VOID LogFaxDev(LPTSTR pszTitle, LPFAXDEV lpFaxDev);
  81. VOID LogWowFaxInfo(LPWOWFAXINFO lpWowFaxInfo);
  82. BOOL ValidateFaxDev(LPFAXDEV lpFaxDev);
  83. VOID Free16BitDriverInfo(LPREGFAXDRVINFO16 lpRegFaxDrvInfo16);
  84. BOOL FaxMapHandler(LPFAXDEV lpdev, UINT iAction);
  85. BOOL InterProcCommHandler(LPFAXDEV lpdev, UINT iAction);
  86. LPVOID WFHeapAlloc(DWORD dwBytes, LPWSTR lpszWhoCalled);
  87. LPVOID WFLocalAlloc(DWORD dwBytes, LPWSTR lpszWhoCalled);
  88. HWND FindWowFaxWindow(void);
  89. LPTSTR DupTokenW(LPTSTR lpTok);
  90. // Prototypes for functions which DrvDocumentEvent dispatches,
  91. // implemented in WOWFAXUI.C:
  92. int DocEvntCreateDCpre(
  93. LPWSTR lpszDevice,
  94. DEVMODEW *pDevModIn,
  95. DEVMODEW **pDevModOut
  96. );
  97. int DocEvntResetDCpre(
  98. HDC hdc,
  99. DEVMODEW *pDevModIn,
  100. DEVMODEW **pDevModOut
  101. );
  102. int DocEvntCreateDCpost(
  103. HDC hdc,
  104. DEVMODEW *pDevModIn
  105. );
  106. int DocEvntResetDCpost(
  107. HDC hdc,
  108. DEVMODEW *pDevModIn
  109. );
  110. int DocEvntStartDoc(
  111. HDC hdc,
  112. DOCINFOW *pDocInfoW
  113. );
  114. int DocEvntDeleteDC(
  115. HDC hdc
  116. );
  117. int DocEvntEndPage(
  118. HDC hdc
  119. );
  120. int DocEvntEndDoc(
  121. HDC hdc
  122. );
  123. //
  124. // Memory allocation macro.
  125. //
  126. #if DBG
  127. #define WFLOCALALLOC(dwBytes, lpszWhoCalled) WFLocalAlloc(dwBytes, lpszWhoCalled)
  128. #else
  129. #define WFLOCALALLOC(dwBytes, lpszWhoCalled) LocalAlloc(LPTR, dwBytes)
  130. #endif