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.

499 lines
9.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. tifflib.h
  5. Abstract:
  6. This file contains the interfaces for the
  7. Windows XP FAX Server TIFF I/O Library.
  8. Environment:
  9. WIN32 User Mode
  10. Author:
  11. Wesley Witt (wesw) 17-Feb-1996
  12. --*/
  13. #ifndef _TIFFLIB_
  14. #define _TIFFLIB_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <tiff.h>
  19. #define TIFF_COMPRESSION_NONE 1
  20. #define TIFF_COMPRESSION_MH 2
  21. #define TIFF_COMPRESSION_MR 3
  22. #define TIFF_COMPRESSION_MMR 4
  23. #define TIFFF_RES_Y 196
  24. #define TIFFF_RES_Y_DRAFT 98
  25. //
  26. // The value of the TIFFTAG_FAX_VERSION TIF tag
  27. // The current fax tif version
  28. //
  29. #define FAX_TIFF_XP_VERSION 2
  30. #define FAX_TIFF_CURRENT_VERSION FAX_TIFF_XP_VERSION
  31. typedef struct _TIFF_INFO {
  32. DWORD ImageWidth;
  33. DWORD ImageHeight;
  34. DWORD PageCount;
  35. DWORD PhotometricInterpretation;
  36. DWORD ImageSize;
  37. DWORD CompressionType;
  38. DWORD FillOrder;
  39. DWORD YResolution;
  40. } UNALIGNED TIFF_INFO, *PTIFF_INFO;
  41. typedef struct _MS_TAG_INFO {
  42. LPTSTR RecipName;
  43. LPTSTR RecipNumber;
  44. LPTSTR SenderName;
  45. LPTSTR Routing;
  46. LPTSTR CallerId;
  47. LPTSTR Csid;
  48. LPTSTR Tsid;
  49. DWORDLONG StartTime;
  50. DWORDLONG EndTime;
  51. DWORDLONG SubmissionTime;
  52. DWORDLONG OriginalScheduledTime;
  53. DWORD Type;
  54. LPTSTR Port;
  55. DWORD Pages;
  56. DWORD Retries;
  57. LPTSTR RecipCompany;
  58. LPTSTR RecipStreet;
  59. LPTSTR RecipCity;
  60. LPTSTR RecipState;
  61. LPTSTR RecipZip;
  62. LPTSTR RecipCountry;
  63. LPTSTR RecipTitle;
  64. LPTSTR RecipDepartment;
  65. LPTSTR RecipOfficeLocation;
  66. LPTSTR RecipHomePhone;
  67. LPTSTR RecipOfficePhone;
  68. LPTSTR RecipEMail;
  69. LPTSTR SenderNumber;
  70. LPTSTR SenderCompany;
  71. LPTSTR SenderStreet;
  72. LPTSTR SenderCity;
  73. LPTSTR SenderState;
  74. LPTSTR SenderZip;
  75. LPTSTR SenderCountry;
  76. LPTSTR SenderTitle;
  77. LPTSTR SenderDepartment;
  78. LPTSTR SenderOfficeLocation;
  79. LPTSTR SenderHomePhone;
  80. LPTSTR SenderOfficePhone;
  81. LPTSTR SenderEMail;
  82. LPTSTR SenderBilling;
  83. LPTSTR Document;
  84. LPTSTR Subject;
  85. LPTSTR SenderUserName;
  86. LPTSTR SenderTsid;
  87. DWORD Priority;
  88. DWORD dwStatus;
  89. DWORD dwExtendedStatus;
  90. LPTSTR lptstrExtendedStatus;
  91. DWORDLONG dwlBroadcastId;
  92. } MS_TAG_INFO, *PMS_TAG_INFO;
  93. BOOL
  94. FXSTIFFInitialize(
  95. VOID
  96. );
  97. HANDLE
  98. TiffCreate(
  99. LPTSTR FileName,
  100. DWORD CompressionType,
  101. DWORD ImageWidth,
  102. DWORD FillOrder,
  103. DWORD HiRes
  104. );
  105. HANDLE
  106. TiffOpen(
  107. LPCTSTR FileName,
  108. PTIFF_INFO TiffInfo,
  109. BOOL ReadOnly,
  110. DWORD RequestedFillOrder
  111. );
  112. BOOL
  113. TiffClose(
  114. HANDLE hTiff
  115. );
  116. BOOL
  117. TiffStartPage(
  118. HANDLE hTiff
  119. );
  120. BOOL
  121. TiffEndPage(
  122. HANDLE hTiff
  123. );
  124. BOOL
  125. TiffWriteRaw(
  126. HANDLE hTiff,
  127. LPBYTE TiffData,
  128. DWORD Size
  129. );
  130. BOOL
  131. TiffRead(
  132. HANDLE hTiff,
  133. LPBYTE TiffData,
  134. DWORD dwTiffDataSize,
  135. DWORD PadLength
  136. );
  137. BOOL
  138. TiffSeekToPage(
  139. HANDLE hTiff,
  140. DWORD PageNumber,
  141. DWORD FillOrder
  142. );
  143. BOOL
  144. TiffRecoverGoodPages(
  145. LPTSTR SrcFileName,
  146. LPDWORD RecoveredPages,
  147. LPDWORD TotalPages
  148. );
  149. // fast tiff
  150. void
  151. BuildLookupTables(
  152. DWORD TableLength
  153. );
  154. BOOL
  155. DecodeMrPage(
  156. HANDLE hTiff,
  157. LPBYTE OutputBuffer,
  158. BOOL SingleLineBuffer,
  159. BOOL HiRes
  160. );
  161. BOOL
  162. DecodeMhPage(
  163. HANDLE hTiff,
  164. LPBYTE OutputBuffer,
  165. BOOL SingleLineBuffer
  166. );
  167. BOOL
  168. DecodeMmrPage(
  169. HANDLE hTiff,
  170. LPBYTE OutputBuffer,
  171. BOOL SingleLineBuffer,
  172. BOOL HiRes
  173. );
  174. BOOL
  175. ConvMmrPageToMrSameRes(
  176. HANDLE hTiff,
  177. LPDWORD lpdwOutputBuffer,
  178. DWORD *lpdwSizeOutputBuffer,
  179. BOOL NegotHiRes
  180. );
  181. BOOL
  182. ConvMmrPageHiResToMrLoRes(
  183. HANDLE hTiff,
  184. LPDWORD lpdwOutputBuffer,
  185. DWORD *lpdwSizeOutputBuffer
  186. );
  187. BOOL
  188. ConvMmrPageToMh(
  189. HANDLE hTiff,
  190. LPDWORD lpdwOutputBuffer,
  191. DWORD *lpdwSizeOutputBuffer,
  192. BOOL NegotHiRes,
  193. BOOL SrcHiRes
  194. );
  195. BOOL
  196. ConvFileMhToMmr(
  197. LPTSTR SrcFileName,
  198. LPTSTR DestFileName
  199. );
  200. BOOL
  201. OutputMmrLine(
  202. LPDWORD lpdwOut,
  203. BYTE BitOut,
  204. WORD *pCurLine,
  205. WORD *pRefLine,
  206. LPDWORD *lpdwResPtr,
  207. BYTE *ResBit,
  208. LPDWORD lpdwOutLimit,
  209. DWORD lineWidth
  210. );
  211. BOOL
  212. TiffPostProcessFast(
  213. LPTSTR SrcFileName,
  214. LPTSTR DstFileName // can be null for generated name
  215. );
  216. BOOL
  217. MmrAddBranding(
  218. LPCTSTR SrcFileName,
  219. LPTSTR Branding,
  220. LPTSTR BrandingOf,
  221. INT BrandingHeight
  222. );
  223. int
  224. ScanMhSegment(
  225. LPDWORD *lplpdwResPtr,
  226. BYTE *lpResBit,
  227. LPDWORD EndPtr,
  228. LPDWORD EndBuffer,
  229. DWORD *Lines,
  230. DWORD *BadFaxLines,
  231. DWORD *ConsecBadLines,
  232. DWORD AllowedBadFaxLines,
  233. DWORD AllowedConsecBadLines,
  234. DWORD lineWidth
  235. );
  236. BOOL
  237. ScanMrSegment(
  238. LPDWORD *lplpdwResPtr,
  239. BYTE *lpResBit,
  240. LPDWORD EndPtr,
  241. LPDWORD EndBuffer,
  242. DWORD *Lines,
  243. DWORD *BadFaxLines,
  244. DWORD *ConsecBadLines,
  245. DWORD AllowedBadFaxLines,
  246. DWORD AllowedConsecBadLines,
  247. BOOL *f1D,
  248. DWORD lineWidth
  249. );
  250. BOOL
  251. TiffGetCurrentPageData(
  252. HANDLE hTiff,
  253. LPDWORD Lines,
  254. LPDWORD StripDataSize,
  255. LPDWORD ImageWidth,
  256. LPDWORD ImageHeight
  257. );
  258. BOOL
  259. TiffGetCurrentPageResolution(
  260. HANDLE hTiff,
  261. LPDWORD lpdwYResolution,
  262. LPDWORD lpdwXResolution
  263. );
  264. BOOL
  265. TiffPrint (
  266. LPCTSTR lpctstrTiffFileName,
  267. LPTSTR lptstrPrinterName
  268. );
  269. BOOL
  270. TiffPrintDC (
  271. LPCTSTR lpctstrTiffFileName,
  272. HDC hdcPrinterDC
  273. );
  274. BOOL
  275. TiffUncompressMmrPage(
  276. HANDLE hTiff,
  277. LPDWORD lpdwOutputBuffer,
  278. DWORD dwOutputBufferSize,
  279. LPDWORD Lines
  280. );
  281. BOOL
  282. TiffUncompressMmrPageRaw(
  283. LPBYTE StripData,
  284. DWORD StripDataSize,
  285. DWORD ImageWidth,
  286. LPDWORD lpdwOutputBuffer,
  287. DWORD dwOutputBufferSize,
  288. LPDWORD LinesOut
  289. );
  290. BOOL
  291. TiffExtractFirstPage(
  292. LPTSTR FileName,
  293. LPBYTE *Buffer,
  294. LPDWORD BufferSize,
  295. LPDWORD ImageWidth,
  296. LPDWORD ImageHeight
  297. );
  298. BOOL
  299. TiffAddMsTags(
  300. LPTSTR FileName,
  301. PMS_TAG_INFO MsTagInfo,
  302. BOOL fSendJob
  303. );
  304. BOOL
  305. TiffLimitTagNumber(
  306. LPCTSTR FileName,
  307. DWORD dwMaxTags
  308. );
  309. BOOL
  310. PrintTiffFile(
  311. HDC PrinterDC,
  312. LPTSTR FileName
  313. );
  314. #define TIFFCF_ORIGINAL_FILE_GOOD 0x00000001
  315. #define TIFFCF_UNCOMPRESSED_BITS 0x00000002
  316. #define TIFFCF_NOT_TIFF_FILE 0x00000004
  317. BOOL
  318. ConvertTiffFileToValidFaxFormat(
  319. LPTSTR TiffFileName,
  320. LPTSTR NewFileName,
  321. LPDWORD Flags
  322. );
  323. BOOL
  324. MergeTiffFiles(
  325. LPCTSTR BaseTiffFile,
  326. LPCTSTR NewTiffFile
  327. );
  328. BOOL
  329. TiffSetCurrentPageWidth(
  330. HANDLE hTiff,
  331. DWORD ImageWidth
  332. );
  333. BOOL
  334. TiffSetCurrentPageParams(
  335. HANDLE hTiff,
  336. DWORD CompressionType,
  337. DWORD ImageWidth,
  338. DWORD FillOrder,
  339. DWORD HiRes
  340. );
  341. BOOL
  342. PrintRandomDocument(
  343. LPCTSTR FaxPrinterName,
  344. LPCTSTR DocName,
  345. LPTSTR OutputFile
  346. );
  347. BOOL
  348. MemoryMapTiffFile(
  349. LPCTSTR lpctstrFileName,
  350. LPDWORD lpdwFileSize,
  351. LPBYTE* lppbfPtr,
  352. HANDLE* phFile,
  353. HANDLE* phMap,
  354. LPDWORD lpdwIfdOffset
  355. );
  356. LPWSTR
  357. GetMsTagString(
  358. LPBYTE RefPointer,
  359. DWORD dwFileSize,
  360. PTIFF_TAG pTiffTag
  361. );
  362. BOOL
  363. GetMsTagDwordLong(
  364. LPBYTE pbBegin,
  365. DWORD dwFileSize,
  366. PTIFF_TAG pTiffTag,
  367. DWORDLONG* pdwlOut
  368. );
  369. BOOL
  370. GetMsTagFileTime(
  371. LPBYTE pbBegin,
  372. DWORD dwFileSize,
  373. PTIFF_TAG pTiffTag,
  374. FILETIME* pftOut
  375. );
  376. void
  377. FreeMsTagInfo(
  378. PMS_TAG_INFO pMsTags
  379. );
  380. //
  381. // DO NOT CHANGE
  382. // It's W2K MS Fax TIFFTAG_SOFTWARE tif file tag value
  383. //
  384. #define W2K_FAX_SOFTWARE_TIF_TAG "Windows NT Fax Server"
  385. #define ERROR_XP_TIF_FILE_FORMAT 20001L
  386. //
  387. // A TIF file has XP format and its type do not match required archive type
  388. //
  389. #define ERROR_XP_TIF_WITH_WRONG_ARCHIVE_TYPE 20002L
  390. #ifdef UNICODE
  391. DWORD
  392. GetW2kMsTiffTags(
  393. LPCWSTR cszFileName,
  394. PMS_TAG_INFO pMsTags,
  395. BOOL bSentArchive
  396. );
  397. #endif // UNICODE
  398. #ifdef __cplusplus
  399. }
  400. #endif
  401. #endif