/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

Large files are truncated click here to view the full 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 /* T…