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.

2084 lines
66 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 <imagehlp.h>
  18. #include <winsock2.h>
  19. #include <setupapi.h>
  20. #include <ole2.h>
  21. #include <tapi.h>
  22. #include <rpc.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <tchar.h>
  26. #include <time.h>
  27. #include <shlobj.h>
  28. #include <stddef.h>
  29. #include <fxsapip.h>
  30. #include <faxroute.h>
  31. #include <faxdev.h>
  32. #include <faxdevex.h>
  33. #include <faxext.h>
  34. #include <sddl.h>
  35. #include <objbase.h>
  36. #include <lmcons.h>
  37. #include <Wincrui.h>
  38. #include "fxsapip.h"
  39. #include "faxrpc.h"
  40. #include "faxcli.h"
  41. #include "faxutil.h"
  42. #include "CritSec.h"
  43. #include "faxevent_messages.h"
  44. #include "faxmsg.h"
  45. #include "tifflib.h"
  46. #include "faxreg.h"
  47. #include "faxsvcrg.h"
  48. #include "faxperf.h"
  49. #include "resource.h"
  50. #include "rpcutil.h"
  51. #include "faxmapi.h"
  52. #include "faxevent.h"
  53. #include "tiff.h"
  54. #include "archive.h"
  55. #include "tapiCountry.h"
  56. #include "RouteGroup.h"
  57. #include "RouteRule.h"
  58. #include "Events.h"
  59. #include "prtcovpg.h"
  60. #include "faxres.h"
  61. #include "Dword2Str.h"
  62. #define INBOX_TABLE TEXT("Inbox")
  63. #define OUTBOX_TABLE TEXT("Outbox")
  64. #define EMPTY_LOG_STRING TEXT(" ")
  65. #define TAB_LOG_STRING TEXT(" ") // Define '/t' to 4 spaces ,so we can use TAB as a delimeter
  66. #define NEW_LINE_LOG_CHAR TEXT(' ') // Define '/n' to 1 space ,so we can log strings with '/n'
  67. #define FIELD_TYPE_TEXT TEXT("Char")
  68. #define FIELD_TYPE_DATE TEXT("Date")
  69. #define FIELD_TYPE_FLOAT TEXT("Float")
  70. typedef struct _LOG_STRING_TABLE {
  71. DWORD FieldStringResourceId;
  72. LPTSTR Type;
  73. DWORD Size;
  74. LPTSTR String;
  75. } LOG_STRING_TABLE, *PLOG_STRING_TABLE;
  76. extern HANDLE g_hInboxActivityLogFile;
  77. extern HANDLE g_hOutboxActivityLogFile;
  78. //
  79. // TAPI versions
  80. //
  81. #define MAX_TAPI_API_VER 0x00020000
  82. #define MIN_TAPI_API_VER MAX_TAPI_API_VER
  83. #define MIN_TAPI_LINE_API_VER 0x00010003
  84. #define MAX_TAPI_LINE_API_VER MAX_TAPI_API_VER
  85. #define FSPI_JOB_STATUS_INFO_FSP_PRIVATE_STATUS_CODE 0x10000000
  86. //
  87. // JobStatus - Virtual property support
  88. //
  89. #define JS_INVALID 0x00000000
  90. typedef enum {
  91. FAX_TIME_TYPE_START = 1,
  92. FAX_TIME_TYPE_END
  93. } FAX_ENUM_TIME_TYPES;
  94. #define ALL_FAX_USER_ACCESS_RIGHTS (READ_CONTROL | WRITE_DAC | WRITE_OWNER | FAX_GENERIC_ALL)
  95. #if DBG
  96. BOOL DebugDateTime( IN DWORDLONG DateTime, OUT LPTSTR lptstrDateTime, IN UINT cchstrDateTime);
  97. VOID DebugPrintDateTime(LPTSTR Heading,DWORDLONG DateTime);
  98. void PrintJobQueue(LPCTSTR lptstrStr, const LIST_ENTRY * lpQueueHead);
  99. #else
  100. #define PrintJobQueue( str, Queue )
  101. #define DebugPrintDateTime( Heading, DateTime )
  102. #define DebugDateTime( DateTime, lptstrDateTime, cchstrDateTime)
  103. #define DumpRecipientJob(lpcRecipJob)
  104. #define DumpParentJobJob(lpcParentJob)
  105. #endif
  106. #ifdef DBG
  107. #define EnterCriticalSection(cs) pEnterCriticalSection(cs,__LINE__,TEXT(__FILE__))
  108. #define LeaveCriticalSection(cs) pLeaveCriticalSection(cs,__LINE__,TEXT(__FILE__))
  109. VOID pEnterCriticalSection(
  110. LPCRITICAL_SECTION cs,
  111. DWORD line,
  112. LPTSTR file
  113. );
  114. VOID pLeaveCriticalSection(
  115. LPCRITICAL_SECTION cs,
  116. DWORD line,
  117. LPTSTR file
  118. );
  119. BOOL
  120. ThreadOwnsCs(
  121. VOID
  122. );
  123. typedef struct {
  124. LIST_ENTRY ListEntry;
  125. ULONG_PTR CritSecAddr;
  126. DWORD ThreadId;
  127. DWORD AquiredTime;
  128. DWORD ReleasedTime;
  129. } DBGCRITSEC, * PDBGCRITSEC;
  130. #endif
  131. #define FAX_IMAGE_NAME FAX_SERVICE_IMAGE_NAME
  132. #define RAS_MODULE_NAME TEXT("rastapi.dll")
  133. #define MAX_CLIENTS 1
  134. #define MIN_THREADS 1
  135. #define MAX_STATUS_THREADS 1
  136. #define SIZEOF_PHONENO 256
  137. #define EX_STATUS_STRING_LEN 256
  138. #define MIN_RINGS_ALLOWED 2
  139. #define MAX_MODEM_POPUPS 2
  140. #define MAX_HANDLES 1024
  141. #define WM_SERVICE_INIT (WM_USER+101)
  142. #define MilliToNano(_ms) ((LONGLONG)(_ms) * 1000 * 10)
  143. #define SecToNano(_sec) (DWORDLONG)((_sec) * 1000 * 1000 * 10)
  144. #define FILLORDER_MSB2LSB 1
  145. #define LINE_SIGNATURE 0x454e494c // 'LINE'
  146. #define ROUTING_SIGNATURE 'RI01'
  147. #define TAPI_COMPLETION_KEY 0x80000001
  148. #define FAXDEV_EVENT_KEY 0x80000002
  149. #define FSPI_JOB_STATUS_MSG_KEY 0x80000003 // Used internally to post FSPI_JOB_STATUS_MSG messages to the FaxStatusThread
  150. #define EFAXDEV_EVENT_KEY 0x80000004
  151. #define ANSWERNOW_EVENT_KEY 0x80000005
  152. #define SERVICE_SHUT_DOWN_KEY 0xffffffff
  153. #define FixupString(_b, _s) (_s) = ((_s) ? (LPTSTR) ((LPBYTE)(_b) + (ULONG_PTR)_s) : 0)
  154. #define FAX_DEVICE_TYPE_NEW 1
  155. #define FAX_DEVICE_TYPE_CACHED 2
  156. #define FAX_DEVICE_TYPE_OLD 4
  157. #define FAX_DEVICE_TYPE_MANUAL_ANSWER 8
  158. //
  159. // private fax port state masks
  160. // this bits must not conflict with FPS_?? in winfax.h or FS_??? in faxdev.h
  161. //
  162. #define FPS_SENDRETRY 0x2000f001
  163. #define FPS_SENDFAILED 0x2000f002
  164. #define FPS_BLANKSTR 0x2000f003
  165. #define FPS_ROUTERETRY 0x2000f004
  166. #define FPF_USED 0x10000000
  167. #define FPF_POWERED_OFF 0x20000000
  168. #define FPF_CLIENT_BITS (FPF_RECEIVE | FPF_SEND)
  169. typedef struct _DEVICE_PROVIDER {
  170. LIST_ENTRY ListEntry;
  171. FAX_ENUM_PROVIDER_STATUS Status; // Initialization status of the FSP
  172. DWORD dwLastError; // Last error code during initialization
  173. FAX_VERSION Version; // FSP's DLL version info.
  174. BOOL bShutDownAttempted; // Used to prevent more than one call FaxDevShutdown
  175. BOOL bInitializationSucceeded; // Set to TRUE if FaxDevInitialized completed successfully.
  176. HMODULE hModule;
  177. TCHAR FriendlyName[MAX_PATH];
  178. TCHAR ImageName[MAX_PATH];
  179. TCHAR ProviderName[MAX_PATH];
  180. TCHAR szGUID[MAX_PATH]; // GUID for extended EFSPs. Empty string for Legacy FSPs.
  181. DWORD dwAPIVersion; // FSPI Version. (Legacy or Extended)
  182. HANDLE HeapHandle;
  183. PFAXDEVINITIALIZE FaxDevInitialize;
  184. PFAXDEVSTARTJOB FaxDevStartJob;
  185. PFAXDEVENDJOB FaxDevEndJob;
  186. PFAXDEVSEND FaxDevSend;
  187. PFAXDEVRECEIVE FaxDevReceive;
  188. PFAXDEVREPORTSTATUS FaxDevReportStatus;
  189. PFAXDEVABORTOPERATION FaxDevAbortOperation;
  190. PFAX_LINECALLBACK FaxDevCallback;
  191. PFAXDEVVIRTUALDEVICECREATION FaxDevVirtualDeviceCreation;
  192. PFAXDEVSHUTDOWN FaxDevShutdown;
  193. PFAX_EXT_INITIALIZE_CONFIG pFaxExtInitializeConfig;
  194. BOOL fMicrosoftExtension;
  195. } DEVICE_PROVIDER, *PDEVICE_PROVIDER;
  196. typedef struct _ROUTING_EXTENSION {
  197. LIST_ENTRY ListEntry;
  198. HMODULE hModule;
  199. FAX_ENUM_PROVIDER_STATUS Status; // Initialization status of the routing extension
  200. DWORD dwLastError; // Last error code during initialization
  201. FAX_VERSION Version; // routing extension's DLL version info.
  202. TCHAR FriendlyName[MAX_PATH];
  203. TCHAR ImageName[MAX_PATH];
  204. TCHAR InternalName[MAX_PATH];
  205. HANDLE HeapHandle;
  206. BOOL MicrosoftExtension;
  207. PFAXROUTEINITIALIZE FaxRouteInitialize;
  208. PFAXROUTEGETROUTINGINFO FaxRouteGetRoutingInfo;
  209. PFAXROUTESETROUTINGINFO FaxRouteSetRoutingInfo;
  210. PFAXROUTEDEVICEENABLE FaxRouteDeviceEnable;
  211. PFAXROUTEDEVICECHANGENOTIFICATION FaxRouteDeviceChangeNotification;
  212. PFAX_EXT_INITIALIZE_CONFIG pFaxExtInitializeConfig;
  213. LIST_ENTRY RoutingMethods;
  214. } ROUTING_EXTENSION, *PROUTING_EXTENSION;
  215. typedef struct _ROUTING_METHOD {
  216. LIST_ENTRY ListEntry;
  217. LIST_ENTRY ListEntryMethod;
  218. GUID Guid;
  219. DWORD Priority;
  220. LPTSTR FunctionName;
  221. LPTSTR FriendlyName;
  222. LPTSTR InternalName;
  223. PFAXROUTEMETHOD FaxRouteMethod;
  224. PROUTING_EXTENSION RoutingExtension;
  225. } ROUTING_METHOD, *PROUTING_METHOD;
  226. typedef BOOL (CALLBACK *PFAXROUTEMETHODENUM)(PROUTING_METHOD,LPVOID);
  227. typedef struct _FAX_ROUTE_FILE {
  228. LIST_ENTRY ListEntry; // linked list pointers
  229. LPWSTR FileName; // file name on disk
  230. GUID Guid; // routing method that created the file
  231. } FAX_ROUTE_FILE, *PFAX_ROUTE_FILE;
  232. typedef struct _LINE_INFO {
  233. LIST_ENTRY ListEntry; // linked list pointers
  234. DWORD Signature; // verification signature
  235. DWORD DeviceId; // tapi device id
  236. DWORD PermanentLineID; // Fax Service allocation permanent line id.
  237. DWORD TapiPermanentLineId; // TAPI permanent tapi device id for TAPI devices.
  238. HLINE hLine; // tapi line handle
  239. PDEVICE_PROVIDER Provider; // fax service device provider
  240. struct _JOB_ENTRY *JobEntry; // non-null if there is an outstanding job
  241. LPTSTR DeviceName; // device name
  242. LPTSTR lptstrDescription; // Device description
  243. DWORD State; // device state
  244. DWORD Flags; // device use flags
  245. DWORD dwReceivingJobsCount; // Number of receiving jobs using this device
  246. DWORD dwSendingJobsCount; // Number of sending jobs using this device
  247. LPTSTR Csid; // calling station's identifier
  248. LPTSTR Tsid; // transmittion station's identifier
  249. BOOL UnimodemDevice; // true if this device is a modem
  250. DWORD RingsForAnswer; //
  251. DWORD RingCount; //
  252. LINEMESSAGE LineMsgOffering; //
  253. BOOL ModemInUse; // TRUE if the modem is in use by another TAPI app
  254. BOOL OpenInProgress; //
  255. DWORD LineStates; //
  256. HCALL RasCallHandle; // used to track call when handed to RAS
  257. BOOL NewCall; // A new call is coming in
  258. DWORDLONG LastLineClose; // Time stamp of the last LINE_CLOSE
  259. DWORD dwDeviceType; // One of FAX_DEVICE_TYPE_XXXX defines
  260. } LINE_INFO, *PLINE_INFO;
  261. VOID
  262. UpdateDeviceJobsCounter (
  263. PLINE_INFO pLine,
  264. BOOL bSend,
  265. int iInc,
  266. BOOL bNotify
  267. );
  268. typedef struct {
  269. HANDLE hComm;
  270. CHAR szDeviceName[1];
  271. } DEVICEID, *PDEVICEID;
  272. typedef struct _ROUTING_DATA_OVERRIDE {
  273. LIST_ENTRY ListEntry; //
  274. LPBYTE RoutingData; //
  275. DWORD RoutingDataSize; //
  276. PROUTING_METHOD RoutingMethod; //
  277. } ROUTING_DATA_OVERRIDE, *PROUTING_DATA_OVERRIDE;
  278. typedef struct _ROUTE_FAILURE_INFO {
  279. WCHAR GuidString[MAX_GUID_STRING_LEN]; // GUID of the rounting method that failed
  280. PVOID FailureData; // pointer to the routing method's data
  281. DWORD FailureSize; // routing method's data size in bytes
  282. } ROUTE_FAILURE_INFO, *PROUTE_FAILURE_INFO;
  283. typedef struct _JOB_QUEUE * PJOB_QUEUE;
  284. typedef struct _JOB_QUEUE_PTR * PJOB_QUEUE_PTR;
  285. typedef struct _JOB_ENTRY {
  286. LIST_ENTRY ListEntry; //
  287. PLINE_INFO LineInfo; //
  288. HCALL CallHandle; //
  289. HANDLE InstanceData; //
  290. DWORDLONG StartTime; //
  291. DWORDLONG EndTime; //
  292. DWORDLONG ElapsedTime; //
  293. BOOL Aborting; // is the job being aborted?
  294. BOOL fSystemAbort; // The job was aborted by the service becuase it is shutting down.
  295. INT SendIdx; //
  296. TCHAR DisplayablePhoneNumber[SIZEOF_PHONENO]; // Displayable phone number for current send job
  297. TCHAR DialablePhoneNumber[SIZEOF_PHONENO]; // Dialable phone number for current send job
  298. BOOL Released; // Is the line used by this job already released.
  299. PJOB_QUEUE lpJobQueueEntry; // link back to the job queue entry for this job
  300. BOOL bFSPJobInProgress; // TRUE if FaxDevStartJob() was called for the job and FaxDevEndJob()
  301. // was not called yet.
  302. FSPI_JOB_STATUS FSPIJobStatus;
  303. HANDLE hFSPIParentJobHandle; // The EFSP provided job handle for the EFSP parent job
  304. // of this job.
  305. WCHAR ExStatusString[EX_STATUS_STRING_LEN]; // Extended status string
  306. LPWSTR lpwstrJobTsid; // The Tsid associated with the job (Server or device or Fax number)
  307. BOOL fStopUpdateStatus; // When it is set to TRUE, the FSPIJobStatus of this structure should not be udated any more
  308. } JOB_ENTRY, *PJOB_ENTRY;
  309. typedef struct _EFSP_JOB_GROUP {
  310. LIST_ENTRY ListEntry;
  311. LPTSTR lptstrPersistFile; // The full path to the file where the group information is persisted.
  312. LINE_INFO * lpLineInfo;
  313. FSPI_MESSAGE_ID FSPIParentPermanentId;
  314. HANDLE hFSPIParent;
  315. DWORD dwRecipientJobs;
  316. LIST_ENTRY RecipientJobs; // List of JOB_QUEUE_PTR pointing to the recipient jobs
  317. // in the group.
  318. } EFSP_JOB_GROUP;
  319. typedef EFSP_JOB_GROUP * LPEFSP_JOB_GROUP;
  320. typedef const EFSP_JOB_GROUP * LPCEFSP_JOB_GROUP;
  321. #define EFSP_JOB_GROUP_SERIALIZATION_SIGNATURE "JOBG"
  322. typedef struct _EFSP_JOB_GROUP_SERIALIZED {
  323. DWORD dwSignature;
  324. DWORD dwPermanentLineId;
  325. FSPI_MESSAGE_ID FSPIParentPermanentId;
  326. DWORD dwRecipientJobsCount;
  327. DWORDLONG dwlRecipientJobs[1];
  328. } EFSP_JOB_GROUP_SERIALIZED;
  329. typedef EFSP_JOB_GROUP_SERIALIZED * LPEFSP_JOB_GROUP_SERIALIZED;
  330. typedef const EFSP_JOB_GROUP_SERIALIZED * LPCEFSP_JOB_GROUP_SERIALIZED;
  331. typedef struct _JOB_QUEUE {
  332. //=========================== BEGIN COMMON ===========================
  333. LIST_ENTRY ListEntry; // linked list pointers
  334. DWORDLONG UniqueId; //
  335. DWORDLONG ScheduleTime; // schedule time in 64bit version after converting from
  336. // SYSTEMTIME and recacluating to fit the discount time
  337. // if necessary. For parent jobs this is the schedule of
  338. // the latest recipient that reached a JS_RETRIES_EXCEEDED state.
  339. // (we use this value to remove old jobs that were left in the queue).
  340. DWORD JobId; // fax job id
  341. DWORD JobType; // job type, see JT defines
  342. PJOB_ENTRY JobEntry; // Pointer to a JOB_ENTRY structure that holds
  343. // run time information for a job which is currently in progress.
  344. DWORD RefCount; // Used to prevent the deletion of a job when it is still in use
  345. // by the receive or send thread.
  346. DWORD PrevRefCount; // Used to count clients using the job's tif.
  347. LPTSTR QueueFileName; // The name of the file where the job is persisted (full path)
  348. __declspec(property(get=GetStatus, put=PutStatus)) // JobStatus is a virtual property
  349. DWORD JobStatus; // job status, see JS defines
  350. DWORD PageCount; // Th total number of pages in the fax document.
  351. LPTSTR FileName; // For a parent job this is the full path to the body file.
  352. // for a recipient job that is aimed at EFSP this is NULL.
  353. // for a recipient job aimed at legacy FSP this is the full path
  354. // to the file to provide to the FSP. This can be the body file
  355. // a rendered coverpage file or a merge or the coverpage file and the
  356. // body file.
  357. // for a receive/route job this is the file into which the FSP
  358. // writes the received FAX.
  359. //=========================== END COMMON ============================
  360. //=========================== BEGIN PARENT ============================
  361. FAX_JOB_PARAM_EXW JobParamsEx; // Extended job parameters the job
  362. // was submitted with.
  363. FAX_COVERPAGE_INFO_EXW CoverPageEx;
  364. LIST_ENTRY RecipientJobs; // A linked list of JOB_QUEUE_PTR structures
  365. // pointing to the recipient jobs of the parent.
  366. DWORD dwRecipientJobsCount;
  367. FAX_PERSONAL_PROFILE SenderProfile;
  368. DWORD dwCompletedRecipientJobsCount;
  369. DWORD dwCanceledRecipientJobsCount;
  370. DWORD dwFailedRecipientJobsCount;
  371. DWORD FileSize; // file size in bytes, up to 4Gb
  372. LPVOID DeliveryReportProfile; // Pointer to the MAPI profile object that is
  373. // is created in order to deliver the reciept.
  374. LPTSTR UserName; // The OS name of the user sending the fax.
  375. // For receive jobs this is set to the service name.
  376. PSID UserSid;
  377. DWORDLONG OriginalScheduleTime;
  378. DWORDLONG SubmissionTime;
  379. BOOL fReceiptSent; // TRUE if a receipt was already sent for this broadcast job.
  380. //=========================== END PARENT ===========================
  381. //=========================== BEGIN RECIPIENT ===========================
  382. FAX_PERSONAL_PROFILE RecipientProfile; // The recipient profile information.
  383. _JOB_QUEUE * lpParentJob; // A pointer to the parent job queue entry.
  384. DWORD SendRetries; // number of times send attempt has been made
  385. LPTSTR PreviewFileName; // The full path to the preview tiff file.
  386. CFaxCriticalSection CsPreview; // Used to synchronize access to preview file
  387. // Used when FAX_SendDocumentEx() receives translated recipient's fax number
  388. TCHAR tczDialableRecipientFaxNumber[SIZEOF_PHONENO];
  389. //=========================== END RECIPIENT ===========================
  390. //=========================== BEGIN RECEIPT ===========================
  391. DWORDLONG StartTime; // Start time as will appear on receipt (copied from JobEntry)
  392. // Used for routing jobs also
  393. DWORDLONG EndTime; // End time as will appear on receipt (copied from JobEntry)
  394. // Used for routing jobs also
  395. //=========================== END RECEIPT ===========================
  396. WCHAR ExStatusString[EX_STATUS_STRING_LEN]; // The last extended status string of this job (when it was active)
  397. DWORD dwLastJobExtendedStatus; // The last extended status of this job (when it was active)
  398. //=========================== BEGIN ROUTE ===========================
  399. LIST_ENTRY FaxRouteFiles; // list of files to be routed
  400. DWORD CountFaxRouteFiles; // count of files to be routed
  401. CFaxCriticalSection CsFileList; // file list lock
  402. LIST_ENTRY RoutingDataOverride; //
  403. CFaxCriticalSection CsRoutingDataOverride; //
  404. PFAX_ROUTE FaxRoute;
  405. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  406. PROUTE_FAILURE_INFO pRouteFailureInfo; // Pointer to an array of ROUTE_FAILURE_INFO structs
  407. //=========================== END ROUTE ===========================
  408. //=========================== BEGIN RECIEVE ===========================
  409. BOOL fDeleteReceivedTiff; // FALSE if the received tiff failed to archive succesfully. It will remain in the queue.
  410. //=========================== END RECIEVE ===========================
  411. _JOB_QUEUE() : m_dwJobStatus(JS_INVALID) {}
  412. ~_JOB_QUEUE();
  413. DWORD GetStatus()
  414. {
  415. return m_dwJobStatus;
  416. }
  417. void PutStatus(DWORD dwStatus);
  418. private:
  419. DWORD m_dwJobStatus;
  420. } JOB_QUEUE, *PJOB_QUEUE;
  421. typedef JOB_QUEUE * PJOB_QUEUE;
  422. typedef const JOB_QUEUE * PCJOB_QUEUE;
  423. typedef struct _JOB_QUEUE_PTR {
  424. LIST_ENTRY ListEntry;
  425. PJOB_QUEUE lpJob;
  426. } JOB_QUEUE_PTR, * PJOB_QUEUE_PTR;
  427. typedef struct _JOB_QUEUE_FILE {
  428. DWORD SizeOfStruct; // size of this structure
  429. //=========================== BEGIN COMMON ===========================
  430. DWORDLONG UniqueId; //
  431. DWORDLONG ScheduleTime; // schedule time in 64bit version after converting from
  432. // SYSTEMTIME and recacluating to fit the discount time
  433. // if necessary.
  434. DWORD JobType; // job type, see JT defines
  435. LPTSTR QueueFileName; //
  436. DWORD JobStatus; // job status, see JS defines
  437. DWORD PageCount; // total pages
  438. //=========================== END COMMON ============================
  439. //=========================== BEGIN RECIPIENT/PARENT ==================
  440. LPTSTR FileName; // Body TIFF file name.
  441. // For each recipient this is set to
  442. // the parent file name or in the case of
  443. // a legacy FSP to the cover page or
  444. // merged cover+body file.
  445. //=========================== END RECEIVE/PARENT ======================
  446. //=========================== BEGIN PARENT ============================
  447. FAX_JOB_PARAM_EXW JobParamsEx;
  448. FAX_COVERPAGE_INFO_EXW CoverPageEx;
  449. DWORD dwRecipientJobsCount;
  450. FAX_PERSONAL_PROFILE SenderProfile;
  451. DWORD dwCompletedRecipientJobsCount;
  452. DWORD dwCanceledRecipientJobsCount;
  453. DWORD FileSize; // file size in bytes, up to 4Gb
  454. LPTSTR DeliveryReportAddress; //
  455. DWORD DeliveryReportType; //
  456. LPTSTR UserName; // The OS name of the user sending the fax.
  457. // For receive jobs this is set to the service name.
  458. PSID UserSid; // Pointer to the user SID
  459. DWORDLONG OriginalScheduleTime;
  460. DWORDLONG SubmissionTime;
  461. //=========================== END PARENT ===========================
  462. //=========================== BEGIN RECIPIENT ===========================
  463. FAX_PERSONAL_PROFILE RecipientProfile; // The recipient profile information.
  464. DWORDLONG dwlParentJobUniqueId; // The unique id of the parent job
  465. DWORD SendRetries; // number of times send attempt has been made
  466. TCHAR tczDialableRecipientFaxNumber[SIZEOF_PHONENO]; // see _JOB_QUEUE for description
  467. //=========================== END RECIPIENT ===========================
  468. //=========================== BEGIN RECIEVE ===========================
  469. DWORD FaxRouteSize;
  470. PFAX_ROUTE FaxRoute;
  471. DWORD CountFaxRouteFiles; // count of files to be routed
  472. DWORD FaxRouteFileGuid; // offset array of GUID's
  473. DWORD FaxRouteFiles; // offset to a multi-sz of filenames
  474. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  475. PROUTE_FAILURE_INFO pRouteFailureInfo; // Pointer to an array of ROUTE_FAILURE_INFO structs
  476. //=========================== END RECIEVE ===========================
  477. FSPI_MESSAGE_ID EFSPPermanentMessageId;
  478. //=========================== BEGIN RECEIPT ===========================
  479. DWORDLONG StartTime; // Start time as will appear on receipt (copied from JobEntry)
  480. // Used for routing jobs also
  481. DWORDLONG EndTime; // End time as will appear on receipt (copied from JobEntry)
  482. // Used for routing jobs also
  483. //=========================== END RECEIPT ===========================
  484. WCHAR ExStatusString[EX_STATUS_STRING_LEN]; // The last extended status string of this job (when it was active)
  485. DWORD dwLastJobExtendedStatus; // The last extended status of this job (when it was active)
  486. } JOB_QUEUE_FILE, *PJOB_QUEUE_FILE;
  487. typedef struct _BOS_JOB_QUEUE_FILE {
  488. DWORD SizeOfStruct; // size of this structure
  489. //=========================== BEGIN COMMON ===========================
  490. DWORDLONG UniqueId; //
  491. DWORDLONG ScheduleTime; // schedule time in 64bit version after converting from
  492. // SYSTEMTIME and recacluating to fit the discount time
  493. // if necessary.
  494. DWORD JobType; // job type, see JT defines
  495. LPTSTR QueueFileName; //
  496. DWORD JobStatus; // job status, see JS defines
  497. DWORD PageCount; // total pages
  498. //=========================== END COMMON ============================
  499. //=========================== BEGIN RECIPIENT/PARENT ==================
  500. LPTSTR FileName; // Body TIFF file name.
  501. // For each recipient this is set to
  502. // the parent file name or in the case of
  503. // a legacy FSP to the cover page or
  504. // merged cover+body file.
  505. //=========================== END RECEIVE/PARENT ======================
  506. //=========================== BEGIN PARENT ============================
  507. FAX_JOB_PARAM_EXW JobParamsEx;
  508. FAX_COVERPAGE_INFO_EXW CoverPageEx;
  509. DWORD dwRecipientJobsCount;
  510. FAX_PERSONAL_PROFILE SenderProfile;
  511. DWORD dwCompletedRecipientJobsCount;
  512. DWORD dwCanceledRecipientJobsCount;
  513. DWORD FileSize; // BUGBUG - file size in bytes, up to 4Gb
  514. LPTSTR DeliveryReportAddress; //
  515. DWORD DeliveryReportType; //
  516. LPTSTR UserName; // The OS name of the user sending the fax.
  517. // For receive jobs this is set to the service name.
  518. PSID UserSid; // Pointer to the user SID
  519. DWORDLONG OriginalScheduleTime;
  520. DWORDLONG SubmissionTime;
  521. //=========================== END PARENT ===========================
  522. //=========================== BEGIN RECIPIENT ===========================
  523. FAX_PERSONAL_PROFILE RecipientProfile; // The recipient profile information.
  524. DWORDLONG dwlParentJobUniqueId; // The unique id of the parent job
  525. DWORD SendRetries; // number of times send attempt has been made
  526. //=========================== END RECIPIENT ===========================
  527. //=========================== BEGIN RECIEVE ===========================
  528. DWORD FaxRouteSize;
  529. PFAX_ROUTE FaxRoute;
  530. DWORD CountFaxRouteFiles; // count of files to be routed
  531. DWORD FaxRouteFileGuid; // offset array of GUID's
  532. DWORD FaxRouteFiles; // offset to a multi-sz of filenames
  533. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  534. PROUTE_FAILURE_INFO pRouteFailureInfo; // Pointer to an array of ROUTE_FAILURE_INFO structs
  535. //=========================== END RECIEVE ===========================
  536. FSPI_MESSAGE_ID EFSPPermanentMessageId;
  537. //=========================== BEGIN RECEIPT ===========================
  538. DWORDLONG StartTime; // Start time as will appear on receipt (copied from JobEntry)
  539. // Used for routing jobs also
  540. DWORDLONG EndTime; // End time as will appear on receipt (copied from JobEntry)
  541. // Used for routing jobs also
  542. //=========================== END RECEIPT ===========================
  543. WCHAR ExStatusString[EX_STATUS_STRING_LEN]; // The last extended status string of this job (when it was active)
  544. DWORD dwLastJobExtendedStatus; // The last extended status of this job (when it was active)
  545. } BOS_JOB_QUEUE_FILE, *BOS_PJOB_QUEUE_FILE;
  546. typedef struct _FAX_SEND_ITEM {
  547. PJOB_ENTRY JobEntry; //
  548. LPTSTR FileName; // The following items are copied from the FAX_JOB_PARAM struct
  549. LPTSTR PhoneNumber; // RecipientNumber
  550. LPTSTR Tsid; // TSID
  551. LPTSTR RecipientName; //
  552. LPTSTR SenderName; //
  553. LPTSTR SenderCompany; //
  554. LPTSTR SenderDept; //
  555. LPTSTR BillingCode; //
  556. LPTSTR DocumentName; //
  557. } FAX_SEND_ITEM, *PFAX_SEND_ITEM;
  558. typedef struct _ROUTE_INFO {
  559. DWORD Signature; // file signature
  560. DWORD StringSize; // size of strings in bytes
  561. DWORD FailureSize; // size of failure data in bytes
  562. LPWSTR TiffFileName; // original tiff file name
  563. LPWSTR ReceiverName; // receiver's name
  564. LPWSTR ReceiverNumber; // receiver's fax number
  565. LPWSTR DeviceName; // device name on which the fax was received
  566. LPWSTR Csid; // calling station's identifier
  567. LPWSTR Tsid; // transmitter's station identifier
  568. LPWSTR CallerId; // caller id information
  569. LPWSTR RoutingInfo; // routing info: DID, T.30 subaddress, etc.
  570. DWORDLONG ElapsedTime; // elapsed time for fax receive
  571. // DWORD RouteFailureCount; // number of failure data blocks
  572. // ROUTE_FAILURE_INFO RouteFailure[...]; // routing failure data blocks
  573. } ROUTE_INFO, *PROUTE_INFO;
  574. typedef struct _MESSAGEBOX_DATA {
  575. LPTSTR Text; //
  576. LPDWORD Response; //
  577. DWORD Type; //
  578. } MESSAGEBOX_DATA, *PMESSAGEBOX_DATA;
  579. typedef struct _FAX_RECEIVE_ITEM {
  580. PJOB_ENTRY JobEntry; //
  581. HCALL hCall; //
  582. PLINE_INFO LineInfo; //
  583. LPTSTR FileName; //
  584. } FAX_RECEIVE_ITEM, *PFAX_RECEIVE_ITEM;
  585. typedef struct _FAX_CLIENT_DATA {
  586. LIST_ENTRY ListEntry; //
  587. handle_t hBinding; //
  588. handle_t FaxHandle; //
  589. WCHAR wstrMachineName[MAX_COMPUTERNAME_LENGTH + 1]; // Machine name
  590. WCHAR wstrEndPoint[MAX_ENDPOINT_LEN]; // End point used for RPC connection
  591. ULONG64 Context; //
  592. HANDLE FaxClientHandle; //
  593. BOOL bEventEx; // TRUE if the registration is for FAX_EVENT_EX, FALSE for FAX_EVENT
  594. DWORD EventTypes; // Bit wise combination of FAX_ENUM_EVENT_TYPE
  595. PSID UserSid; // Pointer to the user SID
  596. } FAX_CLIENT_DATA, *PFAX_CLIENT_DATA;
  597. typedef struct _MDM_DEVSPEC {
  598. DWORD Contents; // Set to 1 (indicates containing key)
  599. DWORD KeyOffset; // Offset to key from start of this struct.
  600. // (not from start of LINEDEVCAPS ).
  601. // 8 in our case.
  602. CHAR String[1]; // place containing null-terminated registry key.
  603. } MDM_DEVSPEC, *PMDM_DEVSPEC;
  604. //
  605. // fax handle defines & structs
  606. //
  607. typedef enum
  608. {
  609. FHT_SERVICE, // Handle to server (FaxConnectFaxServer)
  610. FHT_PORT, // Port Handle (FaxOpenPort)
  611. FHT_MSGENUM, // Message enumeration handle (FaxStartMessagesEnum)
  612. FHT_COPY // RPC copy context handle
  613. } FaxHandleType;
  614. typedef struct _HANDLE_ENTRY
  615. {
  616. LIST_ENTRY ListEntry; // linked list pointers
  617. handle_t hBinding; //
  618. FaxHandleType Type; // handle type, see FHT defines
  619. PLINE_INFO LineInfo; // pointer to line information
  620. DWORD Flags; // open flags
  621. BOOL bReleased; // The connection is not counted in the g_ReferenceCount
  622. DWORD dwClientAPIVersion; // The API version of the connected client
  623. //
  624. // The following fields are used to enumerate files in the archive
  625. //
  626. HANDLE hFile; // Handle used in enumeration / copy
  627. WCHAR wstrFileName[MAX_PATH]; // Name of first file found (enumeration)
  628. // or file being copied (RPC copy)
  629. FAX_ENUM_MESSAGE_FOLDER Folder; // Enumeration folder
  630. //
  631. // The following field is used for RPC copy
  632. //
  633. BOOL bCopyToServer; // Copy direction
  634. BOOL bError; // Was there an error during the RPC copy?
  635. PJOB_QUEUE pJobQueue; // Pointer to the job queue of the preview file (copy from server)
  636. // NULL if it is an archived file
  637. } HANDLE_ENTRY, *PHANDLE_ENTRY;
  638. typedef struct _DEVICE_SORT {
  639. DWORD Priority;
  640. PLINE_INFO LineInfo;
  641. } DEVICE_SORT, *PDEVICE_SORT;
  642. typedef struct _METHOD_SORT {
  643. DWORD Priority;
  644. PROUTING_METHOD RoutingMethod;
  645. } METHOD_SORT, *PMETHOD_SORT;
  646. typedef struct _QUEUE_SORT {
  647. FAX_ENUM_PRIORITY_TYPE Priority;
  648. DWORDLONG ScheduleTime;
  649. PJOB_QUEUE QueueEntry;
  650. } QUEUE_SORT, *PQUEUE_SORT;
  651. typedef struct _FSPI_JOB_STATUS_MSG_tag
  652. {
  653. PJOB_ENTRY lpJobEntry;
  654. LPFSPI_JOB_STATUS lpFSPIJobStatus;
  655. } FSPI_JOB_STATUS_MSG;
  656. typedef FSPI_JOB_STATUS_MSG * LPFSPI_JOB_STATUS_MSG;
  657. typedef const FSPI_JOB_STATUS_MSG * LPCFSPI_JOB_STATUS_MSG;
  658. typedef struct _STRING_TABLE {
  659. DWORD ResourceId;
  660. DWORD InternalId;
  661. LPTSTR String;
  662. } STRING_TABLE, *PSTRING_TABLE;
  663. //
  664. // externs
  665. //
  666. extern HLINEAPP g_hLineApp; //
  667. extern CFaxCriticalSection g_CsJob; // protects the job list
  668. extern CFaxCriticalSection g_CsConfig; // Protects configuration read / write
  669. extern CFaxCriticalSection g_CsRouting; //
  670. extern PFAX_PERF_COUNTERS g_pFaxPerfCounters; //
  671. extern LIST_ENTRY g_JobListHead; //
  672. extern CFaxCriticalSection g_CsLine; // critical section for accessing tapi lines
  673. extern CFaxCriticalSection g_CsPerfCounters; // critical section for performance monitor counters
  674. extern DWORD g_dwTotalSeconds; // use to compute g_pFaxPerfCounters->TotalMinutes
  675. extern DWORD g_dwInboundSeconds; //
  676. extern DWORD g_dwOutboundSeconds; //
  677. extern LIST_ENTRY g_TapiLinesListHead; // linked list of tapi lines
  678. extern CFaxCriticalSection g_CsClients; //
  679. extern HANDLE g_TapiCompletionPort; //
  680. extern HANDLE g_hTapiWorkerThread; // Tapi worker thread handle
  681. extern HANDLE g_hJobQueueThread; // JobQueueThread handle
  682. extern HANDLE g_StatusCompletionPortHandle;
  683. extern DWORD g_dwCountRoutingMethods; // total number of routing methods for ALL extensions
  684. extern LIST_ENTRY g_QueueListHead; //
  685. extern CFaxCriticalSection g_CsQueue; //
  686. extern HANDLE g_hQueueTimer; //
  687. extern DWORD g_dwNextJobId; //
  688. extern const GUID gc_FaxSvcGuid; //
  689. extern DWORD g_dwFaxSendRetries; //
  690. extern DWORD g_dwFaxSendRetryDelay; //
  691. extern DWORD g_dwFaxDirtyDays; //
  692. extern BOOL g_fFaxUseDeviceTsid; //
  693. extern BOOL g_fFaxUseBranding; //
  694. extern BOOL g_fServerCp; //
  695. extern FAX_TIME g_StartCheapTime; //
  696. extern FAX_TIME g_StopCheapTime; //
  697. extern WCHAR g_wszFaxQueueDir[MAX_PATH]; //
  698. extern HANDLE g_hJobQueueEvent; //
  699. extern DWORD g_dwLastUniqueLineId; // The last device id handed out by the Fax Service.
  700. extern DWORD g_dwQueueState; // The state of the queue (paused, blocked, etc.)
  701. extern FAX_SERVER_RECEIPTS_CONFIGW g_ReceiptsConfig; // Global receipts configuration
  702. extern FAX_ARCHIVE_CONFIG g_ArchivesConfig[2]; // Global archives configuration
  703. extern FAX_SERVER_ACTIVITY_LOGGING_CONFIG g_ActivityLoggingConfig; // Global activity logging configuration
  704. extern BOOL g_bServiceIsDown; // This is set to TRUE by FaxEndSvc()
  705. extern HANDLE g_hServiceIsDownSemaphore; // Syncronize TapiWorkerThread() , JobQueueThread() and EndFaxSvc() access to g_bServiceIsDown flag.
  706. extern FAX_SERVER_ACTIVITY g_ServerActivity; // Global Fax Service Activity
  707. extern CFaxCriticalSection g_CsActivity; // Controls access to g_ServerActivity;
  708. extern CFaxCriticalSection g_CsInboundActivityLogging; // Controls access to Inbound Activity logging configuration;
  709. extern CFaxCriticalSection g_CsOutboundActivityLogging; // Controls access to Outbound Activity logging configuration;
  710. //
  711. // Important!! - Always lock g_CsInboundActivityLogging and then g_CsOutboundActivityLogging
  712. //
  713. extern DWORD g_dwReceiveDevicesCount; // Count of devices that are receive-enabled. Protected by g_CsLine.
  714. extern BOOL g_ScanQueueAfterTimeout; // The JobQueueThread checks this if waked up after JOB_QUEUE_TIMEOUT. Use g_CsQueue.
  715. // If it is TRUE - g_hQueueTimer or g_hJobQueueEvent were not set - Scan the queue.
  716. extern DWORD g_dwMaxLineCloseTime; // Wait interval in sec before trying to resend on a powered off device
  717. extern CFaxCriticalSection g_CsServiceThreads; // Controls service global threads count
  718. extern LONG g_lServiceThreadsCount; // Service threads count
  719. extern HANDLE g_hThreadCountEvent; // This Event is set when the service threads count is 0.
  720. extern HANDLE g_hSCMServiceShutDownEvent; // This event is set when SCM tells the service to STOP!
  721. extern HANDLE g_hServiceShutDownEvent; // This event is set after the service got g_hSCMServiceShutDownEvent from SCM and signals the various threads to terminate!
  722. extern DWORD g_dwConnectionCount; // Number of active RPC connections
  723. extern DWORD g_dwQueueCount; // Count of jobs (both parent and non-parent) in the queue. Protected by g_CsQueue
  724. extern BOOL g_bServiceCanSuicide; // See description in queue.c
  725. extern BOOL g_bDelaySuicideAttempt; // See description in queue.c
  726. extern LPLINECOUNTRYLIST g_pLineCountryList; // The list of countries returned by TAPI
  727. extern DWORD g_dwManualAnswerDeviceId; // Id of (one and only) device capable of manual answering (protected by g_CsLine)
  728. extern DWORDLONG g_dwLastUniqueId; // Used for generating unique job IDs
  729. extern CFaxCriticalSection g_CsHandleTable; // Protects the handles list
  730. extern DWORD g_dwDeviceCount; // Total number of devices
  731. extern DWORD g_dwDeviceEnabledCount; // Current Send/Receive enabled devices count (protected by g_CsLine)
  732. extern DWORD g_dwDeviceEnabledLimit; // Send/Receive enabled devices limit by SKU
  733. extern LPBYTE g_pAdaptiveFileBuffer; // list of approved adaptive answer modems
  734. extern LIST_ENTRY g_DeviceProvidersListHead;
  735. extern BOOL g_fLogStringTableInit;
  736. extern LOG_STRING_TABLE g_InboxTable[]; // Inbox activity logging string table
  737. extern LOG_STRING_TABLE g_OutboxTable[]; // Outbox activity logging string table
  738. extern CFaxCriticalSection g_CsSecurity;
  739. extern PSECURITY_DESCRIPTOR g_pFaxSD; // Fax security descriptor
  740. extern STRING_TABLE g_ServiceStringTable[]; // Service string table
  741. extern CFaxCriticalSection g_csUniqueQueueFile;
  742. extern const DWORD gc_dwCountInboxTable;
  743. extern const DWORD gc_dwCountOutboxTable;
  744. extern const DWORD gc_dwCountServiceStringTable;
  745. extern HANDLE g_hFaxPerfCountersMap; // Handle to the performance counters file mapping;
  746. extern LIST_ENTRY g_HandleTableListHead;
  747. extern LIST_ENTRY g_lstRoutingMethods;
  748. extern LIST_ENTRY g_lstRoutingExtensions;
  749. extern LIST_ENTRY g_RemovedTapiLinesListHead;
  750. extern HANDLE g_hRPCListeningThread; // Thread that waits for all RPC threads to terminate
  751. extern HINSTANCE g_hResource; // Handle to fxsres.dll that hold the resources.
  752. extern DWORD g_dwRecipientsLimit; // Limits the number of recipients in a single broadcast job. '0' means no limit.
  753. extern DWORD g_dwAllowRemote; // If this is non-zero, the service will allow remote calls even if the local printer is not shared.
  754. #if DBG
  755. extern HANDLE g_hCritSecLogFile;
  756. extern LIST_ENTRY g_CritSecListHead;
  757. extern CFaxCriticalSection g_CsCritSecList;
  758. #endif
  759. #define EnterCriticalSectionJobAndQueue \
  760. EnterCriticalSection(&g_CsJob); \
  761. EnterCriticalSection(&g_CsQueue);
  762. #define LeaveCriticalSectionJobAndQueue \
  763. LeaveCriticalSection(&g_CsQueue); \
  764. LeaveCriticalSection(&g_CsJob);
  765. //
  766. // prototypes
  767. //
  768. RPC_STATUS
  769. IsLocalRPCConnectionNP(
  770. PBOOL pbIsLocal
  771. );
  772. VOID
  773. FreeMessageBuffer (
  774. PFAX_MESSAGE pFaxMsg,
  775. BOOL fDestroy
  776. );
  777. typedef enum
  778. {
  779. EXCEPTION_SOURCE_UNKNOWN,
  780. EXCEPTION_SOURCE_FSP,
  781. EXCEPTION_SOURCE_ROUTING_EXT
  782. } EXCEPTION_SOURCE_TYPE;
  783. LONG
  784. HandleFaxExtensionFault (
  785. EXCEPTION_SOURCE_TYPE ExSrc,
  786. LPCWSTR lpcswstrExtFriendlyName,
  787. DWORD dwCode
  788. );
  789. BOOL
  790. CommitQueueEntry(
  791. PJOB_QUEUE JobQueue,
  792. BOOL bDeleteFileOnError=TRUE
  793. );
  794. VOID
  795. FaxServiceMain(
  796. DWORD argc,
  797. LPTSTR *argv
  798. );
  799. BOOL
  800. SetServiceIsDownFlag(
  801. VOID
  802. );
  803. DWORD
  804. SetServiceIsDownFlagThread(
  805. LPVOID pvUnused
  806. );
  807. VOID
  808. FaxServiceCtrlHandler(
  809. DWORD Opcode
  810. );
  811. int
  812. DebugService(
  813. VOID
  814. );
  815. DWORD
  816. ServiceStart(
  817. VOID
  818. );
  819. void EndFaxSvc(
  820. DWORD Severity
  821. );
  822. BOOL
  823. StopFaxServiceProviders();
  824. BOOL
  825. WaitAndReportForThreadToTerminate(
  826. HANDLE hThread,
  827. LPCTSTR strWaitMessage
  828. );
  829. BOOL
  830. StopAllInProgressJobs(
  831. VOID
  832. );
  833. BOOL
  834. ReportServiceStatus(
  835. DWORD CurrentState,
  836. DWORD Win32ExitCode,
  837. DWORD WaitHint
  838. );
  839. //
  840. // Fax Server RPC Client
  841. //
  842. DWORD
  843. RpcBindToFaxClient(
  844. IN LPCWSTR servername,
  845. IN LPCWSTR servicename,
  846. OUT RPC_BINDING_HANDLE *pBindingHandle
  847. );
  848. //
  849. // Fax Server RPC Server
  850. //
  851. RPC_STATUS
  852. StartFaxRpcServer(
  853. IN LPWSTR InterfaceName,
  854. IN RPC_IF_HANDLE InterfaceSpecification
  855. );
  856. DWORD
  857. StopFaxRpcServer(
  858. VOID
  859. );
  860. //
  861. // util.c
  862. //
  863. LPTSTR
  864. MapFSPIJobExtendedStatusToString (
  865. DWORD dwFSPIExtendedStatus);
  866. DWORD
  867. LegacyJobStatusToStatus(
  868. DWORD dwLegacyStatus,
  869. PDWORD pdwStatus,
  870. PDWORD pdwExtendedStatus,
  871. PBOOL pbPrivateStatusCode);
  872. DWORD MyGetFileSize(
  873. LPCTSTR FileName
  874. );
  875. BOOL
  876. DecreaseServiceThreadsCount(
  877. VOID
  878. );
  879. HANDLE CreateThreadAndRefCount(
  880. LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
  881. DWORD dwStackSize, // initial stack size
  882. LPTHREAD_START_ROUTINE lpStartAddress, // thread function
  883. LPVOID lpParameter, // thread argument
  884. DWORD dwCreationFlags, // creation option
  885. LPDWORD lpThreadId // thread identifier
  886. );
  887. DWORD
  888. IsValidFaxFolder(
  889. LPCWSTR lpwstrFolder
  890. );
  891. //
  892. // tapi.c
  893. //
  894. BOOL
  895. IsDeviceEnabled(
  896. PLINE_INFO pLineInfo
  897. );
  898. void
  899. FreeTapiLines(
  900. void
  901. );
  902. BOOL
  903. CreateTapiThread(void);
  904. DWORD
  905. TapiInitialize(
  906. PREG_FAX_SERVICE FaxReg
  907. );
  908. DWORD
  909. UpdateDevicesFlags(
  910. void
  911. );
  912. VOID
  913. UpdateManualAnswerDevice(
  914. void
  915. );
  916. VOID
  917. FreeTapiLine(
  918. PLINE_INFO LineInfo
  919. );
  920. PLINE_INFO
  921. GetTapiLineFromDeviceId(
  922. DWORD DeviceId,
  923. BOOL fLegacyId
  924. );
  925. PLINE_INFO
  926. GetLineForSendOperation(
  927. PJOB_QUEUE lpJobQueue
  928. );
  929. PLINE_INFO
  930. GetTapiLineForFaxOperation(
  931. DWORD DeviceId,
  932. DWORD JobType,
  933. LPWSTR FaxNumber
  934. );
  935. LONG
  936. MyLineTranslateAddress(
  937. LPCTSTR Address,
  938. DWORD DeviceId,
  939. LPLINETRANSLATEOUTPUT *TranslateOutput
  940. );
  941. BOOL
  942. ReleaseTapiLine(
  943. PLINE_INFO LineInfo,
  944. HCALL hCall
  945. );
  946. DWORD
  947. QueueTapiCallback(
  948. PLINE_INFO LineInfo,
  949. DWORD hDevice,
  950. DWORD dwMessage,
  951. DWORD dwInstance,
  952. DWORD dwParam1,
  953. DWORD dwParam2,
  954. DWORD dwParam3
  955. );
  956. VOID
  957. SpoolerSetAllTapiLinesActive(
  958. VOID
  959. );
  960. DWORD
  961. GetDeviceListByCountryAndAreaCode(
  962. DWORD dwCountryCode,
  963. DWORD dwAreaCode,
  964. LPDWORD* lppdwDevices,
  965. LPDWORD lpdwNumDevices
  966. );
  967. BOOL
  968. IsAreaCodeMandatory(
  969. LPLINECOUNTRYLIST lpCountryList,
  970. DWORD dwCountryCode
  971. );
  972. //
  973. // tapidbg.c
  974. //
  975. #if DBG
  976. VOID
  977. ShowLineEvent(
  978. HLINE htLine,
  979. HCALL htCall,
  980. LPTSTR MsgStr,
  981. DWORD_PTR dwCallbackInstance,
  982. DWORD dwMsg,
  983. DWORD_PTR dwParam1,
  984. DWORD_PTR dwParam2,
  985. DWORD_PTR dwParam3
  986. );
  987. #endif // #if DBG
  988. //
  989. // faxdev.c
  990. //
  991. void
  992. UnloadDeviceProviders(
  993. void
  994. );
  995. BOOL
  996. LoadDeviceProviders(
  997. PREG_FAX_SERVICE FaxReg
  998. );
  999. BOOL
  1000. InitializeDeviceProviders(
  1001. VOID
  1002. );
  1003. BOOL
  1004. InitializeDeviceProvidersConfiguration(
  1005. VOID
  1006. );
  1007. PDEVICE_PROVIDER
  1008. FindDeviceProvider(
  1009. LPTSTR lptstrProviderName,
  1010. BOOL bSuccessfullyLoaded = TRUE
  1011. );
  1012. DWORD GetSuccessfullyLoadedProvidersCount();
  1013. DWORD ShutdownDeviceProviders(LPVOID lpvUnused);
  1014. BOOL FreeFSPIJobStatus(LPFSPI_JOB_STATUS lpJobStatus, BOOL bDestroy);
  1015. BOOL CopyFSPIJobStatus(LPFSPI_JOB_STATUS lpDst, LPCFSPI_JOB_STATUS lpcSrc, DWORD dwDstSize);
  1016. LPFSPI_JOB_STATUS DuplicateFSPIJobStatus(LPCFSPI_JOB_STATUS lpcSrc);
  1017. DWORD DeviceStatusToFSPIExtendedStatus(DWORD dwDeviceStatus);
  1018. DWORD FSPIExtendedStatusToDeviceStatus(DWORD dwFSPIExtendedStatus);
  1019. BOOL FreeFSPIJobStatusMsg(LPFSPI_JOB_STATUS_MSG lpMsg, BOOL bDestroy);
  1020. DWORD
  1021. MapFSPIJobExtendedStatusToJS_EX (DWORD dwFSPIExtendedStatus);
  1022. //
  1023. // job.c
  1024. //
  1025. BOOL
  1026. UpdateJobStatus(
  1027. PJOB_ENTRY lpJobEntry,
  1028. LPCFSPI_JOB_STATUS lpcFSPJobStatus
  1029. );
  1030. BOOL
  1031. CreateCoverpageTiffFileEx(
  1032. IN short Resolution,
  1033. IN DWORD dwPageCount,
  1034. IN LPCFAX_COVERPAGE_INFO_EXW lpcCoverpageEx,
  1035. IN LPCFAX_PERSONAL_PROFILEW lpcRecipient,
  1036. IN LPCFAX_PERSONAL_PROFILEW lpcSender,
  1037. IN LPCWSTR lpcwstrExtension,
  1038. OUT LPWSTR lptstrCovTiffFile,
  1039. IN DWORD dwCovTiffFile);
  1040. BOOL
  1041. GetBodyTiffResolution(
  1042. IN LPCWSTR lpcwstrBodyFile,
  1043. OUT short* pResolution
  1044. );
  1045. BOOL
  1046. CreateStatusThreads(void);
  1047. BOOL
  1048. CreateJobQueueThread(void);
  1049. BOOL
  1050. FreePermanentMessageId(
  1051. LPFSPI_MESSAGE_ID lpMessageId,
  1052. BOOL bDestroy
  1053. );
  1054. PJOB_ENTRY
  1055. FindJobEntryByRecipientNumber(LPCWSTR lpcwstrNumber);
  1056. PJOB_ENTRY
  1057. StartReceiveJob(
  1058. DWORD DeviceId
  1059. );
  1060. BOOL
  1061. StartSendJob(
  1062. PJOB_QUEUE lpJobQueueEntry,
  1063. PLINE_INFO lpLineInfo
  1064. );
  1065. BOOL
  1066. StartRoutingJob(
  1067. PJOB_QUEUE lpJobQueueEntry
  1068. );
  1069. BOOL HanldeFSPIJobStatusChange(PJOB_ENTRY lpJobEntry);
  1070. BOOL HandleFailedSendJob(PJOB_ENTRY lpJobEntry);
  1071. BOOL HandleCompletedSendJob(PJOB_ENTRY lpJobEntry);
  1072. BOOL
  1073. ArchiveOutboundJob(
  1074. const JOB_QUEUE * lpcJobQueue
  1075. );
  1076. BOOL
  1077. InitializeJobManager(
  1078. PREG_FAX_SERVICE FaxReg
  1079. );
  1080. BOOL
  1081. EndJob(
  1082. IN PJOB_ENTRY JobEntry
  1083. );
  1084. BOOL
  1085. ReleaseJob(
  1086. IN PJOB_ENTRY JobEntry
  1087. );
  1088. DWORD
  1089. SendDocument(
  1090. PJOB_ENTRY JobEntry,
  1091. LPTSTR FileName);
  1092. VOID
  1093. SetGlobalsFromRegistry(
  1094. PREG_FAX_SERVICE FaxReg
  1095. );
  1096. void
  1097. FaxLogSend(
  1098. const JOB_QUEUE * lpcJobQueue, BOOL bRetrying
  1099. );
  1100. BOOL
  1101. FillMsTagInfo(
  1102. LPTSTR FaxFileName,
  1103. PJOB_QUEUE lpJobQueue
  1104. );
  1105. BOOL
  1106. GetJobStatusDataEx(
  1107. LPBYTE JobBuffer,
  1108. PFAX_JOB_STATUSW pFaxStatus,
  1109. DWORD dwClientAPIVersion,
  1110. const PJOB_QUEUE lpcJobQueue,
  1111. PULONG_PTR Offset,
  1112. DWORD dwBufferSize
  1113. );
  1114. BOOL
  1115. CreateTiffFile (
  1116. PJOB_QUEUE lpRecpJob,
  1117. LPCWSTR lpcwstrFileExt,
  1118. LPWSTR lpwstrFullPath,
  1119. DWORD dwFullPathCount
  1120. );
  1121. BOOL
  1122. CreateTiffFileForJob (
  1123. PJOB_QUEUE lpRecpJob
  1124. );
  1125. BOOL
  1126. CreateTiffFileForPreview (
  1127. PJOB_QUEUE lpRecpJob
  1128. );
  1129. //
  1130. // receive.c
  1131. //
  1132. DWORD
  1133. StartFaxReceive(
  1134. PJOB_ENTRY JobEntry,
  1135. HCALL hCall,
  1136. PLINE_INFO LineInfo,
  1137. LPTSTR FileName,
  1138. DWORD FileNameSize
  1139. );
  1140. //
  1141. // route.c
  1142. //
  1143. void
  1144. FreeRoutingExtensions(
  1145. void
  1146. );
  1147. BOOL
  1148. InitializeRouting(
  1149. PREG_FAX_SERVICE FaxReg
  1150. );
  1151. BOOL
  1152. FaxRoute(
  1153. PJOB_QUEUE JobQueue,
  1154. LPTSTR TiffFileName,
  1155. PFAX_ROUTE FaxRoute,
  1156. PROUTE_FAILURE_INFO *RouteFailureInfo,
  1157. LPDWORD RouteFailureCount
  1158. );
  1159. BOOL
  1160. LoadRouteInfo(
  1161. IN LPWSTR RouteFileName,
  1162. OUT PROUTE_INFO *RouteInfo,
  1163. OUT PROUTE_FAILURE_INFO *RouteFailure,
  1164. OUT LPDWORD RouteFailureCount
  1165. );
  1166. PFAX_ROUTE
  1167. SerializeFaxRoute(
  1168. IN PFAX_ROUTE FaxRoute,
  1169. IN LPDWORD Size,
  1170. IN BOOL bSizeOnly
  1171. );
  1172. PFAX_ROUTE
  1173. DeSerializeFaxRoute(
  1174. IN PFAX_ROUTE FaxRoute
  1175. );
  1176. BOOL
  1177. FaxRouteRetry(
  1178. PFAX_ROUTE FaxRoute,
  1179. PROUTE_FAILURE_INFO RouteFailureInfo
  1180. );
  1181. //
  1182. // modem.c
  1183. //
  1184. DWORD
  1185. GetModemClass(
  1186. HANDLE hFile
  1187. );
  1188. //
  1189. // print.c
  1190. //
  1191. LPTSTR
  1192. GetString(
  1193. DWORD InternalId
  1194. );
  1195. BOOL CALLBACK
  1196. FaxDeviceProviderCallback(
  1197. IN HANDLE FaxHandle,
  1198. IN DWORD DeviceId,
  1199. IN DWORD_PTR Param1,
  1200. IN DWORD_PTR Param2,
  1201. IN DWORD_PTR Param3
  1202. );
  1203. BOOL
  1204. InitializePrinting(
  1205. VOID
  1206. );
  1207. PJOB_ENTRY
  1208. FindJob(
  1209. IN HANDLE FaxHandle
  1210. );
  1211. PJOB_ENTRY
  1212. FindJobByPrintJob(
  1213. IN DWORD PrintJobId
  1214. );
  1215. BOOL
  1216. HandoffCallToRas(
  1217. PLINE_INFO LineInfo,
  1218. HCALL hCall
  1219. );
  1220. BOOL
  1221. InitializeStringTable(
  1222. VOID
  1223. );
  1224. BOOL
  1225. InitializeFaxQueue(
  1226. PREG_FAX_SERVICE pFaxReg
  1227. );
  1228. BOOL
  1229. OpenTapiLine(
  1230. PLINE_INFO LineInfo
  1231. );
  1232. PVOID
  1233. MyGetJob(
  1234. HANDLE hPrinter,
  1235. DWORD level,
  1236. DWORD jobId
  1237. );
  1238. LONG
  1239. MyLineGetTransCaps(
  1240. LPLINETRANSLATECAPS *LineTransCaps
  1241. );
  1242. BOOL
  1243. GenerateUniqueArchiveFileName(
  1244. IN LPTSTR Directory,
  1245. OUT LPTSTR FileName,
  1246. IN UINT cchFileName,
  1247. IN DWORDLONG JobId,
  1248. IN LPTSTR lptstrUserSid
  1249. );
  1250. VOID
  1251. SetLineState(
  1252. PLINE_INFO LineInfo,
  1253. DWORD State
  1254. );
  1255. BOOL
  1256. CreateFaxEvent(
  1257. DWORD DeviceId,
  1258. DWORD EventId,
  1259. DWORD JobId
  1260. );
  1261. BOOL
  1262. GetFaxEvent(
  1263. PLINE_INFO LineInfo,
  1264. PFAX_EVENT Event
  1265. );
  1266. DWORD
  1267. MapFSPIJobStatusToEventId(
  1268. LPCFSPI_JOB_STATUS lpcFSPIJobStatus
  1269. );
  1270. void
  1271. FreeServiceContextHandles(
  1272. void
  1273. );
  1274. PHANDLE_ENTRY
  1275. CreateNewPortHandle(
  1276. handle_t hBinding,
  1277. PLINE_INFO LineInfo,
  1278. DWORD Flags
  1279. );
  1280. PHANDLE_ENTRY
  1281. CreateNewMsgEnumHandle(
  1282. handle_t hBinding,
  1283. HANDLE hFileFind,
  1284. LPCWSTR lpcwstrFirstFileName,
  1285. FAX_ENUM_MESSAGE_FOLDER Folder
  1286. );
  1287. PHANDLE_ENTRY
  1288. CreateNewCopyHandle(
  1289. handle_t hBinding,
  1290. HANDLE hFile,
  1291. BOOL bCopyToServer,
  1292. LPCWSTR lpcwstrFileName,
  1293. PJOB_QUEUE pJobQueue
  1294. );
  1295. PHANDLE_ENTRY
  1296. CreateNewConnectionHandle(
  1297. handle_t hBinding,
  1298. DWORD dwClientAPIVersion
  1299. );
  1300. BOOL
  1301. IsPortOpenedForModify(
  1302. PLINE_INFO LineInfo
  1303. );
  1304. VOID
  1305. CloseFaxHandle(
  1306. PHANDLE_ENTRY HandleEntry
  1307. );
  1308. LPLINEDEVSTATUS
  1309. MyLineGetLineDevStatus(
  1310. HLINE hLine
  1311. );
  1312. DWORD
  1313. InitializeServerSecurity(
  1314. VOID
  1315. );
  1316. DWORD
  1317. FaxSvcAccessCheck(
  1318. IN ACCESS_MASK DesiredAccess,
  1319. OUT BOOL* lpbAccessStatus,
  1320. OUT LPDWORD lpdwGrantedAccess
  1321. );
  1322. PROUTING_METHOD
  1323. FindRoutingMethodByGuid(
  1324. IN LPCWSTR RoutingGuidString
  1325. );
  1326. DWORD
  1327. EnumerateRoutingMethods(
  1328. IN PFAXROUTEMETHODENUM Enumerator,
  1329. IN LPVOID Context
  1330. );
  1331. //
  1332. // QUEUE.C
  1333. //
  1334. void
  1335. FreeServiceQueue(
  1336. void
  1337. );
  1338. DWORD
  1339. RemoveJobStatusModifiers(DWORD dwJobStatus);
  1340. VOID
  1341. RescheduleJobQueueEntry(
  1342. IN PJOB_QUEUE JobQueue
  1343. );
  1344. BOOL
  1345. StartJobQueueTimer(
  1346. VOID
  1347. );
  1348. BOOL
  1349. SetDiscountTime(
  1350. IN OUT LPSYSTEMTIME SystemTime
  1351. );
  1352. LPWSTR
  1353. GetClientUserName(
  1354. VOID
  1355. );
  1356. PSID
  1357. GetClientUserSID(
  1358. VOID
  1359. );
  1360. BOOL UserOwnsJob(
  1361. IN const PJOB_QUEUE lpcJobQueue,
  1362. IN const PSID lpcUserSId
  1363. );
  1364. BOOL
  1365. RestoreFaxQueue(
  1366. VOID
  1367. );
  1368. PJOB_QUEUE
  1369. FindJobQueueEntryByJobQueueEntry(
  1370. IN PJOB_QUEUE JobQueueEntry
  1371. );
  1372. PJOB_QUEUE
  1373. FindJobQueueEntry(
  1374. IN DWORD JobId
  1375. );
  1376. PJOB_QUEUE
  1377. FindJobQueueEntryByUniqueId(
  1378. IN DWORDLONG UniqueId
  1379. );
  1380. DWORD
  1381. JobQueueThread(
  1382. LPVOID UnUsed
  1383. );
  1384. BOOL
  1385. ResumeJobQueueEntry(
  1386. IN PJOB_QUEUE JobQueue
  1387. );
  1388. BOOL
  1389. PauseJobQueueEntry(
  1390. IN PJOB_QUEUE JobQueue
  1391. );
  1392. BOOL
  1393. PauseServerQueue(
  1394. VOID
  1395. );
  1396. BOOL
  1397. ResumeServerQueue(
  1398. VOID
  1399. );
  1400. BOOL
  1401. SetFaxServiceAutoStart(
  1402. VOID
  1403. );
  1404. DWORD
  1405. GetFaxDeviceCount(
  1406. VOID
  1407. );
  1408. DWORD
  1409. CreateVirtualDevices(
  1410. PREG_FAX_SERVICE FaxReg,
  1411. DWORD dwAPIVersion
  1412. );
  1413. BOOL
  1414. CommitDeviceChanges(
  1415. PLINE_INFO pLineInfo
  1416. );
  1417. BOOL
  1418. SortMethodPriorities(
  1419. VOID
  1420. );
  1421. BOOL
  1422. CommitMethodChanges(
  1423. VOID
  1424. );
  1425. VOID
  1426. UpdateVirtualDevices(
  1427. VOID
  1428. );
  1429. VOID
  1430. UpdateVirtualDeviceSendAndReceiveStatus(
  1431. PLINE_INFO pLineInfo,
  1432. BOOL bSend,
  1433. BOOL bReceive
  1434. );
  1435. BOOL
  1436. IsVirtualDevice(
  1437. const LINE_INFO *pLineInfo
  1438. );
  1439. DWORD
  1440. ValidateTiffFile(
  1441. LPCWSTR TiffFile
  1442. );
  1443. BOOL PersonalProfileSerialize(
  1444. LPCFAX_PERSONAL_PROFILEW lpProfileSrc,
  1445. PFAX_PERSONAL_PROFILE lpProfileDst,
  1446. LPBYTE lpbBuffer,
  1447. PULONG_PTR pupOffset,
  1448. DWORD dwBufferSize
  1449. );
  1450. void
  1451. DecreaseJobRefCount (
  1452. PJOB_QUEUE pJobQueue,
  1453. BOOL bNotify,
  1454. BOOL bRemoveRecipientJobs = TRUE,
  1455. BOOL bPreview = FALSE
  1456. );
  1457. void
  1458. IncreaseJobRefCount (
  1459. PJOB_QUEUE pJobQueue,
  1460. BOOL bPreview = FALSE
  1461. );
  1462. PJOB_QUEUE_PTR FindRecipientRefByJobId(PJOB_QUEUE lpParentJob,DWORD dwJobId);
  1463. BOOL RemoveParentRecipientRef(PJOB_QUEUE lpParentJob,const PJOB_QUEUE lpcRecpJob);
  1464. BOOL RemoveParentRecipients(PJOB_QUEUE lpParentJob, BOOL bNotify);
  1465. BOOL RemoveRecipientJob(PJOB_QUEUE lpJobToRemove,BOOL bNotify, BOOL bRecalcQueueTimer);
  1466. BOOL RemoveParentJob(PJOB_QUEUE lpJobQueue, BOOL bRemoveRecipients, BOOL bNotify);
  1467. BOOL RemoveReceiveJob(PJOB_QUEUE lpJobToRemove,BOOL bNotify);
  1468. BOOL CopyJobParamEx(PFAX_JOB_PARAM_EXW lpDst,LPCFAX_JOB_PARAM_EXW lpcSrc);
  1469. void FreeJobParamEx(PFAX_JOB_PARAM_EXW lpJobParamEx,BOOL bDestroy);
  1470. #if DBG
  1471. void DumpJobParamsEx( LPCFAX_JOB_PARAM_EX lpParams);
  1472. #endif
  1473. BOOL CopyCoverPageInfoEx(PFAX_COVERPAGE_INFO_EXW lpDst,LPCFAX_COVERPAGE_INFO_EXW lpcSrc);
  1474. void FreeCoverPageInfoEx(PFAX_COVERPAGE_INFO_EXW lpCoverpage, BOOL bDestroy) ;
  1475. #if DBG
  1476. void DumpCoverPageEx(LPCFAX_COVERPAGE_INFO_EX lpcCover);
  1477. #endif
  1478. void FreeParentQueueEntry(PJOB_QUEUE lpJobQueueEntry, BOOL bDestroy);
  1479. #if DBG
  1480. void DumpParentJob(const PJOB_QUEUE lpParentJob);
  1481. #endif
  1482. void FreeRecipientQueueEntry(PJOB_QUEUE lpJobQueue, BOOL bDestroy);
  1483. #if DBG
  1484. void DumpRecipientJob(const PJOB_QUEUE lpRecipJob) ;
  1485. #endif
  1486. void FreeReceiveQueueEntry(PJOB_QUEUE lpJobQueue, BOOL bDestroy);
  1487. #if DBG
  1488. void DumpReceiveJob(const PJOB_QUEUE lpcJob);
  1489. #endif
  1490. BOOL IsSendJobReadyForDeleting(PJOB_QUEUE lpParentJob);
  1491. BOOL SystemTimeToStr( IN const SYSTEMTIME * lptmTime, OUT LPTSTR lptstrDateTime, IN UINT cchstrDateTime);
  1492. BOOL UpdatePersistentJobStatus(const PJOB_QUEUE lpJobQueue);
  1493. DWORDLONG GenerateUniqueQueueFile(
  1494. IN DWORD dwJobType,
  1495. OUT LPTSTR lptstrFileName,
  1496. IN DWORD dwFileNameSize
  1497. );
  1498. PJOB_QUEUE
  1499. AddParentJob(IN const PLIST_ENTRY lpcQueueHead,
  1500. IN LPCWSTR lpcwstrBodyFile,
  1501. IN LPCFAX_PERSONAL_PROFILE lpcSenderProfile,
  1502. IN LPCFAX_JOB_PARAM_EXW lpcJobParams,
  1503. IN LPCFAX_COVERPAGE_INFO_EX lpcCoverPageInfo,
  1504. IN LPCWSTR lpcwstrUserName,
  1505. IN PSID UserSid,
  1506. IN LPCFAX_PERSONAL_PROFILEW lpcRecipientProfile,
  1507. IN BOOL bCreateQueueFile
  1508. );
  1509. PJOB_QUEUE
  1510. AddRecipientJob(
  1511. IN const PLIST_ENTRY lpcQueueHead,
  1512. IN PJOB_QUEUE lpParentJob,
  1513. IN LPCFAX_PERSONAL_PROFILE lpcRecipientProfile,
  1514. IN BOOL bCreateQueueFile,
  1515. DWORD dwJobStatus = JS_PENDING
  1516. );
  1517. PJOB_QUEUE
  1518. AddReceiveJobQueueEntry(
  1519. IN LPCTSTR FileName,
  1520. IN PJOB_ENTRY JobEntry,
  1521. IN DWORD JobType, // can be JT_RECEIVE or JT_RECEIVE_FAIL
  1522. IN DWORDLONG dwlUniqueJobID
  1523. );
  1524. BOOL MarkJobAsExpired(PJOB_QUEUE lpJobQueue);
  1525. DWORD
  1526. GetDevStatus(
  1527. HANDLE hFaxJob,
  1528. PLINE_INFO LineInfo,
  1529. LPFSPI_JOB_STATUS *ppFaxStatus
  1530. );
  1531. HRESULT
  1532. ReportLineStatusToCrm(
  1533. DWORD dwLineState,
  1534. const LINE_INFO *pLineInfo,
  1535. const JOB_QUEUE *pJobQueue
  1536. );
  1537. BOOL
  1538. GetRealFaxTimeAsSystemTime (
  1539. const PJOB_ENTRY lpcJobEntry,
  1540. FAX_ENUM_TIME_TYPES TimeType,
  1541. SYSTEMTIME* lpFaxTime
  1542. );
  1543. BOOL
  1544. GetRealFaxTimeAsFileTime (
  1545. const PJOB_ENTRY lpcJobEntry,
  1546. FAX_ENUM_TIME_TYPES TimeType,
  1547. FILETIME* lpFaxTime
  1548. );
  1549. BOOL
  1550. ReplaceStringWithCopy (
  1551. LPWSTR *plpwstrDst,
  1552. LPWSTR lpcwstrSrc
  1553. );
  1554. //
  1555. // Logging
  1556. //
  1557. BOOL
  1558. LogInboundActivity(
  1559. PJOB_QUEUE JobQueue,
  1560. LPCFSPI_JOB_STATUS pFaxStatus
  1561. );
  1562. DWORD
  1563. InitializeLogging(
  1564. VOID
  1565. );
  1566. DWORD
  1567. InitializeLoggingStringTables(
  1568. VOID
  1569. );
  1570. BOOL
  1571. LogOutboundActivity(
  1572. PJOB_QUEUE JobQueue
  1573. );
  1574. DWORD CreateLogDB (
  1575. LPCWSTR lpcwstrDBPath,
  1576. LPHANDLE phInboxFile,
  1577. LPHANDLE phOutboxFile
  1578. );
  1579. VOID
  1580. FaxExtFreeBuffer(
  1581. LPVOID lpvBuffer
  1582. );
  1583. PDEVICE_PROVIDER
  1584. FindFSPByGUID (
  1585. LPCWSTR lpcwstrGUID
  1586. );
  1587. //
  1588. // Events.cpp
  1589. //
  1590. DWORD
  1591. InitializeServerEvents (
  1592. void
  1593. );
  1594. DWORD
  1595. PostFaxEventEx (
  1596. PFAX_EVENT_EX pFaxEvent,
  1597. DWORD dwEventSize,
  1598. PSID pUserSid
  1599. );
  1600. DWORD
  1601. CreateQueueEvent (
  1602. FAX_ENUM_JOB_EVENT_TYPE JobEventType,
  1603. const PJOB_QUEUE lpcJobQueue
  1604. );
  1605. DWORD
  1606. CreateConfigEvent (
  1607. FAX_ENUM_CONFIG_TYPE ConfigType
  1608. );
  1609. DWORD
  1610. CreateQueueStateEvent (
  1611. DWORD dwQueueState
  1612. );
  1613. DWORD
  1614. CreateDeviceEvent (
  1615. PLINE_INFO pLine,
  1616. BOOL bRinging
  1617. );
  1618. DWORD
  1619. CreateArchiveEvent (
  1620. DWORDLONG dwlMessageId,
  1621. FAX_ENUM_EVENT_TYPE EventType,
  1622. FAX_ENUM_JOB_EVENT_TYPE MessageEventType,
  1623. PSID pUserSid
  1624. );
  1625. DWORD
  1626. CreateActivityEvent (
  1627. void
  1628. );
  1629. BOOL
  1630. SendReceipt(
  1631. BOOL bPositive,
  1632. BOOL bBroadcast,
  1633. const JOB_QUEUE * lpcJobQueue,
  1634. LPCTSTR lpctstrTIFF
  1635. );
  1636. VOID
  1637. SafeIncIdleCounter (
  1638. LPDWORD lpdwCounter
  1639. );
  1640. VOID
  1641. SafeDecIdleCounter (
  1642. LPDWORD lpdwCounter
  1643. );
  1644. VOID UpdateReceiveEnabledDevicesCount();
  1645. DWORD
  1646. GetServerErrorCode (
  1647. DWORD ec
  1648. );
  1649. DWORD
  1650. FindClientAPIVersion (handle_t);
  1651. //
  1652. // This structure is defined because the legacy FAX_COVERPAGE_INFO doesn't have the e-mail field.
  1653. // It is in use only inside functions participating in the rendering proccess.
  1654. // The only difference between FAX_COVERPAGE_INFOW2 and FAX_COVERPAGE_INFO is the e-mail field.
  1655. //
  1656. typedef struct _FAX_COVERPAGE_INFOW2
  1657. {
  1658. DWORD SizeOfStruct; // Size of this structure
  1659. //
  1660. // general
  1661. //
  1662. LPCWSTR CoverPageName; // coverpage document name
  1663. BOOL UseServerCoverPage; // coverpage exists on the fax server
  1664. //
  1665. // Recipient information
  1666. //
  1667. LPCWSTR RecName; //
  1668. LPCWSTR RecFaxNumber; //
  1669. LPCWSTR RecCompany; //
  1670. LPCWSTR RecStreetAddress; //
  1671. LPCWSTR RecCity; //
  1672. LPCWSTR RecState; //
  1673. LPCWSTR RecZip; //
  1674. LPCWSTR RecCountry; //
  1675. LPCWSTR RecTitle; //
  1676. LPCWSTR RecDepartment; //
  1677. LPCWSTR RecOfficeLocation; //
  1678. LPCWSTR RecHomePhone; //
  1679. LPCWSTR RecOfficePhone; //
  1680. //
  1681. // Sender information
  1682. //
  1683. LPCWSTR SdrName; //
  1684. LPCWSTR SdrFaxNumber; //
  1685. LPCWSTR SdrCompany; //
  1686. LPCWSTR SdrAddress; //
  1687. LPCWSTR SdrTitle; //
  1688. LPCWSTR SdrDepartment; //
  1689. LPCWSTR SdrOfficeLocation; //
  1690. LPCWSTR SdrHomePhone; //
  1691. LPCWSTR SdrOfficePhone; //
  1692. LPCWSTR SdrEmail; //
  1693. //
  1694. // Misc information
  1695. //
  1696. LPCWSTR Note; //
  1697. LPCWSTR Subject; //
  1698. SYSTEMTIME TimeSent; // Time the fax was sent
  1699. DWORD PageCount; // Number of pages
  1700. } FAX_COVERPAGE_INFOW2, *PFAX_COVERPAGE_INFOW2;
  1701. #include "ExtensionData.h"
  1702. #endif