PageRenderTime 75ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/Sources/sdk/sccio.h

http://github.com/Nashev/OracleOutsideIn4Delphi
C Header | 1931 lines | 1260 code | 275 blank | 396 comment | 0 complexity | 032e338ec5c490e8e24eaa2f6c5d58fa MD5 | raw file
  1. /* Copyright (c) 2001, 2010, Oracle and/or its affiliates.
  2. All rights reserved. */
  3. /*
  4. | SCC Viewer Technology - Include
  5. |
  6. | Include: SCCIO.H
  7. | Environment: Portable
  8. | Function: Defines for redirectable IO in Viewer Technology
  9. |
  10. */
  11. #ifndef SCCIO_H
  12. #define SCCIO_H
  13. #ifdef WINDOWS
  14. #ifndef SCC_PACK_SET
  15. #define SCC_PACK_SET 1
  16. #define SCC_PACKED_BY_SCCIO_H 1
  17. #pragma pack(push,8)
  18. #endif /* SCC_PACK_SET */
  19. #endif /* WINDOWS */
  20. #include "baseio.h" /* defines the basic IO abstraction (BASEIO struct) */
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #include "sccrc4.h"
  26. #ifdef WIN32
  27. #define IO_OSHANDLETYPE VTHANDLE
  28. #endif /*WIN32*/
  29. #ifdef UNIX
  30. #if defined(_DARWIN_SOURCE)
  31. #if defined(__OBJC__)
  32. typedef NSFileHandle *IO_OSHANDLETYPE;
  33. #else
  34. typedef VTLPVOID IO_OSHANDLETYPE;
  35. #endif /* __OBJC__ */
  36. #else
  37. #define IO_OSHANDLETYPE int
  38. #endif /* Mac OS X */
  39. #endif /*UNIX*/
  40. #ifdef NLM
  41. #define IO_OSHANDLETYPE int
  42. #endif /*NLM*/
  43. /*
  44. | Defines for dwType in IOOPEN function
  45. */
  46. #define IOTYPE_DOSPATH 1
  47. #define IOTYPE_OEMPATH IOTYPE_DOSPATH
  48. #define IOTYPE_ANSIPATH 2
  49. #define IOTYPE_MACPATH 3
  50. #define IOTYPE_UNICODEPATH 4
  51. #define IOTYPE_MACFSSPEC 5
  52. #define IOTYPE_MACHFS 6
  53. #define IOTYPE_TEMP 7
  54. #define IOTYPE_RANGE 8
  55. #define IOTYPE_SECONDARY 9
  56. #define IOTYPE_ISTREAM 10
  57. #define IOTYPE_SUBSTREAM 11
  58. #define IOTYPE_SUBSTORAGE 12
  59. #define IOTYPE_REDIRECT 13
  60. #define IOTYPE_ISTORAGE 14
  61. #define IOTYPE_UNIXPATH 15
  62. #define IOTYPE_SUBOBJECT 16
  63. #define IOTYPE_REMOTEFILTERACCESS 17
  64. #define IOTYPE_CHUNKER 18
  65. #define IOTYPE_COMPRESS 19
  66. #define IOTYPE_SECONDARYFULL 20
  67. #define IOTYPE_IOSPEC 21 /* reserved */
  68. #define IOTYPE_MEMORY 22
  69. /*** for using an open file handle, See sccda.c ***/
  70. #define IOTYPE_HANDLE 23
  71. /*** IOTYPE_URL reserved for Transformation Server */
  72. #define IOTYPE_URL 24
  73. #define IOTYPE_FITEMP 25
  74. #define IOTYPE_PATH 26 /* generic file system path (used by transformation server) */
  75. #define IOTYPE_LOCATOR 27 /* IOLOCATOR path */
  76. #define IOTYPE_LINKEDOBJECT 28 /* Linked object (attachment). */
  77. #define IOTYPE_ARCHIVEOBJECT 29 /* Used in DAOpenDocument to open Archive Nodes*/
  78. /* These IOTYPEs were added to support writable OLE2 using
  79. * Microsoft's interface.
  80. */
  81. #define IOTYPE_MSTREAM 30
  82. #define IOTYPE_MSTORAGE 31
  83. #define IOTYPE_MROOTSTORAGE 32
  84. /* These IOTYPEs were added to support writable OLE2 using
  85. * our portable interface.
  86. */
  87. #define IOTYPE_OLE2STREAM 33
  88. #define IOTYPE_OLE2STORAGE 34
  89. #define IOTYPE_OLE2ROOTSTORAGE 35
  90. /* added to support OLE Package embeddings */
  91. #define IOTYPE_OLEPACKAGE 36
  92. /* added for DASaveObject */
  93. #define IOTYPE_OBJECT 37
  94. /* added for in-memory temp files */
  95. #define IOTYPE_PHYSICALTEMP 38
  96. /* support for zip archive files */
  97. #define IOTYPE_ZIPFILE 39
  98. #define IOTYPE_ZIPNODE 40
  99. /* support for cab files */
  100. #define IOTYPE_CABINET 41
  101. #define IOTYPE_CABFILE 42
  102. #ifdef WINDOWS
  103. #define IOTYPE_WIN32VPATH IOTYPE_ANSIPATH
  104. #endif
  105. #ifdef UNIX
  106. #define IOTYPE_WIN32VPATH IOTYPE_UNIXPATH
  107. #endif
  108. #ifdef NLM
  109. #define IOTYPE_WIN32VPATH IOTYPE_DOSPATH
  110. #endif
  111. /*** Only used by DA to request opening a file requested through DASaveTreeNode */
  112. #define IOTYPE_USERREQUEST 29
  113. /*
  114. | Structures passed to IOOPEN function
  115. */
  116. typedef struct IOSPECMACHFStag
  117. {
  118. short vRefNum;
  119. VTLONG dirId;
  120. VTTCHAR fileName[256];
  121. } IOSPECMACHFS, * PIOSPECMACHFS;
  122. typedef struct IOSPECRANGEtag
  123. {
  124. HIOFILE hRefFile;
  125. #ifdef SCCFEATURE_64BITIO
  126. VTOFF_T dwFirstByte;
  127. VTOFF_T dwLastByte;
  128. #else
  129. VTDWORD dwFirstByte;
  130. VTDWORD dwLastByte;
  131. #endif
  132. } IOSPECRANGE, * PIOSPECRANGE;
  133. typedef struct IOSPECCOMPRESStag
  134. {
  135. HIOFILE hRefFile;
  136. VTDWORD dwFlags;
  137. VTDWORD dwType; /* type of compression */
  138. VTDWORD dwReserved1;
  139. VTDWORD dwReserved2;
  140. VTDWORD dwReserved3;
  141. VTSYSVAL pResPointer1;
  142. } IOSPECCOMPRESS, * PIOSPECCOMPRESS;
  143. typedef struct IOSPECSECONDARYtag
  144. {
  145. HIOFILE hRefFile;
  146. VTTCHAR szFileName[256];
  147. } IOSPECSECONDARY, * PIOSPECSECONDARY;
  148. typedef struct IOSPECSUBSTREAMtag
  149. {
  150. HIOFILE hRefStorage;
  151. VTTCHAR szStreamName[256];
  152. } IOSPECSUBSTREAM, * PIOSPECSUBSTREAM;
  153. typedef struct IOSPECSUBSTORAGEtag
  154. {
  155. HIOFILE hRefStorage;
  156. VTTCHAR szStorageName[256];
  157. } IOSPECSUBSTORAGE, * PIOSPECSUBSTORAGE;
  158. typedef struct IOSPECMROOTSTORAGEtag
  159. {
  160. /* Through NTFS, the maximum filename size is 255 UNICODE
  161. * characters plus the terminator.
  162. */
  163. HIOFILE hRefFile;
  164. VTTCHAR szFileName[512];
  165. VTDWORD dwFlags;
  166. }
  167. IOSPECMROOTSTORAGE, * PIOSPECMROOTSTORAGE;
  168. typedef struct IOSPECMSTREAMtag
  169. {
  170. HIOFILE hRefStorage;
  171. /* Maximum stream name size is 31 UNICODE characters
  172. * plus the terminator.
  173. */
  174. VTTCHAR szStreamName[256];
  175. }
  176. IOSPECMSTREAM, * PIOSPECMSTREAM;
  177. typedef struct IOSPECMSTORAGEtag
  178. {
  179. HIOFILE hRefStorage;
  180. /* Maximum storage name size is 31 UNICODE characters
  181. * plus the terminator.
  182. */
  183. VTTCHAR szStorageName[256];
  184. }
  185. IOSPECMSTORAGE, * PIOSPECMSTORAGE;
  186. /* Parameters to the IOGetInfo() / IOSetInfo() calls for Microsoft OLE2. */
  187. #define IOSETINFO_OLE2CLSID 1
  188. /* These mirror the STGM defines in objbase.h */
  189. #define SCC_STGM_CREATE 0x00001000L
  190. #define SCC_STGM_DIRECT 0x00000000L
  191. #define SCC_STGM_READWRITE 0x00000002L
  192. #define SCC_STGM_SHARE_EXCLUSIVE 0x00000010L
  193. #define SCC_STGM_SHARE_DENY_WRITE 0x00000020L
  194. #define SCC_STGM_DELETEONRELEASE 0x04000000L
  195. typedef struct IOSPECOLE2ROOTSTORAGEtag
  196. {
  197. HIOFILE hRefFile;
  198. VTTCHAR szFileName[512];
  199. VTDWORD dwFlags;
  200. } IOSPECOLE2ROOTSTORAGE, * PIOSPECOLE2ROOTSTORAGE;
  201. /* When opening an OLE2 root storage, we can wrap the provided
  202. * reference file and not re-open it on OLE2 document open and
  203. * not close it on OLE2 document close. Normal behavior is to
  204. * create/open a new file that the OLE2 document owns and let it
  205. * close it on document close.
  206. */
  207. #define SCC_WRAP_REFERENCE_FILE 0x00000001
  208. typedef struct IOSPECOLE2STREAMtag
  209. {
  210. HIOFILE hRefStorage;
  211. VTTCHAR szStreamName[256];
  212. } IOSPECOLE2STREAM, * PIOSPECOLE2STREAM;
  213. typedef struct IOSPECOLE2STORAGEtag
  214. {
  215. HIOFILE hRefStorage;
  216. VTTCHAR szStorageName[256];
  217. } IOSPECOLE2STORAGE, * PIOSPECOLE2STORAGE;
  218. typedef struct IOSPECSUBOBJECTtag
  219. {
  220. VTDWORD dwStructSize;
  221. VTSYSPARAM hDoc; /* VTHDOC is Defined in SCCDA.H, which is not included here */
  222. VTDWORD dwObjectId;
  223. VTDWORD dwStreamId;
  224. VTDWORD dwReserved1;
  225. VTDWORD dwReserved2;
  226. } IOSPECSUBOBJECT, * PIOSPECSUBOBJECT;
  227. /* used to access items in zip archive files,
  228. * added for MS Office 12 support */
  229. typedef struct IOSPECZIPNODEtag
  230. {
  231. HIOFILE hRefFile; /* zip file (block I/O) */
  232. VTCHAR szNodeName[512];
  233. } IOSPECZIPNODE, * PIOSPECZIPNODE;
  234. /* used to access items in cabinet archive files */
  235. typedef struct IOSPECCABFILEtag
  236. {
  237. HIOFILE hRefFile; /* cab file (block I/O) */
  238. VTWORD wFlags; /* see values below */
  239. VTWORD wFileIndex; /* file index */
  240. VTWORD wszFileName[512];/* null terminated file name */
  241. } IOSPECCABFILE, * PIOSPECCABFILE;
  242. /* possible values for IOSPECCABNODE.dwFlags */
  243. #define IO_CABFLAG_INDEX 0x0000
  244. #define IO_CABFLAG_NAME 0x0001
  245. /* used for archive objects in DA */
  246. typedef struct IOSPECARCHIVEOBJECTtag
  247. {
  248. VTDWORD dwStructSize;
  249. VTSYSPARAM hDoc; /* Parent Doc hDoc. VTHDOC is Defined in SCCDA.H, which is not included here */
  250. VTDWORD dwNodeId; /* Node ID */
  251. VTDWORD dwStreamId; /* I'm not sure if this is necessary */
  252. VTDWORD dwReserved1; /* Must always be 0 */
  253. VTDWORD dwReserved2; /* Must always be 0 */
  254. } IOSPECARCHIVEOBJECT, * PIOSPECARCHIVEOBJECT;
  255. /*
  256. Linked objects.
  257. */
  258. typedef struct IOSPECLINKEDOBJECTtag
  259. {
  260. VTDWORD dwStructSize;
  261. VTSYSPARAM hDoc; /* VTHDOC is Defined in SCCDA.H, which is not included here */
  262. VTDWORD dwObjectId; /* Object identifier. */
  263. VTDWORD dwType; /* Linked Object type. (SO_LOCATORTYPE_*) */
  264. VTDWORD dwParam1; /* Parameter for DoSpecial call. */
  265. VTDWORD dwParam2; /* Parameter for DoSpecial call. */
  266. VTDWORD dwReserved1; /* Unused. */
  267. VTDWORD dwReserved2; /* Unused. */
  268. } IOSPECLINKEDOBJECT, * PIOSPECLINKEDOBJECT;
  269. #define IO_FILEOPEN 0x0001
  270. #define IO_FILEISTEMP 0x0002
  271. typedef struct IOLOCATORSEGMENTtag
  272. {
  273. VTDWORD dwType; /* Locator type (SO_LOCATORTYPE_* from sodefs.h) */
  274. VTSYSPARAM param1; /* Parameter 1, use depends on locator segment type:
  275. OLEPATH, FILENAME, HYPERLINK, BOOKMARK: Pointer to double-byte string
  276. SECTION: Section number
  277. TAGREFERENCE: Tag ID
  278. DOSPECIAL: Optional parameter
  279. RANGE: Offset
  280. WINDOWSRESOURCE: Resource type
  281. COMPRESSION: Compression type */
  282. VTSYSPARAM param2; /* Parameter 2, use depends on locator segment type:
  283. OLEPATH, FILENAME, HYPERLINK, BOOKMARK: Length of double-byte string
  284. DOSPECIAL: Optional parameter
  285. RANGE: Length
  286. WINDOWSRESOURCE: Resource ID
  287. COMPRESSION: Compression flags */
  288. } IOLOCATORSEGMENT, * PIOLOCATORSEGMENT;
  289. typedef struct IOLOCATORtag
  290. {
  291. VTDWORD dwStructSize; /* sizeof(IOLOCATOR) */
  292. VTSYSPARAM hDoc; /* VTHDOC is Defined in SCCDA.H, which is not included here */
  293. VTDWORD dwSegmentCount; /* Number of segments in this locator */
  294. IOLOCATORSEGMENT* pSegments; /* Pointer to an array of locator segments */
  295. } IOLOCATOR, * PIOLOCATOR;
  296. #define IOLOCATOR_MAXSEGMENTS 256
  297. /*
  298. | Structure used for specifying the date and time of a file.
  299. */
  300. typedef struct IODATETIMEtag
  301. {
  302. VTDWORD dwYear; /* Year A.D. */
  303. VTDWORD dwMonth; /* Month, Jan == 1 */
  304. VTDWORD dwDay; /* Day of month */
  305. VTDWORD dwTime; /* Number of miliseconds since midnight */
  306. }IODATETIME, * PIODATETIME;
  307. typedef struct IORFAREQUESTtag
  308. {
  309. VTDWORD dwReserved1;
  310. VTDWORD dwReserved2;
  311. VTDWORD dwReserved3;
  312. VTDWORD dwReserved4;
  313. } IORFAREQUEST, * PIORFAREQUEST;
  314. /* LOWORD of request is one of the following: */
  315. #define RAREQ_CHUNKERDATA 1
  316. #define RAREQ_RAWDATA 2
  317. typedef IOERR (IO_ENTRYMODPTR IOGETREMOTEDATAPROC) (HIOFILE hFile, PIORFAREQUEST pRequest, VTVOID * *ppData, VTDWORD *pdwDataSize);
  318. typedef IOERR (IO_ENTRYMODPTR IOCLOSEREMOTEDATAPROC)(HIOFILE hFile);
  319. typedef IOERR (IO_ENTRYMODPTR IOOPENREMOTESUBOBJECTPROC)(HIOFILE hFile, VTDWORD dwObjectId, VTDWORD dwStreamId, VTDWORD dwReserved1, VTDWORD dwReserved2, VTDWORD * pdwSpecType, VTVOID * *pSpec);
  320. typedef struct IOBASERFAtag /* Remote Filter Access */
  321. {
  322. IOGETREMOTEDATAPROC pGetRemoteData;
  323. IOCLOSEREMOTEDATAPROC pCloseRemoteData;
  324. IOOPENREMOTESUBOBJECTPROC pOpenRemoteSubObject;
  325. VTVOID * pDummy[5];
  326. } IOBASERFA, * PIOBASERFA;
  327. /*
  328. | Structures for different types
  329. */
  330. typedef struct IORANGEFILEtag
  331. {
  332. BASEIO sBaseIO; /* Underlying IO system */
  333. HIOFILE hFile; /* Underlying IO system's handle to the file */
  334. VTDWORD dwFlags; /* Info flags */
  335. VTHANDLE hThis; /* Handle to this structure */
  336. #ifdef SCCFEATURE_64BITIO
  337. VTOFF_T dwFirstByte; /* Offset of the begining of the logical file */
  338. VTOFF_T dwLastByte; /* Offset of the end of the logical file */
  339. VTOFF_T dwCurPos; /* Offset in this rangefile wrt dwFirstByte */
  340. #else
  341. VTDWORD dwFirstByte; /* Offset of the begining of the logical file */
  342. VTDWORD dwLastByte; /* Offset of the end of the logical file */
  343. VTDWORD dwCurPos; /* Offset in this rangefile wrt dwFirstByte */
  344. #endif
  345. VTDWORD dwSavedPos; /* Pointer position of the reference file when the range was opened */
  346. } IORANGEFILE, * PIORANGEFILE;
  347. typedef struct IOCOMPRESSFILEtag
  348. {
  349. BASEIO sBaseIO; /* Underlying IO system */
  350. HIOFILE hFile; /* Underlying IO system's handle to the file */
  351. VTDWORD dwType; /* Type of compression */
  352. VTDWORD dwFlags; /* Info flags */
  353. VTHANDLE hThis; /* Handle to this structure */
  354. VTHANDLE hBuffer; /* Handle to a cached buffer of decompressed data */
  355. VTBYTE * pBuffer; /* pointer to cached buffer of decompressed data */
  356. VTHANDLE hData; /* Handle for data needed for decompression */
  357. VTBYTE * pData; /* pointer to data needed for decompression */
  358. VTDWORD dwBufferStartPos; /* Tell of current buffer start position */
  359. VTDWORD dwBufferSize; /* size in bytes of valid buffer */
  360. HIOFILE hTempFile; /* Temp file to store extra */
  361. #ifdef SCCFEATURE_64BITIO
  362. VTOFF_T dwTempFileSize; /* Current temp file size */
  363. VTOFF_T dwTempFilePos; /* Current position in the current temp file of decompressed data */
  364. VTOFF_T dwCurFilePos; /* Current absolute file position of decompressed data */
  365. #else
  366. VTDWORD dwTempFileSize; /* Current temp file size */
  367. VTDWORD dwTempFilePos; /* Current position in the current temp file of decompressed data */
  368. VTDWORD dwCurFilePos; /* Current absolute file position of decompressed data */
  369. #endif
  370. VTBYTE LastByte; /* keep the last byte read for easy bit reading */
  371. VTBYTE nBitsLeft;
  372. VTHANDLE hReadBuffer; /* handle to buffer for input */
  373. VTBYTE * pReadBuffer; /* pointer to buffer for input */
  374. VTDWORD dwReadBufferSize; /* size of read buffer */
  375. VTDWORD dwReadBufferPos; /* position in the read buffer */
  376. VTDWORD dwReadBufferFilePos; /* position of start of read buffer in the file */
  377. VTBOOL bReadBufferEOF; /* is the read buffer at EOF */
  378. VTDWORD dwReserved1;
  379. VTDWORD dwReserved2;
  380. VTDWORD dwReserved3;
  381. VTSYSVAL pResPointer1;
  382. } IOCOMPRESSFILE, * PIOCOMPRESSFILE;
  383. #define IO_COMPRESSREADBUFFERSIZE 16384
  384. /*
  385. | 256KB seems to be the right balance between going to the disk infrequently
  386. | and not having too much memory to schlep around when we do go to disk
  387. */
  388. #define IO_COMPRESSBUFFERSIZE 0x00040000
  389. #define IO_COMPRESSTYPE_NONE 0
  390. #define IO_COMPRESSTYPE_ZLIB 1
  391. #define IO_COMPRESSTYPE_BASE64 2
  392. /* LZSS Support added Nov 18, 1999 */
  393. #define IO_COMPRESSTYPE_LZSS 3
  394. /* Nov 2, 2000 PDF Decoding and Decompression methods types */
  395. #define IO_COMPRESSTYPE_ASCII85 4
  396. #define IO_COMPRESSTYPE_ASCIIHEX 5
  397. #define IO_COMPRESSTYPE_RLE 6
  398. #define IO_COMPRESSTYPE_FLATE 7
  399. #define IO_COMPRESSTYPE_LZW 8
  400. #define IO_COMPRESSTYPE_DCT 9
  401. #define IO_COMPRESSTYPE_CCITT 11
  402. #define IO_COMPRESSTYPE_RC4 13
  403. /* PK Implode added Sept 11, 2000, currently supports Binary only */
  404. #define IO_COMPRESSTYPE_PKMPLOD 10
  405. /* MIF Ascii decode support */
  406. #define IO_COMPRESSTYPE_MIFASCIIDECODE 12
  407. /* Same as zlib compression, but without any header information */
  408. #define IO_COMPRESSTYPE_ZLIB_NOHEADER 14
  409. #define IO_COMPRESSTYPE_UUENCODED 15
  410. #define IO_COMPRESSTYPE_XXENCODED 16
  411. #define IO_COMPRESSTYPE_BINHEX 17
  412. #define IO_COMPRESSTYPE_YENC 18
  413. #define IO_COMPRESSTYPE_BTOA 19
  414. #define IO_COMPRESSTYPE_QUOTEDPRINTABLE 20
  415. #define IO_COMPRESSTYPE_UTF7 21
  416. #define IO_COMPRESSTYPE_COMPRESSEDRTF 22
  417. /* JBIG 2 added May 14, 2004 */
  418. #define IO_COMPRESSTYPE_JBIG2 23
  419. /* CAB support for MSZIP decompression */
  420. #define IO_COMPRESSTYPE_MSZIP 24
  421. /* CAB support for LZX decompression */
  422. #define IO_COMPRESSTYPE_LZX 25
  423. /* Advanced Encryption Standard (AES) decryption - 9/29/09 */
  424. #define IO_COMPRESSTYPE_AES128 26
  425. #define IO_COMPRESSTYPE_AES192 27
  426. #define IO_COMPRESSTYPE_AES256 28
  427. /* ZIP Crypto */
  428. #define IO_COMPRESSTYPE_ZIPCRYPTO 29
  429. /* define unknown compression */
  430. #define IO_COMPRESSTYPE_UNKNOWN 255
  431. /*
  432. | Structure definitions for memory mapped IO.
  433. */
  434. #define IO_MEMFILE_INITSIZE 1024
  435. typedef struct IOGENMEMFILEtag
  436. {
  437. VTDWORD dwSize; /* should be set to the size of this structure */
  438. VTVOID * pData;
  439. VTDWORD dwDataSize; /* size of valid data */
  440. VTHANDLE hData;
  441. VTDWORD dwMemSize; /* size of allocated buffer (must be >= dwDataSize) */
  442. } IOGENMEMFILE, * PIOGENMEMFILE;
  443. typedef struct IOMEMORYFILEtag
  444. {
  445. BASEIO sBaseIO;
  446. VTLPBYTE pDataStart;
  447. VTLPBYTE pCurrPos;
  448. VTDWORD dwDataSize; /* size of valid data */
  449. VTHANDLE hThis;
  450. VTDWORD dwFlags;
  451. VTHANDLE hData;
  452. VTDWORD dwMemSize; /* size of allocated buffer (must be >= dwDataSize) */
  453. HIOFILE hRealFile; /* if we need a ral temp file, use this */
  454. } IOMEMORYFILE, * PIOMEMORYFILE;
  455. /*
  456. | Structure definitions for file access callbacks
  457. */
  458. typedef struct IOREQUESTDATAtag
  459. {
  460. VTDWORD dwSize; /* sizeof(IOREQUESTDATA) */
  461. VTWORD wFIId; /* FI id of reference file */
  462. VTDWORD dwSpecType; /* file spec type */
  463. VTVOID *pSpec; /* pointer to a file spec */
  464. VTDWORD dwRootSpecType; /* root file spec type */
  465. VTVOID *pRootSpec; /* pointer to the root file spec */
  466. VTDWORD dwAttemptNumber; /* The number of times the callback has already been called for the currently requested item of information */
  467. } IOREQUESTDATA, * PIOREQUESTDATA;
  468. /*****************************************************************************
  469. * Start of Zip stuff
  470. ****************************************************************************/
  471. /* Entry in table that stores sorted file names contained in zip file */
  472. typedef struct tagFZFILEINFO
  473. {
  474. VTDWORD dwNameLoc; /* offset of filename in Fzu.pNames */
  475. VTWORD wNameLen; /* length of filename */
  476. #ifdef SCCFEATURE_64BITIO
  477. VTOFF_T dwLoc; /* offset of actual file header */
  478. VTOFF_T dwDataLen; /* length of compressed data */
  479. #else
  480. VTDWORD dwLoc; /* offset of actual file header */
  481. VTDWORD dwDataLen; /* length of compressed data */
  482. #endif
  483. } FZFILEINFO, * PFZFILEINFO;
  484. /* Support for Zip file I/O system */
  485. typedef struct IOZIPFILEtag
  486. {
  487. BASEIO sBaseIO; /* Underlying IO system */
  488. VTHANDLE hThis; /* Handle to this structure */
  489. HIOFILE hRefFile; /* zip file */
  490. VTBOOL bCaseAware; /* filenames are case insensitive */
  491. VTHANDLE hFileTable; /* handle to pFileTable array */
  492. PFZFILEINFO pFileTable; /* sorted array of files in zip */
  493. VTDWORD dwFileCnt; /* number of files in zip */
  494. VTHANDLE hNames; /* handle to pNames */
  495. VTCHAR * pNames; /* concatenation of all filenames */
  496. VTDWORD dwNamesMax; /* allocated bytes in pNames */
  497. VTDWORD dwNamesUse; /* bytes used in pNames */
  498. } IOZIPFILE, * PIOZIPFILE;
  499. /* I/O struct for opened nodes within a zip file */
  500. typedef struct IOZIPNODEtag
  501. {
  502. BASEIO sBaseIO; /* Underlying IO system */
  503. VTHANDLE hThis; /* Handle to this structure */
  504. HIOFILE hRefFile; /* either .hRange or .hCompress */
  505. VTDWORD dwIndex; /* index into IOZIPFILE.pFileTable */
  506. HIOFILE hRange; /* handle to range file */
  507. HIOFILE hCompress; /* handle to compressed file */
  508. VTBYTE Buffer[512];/* space for buffered I/O */
  509. #ifdef SCCFEATURE_64BITIO
  510. VTOFF_T dwBufLoc; /* file location of start of buffer */
  511. #else
  512. VTDWORD dwBufLoc; /* file location of start of buffer */
  513. #endif
  514. VTDWORD dwBufCnt; /* amt of valid data in buffer */
  515. #ifdef SCCFEATURE_64BITIO
  516. VTOFF_T lBufPos; /* buffer offset wrt dwBufLoc */
  517. VTOFF_T dwVerify; /* for verifying buffered zip IO */
  518. #else
  519. VTLONG lBufPos; /* buffer offset wrt dwBufLoc */
  520. VTDWORD dwVerify; /* for verifying buffered zip IO */
  521. #endif
  522. } IOZIPNODE, * PIOZIPNODE;
  523. /* Structure returned by IOGetInfo(IOGETINFO_ZIPRANGE) */
  524. typedef struct IOZIPRANGEtag
  525. {
  526. #ifdef SCCFEATURE_64BITIO
  527. VTOFF_T dwFirstByte;
  528. VTOFF_T dwLastByte;
  529. #else
  530. VTDWORD dwFirstByte;
  531. VTDWORD dwLastByte;
  532. #endif
  533. VTDWORD dwCompressType; /* IO_COMPRESSTYPE_xxxx */
  534. } IOZIPRANGE, * PIOZIPRANGE;
  535. /*****************************************************************************
  536. * End of Zip stuff
  537. ****************************************************************************/
  538. /*****************************************************************************
  539. * Start of CAB stuff
  540. ****************************************************************************/
  541. /* structure to provide access to CFDATA block structure */
  542. typedef struct CABDATAtag
  543. {
  544. HIOFILE hRefFile; /* range I/O file */
  545. VTWORD wCompressedSize; /* # of compressed bytes in block */
  546. VTWORD wUncompressedSize; /* # of uncompressed bytes in block */
  547. } CABDATA, * PCABDATA;
  548. /* structure to provide access to CFFILE info */
  549. typedef struct CABFILEINFOtag
  550. {
  551. VTDWORD dwNameLoc; /* offset into CABFILE.pNames */
  552. VTDWORD dwNameLen;
  553. VTDWORD dwFileSize; /* uncompressed size of this file in bytes */
  554. VTDWORD dwFileLoc; /* uncompressed offset of file in the folder */
  555. VTWORD wFolderIndex;/* index into the CFFOLDER area */
  556. VTWORD wDate; /* date stamp for this file */
  557. VTWORD wTime; /* time stamp for this file */
  558. } CABFILEINFO, * PCABFILEINFO;
  559. typedef struct IOCABFILEtag
  560. {
  561. BASEIO sBaseIO; /* Underlying IO system */
  562. VTHANDLE hThis; /* Handle to this structure */
  563. HIOFILE hCabinet; /* handle to parent IOCABFILE */
  564. HIOFILE hRange; /* range within folder */
  565. /* IOCABINET.pFileInfo array index to obtain the cabfile info */
  566. VTWORD wFileIdx;
  567. } IOCABFILE, * PIOCABFILE;
  568. typedef struct IOCABFOLDERtag
  569. {
  570. BASEIO sBaseIO; /* Underlying IO system */
  571. HIOFILE hCabinet; /* handle to parent IOCABFILE */
  572. VTHANDLE hData; /* handle to pData array */
  573. PCABDATA pData; /* array of cab data blocks */
  574. VTWORD wDataIdx; /* index into folder's pDataArray */
  575. VTDWORD dwDataLoc; /* offset within current data block */
  576. VTDWORD dwDataOffset; /* offset for 1st CFDATA block in folder */
  577. VTWORD wDataCnt; /* # of CFDATA blocks in this folder */
  578. VTWORD wCompressType; /* compression type for CFDATAs in folder */
  579. } IOCABFOLDER, * PIOCABFOLDER;
  580. /* struct facilitating access of continguous uncompressed cab folder data */
  581. typedef struct CABFOLDERINFOtag
  582. {
  583. HIOFILE hRefFile; /* handle to either &Folder or hCompress */
  584. IOCABFOLDER Folder; /* underlying folder I/O handle */
  585. HIOFILE hCompress; /* valid when folder is compressed */
  586. } CABFOLDERINFO, * PCABFOLDERINFO;
  587. typedef struct IOCABINETtag
  588. {
  589. BASEIO sBaseIO; /* Underlying IO system */
  590. VTHANDLE hThis; /* Handle to this structure */
  591. HIOFILE hRefFile; /* cab file */
  592. VTWORD wFolderCnt; /* count of folders */
  593. VTWORD wFileCnt; /* count of files */
  594. VTWORD wHdrReserve; /* bytes in header reserve field */
  595. VTBYTE ubFldrReserve; /* bytes in folder reserve field */
  596. VTBYTE ubDataReserve; /* bytes in data reserve field */
  597. VTDWORD dwFileLoc; /* offset of first file location */
  598. VTHANDLE hFldrInfo; /* handle to pFldrInfo array */
  599. PCABFOLDERINFO pFldrInfo; /* array of all CABFOLDERINFOs in cab */
  600. VTHANDLE hFileInfo; /* handle to pFileInfo array */
  601. PCABFILEINFO pFileInfo; /* array of file info structs */
  602. VTHANDLE hNames; /* handle to pNames */
  603. VTWCHAR* pNames; /* concatenation of all filenames */
  604. VTDWORD dwNamesMax; /* allocated bytes in pNames */
  605. VTDWORD dwNamesUse; /* bytes used in pNames */
  606. } IOCABINET, * PIOCABINET;
  607. /*****************************************************************************
  608. * End of CAB stuff
  609. ****************************************************************************/
  610. /*
  611. | Node of a Shannon-Fano tree
  612. | 0 is the root.
  613. | A zero in left field
  614. | means the right field is the value.
  615. */
  616. typedef struct SFNODEtag
  617. {
  618. VTLONG left;
  619. VTLONG right;
  620. } SFNODE, * PSFNODE;
  621. #define HPSFNODE PSFNODE
  622. /*
  623. | Structure to store input for creating the Shannon-Fano tree.
  624. */
  625. typedef struct CODEINFOtag
  626. {
  627. VTLONG lValue;
  628. VTSHORT nLength;
  629. } CODEINFO, * PCODEINFO;
  630. typedef struct IOZLIBDATAtag
  631. {
  632. VTHANDLE hLitLenTree;
  633. PSFNODE pLitLenTree;
  634. VTHANDLE hDistanceTree;
  635. PSFNODE pDistanceTree;
  636. VTHANDLE hCodeLenTree;
  637. PSFNODE pCodeLenTree;
  638. VTHANDLE hTree;
  639. PSFNODE pTree;
  640. VTBOOL bFinal; /* is this the final block? */
  641. VTBOOL bFinished; /* no more compression. eof */
  642. VTBYTE bType; /* what type of compression: 0=none, 1=fixed codes, 2=dynamic codes */
  643. VTWORD wLength; /* bytes left when bType==0 */
  644. } IOZLIBDATA, * PIOZLIBDATA;
  645. /*********************************************************************/
  646. /*********************************************************************/
  647. /************************* *************************/
  648. /************************* LZSS *************************/
  649. /************************* *************************/
  650. /*********************************************************************/
  651. /*********************************************************************/
  652. #define IO_CIRCBUF_SIZE 0x1000
  653. /* LZSS Support added Nov 18, 1999 */
  654. typedef struct IOLZSSDATAtag
  655. {
  656. VTBYTE bCurFlags; /* the current lzss flags*/
  657. VTBYTE bFlagCount; /* which flag bit to look at next */
  658. VTHANDLE hCircBuf;
  659. VTBYTE * pCircBuf;
  660. VTWORD wCircBufPos;
  661. } IOLZSSDATA, * PIOLZSSDATA;
  662. /*********************************************************************/
  663. /*********************************************************************/
  664. /************************* *************************/
  665. /************************* PKMPLOD *************************/
  666. /************************* *************************/
  667. /*********************************************************************/
  668. /*********************************************************************/
  669. /* PKMPLOD Support added Sept 11, 2000 */
  670. /* these values correspond to the format, do not change */
  671. #define BINARYCOMPRESSION 0
  672. #define ASCIICOMPRESSION 1
  673. #define ONEKDICTIONARY 4
  674. #define TWOKDICTIONARY 5
  675. #define FOURKDICTIONARY 6
  676. #define LITERALDATA 0
  677. #define CODEDATA 1
  678. typedef struct IOPKMPLODDATAtag
  679. {
  680. VTBYTE bCompressionType; /* Binary or ASCII, currently only support Binary */
  681. VTBYTE bDictionarySize; /* 1k, 2k, or 4k */
  682. VTBYTE bDataType; /* the current data type to read: literal or code */
  683. } IOPKMPLODDATA, * PIOPKMPLODDATA;
  684. /*********************************************************************/
  685. /*********************************************************************/
  686. /***************** ********************/
  687. /***************** PDF DECODING AND DECOMPRESSION ********************/
  688. /***************** ********************/
  689. /*********************************************************************/
  690. /*********************************************************************/
  691. /*********************************************************************/
  692. /* ASCII85 decoding support added Nov 2, 2000*/
  693. /*********************************************************************/
  694. /*********************************************************************/
  695. /************************* *************************/
  696. /************************* ASCII85 *************************/
  697. /************************* *************************/
  698. /*********************************************************************/
  699. /*********************************************************************/
  700. #define ASCII85_CHARDATA_SIZE 5 /* buffer size for character data */
  701. #define ASCII85_BINARYDATA_SIZE 4 /* buffer size for binary data */
  702. typedef struct IOASCII85DATAtag
  703. {
  704. VTBYTE byCharData[ASCII85_CHARDATA_SIZE];
  705. VTBYTE byBinaryData[ASCII85_BINARYDATA_SIZE];
  706. VTBOOL bEOD;
  707. VTBYTE byNumber;
  708. VTBYTE byIndex;
  709. } IOASCII85DATA, * PIOASCII85DATA;
  710. typedef struct IOYENCDATAtag
  711. {
  712. VTBYTE Line[256];
  713. VTWORD wCurrentPosition;
  714. VTWORD wUncompressedLength;
  715. VTBOOL bWithinPart;
  716. } IOYENCDATA, * PIOYENCDATA;
  717. typedef struct IOBTOADATAtag
  718. {
  719. VTBYTE Line[32];
  720. VTWORD wCurrentPosition;
  721. VTWORD wUncompressedLength;
  722. VTDWORD dwValue;
  723. VTWORD wCount;
  724. } IOBTOADATA, * PIOBTOADATA;
  725. typedef struct IOQPDATAtag
  726. {
  727. VTBYTE Line[128];
  728. VTWORD wCurrentPosition;
  729. VTWORD wUncompressedLength;
  730. } IOQPDATA, * PIOQPDATA;
  731. typedef struct IOBinHexDATAtag
  732. {
  733. VTDWORD dwReadLength;
  734. VTDWORD dwDataLength;
  735. VTBYTE Line[8];
  736. VTWORD wCurrentPosition;
  737. VTWORD wUncompressedLength;
  738. VTSHORT cchLastCharacter;
  739. VTWORD wRepeatCount;
  740. } IOBINHEXDATA, * PIOBINHEXDATA;
  741. typedef struct IOCOMPRESSEDRTFDATAtag
  742. {
  743. VTHANDLE hLine;
  744. VTLPBYTE Line;
  745. VTBYTE bFlagByte;
  746. VTWORD wBitsLeft;
  747. VTWORD wCurrentPosition;
  748. VTWORD wPositionsBuffered;
  749. VTWORD wNextWritePosition;
  750. VTDWORD dwCompressedSize;
  751. VTDWORD dwUnCompressedSize;
  752. VTDWORD dwSignature;
  753. VTDWORD dwCrc;
  754. } IOCOMPRESSEDRTFDATA, * PIOCOMPRESSEDRTFDATA;
  755. typedef struct IOXXEDATAtag
  756. {
  757. VTBYTE Line[128];
  758. VTWORD wCurrentPosition;
  759. VTWORD wUncompressedLength;
  760. } IOXXEDATA, * PIOXXEDATA;
  761. typedef struct IOUUEDATAtag
  762. {
  763. VTBYTE Line[128];
  764. VTWORD wCurrentPosition;
  765. VTWORD wUncompressedLength;
  766. } IOUUEDATA, * PIOUUEDATA;
  767. typedef struct IOBASE64DATAtag
  768. {
  769. VTBYTE Line[132];
  770. VTWORD wCurrentPosition;
  771. VTWORD wUncompressedLength;
  772. } IOBASE64DATA, * PIOBASE64DATA;
  773. typedef struct IOUTF7DATAtag
  774. {
  775. VTWORD UnCompressedLine[128];
  776. VTBYTE Line[128];
  777. VTWORD wCurrentPosition;
  778. VTWORD wUncompressedLength;
  779. } IOUTF7DATA, * PIOUTF7DATA;
  780. /* ASCIIHex decoding support added Nov 6, 2000*/
  781. /*********************************************************************/
  782. /*********************************************************************/
  783. /************************* *************************/
  784. /************************* ASCIIHEX *************************/
  785. /************************* *************************/
  786. /*********************************************************************/
  787. /*********************************************************************/
  788. typedef struct IOASCIIHEXDATAtag
  789. {
  790. VTBOOL bEOD; /* used when the least significant part is padded with '0' */
  791. } IOASCIIHEXDATA, * PIOASCIIHEXDATA;
  792. /* Flate decoding support added Nov 17, 2000 */
  793. /*********************************************************************/
  794. /*********************************************************************/
  795. /************************* *************************/
  796. /************************* FLATE *************************/
  797. /************************* *************************/
  798. /*********************************************************************/
  799. /*********************************************************************/
  800. #define FLATE_WINDOW 32768 /* buffer size */
  801. #define FLATE_MASK (FLATE_WINDOW - 1)
  802. #define FLATE_MAX_HUFFMAN 15 /* max Huffman code length */
  803. #define FLATE_MAX_CODE_LEN_CODES 19 /* max number of code length codes */
  804. #define FLATE_MAX_LIT_CODES 288 /* max number of literal codes */
  805. #define FLATE_MAX_DIST_CODES 30 /* max number of distance codes */
  806. #define FLATE_MAX_LENGTH 260 /* max number of length for <length, backward distance> pair */
  807. /* (it is max 258 bytes according to RFC 1951) */
  808. /* Structure to store input for creating the Huffman tree (Huffman code table entry) */
  809. typedef struct FLATECODEtag
  810. {
  811. VTSHORT nLength; /* produced code lengths */
  812. VTLONG lCode; /* produced codes */
  813. VTLONG lValue; /* TODO:?? */
  814. } FLATECODE, * PFLATECODE;
  815. /* Huffman code table */
  816. typedef struct FLATEHUFFMANTABLEtag
  817. {
  818. VTHANDLE hStart; /* handle to indexes of the first code of each length [IO_FLATE_MAX_HUFFMAN+2] */
  819. VTLONG* pStart; /* pointer to indexes of the first code of each length [IO_FLATE_MAX_HUFFMAN+2] */
  820. PFLATECODE pFlateCodes;
  821. } FLATEHUFFMANTABLE, * PFLATEHUFFMANTABLE;
  822. /* Decoding info for length and distance code words */
  823. typedef struct FLATEDECODEtag
  824. {
  825. VTLONG lBits; /* number of extra bits */
  826. VTLONG lFirst; /* first length/distance */
  827. } FLATEDECODE, * PFLATEDECODE;
  828. typedef struct IOFLATEDATAtag
  829. {
  830. FLATEHUFFMANTABLE sLiteralCodeTab; /* literal code table */
  831. FLATEHUFFMANTABLE sDistanceCodeTab; /* distance code table */
  832. VTHANDLE hAllCodes; /* handle to literal and distance codes. */
  833. PFLATECODE pAllCodes; /* pointer to literal and distance codes [IO_FLATE_MAX_LIT_CODES + IO_FLATE_MAX_DIST_CODES]. */
  834. VTLONG lCodeBuf; /* input buffer */
  835. VTLONG lCodeSize; /* number of bits in input buffer */
  836. VTBOOL bCompressedBlock; /* set if reading a compressed block */
  837. VTDWORD dwBlockLen; /* remaining length of uncompressed block */
  838. VTBOOL bEndOfBlock; /* set when end of block is reached */
  839. VTBOOL bEOD; /* set when end of stream is reached */
  840. VTHANDLE hDecompData; /* handle to decompressed data buffer extracted form <length, backward distance> pair. */
  841. VTBYTE * pDecompData; /* buffer which will keep extracted decompressed data */
  842. VTDWORD dwRemain; /* number valid bytes in output buffer */
  843. /* predictor support */
  844. VTWORD wSlidingWindowSize; /* calculated from CINFO flag, and used to allocate buffer for sliding window */
  845. VTHANDLE hPredictorData; /* handle to the predictor sturcture. */
  846. VTBYTE * pPredictorData; /* pointer to predictor sturcture [FLATE_MAX_LENGTH]. */
  847. } IOFLATEDATA, * PIOFLATEDATA;
  848. /*********************************************************************/
  849. /*********************************************************************/
  850. /************************* *************************/
  851. /************************* LZW *************************/
  852. /************************* *************************/
  853. /*********************************************************************/
  854. /*********************************************************************/
  855. #define MAX_CODE_SIZE 12 /* max number of bits that can be used. */
  856. #define MIN_CODE_SIZE 8 /* min number of bits that can be used. */
  857. #define DICT_SIZE (1 << MAX_CODE_SIZE) /* size of the dictionary table (for 12 bits = 4096). */
  858. #define CLEAR_CODE (1 << MIN_CODE_SIZE) /* 256 */
  859. #define END_OF_DATA_CODE (CLEAR_CODE + 1) /* 257 */
  860. #define FIRST_CODE (CLEAR_CODE + 2) /* 258 */
  861. #define STOP_CODE 0xFFFF /* this code determines the stop condition when traversing */
  862. /* multiway tree. (initially was 0, but it turned out, that it was */
  863. /* failing when parent contains 0 which should be retrieved. */
  864. /* This data structure defines the dictionary. Each entry in the dictionary has a code value.
  865. * which is emitted by the compressor. Each node is actually made up of two pieces:
  866. * - parent_code
  867. - character.
  868. * Code values of less than 256 are actually plain text codes.
  869. */
  870. typedef struct DICTTTREEtag
  871. {
  872. VTWORD wParentCode;
  873. VTBYTE byCharacter;
  874. } LZWDICTTREE, * PLZWDICTTREE;
  875. typedef struct IOLZWDATAtag
  876. {
  877. VTHANDLE hDictTreeArray;
  878. PLZWDICTTREE pDictTreeArray;
  879. VTWORD wDictNextCode; /* next code to be added to the dictionary. */
  880. VTHANDLE hDecodeStack; /* for reversing strings that come out of the tree. */
  881. VTBYTE * pDecodeStack;
  882. VTWORD wStackPointer;
  883. VTBYTE byCurrentCodeSize; /* contains number of bits, which are currently read from the file. */
  884. VTWORD wNextBumpCode; /* defines the code that will trigger the next jump in bits size. 511, 1023, 2047) */
  885. VTWORD wPrevCode; /* previous code rad from the input file. */
  886. VTWORD wCurrentCode; /* current code read from the input file. */
  887. VTBYTE byFirstChar; /* first character of the prevous code, used to construct dictionary entry. */
  888. VTBOOL bEOD; /* set true when END_OF_DATA_CODE is reached. */
  889. VTDWORD dwBitsBuf; /* contains bits used for reading specified number of bits. */
  890. VTDWORD dwBitsLeft; /* number of bits in dwBitsBuf (used for transforming big-endian to little-endian). */
  891. VTHANDLE hPredictorData; /* handle to the predictor sturcture. */
  892. VTBYTE * pPredictorData; /* pointer to predictor sturcture. */
  893. } IOLZWDATA, * PIOLZWDATA;
  894. #define IO_COMPRESSTYPE_NONE 0
  895. #define IO_COMPRESSTYPE_ZLIB 1
  896. #define IO_COMPRESSTYPE_BASE64 2
  897. /*********************************************************************/
  898. /*********************************************************************/
  899. /************************* *************************/
  900. /************************* PREDICTOR *************************/
  901. /************************* *************************/
  902. /*********************************************************************/
  903. /*********************************************************************/
  904. /* Predictor types: */
  905. #define IO_PREDICTION_NONE 0
  906. #define IO_PREDICTION_DEFAULT 1 /* also no prediction */
  907. #define IO_PREDICTION_TIFF 2
  908. #define IO_PREDICTION_PNG_NONE 10 /* no prediction */
  909. #define IO_PREDICTION_PNG_SUB 11
  910. #define IO_PREDICTION_PNG_UP 12
  911. #define IO_PREDICTION_PNG_AVERAGE 13
  912. #define IO_PREDICTION_PNG_PEATH 14
  913. #define IO_PREDICTION_PNG_OPTIMUM 15
  914. /* Masks for extracting data from the reserved words. */
  915. #define PREDICTOR_MASK_COLORS 0xFF
  916. #define PREDICTOR_MASK_BITS 0xFF00
  917. #define PREDICTOR_MASK_EARLY 0xFF0000
  918. /* When predictors are used we need to keep data in sliding window. To get the size of
  919. * the slididng window CINFO flag from ZLIB header is read. Its max value can be CINFO=7,
  920. * which gives sliding window size of 32k (2pow(CINFO+8). Everything less than CINFO=7
  921. * will give smaller sliding widnow smaller and the value will be get by right shift.
  922. */
  923. #define SLIDING_WINDOW_MAX (1<<15) /* 32k */
  924. /*
  925. | For transfering extra parmeters needed for prediction from IOCOMPRESSDATA, following is used:
  926. | dwReserved1 - prediction values (1 - no prediction, 2 - TIFF prediction, 10 - 15 PNG prediction)
  927. | (for more info see PDF Reference Pg. 48, and PNG specification - filter algorithms)
  928. | dwReserved2 - number of colmuns (pixels per line)
  929. | dwReserved3 - number of color components (last siginivicant byte 0xFF
  930. | dwReserved3 - bits per pixel (second byte 0xFF00)
  931. | dwReserved3 - early change (third byte 0xFF0000)
  932. | They are either repeated or extracted in this structure.
  933. */
  934. typedef struct IOPREDICTORDATAtag
  935. {
  936. VTBYTE byPredictor; /* dwReserved1 - predictor type */
  937. VTDWORD dwWidth; /* dwReserved2 - columns (pixels per line). */
  938. VTBYTE byColorComponents; /* dwReserved3 - number of color components (0xFF) */
  939. VTBYTE byBitsPerComponent; /* dwReserved3 - lower byte of dwReserved3 0xFF00 */
  940. VTBYTE byEarlyChange; /* dwReserved3 - higher byte of dwReserved3 0xFF0000 */
  941. VTDWORD dwVals; /* dwWidth*byColorComponents. - components per line */
  942. VTDWORD dwPixBytes; /* bytes per pixel. */
  943. VTDWORD dwRowBytes; /* bytes per line. */
  944. VTHANDLE hPredictorLine; /* handle to predictor line buffer */
  945. VTBYTE * pPredictorLine; /* pointer to predictor line buffer. */
  946. VTDWORD dwPredictorIndex; /* current index in predictor line. */
  947. VTHANDLE hSlidingWindow; /* handle to sliding window buffer */
  948. VTBYTE * pSlidingWindow; /* pointer to sliding widnow buffer */
  949. VTWORD wSlidingIndex; /* current index in sliding window. */
  950. VTWORD wSlidingMask; /* contains mask for wrapping of index in Sliding window (as circular buffer). */
  951. } IOPREDICTORDATA, * PIOPREDICTORDATA;
  952. /*********************************************************************/
  953. /*********************************************************************/
  954. /************************* *************************/
  955. /************************* DCT *************************/
  956. /************************* *************************/
  957. /*********************************************************************/
  958. /*********************************************************************/
  959. /*
  960. | For transfering extra parmeters needed for DCT from IOCOMPRESSDATA, following is used:
  961. | dwReserved1 - whether ColorTransform parameter is defined in the dictionary
  962. | (0 - not defined in the dictionary,
  963. | 1 - defined in the dictionary with value stored in
  964. | dwReserved2)
  965. | dwReserved2 - ColorTransform integer (0 - no color transformation,
  966. | 1 - apply color transformation)
  967. |
  968. | ColorTransform integer is a code specifying the transformation to be performed on the
  969. | sample values:
  970. | 0 No transformation.
  971. | 1 If the image has three color components, transform RGB values to YUV before
  972. | encoding and from YUV to RGB after decoding. If the image has four components,
  973. | transform CMYK values to YUVK before encoding and from YUVK to CMYK after
  974. | decoding. This option is ignored if the image has one or two color components.
  975. | The default value of ColorTransform is 1 if the image has three components and 0 otherwise.
  976. | In other words, conversion between RGB and YUV is performed for all three-component images
  977. | unless explicitly disabled by setting ColorTransform to 0. Additionally, the encoding
  978. | algorithm inserts an Adobedefined marker code in the encoded data indicating the ColorTransform
  979. | value used. If present, this marker code overrides the ColorTransform value given to DCTDecode.
  980. | Thus it is necessary to specify ColorTransform only when decoding data that does not contain
  981. | the Adobe-defined marker code.
  982. */
  983. /*
  984. * JPEG markers consist of one or more 0xFF bytes, followed by a marker
  985. * code byte (which is not an FF). Here are the marker codes of interest
  986. * in this program. (See jdmarker.c for a more complete list.)
  987. */
  988. /* Note: codes C4 and CC are NOT SOF markers */
  989. typedef enum DCT_MARKERtag
  990. { /* NON-DIFFERENTIAL HUFFMAN */
  991. SOF0 = 0xc0, /* Baseline DCT */
  992. SOF1 = 0xc1, /* Extended sequential DCT */
  993. SOF2 = 0xc2, /* Progressive DCT */
  994. SOF3 = 0xc3, /* Spatial DPCM */
  995. /* DIFFERENTIAL HUFFMAN */
  996. SOF5 = 0xc5, /* Differential sequential DCT */
  997. SOF6 = 0xc6, /* Differential progressive DCT */
  998. SOF7 = 0xc7, /* Differential spatial */
  999. /* NON-DIFFERENTIAL ARITHMETIC */
  1000. JPG = 0xc8, /* Reserved for JPEG extensions */
  1001. SOF9 = 0xc9, /* Extended sequential DCT */
  1002. SOF10 = 0xca, /* Progressive DCT */
  1003. SOF11 = 0xcb, /* Spatial DPCM */
  1004. /* DIFFERENTIAL ARITHMETIC */
  1005. SOF13 = 0xcd, /* Differential sequential DCT */
  1006. SOF14 = 0xce, /* Differential progressive DCT */
  1007. SOF15 = 0xcf, /* Differential spatial */
  1008. DHT = 0xc4, /* Define Huffman table */
  1009. DAC = 0xcc, /* Define Arithmetic conditioning */
  1010. RST0 = 0xd0, /* Restart with modulo 8 count 0 */
  1011. RST1 = 0xd1, /* Restart with modulo 8 count 1 */
  1012. RST2 = 0xd2, /* Restart with modulo 8 count 2 */
  1013. RST3 = 0xd3, /* Restart with modulo 8 count 3 */
  1014. RST4 = 0xd4, /* Restart with modulo 8 count 4 */
  1015. RST5 = 0xd5, /* Restart with modulo 8 count 5 */
  1016. RST6 = 0xd6, /* Restart with modulo 8 count 6 */
  1017. RST7 = 0xd7, /* Restart with modulo 8 count 7 */
  1018. SOI = 0xd8, /* Start of image */
  1019. EOI = 0xd9, /* End of image */
  1020. SOS = 0xda, /* Start of scan */
  1021. DQT = 0xdb, /* Define quantization table(s) */
  1022. DNL = 0xdc, /* Define number of lines */
  1023. DRI = 0xdd, /* Define restart interval */
  1024. DHP = 0xde, /* Define hierarchical progression*/
  1025. EXP = 0xdf, /* Expand reference image(s) */
  1026. /* RESERVED APPLICATION SEGMENTS 0xFFE0-0xFFEF */
  1027. APP0 = 0xe0, /* Application Data */
  1028. APP1 = 0xe1,
  1029. APP2 = 0xe2,
  1030. APP3 = 0xe3,
  1031. APP4 = 0xe4,
  1032. APP5 = 0xe5,
  1033. APP6 = 0xe6,
  1034. APP7 = 0xe7,
  1035. APP8 = 0xe8,
  1036. APP9 = 0xe9,
  1037. APP10 = 0xea,
  1038. APP11 = 0xeb,
  1039. APP12 = 0xec,
  1040. APP13 = 0xed,
  1041. APP14 = 0xee, /* Adobe Application-Specific JPEG Marker */
  1042. APP15 = 0xef,
  1043. /* RESERVED JPEG EXTENSIONS 0xFFF0-0xFFFD */
  1044. JPG0 = 0xf0,
  1045. JPG13 = 0xfd,
  1046. COM = 0xfe, /* Comment */
  1047. TEM = 0x01, /* Temp. private use arithmetic */
  1048. MARKER_ERROR = 0x100
  1049. /* RESERVED 0xFF02-0xFFBF */
  1050. } DCT_MARKER;
  1051. #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
  1052. #define DCT_BLOCK_SIZE 64 /* DCTSIZE squared; # of elements in a block */
  1053. #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
  1054. #define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
  1055. #define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
  1056. #define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
  1057. #define DCT_CLIP_SIZE 768
  1058. #define DCT_CLIP_OFFSET 256
  1059. #define MAX_NUM_HUFF_CODES 256 /* Table B.5 */
  1060. #define dctCos1 0.98078528 /* cos(pi/16) */
  1061. #define dctSin1 0.19509032 /* sin(pi/16) */
  1062. #define dctCos3 0.83146961 /* cos(3*pi/16) */
  1063. #define dctSin3 0.55557023 /* sin(3*pi/16) */
  1064. #define dctCos6 0.38268343 /* cos(6*pi/16) */
  1065. #define dctSin6 0.92387953 /* sin(6*pi/16) */
  1066. #define dctSqrt2 1.41421356 /* sqrt(2) */
  1067. #define dctSqrt1d2 0.70710678 /* sqrt(2) / 2 */
  1068. /*#endif*/
  1069. /* color conversion parameters (16.16 fixed point format) */
  1070. #define dctCrToR 91881 /* 1.4020 */
  1071. #define dctCbToG -22553 /* -0.3441363 */
  1072. #define dctCrToG -46802 /* -0.71413636 */
  1073. #define dctCbToB 116130 /* 1.772 */
  1074. /* DCT component info */
  1075. typedef struct DCTCOMP_INFOtag
  1076. {
  1077. VTBYTE byComponentID; /* component identifier (0-255) (for PDF max 4) */
  1078. VTBOOL bInScan; /* is this component in the current scan? */
  1079. VTBYTE byHSampFactor; /* horizontal sampling factor (1-4) */
  1080. VTBYTE byVSampFactor; /* vertical sampling factor (1-4) */
  1081. VTBYTE byQuantTableNo; /* quantization table selector (0..3) (max 4 tables can be defined) */
  1082. VTBYTE byDCHuffTableNo; /* DC entropy table (Huffman) selector (0..3) */
  1083. VTBYTE byACHuffTableNo; /* AC entropy table (Huffman) selector (0..3) */
  1084. VTSHORT nPrevDC; /* DC coefficient accumulator */
  1085. } DCTCOMP_INFO;
  1086. /* DCT Huffman decoding table */
  1087. typedef struct DCTHUFF_TBLtag
  1088. {
  1089. VTWORD firstSym[17]; /* first symbol for this bit length */
  1090. VTDWORD firstCode[17]; /* first code for this bit length */
  1091. VTBYTE numCodes[17]; /* number of codes of this bit length */
  1092. VTBYTE sym[256]; /* symbols */
  1093. } DCTHUFF_TBL;
  1094. typedef struct DCTQUANT_TBLtag
  1095. {
  1096. VTHANDLE hQuantElems;
  1097. VTLPBYTE pQuantElems;
  1098. } DCTQUANT_TBL;
  1099. typedef struct IODCTDATAtag
  1100. {
  1101. VTWORD wImageWidth; /* image size (X) */
  1102. VTWORD wImageHeight; /* image size (Y) */
  1103. VTBYTE byMCUWidth; /* size of min coding unit, in data units */
  1104. VTBYTE byMCUHeight; /* size of min coding unit, in data units */
  1105. VTHANDLE hCompInfo[MAX_COMPS_IN_SCAN];
  1106. DCTCOMP_INFO* pCompInfo[MAX_COMPS_IN_SCAN]; /* info for each component */
  1107. VTBYTE byNumComps; /* number of image components (Nf) (1-255). */
  1108. VTBYTE byColorTransform; /* need YCbCr-to-RGB transform? */
  1109. VTBOOL bGotAdobeMarker; /* set if APP14 Adobe marker was present */
  1110. VTWORD wRestartInterval; /* restart interval, as number of MCUs (0-65535) */
  1111. DCTQUANT_TBL QuantTbls[NUM_QUANT_TBLS]; /* quantization tables */
  1112. VTBYTE byNumQuantTbls; /* number of quantization tables */
  1113. VTHANDLE hDCHuffTbls[NUM_HUFF_TBLS]; /* DC Huffman tables */
  1114. DCTHUFF_TBL* pDCHuffTbls[NUM_HUFF_TBLS];
  1115. VTBYTE byNumDCHuffTbls; /* number of DC Huffman tables */
  1116. VTHANDLE hACHuffTbls[NUM_HUFF_TBLS]; /* AC Huffman tables */
  1117. DCTHUFF_TBL* pACHuffTbls[NUM_HUFF_TBLS];
  1118. VTBYTE byNumACHuffTbls; /* number of AC Huffman tables (Th) (0-3) */
  1119. VTHANDLE hRowBuf; /* handle to buffer for one MCU */
  1120. VTLPBYTE pRowBuf; /* pointer to buffer for one MCU */
  1121. VTDWORD dwRowBufWidth;
  1122. /*VTLPBYTE rowBuf[4][32];*/ /* buffer for one MCU */
  1123. VTBYTE byCurrentComp; /* curent component */
  1124. VTWORD wCurrentX; /* current X position within image */
  1125. VTWORD wCurrentY; /* current Y position within image */
  1126. VTBYTE byCurrentdY; /* current position within MCU. */
  1127. VTSHORT wRestartCtr; /* MCUs left until restart */
  1128. DCT_MARKER eRrestartMarker; /* next restart marker */
  1129. VTBYTE byInBuf; /* input buffer for variable length codes */
  1130. VTBYTE byNumInBits; /* number of valid bits in input buffer */
  1131. VTBYTE bySs, bySe; /* progressive JPEG spectral selection parms */
  1132. VTBYTE byAh, byAl; /* progressive JPEG successive approx. parms */
  1133. VTBOOL bProgressiveMode; /* TRUE if SOFn specifies progressive mode */
  1134. /* clip [-256,511] --> [0,255] */
  1135. VTHANDLE hDctClip;
  1136. VTLPBYTE pDctClip;
  1137. /*int dctClipInit;*/
  1138. } IODCTDATA, * PIODCTDATA;
  1139. /*********************************************************************/
  1140. /*********************************************************************/
  1141. /************************* **************************/
  1142. /************************* MIFAsciiDecode **************************/
  1143. /************************* **************************/
  1144. /*********************************************************************/
  1145. /*********************************************************************/
  1146. /* Named MIFAsciiDecode because I have not discovered the real format name */
  1147. /* MIFAsciiDecode Support added Nov 11, 2001 */
  1148. /* these values correspond to the format, do not change */
  1149. #define MIFCOMPRESS_BINARYINASCII 1
  1150. #define MIFCOMPRESS_UNKNOWN 2
  1151. #define IMAGELINEBUFSIZE 0x80
  1152. typedef struct IOMIFAsciiDecodetag
  1153. {
  1154. VTHANDLE hSrcbuf;
  1155. VTLPBYTE Srcbuf;
  1156. VTBOOL HexMode; /* Data is binary or ascii */
  1157. VTBOOL FirstTime;
  1158. VTBYTE UnGetVal;
  1159. VTBOOL UnGetIsValid;
  1160. VTLONG ByteCount;
  1161. VTBYTE Datatype;
  1162. VTBOOL DecodeComplete;
  1163. } IOMIFAsciiDecode, * PIOMIFAsciiDecode;
  1164. /*********************************************************************/
  1165. /*********************************************************************/
  1166. /********************* ***********************/
  1167. /********************* CCITT G3D1, G3D2, G4D2 ***********************/
  1168. /********************* ***********************/
  1169. /*********************************************************************/
  1170. /*********************************************************************/
  1171. /*
  1172. | For transfering extra parmeters needed for CCITT decompression from IOCOMPRESSDATA, following is used:
  1173. | dwReserved1 -
  1174. | bits 0-15: K - a code identifying the encoding scheme used:
  1175. | (int) K<0 Pure G42D encoding
  1176. | K=0 Pure G31D encoding
  1177. | K>0 Mixed G3 1D and 2D encoding, in which a line encoded 1D can be
  1178. | followed by at most K-1 lines encoded 2D.
  1179. | bits 16-32: DamagedRowsBeforeError - The number of damaged rows of data to be tolerated
  1180. | (int) before and error occures. This entry applies only if EndOfLine is true and
  1181. | K is nonnegative.
  1182. | dwReserved2 -
  1183. | bit 0: EndOfLine - a flag indicating whether EOL bit patterns are required to be
  1184. | present in the encoding. Decompression always accepts EOL bit patterns, but
  1185. | requires them only if EndOfLine is true.
  1186. | bit 1: EndOfBlock - a flag indicating whether the decompression expects the encoded data
  1187. | to be terminated by an EOB pattern, overriding the Rows parameter. If false,
  1188. | the decompression stops when it has decoded the number of lines indicated by Rows,
  1189. | or when its data has been exausted, whichever occurs first. The bit pattern
  1190. | depends on K parameter and can be either EOFB (end-of-facsimile-block) or RTC
  1191. | (return-to-control).
  1192. | bit 2: EncodedByteAlign - A flag indicating whether the decompression expects extra
  1193. | 0-bits before each encoded line so that the line begins on a byte boundary.
  1194. | If true, the filter skips over encoded bits to begin decoding each line at byte
  1195. | boundary.
  1196. | bit 3: EncodedWordAlign - Indicates that each line of encoded data begins on a word
  1197. | (16-bit) boundary.
  1198. | bit 4: Blacks1 - a flag indicating whether 1-bits are to be interpreted as black pixels
  1199. | and 0-bits as white pixels, the reverse of the normal PDF convention for monochrome
  1200. | image data.
  1201. | bit 5: LSBtoMSB - Indicates that the fill order is least significant to most significant.
  1202. | bit 6: Group3RLE - Indicates that the data is encoded using RLE compression. This is only
  1203. | used by TIFF files currently. Only applies if K=0.
  1204. | dwReserved3 -
  1205. | bits 0-15: Columns - the width of the image in pixels. If the value is not a multiple of 8,
  1206. | the compression should adjust the width of the unencoded image to the next multiple
  1207. | of 8, so that each line starts on a byte boundary.
  1208. | bits 16-32: The height of the image in scan lines. If the value is 0 or absent, the images
  1209. | height is not predetermined, and the encoded data must be terminated by an EOB bit
  1210. | pattern or by the end of the stream data.
  1211. |
  1212. */
  1213. /* Masks for extracting data from the reserved words. */
  1214. #define CCITT_MASK_ENCODING 0x0000FFFF /* dwReserved1 */
  1215. #define CCITT_MASK_DAMAGE_ROWS 0xFFFF0000
  1216. #define CCITT_MASK_EOL 0x00000001 /* dwReserved2 */
  1217. #define CCITT_MASK_EOB 0x00000002
  1218. #define CCITT_MASK_BYTE_ALIGN 0x00000004
  1219. #define CCITT_MASK_WORD_ALIGN 0x00000008
  1220. #define CCITT_MASK_BLACK 0x00000010
  1221. #define CCITT_MASK_LSBTOMSB 0x00000020
  1222. #define CCITT_MASK_GROUP3RLE 0x00000040
  1223. #define CCITT_MASK_COLUMNS 0x0000FFFF /* dwReserved3 */
  1224. #define CCITT_MASK_ROWS 0xFFFF0000
  1225. /*********************************************************************/
  1226. /*********************************************************************/
  1227. /********************* ***********************/
  1228. /********************* RC4 ***********************/
  1229. /********************* ***********************/
  1230. /*********************************************************************/
  1231. /*********************************************************************/
  1232. typedef struct IORC4DATAtag
  1233. {
  1234. VTHANDLE hKey;
  1235. VTBYTE* pKey;
  1236. VTBYTE byKeyLength;
  1237. VTRC4_CTX RC4State;
  1238. } IORC4DATA, * PIORC4DATA;
  1239. /*********************************************************************/
  1240. /*********************************************************************/
  1241. /********************* ***********************/
  1242. /********************* AES ***********************/
  1243. /********************* ***********************/
  1244. /*********************************************************************/
  1245. /*********************************************************************/
  1246. typedef struct IOAESDATAtag
  1247. {
  1248. #ifdef SCCFEATURE_64BITIO
  1249. VTOFF_T offFileSize; /* decrypted file size */
  1250. #else
  1251. VTDWORD offFileSize; /* decrypted file size */
  1252. #endif
  1253. VTDWORD dwType; /* AES type (i.e. AES-128, AES-192, AES-256) */
  1254. VTDWORD dwMode; /* mode of operation */
  1255. VTBYTE szAESBlock[16]; /* generic AES block */
  1256. VTBYTE *pKeySchedule; /* pointer to an AES key schedule */
  1257. } IOAESDATA, *PIOAESDATA;
  1258. typedef struct IOZIPCRYPTODATAtag
  1259. {
  1260. #ifdef SCCFEATURE_64BITIO
  1261. VTOFF_T offFileSize;
  1262. #else
  1263. VTDWORD offFileSize;
  1264. #endif
  1265. VTDWORD dwCrcTable[256];
  1266. VTDWORD Key[3];
  1267. } IOZIPCRYPTODATA, *PIOZIPCRYPTODATA;
  1268. /*********************************************************************/
  1269. /*********************************************************************/
  1270. /********************* ***********************/
  1271. /********************* JBIG2 ***********************/
  1272. /********************* ***********************/
  1273. /*********************************************************************/
  1274. /*********************************************************************/
  1275. #define JBIG2_SYMBOL_DICT 0
  1276. #define JBIG2_INT_TEXT 4
  1277. #define JBIG2_IMM_TEXT 6
  1278. #define JBIG2_IMM_LL_TEXT 7
  1279. #define JBIG2_PATTERN_DICT 16
  1280. #define JBIG2_INT_HALFTONE 20
  1281. #define JBIG2_IMM_HALFTONE 22
  1282. #define JBIG2_IMM_LL_HALFTONE 23
  1283. #define JBIG2_INT_GENERIC 36
  1284. #define JBIG2_IMM_GENERIC 38
  1285. #define JBIG2_IMM_LL_GENERIC 39
  1286. #define JBIG2_INT_GENERIC_REF 40
  1287. #define JBIG2_IMM_GENERIC_REF 42
  1288. #define JBIG2_IMM_LL_GENERIC_REF 43
  1289. #define JBIG2_PAGE_INFO 48
  1290. #define JBIG2_END_OF_PAGE 49
  1291. #define JBIG2_END_OF_STRIPE 50
  1292. #define JBIG2_END_OF_FILE 51
  1293. #define JBIG2_PROFILES 52
  1294. #define JBIG2_TABLES 53
  1295. #define JBIG2_EXTENSIONS 62
  1296. #define JBIG2_INTCONTEXTSIZE 512
  1297. #define JBIG2_BOTTOMLEFT 0
  1298. #define JBIG2_TOPLEFT 1
  1299. #define JBIG2_BOTTOMRIGHT 2
  1300. #define JBIG2_TOPRIGHT 3
  1301. #define JBIG2_OR 0
  1302. #define JBIG2_AND 1
  1303. #define JBIG2_XOR 2
  1304. #define JBIG2_XNOR 3
  1305. typedef struct JBIGHEADERDATA
  1306. {
  1307. VTDWORD dwSegmentNumber;
  1308. VTDWORD dwFlags;
  1309. VTBYTE bySegmentType;
  1310. VTDWORD dwReferredToCount;
  1311. VTBYTE byRetainFlags;
  1312. /* union
  1313. {
  1314. BYTE byRetainFlags;
  1315. LPDWORD pdwRetainFlags;
  1316. } uRetainUnion;
  1317. union
  1318. {
  1319. LPBYTE byteSize;
  1320. LPWORD wordSize;
  1321. LPDWORD dwordSize;
  1322. } uReferredSegments;
  1323. */
  1324. union
  1325. {
  1326. VTBYTE bySegmentPage;
  1327. VTDWORD dwSegmentPage;
  1328. } uPageAssociation;
  1329. VTDWORD dwSegmentDataLength;
  1330. } JBIG_STRUCT, *LPJBIG_STRUCT;
  1331. typedef struct JBIG2_RegionSegmentInfo_tag
  1332. {
  1333. VTDWORD dwXPos;
  1334. VTDWORD dwYPos;
  1335. VTDWORD dwWidth;
  1336. VTDWORD dwHeight;
  1337. VTDWORD dwByteWidth;
  1338. VTBYTE byFlags;
  1339. } JBIG2_RegionSegmentInfo, *PJBIG2_RegionSegmentInfo;
  1340. typedef enum HUFFMAN_ROW_TYPEtag
  1341. {
  1342. ROW_NORMAL,
  1343. ROW_OOB,
  1344. ROW_LOWER,
  1345. ROW_HIGHER
  1346. }HUFFMAN_ROW_TYPE;
  1347. typedef struct JBIG2_Arithmetic_tag
  1348. {
  1349. VTDWORD c;
  1350. VTLONG a;
  1351. VTLONG ct;
  1352. } JBIG2_Arithmetic, *PJBIG2_Arithmetic;
  1353. typedef struct JBIG2_Huffman_tag
  1354. {
  1355. VTBYTE byThisByte;
  1356. VTSHORT BitOffset;
  1357. } JBIG2_Huffman, *PJBIG2_Huffman;
  1358. typedef struct JBIG2_HUFFMAN_LINEtag
  1359. {
  1360. VTLONG RANGELOW;
  1361. VTLONG PREFLEN;
  1362. VTLONG RANGELEN;
  1363. VTLONG PREFIX;
  1364. } JBIG2_HUFFMAN_LINE, * PJBIG2_HUFFMAN_LINE;
  1365. typedef struct JBIG2_HUFFMAN_TABLEtag
  1366. {
  1367. VTBOOL HTOOB;
  1368. VTLONG nLines;
  1369. const JBIG2_HUFFMAN_LINE * Lines;
  1370. }JBIG2_HUFFMAN_TABLE, *PJBIG2_HUFFMAN_TABLE;
  1371. typedef struct JBIG2_HUFFMAN_NODE_tag JBIG2_HUFFMAN_NODE;
  1372. typedef struct JBIG2_HUFFMAN_NODE_tag * PJBIG2_HUFFMAN_NODE;
  1373. struct JBIG2_HUFFMAN_NODE_tag
  1374. {
  1375. VTLONG Index;
  1376. PJBIG2_HUFFMAN_NODE ONE;
  1377. PJBIG2_HUFFMAN_NODE ZERO;
  1378. };
  1379. typedef struct JBIG2_Bitmap_tag
  1380. {
  1381. VTDWORD dwImageWidth;
  1382. VTDWORD dwImageHeight;
  1383. VTDWORD dwRowStride; /*Number of Bytes in Row */
  1384. VTDWORD dwRefCount; /* number of references to this image */
  1385. VTLPBYTE Image; /* Uncompressed Image Data of size (dwRowStride*dwImageHeight)*/
  1386. } JBIG2_Bitmap, *PJBIG2_Bitmap;
  1387. typedef struct JBIG2_SymbolDictionary_tag
  1388. {
  1389. VTDWORD dwSymCount;
  1390. PJBIG2_Bitmap * Symbols;
  1391. }JBIG2_SymbolDictionary, *PJBIG2_SymbolDictionary;
  1392. typedef struct JBIG2_SymbolSettings_tag
  1393. {
  1394. VTBOOL bHuff;
  1395. VTBOOL bRefAgg;
  1396. PJBIG2_SymbolDictionary pSDInSyms; /*Symbol distionary that is used as an input to this symbol dictionary. It contains dwNumInSyms symbols */
  1397. VTDWORD dwNumExSyms; /*The number of symbols to be defined in this symbol dictionary */
  1398. VTDWORD dwNumNewSyms; /*The number of symbols to be exported from this symbol dictionary */
  1399. PJBIG2_HUFFMAN_TABLE SDHUFFDH;
  1400. PJBIG2_HUFFMAN_NODE TreeSDHUFFDH;
  1401. PJBIG2_HUFFMAN_TABLE SDHUFFDW;
  1402. PJBIG2_HUFFMAN_NODE TreeSDHUFFDW;
  1403. PJBIG2_HUFFMAN_TABLE SDHUFFBMSIZE;
  1404. PJBIG2_HUFFMAN_NODE TreeSDHUFFBMSIZE;
  1405. PJBIG2_HUFFMAN_TABLE SDHUFFAGGINST;
  1406. PJBIG2_HUFFMAN_NODE TreeSDHUFFAGGINST;
  1407. VTBYTE byTemplate;
  1408. VTCHAR chSYMAT[4][2]; /* these are signed bytes, *not* text data. Do not make them TCHARs! */
  1409. VTBYTE byRefTemplate;
  1410. VTCHAR chSYMATRef[4]; /*More signed bytes. Don't make TCHARs */
  1411. VTBOOL bBMPCodingUsed;
  1412. VTBOOL bBMPCodingKept;
  1413. VTDWORD dwNumProcessedSyms;
  1414. } JBIG2_SymbolSettings, *PJBIG2_SymbolSettings;
  1415. typedef struct JBIG2_GenericSettings_tag
  1416. {
  1417. VTBOOL bMMR;
  1418. VTBOOL bTPGDON;
  1419. VTBYTE byGBT;
  1420. VTDWORD dwHeight;
  1421. VTDWORD dwWidth;
  1422. VTCHAR chGBAT[4][2]; /* these are signed bytes, *not* text data. Do not make them TCHARs! */
  1423. } JBIG2_GenericSettings, *PJBIG2_GenericSettings;
  1424. typedef struct JBIG2_TextSettings_tag
  1425. {
  1426. VTBOOL bHuff;
  1427. VTBOOL bRefine;
  1428. VTBYTE byLogSBStrips;
  1429. VTBYTE byStrips;
  1430. VTBYTE byRefCorner;
  1431. VTBOOL bTransposed;
  1432. VTBYTE byComboOp;
  1433. VTBOOL bDefPix;
  1434. VTCHAR DeltaSOffset; /* bug9056767: Changing from VTBYTE to VTSHORT because it is a signed value -zf 04/12/10 */
  1435. VTBOOL bRefTemp;
  1436. VTWORD wHuffFlags;
  1437. PJBIG2_HUFFMAN_TABLE SDHUFFFS;
  1438. PJBIG2_HUFFMAN_NODE TreeSDHUFFFS;
  1439. PJBIG2_HUFFMAN_TABLE SDHUFFDS;
  1440. PJBIG2_HUFFMAN_NODE TreeSDHUFFDS;
  1441. PJBIG2_HUFFMAN_TABLE SDHUFFDT;
  1442. PJBIG2_HUFFMAN_NODE TreeSDHUFFDT;
  1443. PJBIG2_HUFFMAN_TABLE SDHUFFRDW;
  1444. PJBIG2_HUFFMAN_NODE TreeSDHUFFRDW;
  1445. PJBIG2_HUFFMAN_TABLE SDHUFFRDH;
  1446. PJBIG2_HUFFMAN_NODE TreeSDHUFFRDH;
  1447. PJBIG2_HUFFMAN_TABLE SDHUFFRDX;
  1448. PJBIG2_HUFFMAN_NODE TreeSDHUFFRDX;
  1449. PJBIG2_HUFFMAN_TABLE SDHUFFRDY;
  1450. PJBIG2_HUFFMAN_NODE TreeSDHUFFRDY;
  1451. PJBIG2_HUFFMAN_TABLE SDHUFFRSIZE;
  1452. PJBIG2_HUFFMAN_NODE TreeSDHUFFRSIZE;
  1453. VTCHAR SBRAT[4]; /* Refinement AT flags */
  1454. VTDWORD dwNumInstances;
  1455. VTDWORD dwNumProcessedInstances;
  1456. } JBIG2_TextSettings, *PJBIG2_TextSettings;
  1457. typedef struct JBIG2_BitmapHeader_tag
  1458. {
  1459. VTDWORD dwWidth;
  1460. VTDWORD dwHeight;
  1461. } JBIG2_BitmapHeader, *PJBIG2_BitmapHeader;
  1462. typedef struct JBIG2_TextInstance_tag
  1463. {
  1464. VTLONG lS;
  1465. VTLONG lT;
  1466. VTLONG lID;
  1467. VTBOOL bRefine; /* indicates if the symbol is refined */
  1468. PJBIG2_Bitmap Symbol;
  1469. } JBIG2_TextInstance, *PJBIG2_TextInstance;
  1470. typedef struct JBIG2_RefinementSettings_tag
  1471. {
  1472. VTDWORD dwGRW;
  1473. VTDWORD dwGRH;
  1474. VTBYTE byGRTemplate;
  1475. PJBIG2_Bitmap pRefImage;
  1476. VTLONG lRDX;
  1477. VTLONG lRDY;
  1478. VTCHAR GRAT[4];
  1479. }JBIG2_RefinementSettings, *PJBIG2_RefinementSettings;
  1480. typedef struct IOJBIG2DATAtag
  1481. {
  1482. JBIG2_Arithmetic ArithState;
  1483. JBIG2_Huffman HuffmanState;
  1484. JBIG2_RegionSegmentInfo SegInfo;
  1485. JBIG2_GenericSettings GenericSettings;
  1486. JBIG2_SymbolSettings SymbolSettings;
  1487. JBIG2_TextSettings TextSettings;
  1488. VTHANDLE hArithmeticContext;
  1489. VTLPBYTE pArithmeticContext;
  1490. VTHANDLE hIADHContext;
  1491. VTLPBYTE pIADHContext;
  1492. VTHANDLE hIADWContext;
  1493. VTLPBYTE pIADWContext;
  1494. VTHANDLE hIAEXContext;
  1495. VTLPBYTE pIAEXContext;
  1496. VTHANDLE hIAAIContext;
  1497. VTLPBYTE pIAAIContext;
  1498. VTHANDLE hIADTContext;
  1499. VTLPBYTE pIADTContext;
  1500. VTHANDLE hIAFSContext;
  1501. VTLPBYTE pIAFSContext;
  1502. VTHANDLE hIADSContext;
  1503. VTLPBYTE pIADSContext;
  1504. VTHANDLE hIAITContext;
  1505. VTLPBYTE pIAITContext;
  1506. VTHANDLE hIAIDContext;
  1507. VTLPBYTE pIAIDContext;
  1508. VTHANDLE hIARDXContext;
  1509. VTLPBYTE pIARDXContext;
  1510. VTHANDLE hIARDYContext;
  1511. VTLPBYTE pIARDYContext;
  1512. VTHANDLE hIARDHContext;
  1513. VTLPBYTE pIARDHContext;
  1514. VTHANDLE hIARDWContext;
  1515. VTLPBYTE pIARDWContext;
  1516. VTHANDLE hIARIContext;
  1517. VTLPBYTE pIARIContext;
  1518. } IOJBIG2DATA, *PIOJBIG2DATA;
  1519. /*********************************************************************/
  1520. /*********************************************************************/
  1521. /********************* ***********************/
  1522. /********************* LZX ***********************/
  1523. /********************* ***********************/
  1524. /*********************************************************************/
  1525. /*********************************************************************/
  1526. /* spec says max # of slots is 42, but others have disagreed */
  1527. #define LZX_MAX_SLOTS 50
  1528. #define LZX_NUM_CHARS 256
  1529. /* constants for building main tree lookup table */
  1530. #define LZX_MAIN_TREE_ELEMS (LZX_NUM_CHARS+LZX_MAX_SLOTS*8)
  1531. #define LZX_MAIN_LOOKUP_BITS 12
  1532. #define LZX_MAIN_LOOKUP_SIZE ((1<<LZX_MAIN_LOOKUP_BITS) + 2*LZX_MAIN_TREE_ELEMS)
  1533. /* constants for building length tree lookup table */
  1534. #define LZX_LENGTH_TREE_ELEMS 249
  1535. #define LZX_LENGTH_LOOKUP_BITS 12
  1536. #define LZX_LENGTH_LOOKUP_SIZE ((1<<LZX_LENGTH_LOOKUP_BITS) + 2*LZX_LENGTH_TREE_ELEMS)
  1537. /* constants for building align tree lookup table */
  1538. #define LZX_ALIGN_TREE_ELEMS 8
  1539. #define LZX_ALIGN_LOOKUP_BITS 7
  1540. #define LZX_ALIGN_LOOKUP_SIZE ((1<<LZX_ALIGN_LOOKUP_BITS) + 2*LZX_ALIGN_TREE_ELEMS)
  1541. typedef struct IOLZXDATAtag
  1542. {
  1543. VTBOOL bEOF;
  1544. VTWORD wBitBuf; /* stores most significant bit first */
  1545. VTWORD wBitsLeft; /* # bits in wBitBuf left to read */
  1546. VTDWORD dwBytesRead; /* total # of uncompressed bytes read */
  1547. /* window size is already stored in IOCOMPRESSFILE.dwReserved1 */
  1548. VTWORD wPositionSlots; /* # of window subdivisions/slots */
  1549. VTDWORD dwTransSize; /* 0xe8 opcode translation size */
  1550. VTBYTE ubBlockType;
  1551. VTWORD MainData[LZX_MAIN_TREE_ELEMS]; /* Main tree lengths */
  1552. VTWORD LengthData[LZX_LENGTH_TREE_ELEMS]; /* Length tree lengths */
  1553. VTWORD AlignData[LZX_ALIGN_TREE_ELEMS]; /* Align tree lengths */
  1554. /* lookup arrays for determining huffman code values */
  1555. VTWORD MainLookup[LZX_MAIN_LOOKUP_SIZE];
  1556. VTWORD LengthLookup[LZX_LENGTH_LOOKUP_SIZE];
  1557. VTWORD AlignLookup[LZX_ALIGN_LOOKUP_SIZE];
  1558. VTHANDLE hWindow; /* handle to memory in pWindow */
  1559. VTBYTE* pWindow; /* sliding window array */
  1560. VTDWORD dwWindowLoc; /* current location in pWindow */
  1561. VTDWORD dwDecodeLoc; /* location needing 0xe8 decoding */
  1562. VTDWORD RecentOffsets[3]; /* R# values as described in lzx spec */
  1563. } IOLZXDATA, *PIOLZXDATA;
  1564. /*********************************************************************/
  1565. /*********************************************************************/
  1566. /*
  1567. | Macros
  1568. */
  1569. #define IOOpenVia(a,b,c,d,e) ((PBASEIO)(a))->pOpen(b,c,d,e)
  1570. #define IOClose(a) ((PBASEIO)(a))->pClose(a)
  1571. #define IORead(a,b,c,d) ((PBASEIO)(a))->pRead(a,(VTBYTE *)b,c,d)
  1572. #define IOWrite(a,b,c,d) ((PBASEIO)(a))->pWrite(a,(VTBYTE *)b,c,d)
  1573. #define IOSeek(a,b,c) ((PBASEIO)(a))->pSeek(a,b,c)
  1574. #define IOTell(a,b) ((PBASEIO)(a))->pTell(a,b)
  1575. #define IOGetInfo(a,b,c) ((PBASEIO)(a))->pGetInfo(a,b,c)
  1576. #ifdef SCCFEATURE_64BITIO
  1577. #define IOSeek64(a,b,c) ((PBASEIO)(a))->pSeek64(a,b,c)
  1578. #define IOTell64(a,b) ((PBASEIO)(a))->pTell64(a,b)
  1579. #endif
  1580. /*
  1581. | Functions
  1582. */
  1583. IO_ENTRYSC IOERR IO_ENTRYMOD IOCreate(HIOFILE * phFile, VTDWORD dwType, VTVOID * pSpec, VTDWORD dwFlags);
  1584. IO_ENTRYSC IOERR IO_ENTRYMOD IOOpen(HIOFILE * phFile, VTDWORD dwType, VTVOID * pSpec, VTDWORD dwFlags);
  1585. IO_ENTRYSC IOERR IO_ENTRYMOD IOSetFileTime(HIOFILE hFile, PIODATETIME pDate, VTDWORD dwFlags);
  1586. IO_ENTRYSC IOERR IO_ENTRYMOD IODelete(VTDWORD dwType, VTVOID * pSpec, VTDWORD dwFlags);
  1587. IO_ENTRYSC IOERR IO_ENTRYMOD IOGetTempFullUnicodeFileName(VTLPWORD pwszFileName);
  1588. IO_ENTRYSC IOERR IO_ENTRYMOD IOGetTempFullFileName(VTLPTSTR pszFileName, VTDWORD dwSpecType);
  1589. IO_ENTRYSC VTDWORD IO_ENTRYMOD IOMapIOERR(IOERR ieCode);
  1590. /*
  1591. | Structure used to access the internal storage of file specifications.
  1592. | Note: This type of structure is never passed into the IO routines
  1593. | but is used to marshall IO specs into a single data block
  1594. |
  1595. | Note: The Mac FSSpec structure is only available on the Mac
  1596. |
  1597. */
  1598. typedef struct IOSPECtag
  1599. {
  1600. VTDWORD dwSignature;
  1601. VTDWORD dwSize;
  1602. VTDWORD dwType;
  1603. union
  1604. {
  1605. VTBYTE szDosPath[1];
  1606. VTBYTE szAnsiPath[1];
  1607. VTBYTE szMacPath[1];
  1608. VTBYTE szUnixPath[1];
  1609. VTWORD szUnicodePath[1];
  1610. IOSPECMACHFS sMacHfs;
  1611. IOSPECRANGE sRange;
  1612. IOSPECCOMPRESS sCompress;
  1613. VTTCHAR szTempPrefix[1];
  1614. VTBYTE aGen[1];
  1615. IOSPECSECONDARY sSecondary;
  1616. IOSPECSUBSTREAM sSubStream;
  1617. IOSPECSUBSTORAGE sSubStorage;
  1618. /* Writable OLE2 Microsoft */
  1619. IOSPECMROOTSTORAGE sMRootStorage;
  1620. IOSPECMSTORAGE sMStorage;
  1621. IOSPECMSTREAM sMStream;
  1622. /* Writable OLE2 native */
  1623. IOSPECOLE2ROOTSTORAGE sOLE2RootStorage;
  1624. IOSPECOLE2STREAM sOLE2Stream;
  1625. IOSPECOLE2STORAGE sOLE2Storage;
  1626. IOSPECZIPNODE sZipNode;
  1627. PBASEIO pRedirect;
  1628. } uTypes;
  1629. } IOSPEC, * PIOSPEC;
  1630. typedef VTHANDLE HIOSPEC;
  1631. #define IO_IOSPEC_SIGNATURE 0x10FED3F1
  1632. IO_ENTRYSC IOERR IO_ENTRYMOD IOAllocSpec(VTDWORD dwType, VTVOID * pSpec, VTHANDLE * phSpec);
  1633. /* Added for writable ole2. */
  1634. IO_ENTRYSC IOERR IO_ENTRYMOD IOSetInfo(HIOFILE hFile, VTDWORD dwType, VTDWORD dwInfoId, VTVOID * pInfo);
  1635. /* dwInfoId parameters for IOSetInfo(). */
  1636. #define IOSETINFO_OLE2CLSID 1
  1637. #define IOSETINFO_CASESENSITIVITY 2
  1638. /*
  1639. | Structure used to retrieve Class IDs of OLE2 files.
  1640. */
  1641. typedef struct SCCOLE2CLSIDtag
  1642. {
  1643. VTDWORD Data1;
  1644. VTWORD Data2;
  1645. VTWORD Data3;
  1646. VTBYTE Data4[8];
  1647. } SCCOLE2CLSID, * PSCCOLE2CLSID;
  1648. #ifdef __cplusplus
  1649. }
  1650. #endif
  1651. #ifdef SCC_PACKED_BY_SCCIO_H
  1652. #pragma pack(pop)
  1653. #undef SCC_PACKED_BY_SCCIO_H
  1654. #undef SCC_PACK_SET
  1655. #endif /* SCC_PACKED_BY_SCCIO_H */
  1656. #endif /*SCCIO_H*/