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.

1165 lines
31 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxsvc.h
  5. Abstract:
  6. This is the main fax service header file. All
  7. source modules should include this file ONLY.
  8. Author:
  9. Wesley Witt (wesw) 16-Jan-1996
  10. Revision History:
  11. --*/
  12. #ifndef _FAXSVC_
  13. #define _FAXSVC_
  14. #include <windows.h>
  15. #include <shellapi.h>
  16. #include <winspool.h>
  17. #include <winsprlp.h>
  18. #include <imagehlp.h>
  19. #include <winsock2.h>
  20. #include <userenv.h>
  21. #include <setupapi.h>
  22. #include <ole2.h>
  23. #include <tapi.h>
  24. #include <rpc.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <tchar.h>
  28. #include <time.h>
  29. #include <shlobj.h>
  30. #include <winfax.h>
  31. #include <faxroute.h>
  32. #include <faxdev.h>
  33. #include "winfaxp.h"
  34. #include "faxrpc.h"
  35. #include "faxcli.h"
  36. #include "faxutil.h"
  37. #include "messages.h"
  38. #include "faxsvmsg.h"
  39. #include "tifflib.h"
  40. #include "faxreg.h"
  41. #include "faxsvcrg.h"
  42. #include "jobtag.h"
  43. #include "faxperf.h"
  44. #include "resource.h"
  45. #include "rpcutil.h"
  46. #include "faxmapi.h"
  47. #include "faxevent.h"
  48. #ifdef DBG
  49. #define EnterCriticalSection(cs) pEnterCriticalSection(cs,__LINE__,TEXT(__FILE__))
  50. #define LeaveCriticalSection(cs) pLeaveCriticalSection(cs,__LINE__,TEXT(__FILE__))
  51. #define InitializeCriticalSection(cs) pInitializeCriticalSection(cs,__LINE__,TEXT(__FILE__))
  52. VOID pEnterCriticalSection(
  53. LPCRITICAL_SECTION cs,
  54. DWORD line,
  55. LPTSTR file
  56. );
  57. VOID pLeaveCriticalSection(
  58. LPCRITICAL_SECTION cs,
  59. DWORD line,
  60. LPTSTR file
  61. );
  62. VOID pInitializeCriticalSection(
  63. LPCRITICAL_SECTION cs,
  64. DWORD line,
  65. LPTSTR file
  66. );
  67. typedef struct {
  68. LIST_ENTRY ListEntry;
  69. ULONG_PTR CritSecAddr;
  70. DWORD ThreadId;
  71. DWORD AquiredTime;
  72. DWORD ReleasedTime;
  73. } DBGCRITSEC, * PDBGCRITSEC;
  74. #endif
  75. #define FAX_SERVICE_NAME TEXT("Fax")
  76. #define FAX_DISPLAY_NAME TEXT("Fax Service")
  77. #define FAX_DRIVER_NAME TEXT("Windows NT Fax Driver")
  78. #define FAX_MONITOR_NAME TEXT("Windows NT Fax Monitor")
  79. #define FAX_IMAGE_NAME TEXT("%systemroot%\\system32\\faxsvc.exe")
  80. #define FAX_FILE_PREFIX TEXT("Fax")
  81. #define RAS_MODULE_NAME TEXT("rastapi.dll")
  82. #define FAX_EXTENSION_NAME TEXT("Microsoft Routing Extension")
  83. #define MAX_CLIENTS 1
  84. #define MIN_THREADS 1
  85. #define MAX_STATUS_THREADS 1
  86. #define SIZEOF_PHONENO 64
  87. #define MIN_RINGS_ALLOWED 2
  88. #define MAX_MODEM_POPUPS 2
  89. #define MAX_HANDLES 1024
  90. #define WM_SERVICE_INIT (WM_USER+101)
  91. #define MilliToNano(_ms) ((LONGLONG)(_ms) * 1000 * 10)
  92. #define SecToNano(_sec) (DWORDLONG)((_sec) * 1000 * 1000 * 10)
  93. #define FILLORDER_MSB2LSB 1
  94. #define LINE_SIGNATURE 0x454e494c // 'LINE'
  95. #define ROUTING_SIGNATURE 'RI01'
  96. #define TAPI_COMPLETION_KEY 0x80000001
  97. #define EVENT_COMPLETION_KEY 0x80000002
  98. #define FAXDEV_EVENT_KEY 0x80000003
  99. #define FixupString(_b, _s) (_s) = ((_s) ? (LPTSTR) ((LPBYTE)(_b) + (ULONG_PTR)_s) : 0)
  100. #define USE_SERVER_DEVICE 0xffffffff
  101. //
  102. // delivery report types
  103. //
  104. #define DRT_NONE 0
  105. #define DRT_EMAIL 1
  106. #define DRT_INBOX 2
  107. //
  108. // mapi message importance flags
  109. //
  110. #define IMPORTANCE_LOW 0
  111. #define IMPORTANCE_NORMAL 1
  112. #define IMPORTANCE_HIGH 2
  113. //
  114. // private fax port state masks
  115. // this bits must not conflict with FPS_?? in winfax.h or FS_??? in faxdev.h
  116. //
  117. #define FPS_SENDRETRY 0x2000f001
  118. #define FPS_SENDFAILED 0x2000f002
  119. #define FPS_BLANKSTR 0x2000f003
  120. #define FPS_ROUTERETRY 0x2000f004
  121. #define FPF_USED 0x10000000
  122. #define FPF_POWERED_OFF 0x20000000
  123. #define FPF_RECEIVE_OK 0x40000000
  124. #define FPF_CLIENT_BITS (FPF_RECEIVE | FPF_SEND)
  125. //
  126. // security types
  127. //
  128. // Note - Georgeje
  129. //
  130. // The number of security descriptors has been reduced from six
  131. // to one. The tables in security.c have been left in place in
  132. // case we need to add more security descriptos later.
  133. #define SEC_CONFIG_SET 0
  134. #define SEC_CONFIG_QUERY 0
  135. #define SEC_PORT_SET 0
  136. #define SEC_PORT_QUERY 0
  137. #define SEC_JOB_SET 0
  138. #define SEC_JOB_QUERY 0
  139. typedef struct _DEVICE_PROVIDER {
  140. LIST_ENTRY ListEntry;
  141. HMODULE hModule;
  142. TCHAR FriendlyName[MAX_PATH];
  143. TCHAR ImageName[MAX_PATH];
  144. TCHAR ProviderName[MAX_PATH];
  145. HANDLE HeapHandle;
  146. PFAXDEVINITIALIZE FaxDevInitialize;
  147. PFAXDEVSTARTJOB FaxDevStartJob;
  148. PFAXDEVENDJOB FaxDevEndJob;
  149. PFAXDEVSEND FaxDevSend;
  150. PFAXDEVRECEIVE FaxDevReceive;
  151. PFAXDEVREPORTSTATUS FaxDevReportStatus;
  152. PFAXDEVABORTOPERATION FaxDevAbortOperation;
  153. PFAX_LINECALLBACK FaxDevCallback;
  154. PFAXDEVVIRTUALDEVICECREATION FaxDevVirtualDeviceCreation;
  155. } DEVICE_PROVIDER, *PDEVICE_PROVIDER;
  156. typedef struct _ROUTING_EXTENSION {
  157. LIST_ENTRY ListEntry;
  158. HMODULE hModule;
  159. TCHAR FriendlyName[MAX_PATH];
  160. TCHAR ImageName[MAX_PATH];
  161. TCHAR InternalName[MAX_PATH];
  162. HANDLE HeapHandle;
  163. BOOL MicrosoftExtension;
  164. PFAXROUTEINITIALIZE FaxRouteInitialize;
  165. PFAXROUTEGETROUTINGINFO FaxRouteGetRoutingInfo;
  166. PFAXROUTESETROUTINGINFO FaxRouteSetRoutingInfo;
  167. PFAXROUTEDEVICEENABLE FaxRouteDeviceEnable;
  168. PFAXROUTEDEVICECHANGENOTIFICATION FaxRouteDeviceChangeNotification;
  169. LIST_ENTRY RoutingMethods;
  170. } ROUTING_EXTENSION, *PROUTING_EXTENSION;
  171. typedef struct _ROUTING_METHOD {
  172. LIST_ENTRY ListEntry;
  173. LIST_ENTRY ListEntryMethod;
  174. GUID Guid;
  175. DWORD Priority;
  176. LPTSTR FunctionName;
  177. LPTSTR FriendlyName;
  178. LPTSTR InternalName;
  179. PFAXROUTEMETHOD FaxRouteMethod;
  180. PROUTING_EXTENSION RoutingExtension;
  181. } ROUTING_METHOD, *PROUTING_METHOD;
  182. typedef BOOL (CALLBACK *PFAXROUTEMETHODENUM)(PROUTING_METHOD,LPVOID);
  183. typedef struct _FAX_ROUTE_FILE {
  184. LIST_ENTRY ListEntry; // linked list pointers
  185. LPWSTR FileName; // file name on disk
  186. GUID Guid; // routing method that created the file
  187. } FAX_ROUTE_FILE, *PFAX_ROUTE_FILE;
  188. typedef struct _LINE_INFO {
  189. LIST_ENTRY ListEntry; // linked list pointers
  190. DWORD Signature; // verification signature
  191. DWORD DeviceId; // tapi device id
  192. DWORD PermanentLineID; // permanent tapi device id
  193. HLINE hLine; // tapi line handle
  194. PDEVICE_PROVIDER Provider; // fax service device provider
  195. struct _JOB_ENTRY *JobEntry; // non-null if there is an outstanding job
  196. LPTSTR DeviceName; // device name
  197. DWORD State; // device state
  198. DWORD Flags; // device use flags
  199. LPTSTR Csid; // calling station's identifier
  200. LPTSTR Tsid; // transmittion station's identifier
  201. DWORD Priority; // sending priority
  202. BOOL UnimodemDevice; // true if this device is a modem
  203. HANDLE InitEvent; // part of the init phase
  204. DWORD RequestId; //
  205. DWORD Result; //
  206. DWORD RingsForAnswer; //
  207. DWORD RingCount; //
  208. LINEMESSAGE LineMsgOffering; //
  209. DWORD ModemPopUps; //
  210. DWORD ModemPopupActive; //
  211. BOOL ModemInUse; // TRUE if the modem is in use by another TAPI app
  212. BOOL OpenInProgress; //
  213. DWORD LineStates; //
  214. HCALL RasCallHandle; // used to track call when handed to RAS
  215. BOOL NewCall; // A new call is coming in
  216. HCALL HandoffCallHandle; // call handle for a handoff job
  217. } LINE_INFO, *PLINE_INFO;
  218. typedef struct {
  219. HANDLE hComm;
  220. CHAR szDeviceName[1];
  221. } DEVICEID, *PDEVICEID;
  222. typedef struct _ROUTING_DATA_OVERRIDE {
  223. LIST_ENTRY ListEntry; //
  224. LPBYTE RoutingData; //
  225. DWORD RoutingDataSize; //
  226. PROUTING_METHOD RoutingMethod; //
  227. } ROUTING_DATA_OVERRIDE, *PROUTING_DATA_OVERRIDE;
  228. typedef struct _ROUTE_FAILURE_INFO {
  229. WCHAR GuidString[MAX_GUID_STRING_LEN]; // GUID of the rounting method that failed
  230. PVOID FailureData; // pointer to the routing method's data
  231. DWORD FailureSize; // routing method's data size in bytes
  232. } ROUTE_FAILURE_INFO, *PROUTE_FAILURE_INFO;
  233. typedef struct _JOB_ENTRY {
  234. LIST_ENTRY ListEntry; //
  235. DWORD JobId; // fax job id
  236. DWORD JobType; // send or receive?
  237. PLINE_INFO LineInfo; //
  238. HCALL CallHandle; //
  239. DWORD InstanceData; //
  240. DWORD ErrorCode; //
  241. DWORDLONG StartTime; //
  242. DWORDLONG EndTime; //
  243. DWORDLONG ElapsedTime; //
  244. DWORD RefCount; //
  245. BOOL Aborting; // is the job being aborted?
  246. INT SendIdx; //
  247. TCHAR PhoneNumber[SIZEOF_PHONENO];// phone number for current send job
  248. HANDLE hEventEnd; //
  249. FAX_DEV_STATUS FaxStatus; // most recent FAX_DEV_STATUS for this job
  250. FAX_JOB_PARAM JobParam; // job params for send jobs
  251. DWORD DeliveryReportType; //
  252. LPTSTR DeliveryReportAddress; //
  253. LPVOID DeliveryReportProfile; //
  254. BOOL Released; //
  255. LPTSTR DocumentName; //
  256. LPTSTR UserName; // user that submitted job (needed for FAX_GetDeviceStatus)
  257. DWORD PageCount; // total pages for outbound job (needed for FAX_GetDeviceStatus)
  258. DWORD FileSize; // total pages for outbound job (needed for FAX_GetDeviceStatus)
  259. BOOL BroadcastJob; // is this a broadcast fax job?
  260. BOOL HandoffJob; // is this a handoff job?
  261. HANDLE hCallHandleEvent; // event for signalling line handoff
  262. } JOB_ENTRY, *PJOB_ENTRY;
  263. typedef struct _JOB_QUEUE {
  264. LIST_ENTRY ListEntry; // linked list pointers
  265. DWORDLONG UniqueId; //
  266. DWORDLONG ScheduleTime; // schedule time in 64bit version
  267. DWORD JobId; // fax job id
  268. DWORD JobType; // job type, see JT defines
  269. BOOL Paused; // should the job be started?
  270. LPTSTR DeliveryReportAddress; //
  271. DWORD DeliveryReportType; //
  272. LPVOID DeliveryReportProfile; //
  273. LPTSTR FileName; //
  274. LPTSTR UserName; //
  275. FAX_JOB_PARAMW JobParams; //
  276. PJOB_ENTRY JobEntry; //
  277. LPTSTR QueueFileName; //
  278. DWORD JobStatus; // job status, see JS defines
  279. DWORD PageCount; // total pages
  280. DWORD FileSize; // file size in bytes, up to 4Gb
  281. BOOL BroadcastJob; // is this a broadcast fax job?
  282. struct _JOB_QUEUE *BroadcastOwner; // queue entry for the owner job
  283. DWORDLONG BroadcastOwnerUniqueId; // used only for queue restore
  284. DWORD BroadcastCount; // owner's count of his children
  285. DWORD RefCount; //
  286. DWORD DeviceId; // device ID for a handoff job
  287. LIST_ENTRY FaxRouteFiles; // list of files to be routed
  288. DWORD CountFaxRouteFiles; // count of files to be routed
  289. CRITICAL_SECTION CsFileList; // file list lock
  290. LIST_ENTRY RoutingDataOverride; //
  291. CRITICAL_SECTION CsRoutingDataOverride; //
  292. DWORD SendRetries; // number of times send attempt has been made
  293. PFAX_ROUTE FaxRoute;
  294. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  295. ROUTE_FAILURE_INFO RouteFailureInfo[1]; // array of ROUTE_FAILURE_INFO structs
  296. } JOB_QUEUE, *PJOB_QUEUE;
  297. typedef struct _JOB_QUEUE_FILE {
  298. DWORD SizeOfStruct; // size of this structure
  299. DWORDLONG UniqueId; //
  300. DWORD JobType; // job type, see JT defines
  301. LPTSTR FileName; //
  302. LPTSTR QueueFileName; //
  303. LPTSTR UserName; //
  304. LPTSTR RecipientNumber; // recipient fax number
  305. LPTSTR RecipientName; // recipient name
  306. LPTSTR Tsid; // transmitter's id
  307. LPTSTR SenderName; // sender name
  308. LPTSTR SenderCompany; // sender company
  309. LPTSTR SenderDept; // sender department
  310. LPTSTR BillingCode; // billing code
  311. LPTSTR DeliveryReportAddress; //
  312. LPTSTR DocumentName; //
  313. DWORD PageCount; // total pages
  314. DWORD FileSize; // file size in bytes, up to 4Gb
  315. DWORD DeliveryReportType; //
  316. DWORD ScheduleAction; // when to schedule the fax, see JSA defines
  317. DWORDLONG ScheduleTime; // schedule time in 64bit version
  318. BOOL BroadcastJob; // is this a broadcast fax job?
  319. DWORDLONG BroadcastOwner; // unique id of the broadcast owner
  320. DWORD SendRetries; // number of times send attempt has been made
  321. DWORD FaxRouteSize;
  322. PFAX_ROUTE FaxRoute;
  323. DWORD CountFaxRouteFiles; // count of files to be routed
  324. DWORD FaxRouteFileGuid; // offset array of GUID's
  325. DWORD FaxRouteFiles; // offset to a multi-sz of filenames
  326. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  327. ROUTE_FAILURE_INFO RouteFailureInfo[1]; // array of ROUTE_FAILURE_INFO structs
  328. } JOB_QUEUE_FILE, *PJOB_QUEUE_FILE;
  329. typedef struct _FAX_SEND_ITEM {
  330. PJOB_ENTRY JobEntry; //
  331. LPTSTR FileName; // The following items are copied from the FAX_JOB_PARAM struct
  332. LPTSTR PhoneNumber; // RecipientNumber
  333. LPTSTR Tsid; // TSID
  334. LPTSTR RecipientName; //
  335. LPTSTR SenderName; //
  336. LPTSTR SenderCompany; //
  337. LPTSTR SenderDept; //
  338. LPTSTR BillingCode; //
  339. PJOB_QUEUE JobQueue; //
  340. LPTSTR DocumentName; //
  341. } FAX_SEND_ITEM, *PFAX_SEND_ITEM;
  342. typedef struct _ROUTE_INFO {
  343. DWORD Signature; // file signature
  344. DWORD StringSize; // size of strings in bytes
  345. DWORD FailureSize; // size of failure data in bytes
  346. LPWSTR TiffFileName; // original tiff file name
  347. LPWSTR ReceiverName; // receiver's name
  348. LPWSTR ReceiverNumber; // receiver's fax number
  349. LPWSTR DeviceName; // device name on which the fax was received
  350. LPWSTR Csid; // calling station's identifier
  351. LPWSTR Tsid; // transmitter's station identifier
  352. LPWSTR CallerId; // caller id information
  353. LPWSTR RoutingInfo; // routing info: DID, T.30 subaddress, etc.
  354. DWORDLONG ElapsedTime; // elapsed time for fax receive
  355. // DWORD RouteFailureCount; // number of failure data blocks
  356. // ROUTE_FAILURE_INFO RouteFailure[...]; // routing failure data blocks
  357. } ROUTE_INFO, *PROUTE_INFO;
  358. typedef struct _MESSAGEBOX_DATA {
  359. LPTSTR Text; //
  360. LPDWORD Response; //
  361. DWORD Type; //
  362. } MESSAGEBOX_DATA, *PMESSAGEBOX_DATA;
  363. typedef struct _FAX_RECEIVE_ITEM {
  364. PJOB_ENTRY JobEntry; //
  365. HCALL hCall; //
  366. PLINE_INFO LineInfo; //
  367. LPTSTR FileName; //
  368. } FAX_RECEIVE_ITEM, *PFAX_RECEIVE_ITEM;
  369. typedef struct _FAX_CLIENT_DATA {
  370. LIST_ENTRY ListEntry; //
  371. handle_t hBinding; //
  372. handle_t FaxHandle; //
  373. LPCTSTR MachineName; //
  374. LPCTSTR ClientName; //
  375. ULONG64 Context; //
  376. HANDLE FaxClientHandle; //
  377. HWND hWnd; //
  378. DWORD MessageStart; //
  379. BOOL StartedMsg; // only send FEI_FAXSVC_STARTED once to each client
  380. HANDLE hClientToken; // to impersonate client's desktop
  381. LPCTSTR WindowStation;
  382. LPCTSTR Desktop;
  383. } FAX_CLIENT_DATA, *PFAX_CLIENT_DATA;
  384. typedef struct _MDM_DEVSPEC {
  385. DWORD Contents; // Set to 1 (indicates containing key)
  386. DWORD KeyOffset; // Offset to key from start of this struct.
  387. // (not from start of LINEDEVCAPS ).
  388. // 8 in our case.
  389. CHAR String[1]; // place containing null-terminated registry key.
  390. } MDM_DEVSPEC, *PMDM_DEVSPEC;
  391. //
  392. // fax handle defines & structs
  393. //
  394. #define FHT_PORT 1
  395. #define FHT_CON 2 // connection handle
  396. typedef struct _HANDLE_ENTRY {
  397. LIST_ENTRY ListEntry; // linked list pointers
  398. handle_t hBinding; //
  399. DWORD Type; // handle type, see FHT defines
  400. PLINE_INFO LineInfo; // pointer to line information
  401. PJOB_ENTRY JobEntry; // pointer to job entry
  402. DWORD Flags; // open flags
  403. } HANDLE_ENTRY, *PHANDLE_ENTRY;
  404. typedef struct _DEVICE_SORT {
  405. DWORD Priority;
  406. PLINE_INFO LineInfo;
  407. } DEVICE_SORT, *PDEVICE_SORT;
  408. typedef struct _METHOD_SORT {
  409. DWORD Priority;
  410. PROUTING_METHOD RoutingMethod;
  411. } METHOD_SORT, *PMETHOD_SORT;
  412. typedef struct _QUEUE_SORT {
  413. DWORDLONG ScheduleTime;
  414. PJOB_QUEUE QueueEntry;
  415. } QUEUE_SORT, *PQUEUE_SORT;
  416. //
  417. // externs
  418. //
  419. extern BOOL ServiceDebug; //
  420. extern HLINEAPP hLineApp; //
  421. extern CRITICAL_SECTION CsJob; // protects the job list
  422. extern CRITICAL_SECTION CsSession; // protects the session list
  423. extern DWORD Installed; //
  424. extern DWORD InstallType; //
  425. extern DWORD InstalledPlatforms; //
  426. extern DWORD ProductType; //
  427. extern PFAX_PERF_COUNTERS PerfCounters; //
  428. extern LIST_ENTRY JobListHead; //
  429. extern LPVOID InboundProfileInfo; //
  430. extern CRITICAL_SECTION CsLine; // critical section for accessing tapi lines
  431. extern CRITICAL_SECTION CsPerfCounters; // critical section for performance monitor counters
  432. extern DWORD TotalSeconds; // use to compute PerfCounters->TotalMinutes
  433. extern DWORD InboundSeconds; //
  434. extern DWORD OutboundSeconds; //
  435. extern DWORD TapiDevices; // number of tapi devices
  436. extern LIST_ENTRY TapiLinesListHead; // linked list of tapi lines
  437. extern HANDLE FaxStatusEvent; //
  438. extern LIST_ENTRY ClientsListHead; //
  439. extern CRITICAL_SECTION CsClients; //
  440. extern HANDLE TapiCompletionPort; //
  441. extern HANDLE StatusCompletionPortHandle;
  442. extern HANDLE FaxSvcHeapHandle; //
  443. extern DWORD CountRoutingMethods; // total number of routing methods for ALL extensions
  444. //extern LPTSTR FaxReceiveDir; //
  445. //extern LPTSTR FaxQueueDir; //
  446. extern LIST_ENTRY QueueListHead; //
  447. extern CRITICAL_SECTION CsQueue; //
  448. extern DWORD QueueCount; //
  449. extern BOOL QueuePaused; //
  450. extern HANDLE QueueTimer; //
  451. extern DWORD NextJobId; //
  452. extern GUID FaxSvcGuid; //
  453. extern LPTSTR InboundProfileName; //
  454. extern DWORD FaxSendRetries; //
  455. extern DWORD FaxSendRetryDelay; //
  456. extern DWORD FaxDirtyDays; //
  457. extern BOOL FaxUseDeviceTsid; //
  458. extern BOOL FaxUseBranding; //
  459. extern BOOL ServerCp; //
  460. extern FAX_TIME StartCheapTime; //
  461. extern FAX_TIME StopCheapTime; //
  462. extern BOOL ArchiveOutgoingFaxes; //
  463. extern LPTSTR ArchiveDirectory; //
  464. extern BOOL ForceReceive; //
  465. extern DWORD TerminationDelay; //
  466. extern WCHAR FaxDir[MAX_PATH]; //
  467. extern WCHAR FaxQueueDir[MAX_PATH]; //
  468. extern WCHAR FaxReceiveDir[MAX_PATH]; //
  469. extern HANDLE JobQueueSemaphore; //
  470. //
  471. // prototypes
  472. //
  473. BOOL
  474. CommitQueueEntry(
  475. PJOB_QUEUE JobQueue,
  476. LPTSTR QueueFileName,
  477. DWORDLONG UniqueId
  478. );
  479. VOID
  480. FaxServiceMain(
  481. DWORD argc,
  482. LPTSTR *argv
  483. );
  484. VOID
  485. FaxServiceCtrlHandler(
  486. DWORD Opcode
  487. );
  488. DWORD
  489. InstallService(
  490. LPTSTR Username,
  491. LPTSTR Password
  492. );
  493. DWORD
  494. RemoveService(
  495. void
  496. );
  497. int
  498. DebugService(
  499. VOID
  500. );
  501. DWORD
  502. ServiceStart(
  503. VOID
  504. );
  505. void
  506. ServiceStop(
  507. void
  508. );
  509. void EndFaxSvc(
  510. BOOL bEndProcess,
  511. DWORD Severity
  512. );
  513. DWORD
  514. ReportServiceStatus(
  515. DWORD CurrentState,
  516. DWORD Win32ExitCode,
  517. DWORD WaitHint
  518. );
  519. //
  520. // util.c
  521. //
  522. void
  523. LogMessage(
  524. DWORD FormatId,
  525. ...
  526. );
  527. LPTSTR
  528. GetLastErrorText(
  529. DWORD ErrorCode
  530. );
  531. DWORD MyGetFileSize(
  532. LPCTSTR FileName
  533. );
  534. //
  535. // tapi.c
  536. //
  537. DWORD
  538. TapiInitialize(
  539. PREG_FAX_SERVICE FaxReg
  540. );
  541. PLINE_INFO
  542. GetTapiLineFromDeviceId(
  543. DWORD DeviceId
  544. );
  545. PLINE_INFO
  546. GetTapiLineForFaxOperation(
  547. DWORD DeviceId,
  548. DWORD JobType,
  549. LPWSTR FaxNumber,
  550. BOOL Handoff
  551. );
  552. BOOL
  553. ReleaseTapiLine(
  554. PLINE_INFO LineInfo,
  555. HCALL hCall
  556. );
  557. DWORD
  558. QueueTapiCallback(
  559. PLINE_INFO LineInfo,
  560. DWORD hDevice,
  561. DWORD dwMessage,
  562. DWORD dwInstance,
  563. DWORD dwParam1,
  564. DWORD dwParam2,
  565. DWORD dwParam3
  566. );
  567. VOID
  568. SpoolerSetAllTapiLinesActive(
  569. VOID
  570. );
  571. //
  572. // tapidbg.c
  573. //
  574. VOID
  575. ShowLineEvent(
  576. HLINE htLine,
  577. HCALL htCall,
  578. LPTSTR MsgStr,
  579. DWORD_PTR dwCallbackInstance,
  580. DWORD dwMsg,
  581. DWORD_PTR dwParam1,
  582. DWORD_PTR dwParam2,
  583. DWORD_PTR dwParam3
  584. );
  585. //
  586. // faxdev.c
  587. //
  588. BOOL
  589. LoadDeviceProviders(
  590. PREG_FAX_SERVICE FaxReg
  591. );
  592. BOOL
  593. InitializeDeviceProviders(
  594. VOID
  595. );
  596. PDEVICE_PROVIDER
  597. FindDeviceProvider(
  598. LPTSTR ProviderName
  599. );
  600. //
  601. // job.c
  602. //
  603. BOOL
  604. InitializeJobManager(
  605. PREG_FAX_SERVICE FaxReg
  606. );
  607. PJOB_ENTRY
  608. StartJob(
  609. DWORD DeviceId,
  610. DWORD JobType,
  611. LPWSTR FaxNumber
  612. );
  613. BOOL
  614. EndJob(
  615. PJOB_ENTRY JobEntry
  616. );
  617. BOOL
  618. ReleaseJob(
  619. IN PJOB_ENTRY JobEntry
  620. );
  621. DWORD
  622. SendDocument(
  623. PJOB_ENTRY JobEntry,
  624. LPTSTR FileName,
  625. PFAX_JOB_PARAM JobParam,
  626. PJOB_QUEUE JobQueue
  627. );
  628. VOID
  629. SetRetryValues(
  630. PREG_FAX_SERVICE FaxReg
  631. );
  632. VOID
  633. FaxLogSend(
  634. PFAX_SEND_ITEM FaxSendItem,
  635. BOOL Rslt,
  636. PFAX_DEV_STATUS FaxStatus,
  637. BOOL Retrying
  638. );
  639. LPTSTR
  640. ExtractFaxTag(
  641. LPTSTR pTagKeyword,
  642. LPTSTR pTaggedStr,
  643. INT *pcch
  644. );
  645. BOOL
  646. AddTiffTags(
  647. LPTSTR FaxFileName,
  648. DWORDLONG SendTime,
  649. PFAX_DEV_STATUS FaxStatus,
  650. PFAX_SEND FaxSend
  651. );
  652. //
  653. // receive.c
  654. //
  655. DWORD
  656. StartFaxReceive(
  657. PJOB_ENTRY JobEntry,
  658. HCALL hCall,
  659. PLINE_INFO LineInfo,
  660. LPTSTR FileName,
  661. DWORD FileNameSize
  662. );
  663. //
  664. // route.c
  665. //
  666. BOOL
  667. InitializeRouting(
  668. PREG_FAX_SERVICE FaxReg
  669. );
  670. BOOL
  671. FaxRoute(
  672. PJOB_QUEUE JobQueue,
  673. LPTSTR TiffFileName,
  674. PFAX_ROUTE FaxRoute,
  675. PROUTE_FAILURE_INFO *RouteFailureInfo,
  676. LPDWORD RouteFailureCount
  677. );
  678. LPTSTR
  679. TiffFileNameToRouteFileName(
  680. LPTSTR TiffFileName
  681. );
  682. BOOL
  683. LoadRouteInfo(
  684. IN LPWSTR RouteFileName,
  685. OUT PROUTE_INFO *RouteInfo,
  686. OUT PROUTE_FAILURE_INFO *RouteFailure,
  687. OUT LPDWORD RouteFailureCount
  688. );
  689. PFAX_ROUTE
  690. SerializeFaxRoute(
  691. IN PFAX_ROUTE FaxRoute,
  692. IN LPDWORD Size
  693. );
  694. PFAX_ROUTE
  695. DeSerializeFaxRoute(
  696. IN PFAX_ROUTE FaxRoute
  697. );
  698. BOOL
  699. FaxRouteRetry(
  700. PFAX_ROUTE FaxRoute,
  701. PROUTE_FAILURE_INFO RouteFailureInfo
  702. );
  703. //
  704. // modem.c
  705. //
  706. DWORD
  707. GetModemClass(
  708. HANDLE hFile
  709. );
  710. //
  711. // print.c
  712. //
  713. BOOL
  714. ArchivePrintJob(
  715. LPTSTR FaxFileName
  716. );
  717. LPTSTR
  718. GetString(
  719. DWORD InternalId
  720. );
  721. BOOL
  722. IsPrinterFaxPrinter(
  723. LPTSTR PrinterName
  724. );
  725. BOOL CALLBACK
  726. FaxDeviceProviderCallback(
  727. IN HANDLE FaxHandle,
  728. IN DWORD DeviceId,
  729. IN DWORD_PTR Param1,
  730. IN DWORD_PTR Param2,
  731. IN DWORD_PTR Param3
  732. );
  733. BOOL
  734. InitializePrinting(
  735. VOID
  736. );
  737. PJOB_ENTRY
  738. FindJob(
  739. IN HANDLE FaxHandle
  740. );
  741. PJOB_ENTRY
  742. FindJobByPrintJob(
  743. IN DWORD PrintJobId
  744. );
  745. BOOL
  746. HandoffCallToRas(
  747. PLINE_INFO LineInfo,
  748. HCALL hCall
  749. );
  750. VOID
  751. StoreString(
  752. LPCTSTR String,
  753. PULONG_PTR DestString,
  754. LPBYTE Buffer,
  755. PULONG_PTR Offset
  756. );
  757. VOID
  758. InitializeStringTable(
  759. VOID
  760. );
  761. BOOL
  762. InitializeFaxDirectories(
  763. VOID
  764. );
  765. BOOL
  766. OpenTapiLine(
  767. PLINE_INFO LineInfo
  768. );
  769. PVOID
  770. MyGetJob(
  771. HANDLE hPrinter,
  772. DWORD level,
  773. DWORD jobId
  774. );
  775. LPLINEDEVCAPS
  776. MyLineGetDevCaps(
  777. DWORD DeviceId
  778. );
  779. LONG
  780. MyLineGetTransCaps(
  781. LPLINETRANSLATECAPS *LineTransCaps
  782. );
  783. LONG
  784. MyLineTranslateAddress(
  785. LPTSTR Address,
  786. DWORD DeviceId,
  787. LPLINETRANSLATEOUTPUT *TranslateOutput
  788. );
  789. DWORDLONG
  790. GenerateUniqueFileName(
  791. LPTSTR Directory,
  792. LPTSTR Extension,
  793. LPTSTR FileName,
  794. DWORD FileNameSize
  795. );
  796. BOOL
  797. ServiceMessageBox(
  798. IN LPCTSTR MsgString,
  799. IN DWORD Type,
  800. IN BOOL UseThread,
  801. IN LPDWORD Response,
  802. IN ...
  803. );
  804. VOID
  805. SetLineState(
  806. PLINE_INFO LineInfo,
  807. DWORD State
  808. );
  809. BOOL
  810. CreateFaxEvent(
  811. DWORD DeviceId,
  812. DWORD EventId,
  813. DWORD JobId
  814. );
  815. BOOL
  816. GetFaxEvent(
  817. PLINE_INFO LineInfo,
  818. PFAX_EVENT Event
  819. );
  820. DWORD
  821. MapStatusIdToEventId(
  822. DWORD StatusId
  823. );
  824. BOOL
  825. InitializeHandleTable(
  826. PREG_FAX_SERVICE FaxReg
  827. );
  828. PHANDLE_ENTRY
  829. CreateNewPortHandle(
  830. handle_t hBinding,
  831. PLINE_INFO LineInfo,
  832. DWORD Flags
  833. );
  834. PHANDLE_ENTRY
  835. CreateNewConnectionHandle(
  836. handle_t hBinding
  837. );
  838. BOOL
  839. IsPortOpenedForModify(
  840. PLINE_INFO LineInfo
  841. );
  842. VOID
  843. CloseFaxHandle(
  844. PHANDLE_ENTRY HandleEntry
  845. );
  846. LPLINEDEVSTATUS
  847. MyLineGetLineDevStatus(
  848. HLINE hLine
  849. );
  850. DWORD
  851. InitializeFaxSecurityDescriptors(
  852. VOID
  853. );
  854. BOOL
  855. FaxSvcAccessCheck(
  856. DWORD SecurityType,
  857. ACCESS_MASK DesiredAccess
  858. );
  859. BOOL
  860. PostClientMessage(
  861. PFAX_CLIENT_DATA ClientData,
  862. PFAX_EVENT FaxEvent
  863. );
  864. BOOL
  865. BuildSecureSD(
  866. OUT PSECURITY_DESCRIPTOR *Dacl
  867. );
  868. PROUTING_METHOD
  869. FindRoutingMethodByGuid(
  870. IN LPCWSTR RoutingGuidString
  871. );
  872. DWORD
  873. EnumerateRoutingMethods(
  874. IN PFAXROUTEMETHODENUM Enumerator,
  875. IN LPVOID Context
  876. );
  877. VOID
  878. RescheduleJobQueueEntry(
  879. IN PJOB_QUEUE JobQueue
  880. );
  881. VOID
  882. SortJobQueue(
  883. VOID
  884. );
  885. PJOB_QUEUE
  886. AddJobQueueEntry(
  887. IN DWORD JobType,
  888. IN LPCTSTR FileName,
  889. IN const FAX_JOB_PARAMW *JobParams,
  890. IN LPCWSTR UserName,
  891. IN BOOL CreateQueueFile,
  892. IN PJOB_ENTRY JobEntry
  893. );
  894. VOID
  895. SetDiscountTime(
  896. IN OUT LPSYSTEMTIME SystemTime
  897. );
  898. LPWSTR
  899. GetClientUserName(
  900. VOID
  901. );
  902. BOOL
  903. RestoreFaxQueue(
  904. VOID
  905. );
  906. PJOB_QUEUE
  907. FindJobQueueEntryByJobQueueEntry(
  908. IN PJOB_QUEUE JobQueueEntry
  909. );
  910. PJOB_QUEUE
  911. FindJobQueueEntry(
  912. IN DWORD JobId
  913. );
  914. PJOB_QUEUE
  915. FindJobQueueEntryByUniqueId(
  916. IN DWORDLONG UniqueId
  917. );
  918. BOOL
  919. RemoveJobQueueEntry(
  920. IN PJOB_QUEUE JobQueue
  921. );
  922. DWORD
  923. JobQueueThread(
  924. LPVOID UnUsed
  925. );
  926. BOOL
  927. ResumeJobQueueEntry(
  928. IN PJOB_QUEUE JobQueue
  929. );
  930. BOOL
  931. PauseJobQueueEntry(
  932. IN PJOB_QUEUE JobQueue
  933. );
  934. VOID
  935. PauseServerQueue(
  936. VOID
  937. );
  938. VOID
  939. ResumeServerQueue(
  940. VOID
  941. );
  942. BOOL
  943. SetFaxServiceAutoStart(
  944. VOID
  945. );
  946. BOOL
  947. SortDevicePriorities(
  948. VOID
  949. );
  950. DWORD
  951. GetFaxDeviceCount(
  952. VOID
  953. );
  954. BOOL
  955. CommitDeviceChanges(
  956. VOID
  957. );
  958. BOOL
  959. SortMethodPriorities(
  960. VOID
  961. );
  962. BOOL
  963. CommitMethodChanges(
  964. VOID
  965. );
  966. VOID
  967. UpdateVirtualDevices(
  968. VOID
  969. );
  970. BOOL
  971. IsVirtualDevice(
  972. PLINE_INFO LineInfo
  973. );
  974. DWORD
  975. ValidateTiffFile(
  976. LPCWSTR TiffFile
  977. );
  978. #endif