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.

172 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxapi.h
  5. Abstract:
  6. This module contains all includes to the FAX client DLL. All
  7. objects in this DLL should include this header only.
  8. Author:
  9. Wesley Witt (wesw) 12-Jan-1996
  10. --*/
  11. #define _WINFAX_
  12. #include <windows.h>
  13. #include <shellapi.h>
  14. #include <winspool.h>
  15. #include <rpc.h>
  16. #include <tapi.h>
  17. #include <tapi3if.h>
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <tchar.h>
  21. #include <shlobj.h>
  22. #include "jobtag.h"
  23. #include "faxreg.h"
  24. #include "prtcovpg.h"
  25. #include "faxutil.h"
  26. #include "faxrpc.h"
  27. #include "faxcli.h"
  28. #include "faxsvcrg.h"
  29. #include "rpcutil.h"
  30. #include "tiff.h"
  31. #include "tifflib.h"
  32. #include "winfax.h"
  33. #include "winfaxp.h"
  34. #include "devmode.h"
  35. #define IDS_DEFAULT_PRINTER_NAME 100
  36. #define FHT_SERVICE 1
  37. #define FHT_PORT 2
  38. #define FAX_DRIVER_NAME TEXT("Windows NT Fax Driver")
  39. #define TAPI_LIBRARY TEXT("%systemroot%\\system32\\tapi32.dll")
  40. #define CP_FILENAME_EXT L".cov"
  41. #define CP_SHORTCUT_EXT L".lnk"
  42. #define ARGUMENT_PRESENT(ArgumentPointer) ((CHAR *)(ArgumentPointer) != (CHAR *)(NULL))
  43. #define FixupStringPtr(_buf,_str) if (_str) (LPWSTR)_str = (LPWSTR) ((LPBYTE)(*_buf) + (ULONG_PTR)_str)
  44. //
  45. // typedefs
  46. //
  47. typedef int (*FaxConnFunction)(LPTSTR,handle_t*);
  48. #define FH_PORT_HANDLE(_phe) (((PHANDLE_ENTRY)(_phe))->FaxPortHandle)
  49. #define FH_FAX_HANDLE(_phe) (((PHANDLE_ENTRY)(_phe))->FaxData->FaxHandle)
  50. #define FH_CONTEXT_HANDLE(_phe) (((PHANDLE_ENTRY)(_phe))->FaxContextHandle)
  51. #define FH_DATA(_phe) (((PHANDLE_ENTRY)(_phe))->FaxData)
  52. #define ValidateFaxHandle(_phe,_type) ((_phe && \
  53. *(LPDWORD)_phe && \
  54. (((PHANDLE_ENTRY)_phe)->Type == _type)) ? TRUE : FALSE)
  55. typedef struct _FAX_HANDLE_DATA {
  56. HANDLE FaxHandle; // Fax handle obtained from FaxConnectFaxServer()
  57. BOOL EventInit; //
  58. LIST_ENTRY HandleTableListHead; //
  59. CRITICAL_SECTION CsHandleTable; //
  60. LPWSTR MachineName; //
  61. } FAX_HANDLE_DATA, *PFAX_HANDLE_DATA;
  62. typedef struct _HANDLE_ENTRY {
  63. LIST_ENTRY ListEntry; // linked list pointers
  64. DWORD Type; // handle type, see FHT defines
  65. DWORD Flags; // open flags
  66. DWORD DeviceId; // device id
  67. PFAX_HANDLE_DATA FaxData; // pointer to connection data
  68. HANDLE FaxPortHandle; // open fax port handle
  69. HANDLE FaxContextHandle; // context handle for refcounting
  70. } HANDLE_ENTRY, *PHANDLE_ENTRY;
  71. typedef struct _ASYNC_EVENT_INFO {
  72. PFAX_HANDLE_DATA FaxData; // Pointer to connection data
  73. HANDLE CompletionPort; // Completion port handle
  74. ULONG_PTR CompletionKey; // Completion key
  75. } ASYNC_EVENT_INFO, *PASYNC_EVENT_INFO;
  76. extern OSVERSIONINFOA OsVersion;
  77. //
  78. // prototypes
  79. //
  80. VOID
  81. CloseFaxHandle(
  82. PFAX_HANDLE_DATA FaxData,
  83. PHANDLE_ENTRY HandleEntry
  84. );
  85. PHANDLE_ENTRY
  86. CreateNewServiceHandle(
  87. PFAX_HANDLE_DATA FaxData
  88. );
  89. PHANDLE_ENTRY
  90. CreateNewPortHandle(
  91. PFAX_HANDLE_DATA FaxData,
  92. DWORD Flags,
  93. HANDLE FaxPortHandle
  94. );
  95. BOOL
  96. ConvertUnicodeMultiSZInPlace(
  97. LPCWSTR UnicodeString,
  98. DWORD ByteCount
  99. );
  100. VOID
  101. ConvertUnicodeStringInPlace(
  102. LPCWSTR UnicodeString
  103. );
  104. VOID
  105. ConvertAnsiiStringInPlace(
  106. LPCSTR AnsiiString
  107. );
  108. VOID
  109. StoreString(
  110. LPCWSTR String,
  111. PULONG_PTR DestString,
  112. LPBYTE Buffer,
  113. PULONG_PTR Offset
  114. );
  115. VOID
  116. StoreStringA(
  117. LPCSTR String,
  118. PULONG_PTR DestString,
  119. LPBYTE Buffer,
  120. PULONG_PTR Offset
  121. );
  122. BOOL
  123. ValidateCoverpage(
  124. LPCWSTR CoverPageName,
  125. LPCWSTR ServerName,
  126. BOOL ServerCoverpage,
  127. LPWSTR ResolvedName
  128. );
  129. BOOL EnsureFaxServiceIsStarted(LPCWSTR ServerName);
  130. LPWSTR GetFaxPrinterName();
  131. BOOL
  132. IsLocalFaxConnection(
  133. HANDLE FaxHandle
  134. );