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.

300 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxmon.h
  5. Abstract:
  6. Header file for fax print monitor
  7. Environment:
  8. Windows XP fax print monitor
  9. Revision History:
  10. 02/22/96 -davidx-
  11. Created it.
  12. dd-mm-yy -author-
  13. description
  14. --*/
  15. #ifndef _FAXMON_H_
  16. #define _FAXMON_H_
  17. #if defined(UNICODE) && !defined(_UNICODE)
  18. #define _UNICODE
  19. #endif
  20. #include <stddef.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <windows.h>
  24. #include <winspool.h>
  25. #include <winsplp.h>
  26. #include <tchar.h>
  27. #include "faxutil.h"
  28. #include <fxsapip.h>
  29. #include "jobtag.h"
  30. #include "resource.h"
  31. #include "faxres.h"
  32. #include "Dword2Str.h"
  33. //
  34. // Data structure for representing a fax monitor port
  35. //
  36. typedef struct _FAXPORT {
  37. PVOID startSig; // signature
  38. LPTSTR pName; // port name
  39. HANDLE hFaxSvc; // fax service handle
  40. DWORD jobId; // main job ID
  41. DWORD nextJobId; // next job ID in the chain
  42. HANDLE hFile; // handle to currently open file
  43. LPTSTR pFilename; // pointer to currently open file name
  44. LPTSTR pPrinterName; // currently connected printer name
  45. HANDLE hPrinter; // open handle to currently connected printer
  46. LPTSTR pParameters; // pointer to job parameter string
  47. FAX_JOB_PARAM_EX JobParamsEx; // pointer to individual job parameters
  48. //
  49. FAX_COVERPAGE_INFO_EX CoverPageEx; // Cover page information
  50. FAX_PERSONAL_PROFILE SenderProfile; // Sender information
  51. PFAX_PERSONAL_PROFILE pRecipients; // Array of recipient information for this transmission
  52. UINT nRecipientCount; // The number of recipients in this transmission
  53. HANDLE hCoverPageFile;
  54. LPTSTR pCoverPageFileName; // The name of the cover page file generated on the server by the fax monitor.
  55. // This file contains the cover page template as transfered via the cover page
  56. // print job.
  57. BOOL bCoverPageJob; // TRUE if the current print job is the cover page job.
  58. PVOID endSig; // signature
  59. } FAXPORT, *PFAXPORT;
  60. #define ValidFaxPort(pFaxPort) \
  61. ((pFaxPort) && (pFaxPort) == (pFaxPort)->startSig && (pFaxPort) == (pFaxPort)->endSig)
  62. //
  63. // Different error code when sending fax document
  64. //
  65. #define FAXERR_NONE 0
  66. #define FAXERR_IGNORE 1
  67. #define FAXERR_RESTART 2
  68. #define FAXERR_SPECIAL 3
  69. #define FAXERR_FATAL IDS_FAXERR_FATAL
  70. #define FAXERR_RECOVERABLE IDS_FAXERR_RECOVERABLE
  71. #define FAXERR_BAD_TIFF IDS_FAXERR_BAD_TIFF
  72. #define FAXERR_BAD_DATA16 IDS_FAXERR_BAD_DATA16
  73. //
  74. // Memory allocation and deallocation macros
  75. //
  76. //
  77. // undefine the memory allocation routines from FAXUTIL.H
  78. //
  79. #undef MemAlloc
  80. #undef MemFree
  81. #define MemAlloc(size) ((PVOID) LocalAlloc(LMEM_FIXED, (size)))
  82. #define MemAllocZ(size) ((PVOID) LocalAlloc(LPTR, (size)))
  83. #define MemFree(ptr) { if (ptr) LocalFree((HLOCAL) (ptr)); }
  84. //
  85. // Number of tags used for passing fax job parameters
  86. //
  87. #define NUM_JOBPARAM_TAGS 12
  88. //
  89. // Nul terminator for a character string
  90. //
  91. #define NUL 0
  92. //
  93. // Result of string comparison
  94. //
  95. #define EQUAL_STRING 0
  96. #define IsEmptyString(p) ((p)[0] == NUL)
  97. #define IsNulChar(c) ((c) == NUL)
  98. #define SizeOfString(p) ((_tcslen(p) + 1) * sizeof(TCHAR))
  99. //
  100. // Maximum value for signed and unsigned integers
  101. //
  102. #ifndef MAX_LONG
  103. #define MAX_LONG 0x7fffffff
  104. #endif
  105. #ifndef MAX_DWORD
  106. #define MAX_DWORD 0xffffffff
  107. #endif
  108. #ifndef MAX_SHORT
  109. #define MAX_SHORT 0x7fff
  110. #endif
  111. #ifndef MAX_WORD
  112. #define MAX_WORD 0xffff
  113. #endif
  114. //
  115. // Declaration of print monitor entry points
  116. //
  117. BOOL
  118. FaxMonOpenPort(
  119. LPTSTR pPortName,
  120. PHANDLE pHandle
  121. );
  122. BOOL
  123. FaxMonClosePort(
  124. HANDLE hPort
  125. );
  126. BOOL
  127. FaxMonStartDocPort(
  128. HANDLE hPort,
  129. LPTSTR pPrinterName,
  130. DWORD JobId,
  131. DWORD Level,
  132. LPBYTE pDocInfo
  133. );
  134. BOOL
  135. FaxMonEndDocPort(
  136. HANDLE hPort
  137. );
  138. BOOL
  139. FaxMonWritePort(
  140. HANDLE hPort,
  141. LPBYTE pBuffer,
  142. DWORD cbBuf,
  143. LPDWORD pcbWritten
  144. );
  145. BOOL
  146. FaxMonReadPort(
  147. HANDLE hPort,
  148. LPBYTE pBuffer,
  149. DWORD cbBuf,
  150. LPDWORD pcbRead
  151. );
  152. BOOL
  153. FaxMonEnumPorts(
  154. LPTSTR pServerName,
  155. DWORD Level,
  156. LPBYTE pPorts,
  157. DWORD cbBuf,
  158. LPDWORD pcbNeeded,
  159. LPDWORD pReturned
  160. );
  161. BOOL
  162. FaxMonAddPort(
  163. LPTSTR pServerName,
  164. HWND hwnd,
  165. LPTSTR pMonitorName
  166. );
  167. BOOL
  168. FaxMonAddPortEx(
  169. LPTSTR pServerName,
  170. DWORD level,
  171. LPBYTE pBuffer,
  172. LPTSTR pMonitorName
  173. );
  174. BOOL
  175. FaxMonDeletePort(
  176. LPTSTR pServerName,
  177. HWND hwnd,
  178. LPTSTR pPortName
  179. );
  180. BOOL
  181. FaxMonConfigurePort(
  182. LPWSTR pServerName,
  183. HWND hwnd,
  184. LPWSTR pPortName
  185. );
  186. //
  187. // Get the list of fax devices from the service
  188. //
  189. PFAX_PORT_INFO
  190. MyFaxEnumPorts(
  191. LPDWORD pcPorts,
  192. BOOL useCache
  193. );
  194. //
  195. // Wrapper function for fax service's FaxGetPort API
  196. //
  197. PFAX_PORT_INFO
  198. MyFaxGetPort(
  199. LPTSTR pPortName,
  200. BOOL useCache
  201. );
  202. //
  203. // Make a duplicate of the given character string
  204. //
  205. LPTSTR
  206. DuplicateString(
  207. LPCTSTR pSrcStr
  208. );
  209. //
  210. // Wrapper function for spooler API GetJob
  211. //
  212. PVOID
  213. MyGetJob(
  214. HANDLE hPrinter,
  215. DWORD level,
  216. DWORD jobId
  217. );
  218. //
  219. // Create a temporary file in the system spool directory for storing fax data
  220. //
  221. LPTSTR
  222. CreateTempFaxFile(
  223. LPCTSTR lpctstrPrefix
  224. );
  225. //
  226. // Open a handle to the current fax job file associated with a port
  227. //
  228. BOOL
  229. OpenTempFaxFile(
  230. PFAXPORT pFaxPort,
  231. BOOL doAppend
  232. );
  233. #endif // !_FAXMON_H_