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.

136 lines
5.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. newfsp.h
  5. Abstract:
  6. This module contains the newfsp definitions
  7. --*/
  8. #include <windows.h>
  9. #include <stdio.h>
  10. #include <tapi.h>
  11. #include <faxdev.h>
  12. #include <winfax.h>
  13. #include "macros.h"
  14. #include "reg.h"
  15. // RESOURCE_STRING_LEN is the maximum length of a resource string
  16. #define RESOURCE_STRING_LEN 256
  17. // MAX_PATH_LEN is the maximum length of a fully-qualified path without the filename
  18. #define MAX_PATH_LEN MAX_PATH - 16
  19. // NEWFSP_DEVICE_LIMIT is the virtual fax device limit of the newfsp service provider
  20. #define NEWFSP_DEVICE_LIMIT 4
  21. // NEWFSP_LOG_FILE is the name of the log file
  22. #define NEWFSP_LOG_FILE L"newfsp.log"
  23. // DEVICE_NAME_PREFIX is the name prefix for the virtual fax devices
  24. #define NEWFSP_DEVICE_NAME_PREFIX L"NewFsp Device "
  25. // DEVICE_ID_PREFIX is the value that identifies the virtual fax devices
  26. #define NEWFSP_DEVICE_ID_PREFIX 0x10000
  27. // DEVICE_IDLE indicates the virtual fax device is idle
  28. #define DEVICE_IDLE 1
  29. // DEVICE_START indicates the virtual fax device is pending a fax job
  30. #define DEVICE_START 2
  31. // DEVICE_SEND indicates the virtual fax device is sending
  32. #define DEVICE_SEND 3
  33. // DEVICE_RECEIVE indicates the virtual fax device is receiving
  34. #define DEVICE_RECEIVE 4
  35. // DEVICE_ABORTING indicates the virtual fax device is aborting
  36. #define DEVICE_ABORTING 5
  37. // JOB_UNKNOWN indicates the fax job is pending
  38. #define JOB_UNKNOWN 1
  39. // JOB_SEND indicates the fax job is a send
  40. #define JOB_SEND 2
  41. // JOB_RECEIVE indicates the fax job is a receive
  42. #define JOB_RECEIVE 3
  43. typedef struct _DEVICE_INFO {
  44. CRITICAL_SECTION cs; // object to serialize access to the virtual fax device
  45. DWORD DeviceId; // specifies the identifier of the virtual fax device
  46. WCHAR Directory[MAX_PATH_LEN]; // specifies the virtual fax device's incoming fax directory
  47. DWORD Status; // specifies the current status of the virtual fax device
  48. HANDLE ExitEvent; // specifies the handle to the event to indicate the thread to watch for an incoming fax transmission is to exit
  49. struct _DEVICE_INFO *pNextDeviceInfo; // pointer to the next virtual fax device
  50. struct _JOB_INFO *pJobInfo; // pointer to the fax job associated with the virtual fax device
  51. } DEVICE_INFO, *PDEVICE_INFO;
  52. typedef struct _JOB_INFO {
  53. PDEVICE_INFO pDeviceInfo; // pointer to the virtual fax device data associated with the fax job
  54. HANDLE CompletionPortHandle; // specifies a handle to an I/O completion port
  55. ULONG_PTR CompletionKey; // specifies a completion port key value
  56. DWORD JobType; // specifies the fax job type
  57. DWORD Status; // specifies the current status of the fax job
  58. HLINE LineHandle; // specifies a handle to the open line device associated with the fax job
  59. HCALL CallHandle; // specifies a handle to the active call associated with the fax job
  60. LPWSTR FileName; // specifies the full path to the file that contains the data stream for the fax document
  61. LPWSTR CallerName; // specifies the name of the calling device
  62. LPWSTR CallerNumber; // specifies the telephone number of the calling device
  63. LPWSTR ReceiverName; // specifies the name of the receiving device
  64. LPWSTR ReceiverNumber; // specifies the telephone number of the receiving device
  65. DWORD RetryCount; // specifies the number of retries associated with the fax job
  66. BOOL Branding; // specifies whether the fax service provider should generate a brand at the top of the fax transmission
  67. DWORD PageCount; // specifies the number of pages associated with the fax job
  68. LPWSTR CSI; // specifies the identifier of the remote fax device
  69. LPWSTR CallerId; // specifies the identifier of the calling fax device
  70. LPWSTR RoutingInfo; // specifies the routing string associated with the fax job
  71. } JOB_INFO, *PJOB_INFO;
  72. HANDLE g_hInstance; // g_hInstance is the global handle to the module
  73. HLINEAPP g_LineAppHandle; // g_LineAppHandle is the global handle to the fax service's registration with TAPI
  74. HANDLE g_CompletionPort; // g_CompletionPort is the global handle to an I/O completion port that the fax service provider must use to post I/O completion port packets to the fax service for asynchronous line status events
  75. ULONG_PTR g_CompletionKey; // g_CompletionKey is the global completion port key value
  76. HANDLE g_hLogFile; // g_hLogFile is the global handle to the log file
  77. PDEVICE_INFO *g_pDeviceInfo; // g_pDeviceInfo is the global pointer to the virtual fax device data
  78. // Function definitions:
  79. BOOL
  80. GetNewFspRegistryData(
  81. BOOL *bLoggingEnabled,
  82. LPWSTR lpszLoggingDirectory,
  83. PDEVICE_INFO *pDeviceInfo,
  84. LPDWORD pdwNumDevices
  85. );
  86. VOID
  87. SetNewFspRegistryData(
  88. BOOL bLoggingEnabled,
  89. LPWSTR lpszLoggingDirectory,
  90. PDEVICE_INFO pDeviceInfo
  91. );
  92. BOOL
  93. OpenLogFile(
  94. BOOL bLoggingEnabled,
  95. LPWSTR lpszLoggingDirectory
  96. );
  97. VOID
  98. CloseLogFile(
  99. );
  100. VOID
  101. WriteDebugString(
  102. LPWSTR lpszFormatString,
  103. ...
  104. );
  105. VOID
  106. PostJobStatus(
  107. HANDLE CompletionPort,
  108. ULONG_PTR CompletionKey,
  109. DWORD StatusId,
  110. DWORD ErrorCode
  111. );