xref: /aoo41x/main/twain/inc/twain.h (revision 4faf9d3a)
1 /* ======================================================================== *\
2 
3   Copyright (C) 2007 TWAIN Working Group: Adobe Systems Incorporated,
4   AnyDoc Software Inc., Eastman Kodak Company, Fujitsu Computer Products
5   of America, JFL Peripheral Solutions Inc., Ricoh Corporation, and
6   Xerox Corporation.  All rights reserved.
7 
8   Copyright (C) 1991, 1992 TWAIN Working Group: Aldus, Caere, Eastman-Kodak,
9   Hewlett-Packard and Logitech Corporations.  All rights reserved.
10 
11   Copyright (C) 1997 TWAIN Working Group: Bell+Howell, Canon, DocuMagix,
12   Fujitsu, Genoa Technology, Hewlett-Packard, Kofax Imaging Products, and
13   Ricoh Corporation.  All rights reserved.
14 
15   Copyright � 1998 TWAIN Working Group: Adobe Systems Incorporated,
16   Canon Information Systems, Eastman Kodak Company,
17   Fujitsu Computer Products of America, Genoa Technology,
18   Hewlett-Packard Company, Intel Corporation, Kofax Image Products,
19   JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
20   All rights reserved.
21 
22   Copyright � 2000 TWAIN Working Group: Adobe Systems Incorporated,
23   Canon Information Systems, Digimarc Corporation, Eastman Kodak Company,
24   Fujitsu Computer Products of America, Hewlett-Packard Company,
25   JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
26   All rights reserved.
27 
28 
29   TWAIN.h -  This is the definitive include file for applications and
30           data sources written to the TWAIN specification.
31           It defines constants, data structures, messages etc.
32           for the public interface to TWAIN.
33 
34   Revision History:
35     version 1.0, March 6, 1992.  TWAIN 1.0.
36     version 1.1, January 1993.   Tech Notes 1.1
37     version 1.5, June 1993.      Specification Update 1.5
38                                  Change DC to TW
39                                  Change filename from DC.H to TWAIN.H
40     version 1.5, July 1993.      Remove spaces from country identifiers
41 
42     version 1.7, July 1997       Added Capabilities and data structure for
43                                  document imaging and digital cameras.
44                                  KHL.
45     version 1.7, July 1997       Inserted Borland compatibile structure packing
46                                  directives provided by Mentor.  JMH
47     version 1.7, Aug 1997        Expanded file tabs to spaces.
48                                  NOTE: future authors should be sure to have
49                                  their editors set to automatically expand tabs
50                                  to spaces (original tab setting was 4 spaces).
51     version 1.7, Sept 1997       Added job control values
52                                  Added return codes
53     version 1.7, Sept 1997       changed definition of pRGBRESPONSE to
54                                  pTW_RGBRESPONSE
55     version 1.7  Aug 1998        Added missing TWEI_BARCODEROTATION values
56                                  TWBCOR_ types JMH
57     version 1.8  August 1998     Added new types and definitions required
58                                  for 1.8 Specification JMH
59     version 1.8  January 1999    Changed search mode from SRCH_ to TWBD_ as
60                                  in 1.8 Specification, added TWBT_MAXICODE JMH
61     version 1.8  January 1999    Removed undocumented duplicate AUTO<cap> JMH
62     version 1.8  March 1999      Removed undocumented 1.8 caps:
63                                  CAP_FILESYSTEM
64                                  CAP_PAPERBINDING
65                                  CAP_PASSTHRU
66                                  CAP_POWERDOWNTIME
67                                  ICAP_AUTODISCARDBLANKPAGES
68                                * CAP_PAGEMULTIPLEACQUIRE - is CAP_REACQUIREALLOWED,
69                                requires spec change.  JMH
70                                  Added Mac structure packing modifications JMH
71     version 1.9  March 2000  Added new types and definations required
72                              for 1.9 Specification MLM
73     version 1.9  March 2000  Added ICAP_JPEGQUALITY, TWJQ_ values,
74                                  updated TWON_PROTOCOLMINOR for Release v1.9 MN
75     version 1.91 August 2007     Added new types and definitions required
76                                  for 1.91 Specification MLM
77     version 2.0  Sept 2007       Added new types and definitions required
78                                  for 2.0 Specification FHH
79     version 2.0  Mar 2008        Depreciated ICAP_PIXELTYPEs TWPT_SRGB64, TWPT_BGR,
80                                  TWPT_CIELAB, TWPT_CIELUV, and TWPT_YCBCR  JMW
81     version 2.0  Mar 2008        Added missing new 2.0 CAP_ definitions JMW
82     version 2.0  Dec 2008        Updated TW_INFO structure for 64bit JMW
83     version 2.1  Mar 2009        Added new types and definitions required
84                                  for 2.1 Specification JMW
85 \* ======================================================================== */
86 
87 #ifndef TWAIN
88 #define TWAIN
89 
90 /****************************************************************************
91  * TWAIN Version                                                            *
92  ****************************************************************************/
93 #define TWON_PROTOCOLMINOR   1        /* Changed for Version 2.1            */
94 #define TWON_PROTOCOLMAJOR   2
95 
96 /****************************************************************************
97  * Platform Dependent Definitions and Typedefs                              *
98  ****************************************************************************/
99 
100 /*
101  * Mingw32 may be detected as both GNUC or WIN32/64 so try
102  * to detect it early and override both GNU and MS.
103  */
104 #if defined(__MINGW32__)
105   #define TWH_CMP_MING32
106 #endif
107 
108 /* Microsoft C/C++ Compiler */
109 #if defined(WIN32) || defined(WIN64) || defined (_WINDOWS)
110     #define TWH_CMP_MSC
111     #if  defined(_WIN64) || defined(WIN64)
112       #define TWH_64BIT
113     #elif defined(WIN32) || defined(_WIN32)
114       #define TWH_32BIT
115     #endif
116 
117 /* Apple Compiler (which is GNU now) */
118 #elif defined(__APPLE__)
119     #define TWH_CMP_XCODE
120     #define TWH_32BIT
121 
122 /* GNU C/C++ Compiler */
123 #elif defined(__GNUC__)
124     #define TWH_CMP_GNU
125     #if defined(__alpha__)\
126         ||defined(__ia64__)\
127         ||defined(__ppc64__)\
128         ||defined(__s390x__)\
129         ||defined(__x86_64__)
130       #define TWH_64BIT
131     #else
132       #define TWH_32BIT
133     #endif
134 
135 /* Borland C/C++ Compiler */
136 #elif defined(__BORLAND__)
137     #define TWH_CMP_BORLAND
138     #define TWH_32BIT
139 /* Unrecognized */
140 #else
141     #error Unrecognized compiler
142 #endif
143 
144 /* Win32 and Win64 systems */
145 #if defined(TWH_CMP_MSC) | defined(TWH_CMP_BORLAND)
146     typedef HANDLE  TW_HANDLE;
147     typedef LPVOID  TW_MEMREF;
148     typedef UINT_PTR TW_UINTPTR;
149 
150 /* MacOS/X... */
151 #elif defined(TWH_CMP_XCODE)
152     #define PASCAL   pascal
153     #define FAR
154     typedef Handle   TW_HANDLE;
155     typedef char    *TW_MEMREF;
156 
157     #ifdef TWH_32BIT
158       //32 bit GNU
159       typedef unsigned long      TW_UINTPTR;
160     #else
161       //64 bit GNU
162       typedef unsigned long long TW_UINTPTR;
163     #endif
164 
165 /* Everything else... */
166 #else
167     #define PASCAL
168     #define FAR
169     typedef void* TW_HANDLE;
170     typedef void* TW_MEMREF;
171     typedef unsigned char BYTE;
172 
173     #ifdef TWH_32BIT
174       //32 bit GNU
175       typedef unsigned long      TW_UINTPTR;
176     #else
177       //64 bit GNU
178       typedef unsigned long long TW_UINTPTR;
179     #endif
180 #endif
181 
182 
183 /* Set the packing: this occurs before any structures are defined */
184 #ifdef defined(TWH_CMP_MING32)
185     #pragma pack (push, 2)
186 #elif TWH_CMP_MSC
187     #pragma pack (push, before_twain)
188     #pragma pack (2)
189 #elif defined(TWH_CMP_GNU)
190     #pragma pack (push, before_twain)
191     #pragma pack (2)
192 #elif defined(TWH_CMP_BORLAND)
193     #pragma option -a2
194 #elif defined(TWH_CMP_XCODE)
195     #if PRAGMA_STRUCT_ALIGN
196         #pragma options align=mac68k
197     #elif PRAGMA_STRUCT_PACKPUSH
198         #pragma pack (push, 2)
199     #elif PRAGMA_STRUCT_PACK
200         #pragma pack (2)
201     #endif
202 #endif
203 
204 
205 /****************************************************************************
206  * Type Definitions                                                         *
207  ****************************************************************************/
208 
209 /* String types. These include room for the strings and a NULL char,     *
210  * or, on the Mac, a length byte followed by the string.                 *
211  * TW_STR255 must hold less than 256 chars so length fits in first byte. */
212 typedef char    TW_STR32[34],     FAR *pTW_STR32;
213 typedef char    TW_STR64[66],     FAR *pTW_STR64;
214 typedef char    TW_STR128[130],   FAR *pTW_STR128;
215 typedef char    TW_STR255[256],   FAR *pTW_STR255;
216 
217 /* Numeric types. */
218 typedef char           TW_INT8,   FAR *pTW_INT8;
219 typedef short          TW_INT16,  FAR *pTW_INT16;
220 typedef long           TW_INT32,  FAR *pTW_INT32;
221 typedef unsigned char  TW_UINT8,  FAR *pTW_UINT8;
222 typedef unsigned short TW_UINT16, FAR *pTW_UINT16;
223 typedef unsigned long  TW_UINT32, FAR *pTW_UINT32;
224 typedef unsigned short TW_BOOL,   FAR *pTW_BOOL;
225 
226 
227 /****************************************************************************
228  * Structure Definitions                                                    *
229  ****************************************************************************/
230 
231 /* Fixed point structure type. */
232 typedef struct {
233     TW_INT16     Whole;        /* maintains the sign */
234     TW_UINT16    Frac;
235 } TW_FIX32,  FAR *pTW_FIX32;
236 
237 /* No DAT.  Defines a frame rectangle in ICAP_UNITS coordinates. */
238 typedef struct {
239    TW_FIX32   Left;
240    TW_FIX32   Top;
241    TW_FIX32   Right;
242    TW_FIX32   Bottom;
243 } TW_FRAME, FAR * pTW_FRAME;
244 
245 /* No DAT needed. */
246 typedef struct {
247    TW_FIX32   StartIn;
248    TW_FIX32   BreakIn;
249    TW_FIX32   EndIn;
250    TW_FIX32   StartOut;
251    TW_FIX32   BreakOut;
252    TW_FIX32   EndOut;
253    TW_FIX32   Gamma;
254    TW_FIX32   SampleCount;  /* if =0 use the gamma */
255 } TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION;
256 
257 /* No DAT needed. */
258 typedef struct {
259    TW_DECODEFUNCTION   Decode[3];
260    TW_FIX32            Mix[3][3];
261 } TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE;
262 
263 /* TWON_ARRAY. Container for array of values (a simplified TW_ENUMERATION) */
264 typedef struct {
265    TW_UINT16  ItemType;
266    TW_UINT32  NumItems;    /* How many items in ItemList           */
267    TW_UINT8   ItemList[1]; /* Array of ItemType values starts here */
268 } TW_ARRAY, FAR * pTW_ARRAY;
269 
270 /* DAT_AUDIOINFO, information about audio data */
271 typedef struct {
272    TW_STR255  Name;       /* name of audio data */
273    TW_UINT32  Reserved;   /* reserved space */
274 } TW_AUDIOINFO, FAR * pTW_AUDIOINFO;
275 
276 /* TW_CALLBACK, used to register callbacks Added 2.0 */
277 typedef struct  {
278     TW_MEMREF   CallBackProc;
279     TW_UINT32   RefCon;
280     TW_INT16    Message;
281 } TW_CALLBACK, FAR * pTW_CALLBACK;
282 
283 /* DAT_CAPABILITY. Used by application to get/set capability from/in a data source. */
284 typedef struct {
285    TW_UINT16  Cap; /* id of capability to set or get, e.g. CAP_BRIGHTNESS */
286    TW_UINT16  ConType; /* TWON_ONEVALUE, _RANGE, _ENUMERATION or _ARRAY   */
287    TW_HANDLE  hContainer; /* Handle to container of type Dat              */
288 } TW_CAPABILITY, FAR * pTW_CAPABILITY;
289 
290 /* No DAT needed. */
291 typedef struct {
292    TW_FIX32   X;
293    TW_FIX32   Y;
294    TW_FIX32   Z;
295 } TW_CIEPOINT, FAR * pTW_CIEPOINT;
296 
297 /* DAT_CIECOLOR. */
298 typedef struct {
299    TW_UINT16           ColorSpace;
300    TW_INT16            LowEndian;
301    TW_INT16            DeviceDependent;
302    TW_INT32            VersionNumber;
303    TW_TRANSFORMSTAGE   StageABC;
304    TW_TRANSFORMSTAGE   StageLMN;
305    TW_CIEPOINT         WhitePoint;
306    TW_CIEPOINT         BlackPoint;
307    TW_CIEPOINT         WhitePaper;
308    TW_CIEPOINT         BlackInk;
309    TW_FIX32            Samples[1];
310 } TW_CIECOLOR, FAR * pTW_CIECOLOR;
311 
312 typedef struct {
313     TW_UINT32  InfoLength;     /* Length of Information in bytes.  */
314     TW_HANDLE  hData;          /* Place holder for data, DS Allocates */
315 }TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
316 
317 /* DAT_DEVICEEVENT, information about events */
318 typedef struct {
319    TW_UINT32  Event;                  /* One of the TWDE_xxxx values. */
320    TW_STR255  DeviceName;             /* The name of the device that generated the event */
321    TW_UINT32  BatteryMinutes;         /* Battery Minutes Remaining    */
322    TW_INT16   BatteryPercentage;      /* Battery Percentage Remaining */
323    TW_INT32   PowerSupply;            /* Power Supply                 */
324    TW_FIX32   XResolution;            /* Resolution                   */
325    TW_FIX32   YResolution;            /* Resolution                   */
326    TW_UINT32  FlashUsed2;             /* Flash Used2                  */
327    TW_UINT32  AutomaticCapture;       /* Automatic Capture            */
328    TW_UINT32  TimeBeforeFirstCapture; /* Automatic Capture            */
329    TW_UINT32  TimeBetweenCaptures;    /* Automatic Capture            */
330 } TW_DEVICEEVENT, FAR * pTW_DEVICEEVENT;
331 
332 /* No DAT needed. */
333 typedef struct {
334    TW_UINT8    Index;    /* Value used to index into the color table. */
335    TW_UINT8    Channel1; /* First  tri-stimulus value (e.g Red)       */
336    TW_UINT8    Channel2; /* Second tri-stimulus value (e.g Green)     */
337    TW_UINT8    Channel3; /* Third  tri-stimulus value (e.g Blue)      */
338 } TW_ELEMENT8, FAR * pTW_ELEMENT8;
339 
340 /* TWON_ENUMERATION. Container for a collection of values. */
341 typedef struct {
342    TW_UINT16  ItemType;
343    TW_UINT32  NumItems;     /* How many items in ItemList                 */
344    TW_UINT32  CurrentIndex; /* Current value is in ItemList[CurrentIndex] */
345    TW_UINT32  DefaultIndex; /* Powerup value is in ItemList[DefaultIndex] */
346    TW_UINT8   ItemList[1];  /* Array of ItemType values starts here       */
347 } TW_ENUMERATION, FAR * pTW_ENUMERATION;
348 
349 /* DAT_EVENT. For passing events down from the application to the DS. */
350 typedef struct {
351    TW_MEMREF  pEvent;    /* Windows pMSG or Mac pEvent.                 */
352    TW_UINT16  TWMessage; /* TW msg from data source, e.g. MSG_XFERREADY */
353 } TW_EVENT, FAR * pTW_EVENT;
354 
355 typedef struct {
356     TW_UINT16   InfoID;
357     TW_UINT16   ItemType;
358     TW_UINT16   NumItems;
359     union {
360       TW_UINT16   CondCode;    /* Depreciated, use ReturnCode. TWAIN 2.0 and older. */
361       TW_UINT16   ReturnCode;  /* TWAIN 2.1 and newer */
362     };
363     TW_UINTPTR  Item;
364 }TW_INFO, FAR* pTW_INFO;
365 
366 typedef struct {
367     TW_UINT32   NumInfos;
368     TW_INFO     Info[1];
369 }TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO;
370 
371 /* DAT_FILESYSTEM, information about TWAIN file system */
372 typedef struct {
373    /* DG_CONTROL / DAT_FILESYSTEM / MSG_xxxx fields     */
374    TW_STR255  InputName; /* The name of the input or source file */
375    TW_STR255  OutputName; /* The result of an operation or the name of a destination file */
376    TW_MEMREF  Context; /* Source specific data used to remember state information */
377    /* DG_CONTROL / DAT_FILESYSTEM / MSG_DELETE field    */
378    int        Recursive; /* recursively delete all sub-directories */
379    /* DG_CONTROL / DAT_FILESYSTEM / MSG_GETINFO fields  */
380    TW_INT32   FileType; /* One of the TWFY_xxxx values */
381    TW_UINT32  Size; /* Size of current FileType */
382    TW_STR32   CreateTimeDate; /* creation date of the file */
383    TW_STR32   ModifiedTimeDate; /* last date the file was modified */
384    TW_UINT32  FreeSpace; /* bytes of free space on the current device */
385    TW_INT32   NewImageSize; /* estimate of the amount of space a new image would take up */
386    TW_UINT32  NumberOfFiles; /* number of files, depends on FileType */
387    TW_UINT32  NumberOfSnippets; /* number of audio snippets */
388    TW_UINT32  DeviceGroupMask; /* used to group cameras (ex: front/rear bitonal, front/rear grayscale...) */
389    char       Reserved[508]; /**/
390 } TW_FILESYSTEM, FAR * pTW_FILESYSTEM;
391 
392 /* DAT_GRAYRESPONSE */
393 typedef struct {
394    TW_ELEMENT8         Response[1];
395 } TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE;
396 
397 /* No DAT needed.  Describes version of software currently running. */
398 typedef struct {
399    TW_UINT16  MajorNum;  /* Major revision number of the software. */
400    TW_UINT16  MinorNum;  /* Incremental revision number of the software. */
401    TW_UINT16  Language;  /* e.g. TWLG_SWISSFRENCH */
402    TW_UINT16  Country;   /* e.g. TWCY_SWITZERLAND */
403    TW_STR32   Info;      /* e.g. "1.0b3 Beta release" */
404 } TW_VERSION, FAR * pTW_VERSION;
405 
406 /* DAT_IDENTITY. Identifies the program/library/code resource. */
407 typedef struct {
408    TW_UINT32  Id;              /* Unique number.  In Windows, application hWnd      */
409    TW_VERSION Version;         /* Identifies the piece of code              */
410    TW_UINT16  ProtocolMajor;   /* Application and DS must set to TWON_PROTOCOLMAJOR */
411    TW_UINT16  ProtocolMinor;   /* Application and DS must set to TWON_PROTOCOLMINOR */
412    TW_UINT32  SupportedGroups; /* Bit field OR combination of DG_ constants */
413    TW_STR32   Manufacturer;    /* Manufacturer name, e.g. "Hewlett-Packard" */
414    TW_STR32   ProductFamily;   /* Product family name, e.g. "ScanJet"       */
415    TW_STR32   ProductName;     /* Product name, e.g. "ScanJet Plus"         */
416 } TW_IDENTITY, FAR * pTW_IDENTITY;
417 
418 /* DAT_IMAGEINFO. Application gets detailed image info from DS with this. */
419 typedef struct {
420    TW_FIX32   XResolution;      /* Resolution in the horizontal             */
421    TW_FIX32   YResolution;      /* Resolution in the vertical               */
422    TW_INT32   ImageWidth;       /* Columns in the image, -1 if unknown by DS*/
423    TW_INT32   ImageLength;      /* Rows in the image, -1 if unknown by DS   */
424    TW_INT16   SamplesPerPixel;  /* Number of samples per pixel, 3 for RGB   */
425    TW_INT16   BitsPerSample[8]; /* Number of bits for each sample           */
426    TW_INT16   BitsPerPixel;     /* Number of bits for each padded pixel     */
427    TW_BOOL    Planar;           /* True if Planar, False if chunky          */
428    TW_INT16   PixelType;        /* How to interp data; photo interp (TWPT_) */
429    TW_UINT16  Compression;      /* How the data is compressed (TWCP_xxxx)   */
430 } TW_IMAGEINFO, FAR * pTW_IMAGEINFO;
431 
432 /* DAT_IMAGELAYOUT. Provides image layout information in current units. */
433 typedef struct {
434    TW_FRAME   Frame;          /* Frame coords within larger document */
435    TW_UINT32  DocumentNumber;
436    TW_UINT32  PageNumber;     /* Reset when you go to next document  */
437    TW_UINT32  FrameNumber;    /* Reset when you go to next page      */
438 } TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT;
439 
440 /* No DAT needed.  Used to manage memory buffers. */
441 typedef struct {
442    TW_UINT32  Flags;  /* Any combination of the TWMF_ constants.           */
443    TW_UINT32  Length; /* Number of bytes stored in buffer TheMem.          */
444    TW_MEMREF  TheMem; /* Pointer or handle to the allocated memory buffer. */
445 } TW_MEMORY, FAR * pTW_MEMORY;
446 
447 /* DAT_IMAGEMEMXFER. Used to pass image data (e.g. in strips) from DS to application.*/
448 typedef struct {
449    TW_UINT16  Compression;  /* How the data is compressed                */
450    TW_UINT32  BytesPerRow;  /* Number of bytes in a row of data          */
451    TW_UINT32  Columns;      /* How many columns                          */
452    TW_UINT32  Rows;         /* How many rows                             */
453    TW_UINT32  XOffset;      /* How far from the side of the image        */
454    TW_UINT32  YOffset;      /* How far from the top of the image         */
455    TW_UINT32  BytesWritten; /* How many bytes written in Memory          */
456    TW_MEMORY  Memory;       /* Mem struct used to pass actual image data */
457 } TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER;
458 
459 /* Changed in 1.1: QuantTable, HuffmanDC, HuffmanAC TW_MEMREF -> TW_MEMORY  */
460 /* DAT_JPEGCOMPRESSION. Based on JPEG Draft International Std, ver 10918-1. */
461 typedef struct {
462    TW_UINT16   ColorSpace;       /* One of the TWPT_xxxx values                */
463    TW_UINT32   SubSampling;      /* Two word "array" for subsampling values    */
464    TW_UINT16   NumComponents;    /* Number of color components in image        */
465    TW_UINT16   RestartFrequency; /* Frequency of restart marker codes in MDU's */
466    TW_UINT16   QuantMap[4];      /* Mapping of components to QuantTables       */
467    TW_MEMORY   QuantTable[4];    /* Quantization tables                        */
468    TW_UINT16   HuffmanMap[4];    /* Mapping of components to Huffman tables    */
469    TW_MEMORY   HuffmanDC[2];     /* DC Huffman tables                          */
470    TW_MEMORY   HuffmanAC[2];     /* AC Huffman tables                          */
471 } TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION;
472 
473 /* TWON_ONEVALUE. Container for one value. */
474 typedef struct {
475    TW_UINT16  ItemType;
476    TW_UINT32  Item;
477 } TW_ONEVALUE, FAR * pTW_ONEVALUE;
478 
479 /* DAT_PALETTE8. Color palette when TWPT_PALETTE pixels xfer'd in mem buf. */
480 typedef struct {
481    TW_UINT16    NumColors;   /* Number of colors in the color table.  */
482    TW_UINT16    PaletteType; /* TWPA_xxxx, specifies type of palette. */
483    TW_ELEMENT8  Colors[256]; /* Array of palette values starts here.  */
484 } TW_PALETTE8, FAR * pTW_PALETTE8;
485 
486 /* DAT_PASSTHRU, device dependant data to pass through Data Source */
487 typedef struct {
488    TW_MEMREF  pCommand;        /* Pointer to Command buffer */
489    TW_UINT32  CommandBytes;    /* Number of bytes in Command buffer */
490    TW_INT32   Direction;       /* One of the TWDR_xxxx values.  Defines the direction of data flow */
491    TW_MEMREF  pData;           /* Pointer to Data buffer */
492    TW_UINT32  DataBytes;       /* Number of bytes in Data buffer */
493    TW_UINT32  DataBytesXfered; /* Number of bytes successfully transferred */
494 } TW_PASSTHRU, FAR * pTW_PASSTHRU;
495 
496 /* DAT_PENDINGXFERS. Used with MSG_ENDXFER to indicate additional data. */
497 typedef struct {
498    TW_UINT16 Count;
499    union {
500       TW_UINT32 EOJ;
501       TW_UINT32 Reserved;
502    };
503 } TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
504 
505 /* TWON_RANGE. Container for a range of values. */
506 typedef struct {
507    TW_UINT16  ItemType;
508    TW_UINT32  MinValue;     /* Starting value in the range.           */
509    TW_UINT32  MaxValue;     /* Final value in the range.              */
510    TW_UINT32  StepSize;     /* Increment from MinValue to MaxValue.   */
511    TW_UINT32  DefaultValue; /* Power-up value.                        */
512    TW_UINT32  CurrentValue; /* The value that is currently in effect. */
513 } TW_RANGE, FAR * pTW_RANGE;
514 
515 /* DAT_RGBRESPONSE */
516 typedef struct {
517    TW_ELEMENT8         Response[1];
518 } TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE;
519 
520 /* DAT_SETUPFILEXFER. Sets up DS to application data transfer via a file. */
521 typedef struct {
522    TW_STR255 FileName;
523    TW_UINT16 Format;   /* Any TWFF_ constant */
524    TW_INT16  VRefNum;  /* Used for Mac only  */
525 } TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER;
526 
527 /* DAT_SETUPMEMXFER. Sets up DS to application data transfer via a memory buffer. */
528 typedef struct {
529    TW_UINT32 MinBufSize;
530    TW_UINT32 MaxBufSize;
531    TW_UINT32 Preferred;
532 } TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER;
533 
534 /* DAT_STATUS. Application gets detailed status info from a data source with this. */
535 typedef struct {
536    TW_UINT16  ConditionCode;  /* Any TWCC_ constant     */
537    union {
538      TW_UINT16  Data;         /* output (TWAIN 2.1 and newer) This field contains additional data. */
539      TW_UINT16  Reserved;     /* output (TWAIN 2.0 and older) */
540    };
541 } TW_STATUS, FAR * pTW_STATUS;
542 
543 /* DAT_STATUSUTF8. Application gets detailed UTF8 status info from a data source with this.  Added 2.1 */
544 typedef struct {
545    TW_STATUS    Status;         /* input  TW_STATUS data received from a previous call to DG_CONTROL / DAT_STATUS / MSG_GET. */
546    TW_UINT32    Size;           /* output Total number of bytes in the UTF8string, plus the terminating NUL byte.  This is not the same as the total number of characters in the string. */
547    TW_HANDLE    UTF8string;     /* output TW_HANDLE to a UTF-8 encoded localized string (based on TW_IDENTITY.Language or CAP_LANGUAGE).  The Source allocates it, the Application frees it. */
548 } TW_STATUSUTF8, FAR * pTW_STATUSUTF8;
549 
550 /* DAT_USERINTERFACE. Coordinates UI between application and data source. */
551 typedef struct {
552    TW_BOOL    ShowUI;  /* TRUE if DS should bring up its UI           */
553    TW_BOOL    ModalUI; /* For Mac only - true if the DS's UI is modal */
554    TW_HANDLE  hParent; /* For windows only - Application window handle        */
555 } TW_USERINTERFACE, FAR * pTW_USERINTERFACE;
556 
557 
558 
559 /****************************************************************************
560  * Generic Constants                                                        *
561  ****************************************************************************/
562 
563 #define TWON_ARRAY           3 /* indicates TW_ARRAY container       */
564 #define TWON_ENUMERATION     4 /* indicates TW_ENUMERATION container */
565 #define TWON_ONEVALUE        5 /* indicates TW_ONEVALUE container    */
566 #define TWON_RANGE           6 /* indicates TW_RANGE container       */
567 
568 #define TWON_ICONID          962 /* res Id of icon used in USERSELECT lbox */
569 #define TWON_DSMID           461 /* res Id of the DSM version num resource */
570 #define TWON_DSMCODEID       63  /* res Id of the Mac SM Code resource     */
571 
572 #define TWON_DONTCARE8       0xff
573 #define TWON_DONTCARE16      0xffff
574 #define TWON_DONTCARE32      0xffffffff
575 
576 /* Flags used in TW_MEMORY structure. */
577 #define TWMF_APPOWNS     0x1
578 #define TWMF_DSMOWNS     0x2
579 #define TWMF_DSOWNS      0x4
580 #define TWMF_POINTER     0x8
581 #define TWMF_HANDLE      0x10
582 
583 /* There are four containers used for capabilities negotiation:
584  *    TWON_ONEVALUE, TWON_RANGE, TWON_ENUMERATION, TWON_ARRAY
585  * In each container structure ItemType can be TWTY_INT8, TWTY_INT16, etc.
586  * The kind of data stored in the container can be determined by doing
587  * DCItemSize[ItemType] where the following is defined in TWAIN glue code:
588  *          DCItemSize[]= { sizeof(TW_INT8),
589  *                          sizeof(TW_INT16),
590  *                          etc.
591  *                          sizeof(TW_UINT32) };
592  *
593  */
594 
595 #define TWTY_INT8        0x0000    /* Means Item is a TW_INT8   */
596 #define TWTY_INT16       0x0001    /* Means Item is a TW_INT16  */
597 #define TWTY_INT32       0x0002    /* Means Item is a TW_INT32  */
598 
599 #define TWTY_UINT8       0x0003    /* Means Item is a TW_UINT8  */
600 #define TWTY_UINT16      0x0004    /* Means Item is a TW_UINT16 */
601 #define TWTY_UINT32      0x0005    /* Means Item is a TW_UINT32 */
602 
603 #define TWTY_BOOL        0x0006    /* Means Item is a TW_BOOL   */
604 
605 #define TWTY_FIX32       0x0007    /* Means Item is a TW_FIX32  */
606 
607 #define TWTY_FRAME       0x0008    /* Means Item is a TW_FRAME  */
608 
609 #define TWTY_STR32       0x0009    /* Means Item is a TW_STR32  */
610 #define TWTY_STR64       0x000a    /* Means Item is a TW_STR64  */
611 #define TWTY_STR128      0x000b    /* Means Item is a TW_STR128 */
612 #define TWTY_STR255      0x000c    /* Means Item is a TW_STR255 */
613 #define TWTY_HANDLE      0x000f    /* Means Item is a TW_HANDLE */
614 
615 
616 /****************************************************************************
617  * Capability Constants                                                     *
618  ****************************************************************************/
619 
620 /* CAP_ALARMS values (AL_ means alarms) Added 1.8  */
621 #define TWAL_ALARM               0
622 #define TWAL_FEEDERERROR         1
623 #define TWAL_FEEDERWARNING       2
624 #define TWAL_BARCODE             3
625 #define TWAL_DOUBLEFEED          4
626 #define TWAL_JAM                 5
627 #define TWAL_PATCHCODE           6
628 #define TWAL_POWER               7
629 #define TWAL_SKEW                8
630 
631 /* ICAP_AUTOSIZE values Added 2.0 */
632 #define TWAS_NONE                0
633 #define TWAS_AUTO                1
634 #define TWAS_CURRENT             2
635 
636 /* TWEI_BARCODEROTATION values (BCOR_ means barcode rotation) Added 1.7 */
637 #define TWBCOR_ROT0              0
638 #define TWBCOR_ROT90             1
639 #define TWBCOR_ROT180            2
640 #define TWBCOR_ROT270            3
641 #define TWBCOR_ROTX              4
642 
643 /* ICAP_BARCODESEARCHMODE values (TWBD_ means search) */
644 #define TWBD_HORZ                0
645 #define TWBD_VERT                1
646 #define TWBD_HORZVERT            2
647 #define TWBD_VERTHORZ            3
648 
649 /* ICAP_BITORDER values (BO_ means Bit Order) */
650 #define TWBO_LSBFIRST            0
651 #define TWBO_MSBFIRST            1
652 
653 /* ICAP_AUTODISCARDBLANKPAGES values Added 2.0 */
654 #define TWBP_DISABLE            -2
655 #define TWBP_AUTO               -1
656 
657 /* ICAP_BITDEPTHREDUCTION values (BR_ means Bitdepth Reduction) Added 1.5 */
658 #define TWBR_THRESHOLD           0
659 #define TWBR_HALFTONE            1
660 #define TWBR_CUSTHALFTONE        2
661 #define TWBR_DIFFUSION           3
662 
663 /* ICAP_SUPPORTEDBARCODETYPES and TWEI_BARCODETYPE values Added 1.7 */
664 #define TWBT_3OF9                 0
665 #define TWBT_2OF5INTERLEAVED      1
666 #define TWBT_2OF5NONINTERLEAVED   2
667 #define TWBT_CODE93               3
668 #define TWBT_CODE128              4
669 #define TWBT_UCC128               5
670 #define TWBT_CODABAR              6
671 #define TWBT_UPCA                 7
672 #define TWBT_UPCE                 8
673 #define TWBT_EAN8                 9
674 #define TWBT_EAN13                10
675 #define TWBT_POSTNET              11
676 #define TWBT_PDF417               12
677 #define TWBT_2OF5INDUSTRIAL       13 /* Added 1.8 */
678 #define TWBT_2OF5MATRIX           14 /* Added 1.8 */
679 #define TWBT_2OF5DATALOGIC        15 /* Added 1.8 */
680 #define TWBT_2OF5IATA             16 /* Added 1.8 */
681 #define TWBT_3OF9FULLASCII        17 /* Added 1.8 */
682 #define TWBT_CODABARWITHSTARTSTOP 18 /* Added 1.8 */
683 #define TWBT_MAXICODE             19 /* Added 1.8 */
684 
685 /* ICAP_COMPRESSION values (CP_ means ComPression ) */
686 #define TWCP_NONE                0
687 #define TWCP_PACKBITS            1
688 #define TWCP_GROUP31D            2 /* Follows CCITT spec (no End Of Line)          */
689 #define TWCP_GROUP31DEOL         3 /* Follows CCITT spec (has End Of Line)         */
690 #define TWCP_GROUP32D            4 /* Follows CCITT spec (use cap for K Factor)    */
691 #define TWCP_GROUP4              5 /* Follows CCITT spec                           */
692 #define TWCP_JPEG                6 /* Use capability for more info                 */
693 #define TWCP_LZW                 7 /* Must license from Unisys and IBM to use      */
694 #define TWCP_JBIG                8 /* For Bitonal images  -- Added 1.7 KHL         */
695 #define TWCP_PNG                 9 /* Added 1.8 */
696 #define TWCP_RLE4               10 /* Added 1.8 */
697 #define TWCP_RLE8               11 /* Added 1.8 */
698 #define TWCP_BITFIELDS          12 /* Added 1.8 */
699 
700 /* CAP_CAMERASIDE and TWEI_PAGESIDE values (CS_ means camera side) Added 1.91 */
701 #define TWCS_BOTH                0
702 #define TWCS_TOP                 1
703 #define TWCS_BOTTOM              2
704 
705 /* CAP_CLEARBUFFERS values (CB_ means clear buffers) */
706 #define TWCB_AUTO                0
707 #define TWCB_CLEAR               1
708 #define TWCB_NOCLEAR             2
709 
710 /* CAP_DEVICEEVENT values (DE_ means device event) */
711 #define TWDE_CUSTOMEVENTS           0x8000
712 #define TWDE_CHECKAUTOMATICCAPTURE  0
713 #define TWDE_CHECKBATTERY           1
714 #define TWDE_CHECKDEVICEONLINE      2
715 #define TWDE_CHECKFLASH             3
716 #define TWDE_CHECKPOWERSUPPLY       4
717 #define TWDE_CHECKRESOLUTION        5
718 #define TWDE_DEVICEADDED            6
719 #define TWDE_DEVICEOFFLINE          7
720 #define TWDE_DEVICEREADY            8
721 #define TWDE_DEVICEREMOVED          9
722 #define TWDE_IMAGECAPTURED          10
723 #define TWDE_IMAGEDELETED           11
724 #define TWDE_PAPERDOUBLEFEED        12
725 #define TWDE_PAPERJAM               13
726 #define TWDE_LAMPFAILURE            14
727 #define TWDE_POWERSAVE              15
728 #define TWDE_POWERSAVENOTIFY        16
729 
730 /* TW_PASSTHRU.Direction values.  Added 1.8 */
731 #define TWDR_GET                 1
732 #define TWDR_SET                 2
733 
734 /* TWEI_DESKEWSTATUS values Added 1.7 */
735 #define TWDSK_SUCCESS            0
736 #define TWDSK_REPORTONLY         1
737 #define TWDSK_FAIL               2
738 #define TWDSK_DISABLED           3
739 
740 /* CAP_DUPLEX values Added 1.7 */
741 #define TWDX_NONE                0
742 #define TWDX_1PASSDUPLEX         1
743 #define TWDX_2PASSDUPLEX         2
744 
745 /* CAP_FEEDERALIGNMENT values (FA_ means feeder alignment) */
746 #define TWFA_NONE                0
747 #define TWFA_LEFT                1
748 #define TWFA_CENTER              2
749 #define TWFA_RIGHT               3
750 
751 /* ICAP_FEEDERTYPE */
752 #define TWFE_GENERAL             0
753 #define TWFE_PHOTO               1
754 
755 /* ICAP_IMAGEFILEFORMAT values (FF_means File Format)   */
756 #define TWFF_TIFF                0    /* Tagged Image File Format     */
757 #define TWFF_PICT                1    /* Macintosh PICT               */
758 #define TWFF_BMP                 2    /* Windows Bitmap               */
759 #define TWFF_XBM                 3    /* X-Windows Bitmap             */
760 #define TWFF_JFIF                4    /* JPEG File Interchange Format */
761 #define TWFF_FPX                 5    /* Flash Pix                    */
762 #define TWFF_TIFFMULTI           6    /* Multi-page tiff file         */
763 #define TWFF_PNG                 7
764 #define TWFF_SPIFF               8
765 #define TWFF_EXIF                9
766 #define TWFF_PDF                10    /* 1.91 NB: this is not PDF/A */
767 #define TWFF_JP2                11    /* 1.91 */
768 #define TWFF_JPX                13    /* 1.91 */
769 #define TWFF_DEJAVU             14    /* 1.91 */
770 #define TWFF_PDFA               15    /* 2.0 Adobe PDF/A, Version 1*/
771 #define TWFF_PDFA2              16    /* 2.1 Adobe PDF/A, Version 2*/
772 
773 /* ICAP_FLASHUSED2 values (FL_ means flash) */
774 #define TWFL_NONE                0
775 #define TWFL_OFF                 1
776 #define TWFL_ON                  2
777 #define TWFL_AUTO                3
778 #define TWFL_REDEYE              4
779 
780 /* CAP_FEEDERORDER values (FO_ means feeder order) */
781 #define TWFO_FIRSTPAGEFIRST      0
782 #define TWFO_LASTPAGEFIRST       1
783 
784 /* CAP_FEEDERPOCKET */
785 #define TWFP_POCKETERROR         0
786 #define TWFP_POCKET1             1
787 #define TWFP_POCKET2             2
788 #define TWFP_POCKET3             3
789 #define TWFP_POCKET4             4
790 #define TWFP_POCKET5             5
791 #define TWFP_POCKET6             6
792 #define TWFP_POCKET7             7
793 #define TWFP_POCKET8             8
794 #define TWFP_POCKET9             9
795 #define TWFP_POCKET10           10
796 #define TWFP_POCKET11           11
797 #define TWFP_POCKET12           12
798 #define TWFP_POCKET13           13
799 #define TWFP_POCKET14           14
800 #define TWFP_POCKET15           15
801 #define TWFP_POCKET16           16
802 
803 /* ICAP_FLIPROTATION values (FR_ means flip rotation) */
804 #define TWFR_BOOK                0
805 #define TWFR_FANFOLD             1
806 
807 /* ICAP_FILTER values (FT_ means Filter Type) */
808 #define TWFT_RED                 0
809 #define TWFT_GREEN               1
810 #define TWFT_BLUE                2
811 #define TWFT_NONE                3
812 #define TWFT_WHITE               4
813 #define TWFT_CYAN                5
814 #define TWFT_MAGENTA             6
815 #define TWFT_YELLOW              7
816 #define TWFT_BLACK               8
817 
818 /* TW_FILESYSTEM.FileType values (FY_ means file type) */
819 #define TWFY_CAMERA              0
820 #define TWFY_CAMERATOP           1
821 #define TWFY_CAMERABOTTOM        2
822 #define TWFY_CAMERAPREVIEW       3
823 #define TWFY_DOMAIN              4
824 #define TWFY_HOST                5
825 #define TWFY_DIRECTORY           6
826 #define TWFY_IMAGE               7
827 #define TWFY_UNKNOWN             8
828 
829 /* ICAP_ICCPROFILE */
830 #define TWIC_NONE                0
831 #define TWIC_LINK                1
832 #define TWIC_EMBED               2
833 
834 /* ICAP_IMAGEFILTER values (IF_ means image filter) */
835 #define TWIF_NONE                0
836 #define TWIF_AUTO                1
837 #define TWIF_LOWPASS             2
838 #define TWIF_BANDPASS            3
839 #define TWIF_HIGHPASS            4
840 #define TWIF_TEXT                TWIF_BANDPASS
841 #define TWIF_FINELINE            TWIF_HIGHPASS
842 
843 /* ICAP_IMAGEMERGE values (IM_ means image merge) */
844 #define TWIM_NONE                0
845 #define TWIM_FRONTONTOP          1
846 #define TWIM_FRONTONBOTTOM       2
847 #define TWIM_FRONTONLEFT         3
848 #define TWIM_FRONTONRIGHT        4
849 
850 /* CAP_JOBCONTROL values Added 1.7  */
851 #define TWJC_NONE                0
852 #define TWJC_JSIC                1
853 #define TWJC_JSIS                2
854 #define TWJC_JSXC                3
855 #define TWJC_JSXS                4
856 
857 /* ICAP_JPEGQUALITY values (JQ_ means jpeg quality) */
858 #define TWJQ_UNKNOWN            -4
859 #define TWJQ_LOW                -3
860 #define TWJQ_MEDIUM             -2
861 #define TWJQ_HIGH               -1
862 
863 /* ICAP_LIGHTPATH values (LP_ means Light Path) */
864 #define TWLP_REFLECTIVE          0
865 #define TWLP_TRANSMISSIVE        1
866 
867 /* ICAP_LIGHTSOURCE values (LS_ means Light Source) */
868 #define TWLS_RED                 0
869 #define TWLS_GREEN               1
870 #define TWLS_BLUE                2
871 #define TWLS_NONE                3
872 #define TWLS_WHITE               4
873 #define TWLS_UV                  5
874 #define TWLS_IR                  6
875 
876 /* TWEI_MAGTYPE values (MD_ means Mag Type) Added 2.0 */
877 #define TWMD_MICR                0  /* Added 2.0 */
878 #define TWMD_RAW                 1  /* added 2.1 */
879 #define TWMD_INVALID             2  /* added 2.1 */
880 
881 /* ICAP_NOISEFILTER values (NF_ means noise filter) */
882 #define TWNF_NONE                0
883 #define TWNF_AUTO                1
884 #define TWNF_LONEPIXEL           2
885 #define TWNF_MAJORITYRULE        3
886 
887 /* ICAP_ORIENTATION values (OR_ means ORientation) */
888 #define TWOR_ROT0                0
889 #define TWOR_ROT90               1
890 #define TWOR_ROT180              2
891 #define TWOR_ROT270              3
892 #define TWOR_PORTRAIT            TWOR_ROT0
893 #define TWOR_LANDSCAPE           TWOR_ROT270
894 #define TWOR_AUTO                4           /* 2.0 */
895 #define TWOR_AUTOTEXT            5           /* 2.0 */
896 #define TWOR_AUTOPICTURE         6           /* 2.0 */
897 
898 /* ICAP_OVERSCAN values (OV_ means overscan) */
899 #define TWOV_NONE                0
900 #define TWOV_AUTO                1
901 #define TWOV_TOPBOTTOM           2
902 #define TWOV_LEFTRIGHT           3
903 #define TWOV_ALL                 4
904 
905 /* Palette types for TW_PALETTE8 */
906 #define TWPA_RGB         0
907 #define TWPA_GRAY        1
908 #define TWPA_CMY         2
909 
910 /* ICAP_PLANARCHUNKY values (PC_ means Planar/Chunky ) */
911 #define TWPC_CHUNKY              0
912 #define TWPC_PLANAR              1
913 
914 /* TWEI_PATCHCODE values Added 1.7 */
915 #define TWPCH_PATCH1             0
916 #define TWPCH_PATCH2             1
917 #define TWPCH_PATCH3             2
918 #define TWPCH_PATCH4             3
919 #define TWPCH_PATCH6             4
920 #define TWPCH_PATCHT             5
921 
922 /* ICAP_PIXELFLAVOR values (PF_ means Pixel Flavor) */
923 #define TWPF_CHOCOLATE           0  /* zero pixel represents darkest shade  */
924 #define TWPF_VANILLA             1  /* zero pixel represents lightest shade */
925 
926 /* CAP_PRINTERMODE values (PM_ means printer mode) */
927 #define TWPM_SINGLESTRING        0
928 #define TWPM_MULTISTRING         1
929 #define TWPM_COMPOUNDSTRING      2
930 
931 /* CAP_PRINTER values (PR_ means printer) */
932 #define TWPR_IMPRINTERTOPBEFORE     0
933 #define TWPR_IMPRINTERTOPAFTER      1
934 #define TWPR_IMPRINTERBOTTOMBEFORE  2
935 #define TWPR_IMPRINTERBOTTOMAFTER   3
936 #define TWPR_ENDORSERTOPBEFORE      4
937 #define TWPR_ENDORSERTOPAFTER       5
938 #define TWPR_ENDORSERBOTTOMBEFORE   6
939 #define TWPR_ENDORSERBOTTOMAFTER    7
940 
941 /* CAP_POWERSUPPLY values (PS_ means power supply) */
942 #define TWPS_EXTERNAL            0
943 #define TWPS_BATTERY             1
944 
945 /* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
946 #define TWPT_BW                  0 /* Black and White */
947 #define TWPT_GRAY                1
948 #define TWPT_RGB                 2
949 #define TWPT_PALETTE             3
950 #define TWPT_CMY                 4
951 #define TWPT_CMYK                5
952 #define TWPT_YUV                 6
953 #define TWPT_YUVK                7
954 #define TWPT_CIEXYZ              8
955 #define TWPT_LAB                 9
956 #define TWPT_SRGB               10 /* 1.91 */
957 #define TWPT_SCRGB              11 /* 1.91 */
958 #define TWPT_INFRARED           16 /* 2.0 */
959 
960 /* CAP_SEGMENTED values (SG_ means segmented) Added 1.91 */
961 #define TWSG_NONE                0
962 #define TWSG_AUTO                1
963 
964 /* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
965 #define TWSS_NONE                0
966 #define TWSS_A4                  1
967 #define TWSS_JISB5               2
968 #define TWSS_USLETTER            3
969 #define TWSS_USLEGAL             4
970 /* Added 1.5 */
971 #define TWSS_A5                  5
972 #define TWSS_ISOB4               6
973 #define TWSS_ISOB6               7
974 /* Added 1.7 */
975 #define TWSS_USLEDGER            9
976 #define TWSS_USEXECUTIVE        10
977 #define TWSS_A3                 11
978 #define TWSS_ISOB3              12
979 #define TWSS_A6                 13
980 #define TWSS_C4                 14
981 #define TWSS_C5                 15
982 #define TWSS_C6                 16
983 /* Added 1.8 */
984 #define TWSS_4A0                17
985 #define TWSS_2A0                18
986 #define TWSS_A0                 19
987 #define TWSS_A1                 20
988 #define TWSS_A2                 21
989 #define TWSS_A7                 22
990 #define TWSS_A8                 23
991 #define TWSS_A9                 24
992 #define TWSS_A10                25
993 #define TWSS_ISOB0              26
994 #define TWSS_ISOB1              27
995 #define TWSS_ISOB2              28
996 #define TWSS_ISOB5              29
997 #define TWSS_ISOB7              30
998 #define TWSS_ISOB8              31
999 #define TWSS_ISOB9              32
1000 #define TWSS_ISOB10             33
1001 #define TWSS_JISB0              34
1002 #define TWSS_JISB1              35
1003 #define TWSS_JISB2              36
1004 #define TWSS_JISB3              37
1005 #define TWSS_JISB4              38
1006 #define TWSS_JISB6              39
1007 #define TWSS_JISB7              40
1008 #define TWSS_JISB8              41
1009 #define TWSS_JISB9              42
1010 #define TWSS_JISB10             43
1011 #define TWSS_C0                 44
1012 #define TWSS_C1                 45
1013 #define TWSS_C2                 46
1014 #define TWSS_C3                 47
1015 #define TWSS_C7                 48
1016 #define TWSS_C8                 49
1017 #define TWSS_C9                 50
1018 #define TWSS_C10                51
1019 #define TWSS_USSTATEMENT        52
1020 #define TWSS_BUSINESSCARD       53
1021 #define TWSS_MAXSIZE            54  /* Added 2.1 */
1022 
1023 /* ICAP_XFERMECH values (SX_ means Setup XFer) */
1024 #define TWSX_NATIVE              0
1025 #define TWSX_FILE                1
1026 #define TWSX_MEMORY              2
1027 #define TWSX_MEMFILE             4    /* added 1.91 */
1028 
1029 /* ICAP_UNITS values (UN_ means UNits) */
1030 #define TWUN_INCHES              0
1031 #define TWUN_CENTIMETERS         1
1032 #define TWUN_PICAS               2
1033 #define TWUN_POINTS              3
1034 #define TWUN_TWIPS               4
1035 #define TWUN_PIXELS              5
1036 #define TWUN_MILLIMETERS         6    /* added 1.91 */
1037 
1038 
1039 /****************************************************************************
1040  * Country Constants                                                        *
1041  ****************************************************************************/
1042 
1043 #define TWCY_AFGHANISTAN   1001
1044 #define TWCY_ALGERIA        213
1045 #define TWCY_AMERICANSAMOA  684
1046 #define TWCY_ANDORRA        033
1047 #define TWCY_ANGOLA        1002
1048 #define TWCY_ANGUILLA      8090
1049 #define TWCY_ANTIGUA       8091
1050 #define TWCY_ARGENTINA       54
1051 #define TWCY_ARUBA          297
1052 #define TWCY_ASCENSIONI     247
1053 #define TWCY_AUSTRALIA       61
1054 #define TWCY_AUSTRIA         43
1055 #define TWCY_BAHAMAS       8092
1056 #define TWCY_BAHRAIN        973
1057 #define TWCY_BANGLADESH     880
1058 #define TWCY_BARBADOS      8093
1059 #define TWCY_BELGIUM         32
1060 #define TWCY_BELIZE         501
1061 #define TWCY_BENIN          229
1062 #define TWCY_BERMUDA       8094
1063 #define TWCY_BHUTAN        1003
1064 #define TWCY_BOLIVIA        591
1065 #define TWCY_BOTSWANA       267
1066 #define TWCY_BRITAIN          6
1067 #define TWCY_BRITVIRGINIS  8095
1068 #define TWCY_BRAZIL          55
1069 #define TWCY_BRUNEI         673
1070 #define TWCY_BULGARIA       359
1071 #define TWCY_BURKINAFASO   1004
1072 #define TWCY_BURMA         1005
1073 #define TWCY_BURUNDI       1006
1074 #define TWCY_CAMAROON       237
1075 #define TWCY_CANADA           2
1076 #define TWCY_CAPEVERDEIS    238
1077 #define TWCY_CAYMANIS      8096
1078 #define TWCY_CENTRALAFREP  1007
1079 #define TWCY_CHAD          1008
1080 #define TWCY_CHILE           56
1081 #define TWCY_CHINA           86
1082 #define TWCY_CHRISTMASIS   1009
1083 #define TWCY_COCOSIS       1009
1084 #define TWCY_COLOMBIA        57
1085 #define TWCY_COMOROS       1010
1086 #define TWCY_CONGO         1011
1087 #define TWCY_COOKIS        1012
1088 #define TWCY_COSTARICA     506
1089 #define TWCY_CUBA           005
1090 #define TWCY_CYPRUS         357
1091 #define TWCY_CZECHOSLOVAKIA  42
1092 #define TWCY_DENMARK         45
1093 #define TWCY_DJIBOUTI      1013
1094 #define TWCY_DOMINICA      8097
1095 #define TWCY_DOMINCANREP   8098
1096 #define TWCY_EASTERIS      1014
1097 #define TWCY_ECUADOR        593
1098 #define TWCY_EGYPT           20
1099 #define TWCY_ELSALVADOR     503
1100 #define TWCY_EQGUINEA      1015
1101 #define TWCY_ETHIOPIA       251
1102 #define TWCY_FALKLANDIS    1016
1103 #define TWCY_FAEROEIS       298
1104 #define TWCY_FIJIISLANDS    679
1105 #define TWCY_FINLAND        358
1106 #define TWCY_FRANCE          33
1107 #define TWCY_FRANTILLES     596
1108 #define TWCY_FRGUIANA       594
1109 #define TWCY_FRPOLYNEISA    689
1110 #define TWCY_FUTANAIS      1043
1111 #define TWCY_GABON          241
1112 #define TWCY_GAMBIA         220
1113 #define TWCY_GERMANY         49
1114 #define TWCY_GHANA          233
1115 #define TWCY_GIBRALTER      350
1116 #define TWCY_GREECE          30
1117 #define TWCY_GREENLAND      299
1118 #define TWCY_GRENADA       8099
1119 #define TWCY_GRENEDINES    8015
1120 #define TWCY_GUADELOUPE     590
1121 #define TWCY_GUAM           671
1122 #define TWCY_GUANTANAMOBAY 5399
1123 #define TWCY_GUATEMALA      502
1124 #define TWCY_GUINEA         224
1125 #define TWCY_GUINEABISSAU  1017
1126 #define TWCY_GUYANA         592
1127 #define TWCY_HAITI          509
1128 #define TWCY_HONDURAS       504
1129 #define TWCY_HONGKONG      852
1130 #define TWCY_HUNGARY         36
1131 #define TWCY_ICELAND        354
1132 #define TWCY_INDIA           91
1133 #define TWCY_INDONESIA       62
1134 #define TWCY_IRAN            98
1135 #define TWCY_IRAQ           964
1136 #define TWCY_IRELAND        353
1137 #define TWCY_ISRAEL         972
1138 #define TWCY_ITALY           39
1139 #define TWCY_IVORYCOAST    225
1140 #define TWCY_JAMAICA       8010
1141 #define TWCY_JAPAN           81
1142 #define TWCY_JORDAN         962
1143 #define TWCY_KENYA          254
1144 #define TWCY_KIRIBATI      1018
1145 #define TWCY_KOREA           82
1146 #define TWCY_KUWAIT         965
1147 #define TWCY_LAOS          1019
1148 #define TWCY_LEBANON       1020
1149 #define TWCY_LIBERIA        231
1150 #define TWCY_LIBYA          218
1151 #define TWCY_LIECHTENSTEIN   41
1152 #define TWCY_LUXENBOURG     352
1153 #define TWCY_MACAO          853
1154 #define TWCY_MADAGASCAR    1021
1155 #define TWCY_MALAWI         265
1156 #define TWCY_MALAYSIA        60
1157 #define TWCY_MALDIVES       960
1158 #define TWCY_MALI          1022
1159 #define TWCY_MALTA          356
1160 #define TWCY_MARSHALLIS     692
1161 #define TWCY_MAURITANIA    1023
1162 #define TWCY_MAURITIUS      230
1163 #define TWCY_MEXICO           3
1164 #define TWCY_MICRONESIA     691
1165 #define TWCY_MIQUELON       508
1166 #define TWCY_MONACO          33
1167 #define TWCY_MONGOLIA      1024
1168 #define TWCY_MONTSERRAT    8011
1169 #define TWCY_MOROCCO        212
1170 #define TWCY_MOZAMBIQUE    1025
1171 #define TWCY_NAMIBIA        264
1172 #define TWCY_NAURU         1026
1173 #define TWCY_NEPAL          977
1174 #define TWCY_NETHERLANDS     31
1175 #define TWCY_NETHANTILLES   599
1176 #define TWCY_NEVIS         8012
1177 #define TWCY_NEWCALEDONIA   687
1178 #define TWCY_NEWZEALAND      64
1179 #define TWCY_NICARAGUA      505
1180 #define TWCY_NIGER          227
1181 #define TWCY_NIGERIA        234
1182 #define TWCY_NIUE          1027
1183 #define TWCY_NORFOLKI      1028
1184 #define TWCY_NORWAY          47
1185 #define TWCY_OMAN           968
1186 #define TWCY_PAKISTAN        92
1187 #define TWCY_PALAU         1029
1188 #define TWCY_PANAMA         507
1189 #define TWCY_PARAGUAY       595
1190 #define TWCY_PERU            51
1191 #define TWCY_PHILLIPPINES    63
1192 #define TWCY_PITCAIRNIS    1030
1193 #define TWCY_PNEWGUINEA     675
1194 #define TWCY_POLAND          48
1195 #define TWCY_PORTUGAL       351
1196 #define TWCY_QATAR          974
1197 #define TWCY_REUNIONI      1031
1198 #define TWCY_ROMANIA         40
1199 #define TWCY_RWANDA         250
1200 #define TWCY_SAIPAN         670
1201 #define TWCY_SANMARINO       39
1202 #define TWCY_SAOTOME       1033
1203 #define TWCY_SAUDIARABIA    966
1204 #define TWCY_SENEGAL        221
1205 #define TWCY_SEYCHELLESIS  1034
1206 #define TWCY_SIERRALEONE   1035
1207 #define TWCY_SINGAPORE       65
1208 #define TWCY_SOLOMONIS     1036
1209 #define TWCY_SOMALI        1037
1210 #define TWCY_SOUTHAFRICA    27
1211 #define TWCY_SPAIN           34
1212 #define TWCY_SRILANKA        94
1213 #define TWCY_STHELENA      1032
1214 #define TWCY_STKITTS       8013
1215 #define TWCY_STLUCIA       8014
1216 #define TWCY_STPIERRE       508
1217 #define TWCY_STVINCENT     8015
1218 #define TWCY_SUDAN         1038
1219 #define TWCY_SURINAME       597
1220 #define TWCY_SWAZILAND      268
1221 #define TWCY_SWEDEN          46
1222 #define TWCY_SWITZERLAND     41
1223 #define TWCY_SYRIA         1039
1224 #define TWCY_TAIWAN         886
1225 #define TWCY_TANZANIA       255
1226 #define TWCY_THAILAND        66
1227 #define TWCY_TOBAGO        8016
1228 #define TWCY_TOGO           228
1229 #define TWCY_TONGAIS        676
1230 #define TWCY_TRINIDAD      8016
1231 #define TWCY_TUNISIA        216
1232 #define TWCY_TURKEY          90
1233 #define TWCY_TURKSCAICOS   8017
1234 #define TWCY_TUVALU        1040
1235 #define TWCY_UGANDA         256
1236 #define TWCY_USSR             7
1237 #define TWCY_UAEMIRATES     971
1238 #define TWCY_UNITEDKINGDOM   44
1239 #define TWCY_USA              1
1240 #define TWCY_URUGUAY        598
1241 #define TWCY_VANUATU       1041
1242 #define TWCY_VATICANCITY     39
1243 #define TWCY_VENEZUELA       58
1244 #define TWCY_WAKE          1042
1245 #define TWCY_WALLISIS      1043
1246 #define TWCY_WESTERNSAHARA 1044
1247 #define TWCY_WESTERNSAMOA  1045
1248 #define TWCY_YEMEN         1046
1249 #define TWCY_YUGOSLAVIA      38
1250 #define TWCY_ZAIRE          243
1251 #define TWCY_ZAMBIA         260
1252 #define TWCY_ZIMBABWE       263
1253 /* Added for 1.8 */
1254 #define TWCY_ALBANIA        355
1255 #define TWCY_ARMENIA        374
1256 #define TWCY_AZERBAIJAN     994
1257 #define TWCY_BELARUS        375
1258 #define TWCY_BOSNIAHERZGO   387
1259 #define TWCY_CAMBODIA       855
1260 #define TWCY_CROATIA        385
1261 #define TWCY_CZECHREPUBLIC  420
1262 #define TWCY_DIEGOGARCIA    246
1263 #define TWCY_ERITREA        291
1264 #define TWCY_ESTONIA        372
1265 #define TWCY_GEORGIA        995
1266 #define TWCY_LATVIA         371
1267 #define TWCY_LESOTHO        266
1268 #define TWCY_LITHUANIA      370
1269 #define TWCY_MACEDONIA      389
1270 #define TWCY_MAYOTTEIS      269
1271 #define TWCY_MOLDOVA        373
1272 #define TWCY_MYANMAR        95
1273 #define TWCY_NORTHKOREA     850
1274 #define TWCY_PUERTORICO     787
1275 #define TWCY_RUSSIA         7
1276 #define TWCY_SERBIA         381
1277 #define TWCY_SLOVAKIA       421
1278 #define TWCY_SLOVENIA       386
1279 #define TWCY_SOUTHKOREA     82
1280 #define TWCY_UKRAINE        380
1281 #define TWCY_USVIRGINIS     340
1282 #define TWCY_VIETNAM        84
1283 
1284 /****************************************************************************
1285  * Language Constants                                                       *
1286  ****************************************************************************/
1287 /* Added for 1.8 */
1288 #define TWLG_USERLOCALE           -1
1289 #define TWLG_DANISH               0    /* Danish                 */
1290 #define TWLG_DUTCH                1    /* Dutch                  */
1291 #define TWLG_ENGLISH              2    /* International English  */
1292 #define TWLG_FRENCH_CANADIAN      3    /* French Canadian        */
1293 #define TWLG_FINNISH              4    /* Finnish                */
1294 #define TWLG_FRENCH               5    /* French                 */
1295 #define TWLG_GERMAN               6    /* German                 */
1296 #define TWLG_ICELANDIC            7    /* Icelandic              */
1297 #define TWLG_ITALIAN              8    /* Italian                */
1298 #define TWLG_NORWEGIAN            9    /* Norwegian              */
1299 #define TWLG_PORTUGUESE           10   /* Portuguese             */
1300 #define TWLG_SPANISH              11   /* Spanish                */
1301 #define TWLG_SWEDISH              12   /* Swedish                */
1302 #define TWLG_ENGLISH_USA          13   /* U.S. English           */
1303 #define TWLG_AFRIKAANS            14
1304 #define TWLG_ALBANIA              15
1305 #define TWLG_ARABIC               16
1306 #define TWLG_ARABIC_ALGERIA       17
1307 #define TWLG_ARABIC_BAHRAIN       18
1308 #define TWLG_ARABIC_EGYPT         19
1309 #define TWLG_ARABIC_IRAQ          20
1310 #define TWLG_ARABIC_JORDAN        21
1311 #define TWLG_ARABIC_KUWAIT        22
1312 #define TWLG_ARABIC_LEBANON       23
1313 #define TWLG_ARABIC_LIBYA         24
1314 #define TWLG_ARABIC_MOROCCO       25
1315 #define TWLG_ARABIC_OMAN          26
1316 #define TWLG_ARABIC_QATAR         27
1317 #define TWLG_ARABIC_SAUDIARABIA   28
1318 #define TWLG_ARABIC_SYRIA         29
1319 #define TWLG_ARABIC_TUNISIA       30
1320 #define TWLG_ARABIC_UAE           31 /* United Arabic Emirates */
1321 #define TWLG_ARABIC_YEMEN         32
1322 #define TWLG_BASQUE               33
1323 #define TWLG_BYELORUSSIAN         34
1324 #define TWLG_BULGARIAN            35
1325 #define TWLG_CATALAN              36
1326 #define TWLG_CHINESE              37
1327 #define TWLG_CHINESE_HONGKONG     38
1328 #define TWLG_CHINESE_PRC          39 /* People's Republic of China */
1329 #define TWLG_CHINESE_SINGAPORE    40
1330 #define TWLG_CHINESE_SIMPLIFIED   41
1331 #define TWLG_CHINESE_TAIWAN       42
1332 #define TWLG_CHINESE_TRADITIONAL  43
1333 #define TWLG_CROATIA              44
1334 #define TWLG_CZECH                45
1335 #define TWLG_DUTCH_BELGIAN        46
1336 #define TWLG_ENGLISH_AUSTRALIAN   47
1337 #define TWLG_ENGLISH_CANADIAN     48
1338 #define TWLG_ENGLISH_IRELAND      49
1339 #define TWLG_ENGLISH_NEWZEALAND   50
1340 #define TWLG_ENGLISH_SOUTHAFRICA  51
1341 #define TWLG_ENGLISH_UK           52
1342 #define TWLG_ESTONIAN             53
1343 #define TWLG_FAEROESE             54
1344 #define TWLG_FARSI                55
1345 #define TWLG_FRENCH_BELGIAN       56
1346 #define TWLG_FRENCH_LUXEMBOURG    57
1347 #define TWLG_FRENCH_SWISS         58
1348 #define TWLG_GERMAN_AUSTRIAN      59
1349 #define TWLG_GERMAN_LUXEMBOURG    60
1350 #define TWLG_GERMAN_LIECHTENSTEIN 61
1351 #define TWLG_GERMAN_SWISS         62
1352 #define TWLG_GREEK                63
1353 #define TWLG_HEBREW               64
1354 #define TWLG_HUNGARIAN            65
1355 #define TWLG_INDONESIAN           66
1356 #define TWLG_ITALIAN_SWISS        67
1357 #define TWLG_JAPANESE             68
1358 #define TWLG_KOREAN               69
1359 #define TWLG_KOREAN_JOHAB         70
1360 #define TWLG_LATVIAN              71
1361 #define TWLG_LITHUANIAN           72
1362 #define TWLG_NORWEGIAN_BOKMAL     73
1363 #define TWLG_NORWEGIAN_NYNORSK    74
1364 #define TWLG_POLISH               75
1365 #define TWLG_PORTUGUESE_BRAZIL    76
1366 #define TWLG_ROMANIAN             77
1367 #define TWLG_RUSSIAN              78
1368 #define TWLG_SERBIAN_LATIN        79
1369 #define TWLG_SLOVAK               80
1370 #define TWLG_SLOVENIAN            81
1371 #define TWLG_SPANISH_MEXICAN      82
1372 #define TWLG_SPANISH_MODERN       83
1373 #define TWLG_THAI                 84
1374 #define TWLG_TURKISH              85
1375 #define TWLG_UKRANIAN             86
1376 /* More stuff added for 1.8 */
1377 #define TWLG_ASSAMESE             87
1378 #define TWLG_BENGALI              88
1379 #define TWLG_BIHARI               89
1380 #define TWLG_BODO                 90
1381 #define TWLG_DOGRI                91
1382 #define TWLG_GUJARATI             92
1383 #define TWLG_HARYANVI             93
1384 #define TWLG_HINDI                94
1385 #define TWLG_KANNADA              95
1386 #define TWLG_KASHMIRI             96
1387 #define TWLG_MALAYALAM            97
1388 #define TWLG_MARATHI              98
1389 #define TWLG_MARWARI              99
1390 #define TWLG_MEGHALAYAN          100
1391 #define TWLG_MIZO                101
1392 #define TWLG_NAGA                102
1393 #define TWLG_ORISSI              103
1394 #define TWLG_PUNJABI             104
1395 #define TWLG_PUSHTU              105
1396 #define TWLG_SERBIAN_CYRILLIC    106
1397 #define TWLG_SIKKIMI             107
1398 #define TWLG_SWEDISH_FINLAND     108
1399 #define TWLG_TAMIL               109
1400 #define TWLG_TELUGU              110
1401 #define TWLG_TRIPURI             111
1402 #define TWLG_URDU                112
1403 #define TWLG_VIETNAMESE          113
1404 
1405 /****************************************************************************
1406  * Data Groups                                                              *
1407  ****************************************************************************/
1408 
1409 /* More Data Groups may be added in the future.
1410  * Possible candidates include text, vector graphics, sound, etc.
1411  * NOTE: Data Group constants must be powers of 2 as they are used
1412  *       as bitflags when Application asks DSM to present a list of DSs.
1413  */
1414 
1415 #define DG_CONTROL          0x0001L /* data pertaining to control       */
1416 #define DG_IMAGE            0x0002L /* data pertaining to raster images */
1417 /* Added 1.8 */
1418 #define DG_AUDIO            0x0004L /* data pertaining to audio */
1419 
1420 /* More Data Functionality may be added in the future.
1421  * These are for items that need to be determined before DS is opened.
1422  * NOTE: Supported Functionality constants must be powers of 2 as they are
1423  *       used as bitflags when Application asks DSM to present a list of DSs.
1424  *       to support backward capability the App and DS will not use the fields
1425  */
1426 #define DF_DSM2             0x10000000L   /* added to the identity by the DSM  */
1427 #define DF_APP2             0x20000000L   /* Set by the App to indicate it would
1428                                              prefer to use DSM2 */
1429 #define DF_DS2              0x40000000L   /* Set by the DS to indicate it would
1430                                              prefer to use DSM2 */
1431 #define DG_MASK             0xFFFFL       /* all Data Groups limited to 16 bit.  Added for 2.1  */
1432 
1433 /****************************************************************************
1434  *                                                        *
1435  ****************************************************************************/
1436 #define DAT_NULL            0x0000 /* No data or structure. */
1437 #define DAT_CUSTOMBASE      0x8000 /* Base of custom DATs.  */
1438 
1439 /* Data Argument Types for the DG_CONTROL Data Group. */
1440 #define DAT_CAPABILITY      0x0001 /* TW_CAPABILITY                        */
1441 #define DAT_EVENT           0x0002 /* TW_EVENT                             */
1442 #define DAT_IDENTITY        0x0003 /* TW_IDENTITY                          */
1443 #define DAT_PARENT          0x0004 /* TW_HANDLE, application win handle in Windows */
1444 #define DAT_PENDINGXFERS    0x0005 /* TW_PENDINGXFERS                      */
1445 #define DAT_SETUPMEMXFER    0x0006 /* TW_SETUPMEMXFER                      */
1446 #define DAT_SETUPFILEXFER   0x0007 /* TW_SETUPFILEXFER                     */
1447 #define DAT_STATUS          0x0008 /* TW_STATUS                            */
1448 #define DAT_USERINTERFACE   0x0009 /* TW_USERINTERFACE                     */
1449 #define DAT_XFERGROUP       0x000a /* TW_UINT32                            */
1450 #define DAT_CUSTOMDSDATA    0x000c /* TW_CUSTOMDSDATA.                     */
1451 #define DAT_DEVICEEVENT     0x000d /* TW_DEVICEEVENT     Added 1.8         */
1452 #define DAT_FILESYSTEM      0x000e /* TW_FILESYSTEM      Added 1.8         */
1453 #define DAT_PASSTHRU        0x000f /* TW_PASSTHRU        Added 1.8         */
1454 #define DAT_CALLBACK        0x0010 /* TW_CALLBACK        Added 2.0         */
1455 #define DAT_STATUSUTF8      0x0011 /* TW_STATUSUTF8      Added 2.1         */
1456 
1457 /* Data Argument Types for the DG_IMAGE Data Group. */
1458 #define DAT_IMAGEINFO       0x0101 /* TW_IMAGEINFO                         */
1459 #define DAT_IMAGELAYOUT     0x0102 /* TW_IMAGELAYOUT                       */
1460 #define DAT_IMAGEMEMXFER    0x0103 /* TW_IMAGEMEMXFER                      */
1461 #define DAT_IMAGENATIVEXFER 0x0104 /* TW_UINT32 loword is hDIB, PICHandle  */
1462 #define DAT_IMAGEFILEXFER   0x0105 /* Null data                            */
1463 #define DAT_CIECOLOR        0x0106 /* TW_CIECOLOR                          */
1464 #define DAT_GRAYRESPONSE    0x0107 /* TW_GRAYRESPONSE                      */
1465 #define DAT_RGBRESPONSE     0x0108 /* TW_RGBRESPONSE                       */
1466 #define DAT_JPEGCOMPRESSION 0x0109 /* TW_JPEGCOMPRESSION                   */
1467 #define DAT_PALETTE8        0x010a /* TW_PALETTE8                          */
1468 #define DAT_EXTIMAGEINFO    0x010b /* TW_EXTIMAGEINFO -- for 1.7 Spec.     */
1469 
1470 /* Data Argument Types for the DG_AUDIO Data Group. */
1471 #define DAT_AUDIOFILEXFER   0x0201 /* Null data          Added 1.8         */
1472 #define DAT_AUDIOINFO       0x0202 /* TW_AUDIOINFO       Added 1.8         */
1473 #define DAT_AUDIONATIVEXFER 0x0203 /* TW_UINT32 handle to WAV, (AIFF Mac) Added 1.8 */
1474 
1475 /* misplaced */
1476 #define DAT_ICCPROFILE        0x0401 /* TW_MEMORY        Added 1.91  This Data Argument is misplaced but belongs to the DG_IMAGE Data Group */
1477 #define DAT_IMAGEMEMFILEXFER  0x0402 /* TW_IMAGEMEMXFER  Added 1.91  This Data Argument is misplaced but belongs to the DG_IMAGE Data Group */
1478 #define DAT_ENTRYPOINT        0x0403 /* TW_ENTRYPOINT    Added 2.0   This Data Argument is misplaced but belongs to the DG_CONTROL Data Group */
1479 
1480 
1481 /****************************************************************************
1482  * Messages                                                                 *
1483  ****************************************************************************/
1484 
1485 /* All message constants are unique.
1486  * Messages are grouped according to which DATs they are used with.*/
1487 
1488 #define MSG_NULL         0x0000 /* Used in TW_EVENT structure               */
1489 #define MSG_CUSTOMBASE   0x8000 /* Base of custom messages                  */
1490 
1491 /* Generic messages may be used with any of several DATs.                   */
1492 #define MSG_GET             0x0001 /* Get one or more values                   */
1493 #define MSG_GETCURRENT      0x0002 /* Get current value                        */
1494 #define MSG_GETDEFAULT      0x0003 /* Get default (e.g. power up) value        */
1495 #define MSG_GETFIRST        0x0004 /* Get first of a series of items, e.g. DSs */
1496 #define MSG_GETNEXT         0x0005 /* Iterate through a series of items.       */
1497 #define MSG_SET             0x0006 /* Set one or more values                   */
1498 #define MSG_RESET           0x0007 /* Set current value to default value       */
1499 #define MSG_QUERYSUPPORT    0x0008 /* Get supported operations on the cap.     */
1500 #define MSG_GETHELP         0x0009 /* Returns help text suitable for use in a GUI        Added 2.1 */
1501 #define MSG_GETLABEL        0x000a /* Returns a label suitable for use in a GUI          Added 2.1 */
1502 #define MSG_GETLABELENUM    0x000b /* Return all of the labels for a capability of type  Added 2.1 */
1503 
1504 
1505 /* Messages used with DAT_NULL                                              */
1506 #define MSG_XFERREADY    0x0101 /* The data source has data ready           */
1507 #define MSG_CLOSEDSREQ   0x0102 /* Request for Application. to close DS               */
1508 #define MSG_CLOSEDSOK    0x0103 /* Tell the Application. to save the state.           */
1509 #define MSG_DEVICEEVENT  0X0104 /* Some event has taken place               Added 1.8 */
1510 
1511 /* Messages used with a pointer to DAT_PARENT data                          */
1512 #define MSG_OPENDSM      0x0301 /* Open the DSM                             */
1513 #define MSG_CLOSEDSM     0x0302 /* Close the DSM                            */
1514 
1515 /* Messages used with a pointer to a DAT_IDENTITY structure                 */
1516 #define MSG_OPENDS       0x0401 /* Open a data source                       */
1517 #define MSG_CLOSEDS      0x0402 /* Close a data source                      */
1518 #define MSG_USERSELECT   0x0403 /* Put up a dialog of all DS                */
1519 
1520 /* Messages used with a pointer to a DAT_USERINTERFACE structure            */
1521 #define MSG_DISABLEDS    0x0501 /* Disable data transfer in the DS          */
1522 #define MSG_ENABLEDS     0x0502 /* Enable data transfer in the DS           */
1523 #define MSG_ENABLEDSUIONLY  0x0503  /* Enable for saving DS state only.     */
1524 
1525 /* Messages used with a pointer to a DAT_EVENT structure                    */
1526 #define MSG_PROCESSEVENT 0x0601
1527 
1528 /* Messages used with a pointer to a DAT_PENDINGXFERS structure             */
1529 #define MSG_ENDXFER      0x0701
1530 #define MSG_STOPFEEDER   0x0702
1531 
1532 /* Messages used with a pointer to a DAT_FILESYSTEM structure               */
1533 #define MSG_CHANGEDIRECTORY   0x0801 /* Added 1.8 */
1534 #define MSG_CREATEDIRECTORY   0x0802 /* Added 1.8 */
1535 #define MSG_DELETE            0x0803 /* Added 1.8 */
1536 #define MSG_FORMATMEDIA       0x0804 /* Added 1.8 */
1537 #define MSG_GETCLOSE          0x0805 /* Added 1.8 */
1538 #define MSG_GETFIRSTFILE      0x0806 /* Added 1.8 */
1539 #define MSG_GETINFO           0x0807 /* Added 1.8 */
1540 #define MSG_GETNEXTFILE       0x0808 /* Added 1.8 */
1541 #define MSG_RENAME            0x0809 /* Added 1.8 */
1542 #define MSG_COPY              0x080A /* Added 1.8 */
1543 #define MSG_AUTOMATICCAPTUREDIRECTORY 0x080B /* Added 1.8 */
1544 
1545 /* Messages used with a pointer to a DAT_PASSTHRU structure                 */
1546 #define MSG_PASSTHRU          0x0901
1547 
1548 /* used with DAT_CALLBACK */
1549 #define MSG_REGISTER_CALLBACK 0x0902
1550 
1551 /* used with DAT_CAPABILITY */
1552 #define MSG_RESETALL          0x0A01 /*  Added 1.91 */
1553 
1554 /****************************************************************************
1555  * Capabilities                                                             *
1556  ****************************************************************************/
1557 
1558 #define CAP_CUSTOMBASE          0x8000 /* Base of custom capabilities */
1559 
1560 /* all data sources are REQUIRED to support these caps */
1561 #define CAP_XFERCOUNT           0x0001
1562 
1563 /* image data sources are REQUIRED to support these caps */
1564 #define ICAP_COMPRESSION        0x0100
1565 #define ICAP_PIXELTYPE          0x0101
1566 #define ICAP_UNITS              0x0102 /* default is TWUN_INCHES */
1567 #define ICAP_XFERMECH           0x0103
1568 
1569 /* all data sources MAY support these caps */
1570 #define CAP_AUTHOR                  0x1000
1571 #define CAP_CAPTION                 0x1001
1572 #define CAP_FEEDERENABLED           0x1002
1573 #define CAP_FEEDERLOADED            0x1003
1574 #define CAP_TIMEDATE                0x1004
1575 #define CAP_SUPPORTEDCAPS           0x1005
1576 #define CAP_EXTENDEDCAPS            0x1006
1577 #define CAP_AUTOFEED                0x1007
1578 #define CAP_CLEARPAGE               0x1008
1579 #define CAP_FEEDPAGE                0x1009
1580 #define CAP_REWINDPAGE              0x100a
1581 #define CAP_INDICATORS              0x100b   /* Added 1.1 */
1582 #define CAP_SUPPORTEDCAPSEXT        0x100c   /* Added 1.6 */
1583 #define CAP_PAPERDETECTABLE         0x100d   /* Added 1.6 */
1584 #define CAP_UICONTROLLABLE          0x100e   /* Added 1.6 */
1585 #define CAP_DEVICEONLINE            0x100f   /* Added 1.6 */
1586 #define CAP_AUTOSCAN                0x1010   /* Added 1.6 */
1587 #define CAP_THUMBNAILSENABLED       0x1011   /* Added 1.7 */
1588 #define CAP_DUPLEX                  0x1012   /* Added 1.7 */
1589 #define CAP_DUPLEXENABLED           0x1013   /* Added 1.7 */
1590 #define CAP_ENABLEDSUIONLY          0x1014   /* Added 1.7 */
1591 #define CAP_CUSTOMDSDATA            0x1015   /* Added 1.7 */
1592 #define CAP_ENDORSER                0x1016   /* Added 1.7 */
1593 #define CAP_JOBCONTROL              0x1017   /* Added 1.7 */
1594 #define CAP_ALARMS                  0x1018   /* Added 1.8 */
1595 #define CAP_ALARMVOLUME             0x1019   /* Added 1.8 */
1596 #define CAP_AUTOMATICCAPTURE        0x101a   /* Added 1.8 */
1597 #define CAP_TIMEBEFOREFIRSTCAPTURE  0x101b   /* Added 1.8 */
1598 #define CAP_TIMEBETWEENCAPTURES     0x101c   /* Added 1.8 */
1599 #define CAP_CLEARBUFFERS            0x101d   /* Added 1.8 */
1600 #define CAP_MAXBATCHBUFFERS         0x101e   /* Added 1.8 */
1601 #define CAP_DEVICETIMEDATE          0x101f   /* Added 1.8 */
1602 #define CAP_POWERSUPPLY             0x1020   /* Added 1.8 */
1603 #define CAP_CAMERAPREVIEWUI         0x1021   /* Added 1.8 */
1604 #define CAP_DEVICEEVENT             0x1022   /* Added 1.8 */
1605 #define CAP_SERIALNUMBER            0x1024   /* Added 1.8 */
1606 #define CAP_PRINTER                 0x1026   /* Added 1.8 */
1607 #define CAP_PRINTERENABLED          0x1027   /* Added 1.8 */
1608 #define CAP_PRINTERINDEX            0x1028   /* Added 1.8 */
1609 #define CAP_PRINTERMODE             0x1029   /* Added 1.8 */
1610 #define CAP_PRINTERSTRING           0x102a   /* Added 1.8 */
1611 #define CAP_PRINTERSUFFIX           0x102b   /* Added 1.8 */
1612 #define CAP_LANGUAGE                0x102c   /* Added 1.8 */
1613 #define CAP_FEEDERALIGNMENT         0x102d   /* Added 1.8 */
1614 #define CAP_FEEDERORDER             0x102e   /* Added 1.8 */
1615 #define CAP_REACQUIREALLOWED        0x1030   /* Added 1.8 */
1616 #define CAP_BATTERYMINUTES          0x1032   /* Added 1.8 */
1617 #define CAP_BATTERYPERCENTAGE       0x1033   /* Added 1.8 */
1618 #define CAP_CAMERASIDE              0x1034   /* Added 1.91 */
1619 #define CAP_SEGMENTED               0x1035   /* Added 1.91 */
1620 #define CAP_CAMERAENABLED           0x1036   /* Added 2.0 */
1621 #define CAP_CAMERAORDER             0x1037   /* Added 2.0 */
1622 #define CAP_MICRENABLED             0x1038   /* Added 2.0 */
1623 #define CAP_FEEDERPREP              0x1039   /* Added 2.0 */
1624 #define CAP_FEEDERPOCKET            0x103a   /* Added 2.0 */
1625 #define CAP_AUTOMATICSENSEMEDIUM    0x103b   /* Added 2.1 */
1626 #define CAP_CUSTOMINTERFACEGUID     0x103c   /* Added 2.1 */
1627 
1628 
1629 /* image data sources MAY support these caps */
1630 #define ICAP_AUTOBRIGHT                   0x1100
1631 #define ICAP_BRIGHTNESS                   0x1101
1632 #define ICAP_CONTRAST                     0x1103
1633 #define ICAP_CUSTHALFTONE                 0x1104
1634 #define ICAP_EXPOSURETIME                 0x1105
1635 #define ICAP_FILTER                       0x1106
1636 #define ICAP_FLASHUSED                    0x1107
1637 #define ICAP_GAMMA                        0x1108
1638 #define ICAP_HALFTONES                    0x1109
1639 #define ICAP_HIGHLIGHT                    0x110a
1640 #define ICAP_IMAGEFILEFORMAT              0x110c
1641 #define ICAP_LAMPSTATE                    0x110d
1642 #define ICAP_LIGHTSOURCE                  0x110e
1643 #define ICAP_ORIENTATION                  0x1110
1644 #define ICAP_PHYSICALWIDTH                0x1111
1645 #define ICAP_PHYSICALHEIGHT               0x1112
1646 #define ICAP_SHADOW                       0x1113
1647 #define ICAP_FRAMES                       0x1114
1648 #define ICAP_XNATIVERESOLUTION            0x1116
1649 #define ICAP_YNATIVERESOLUTION            0x1117
1650 #define ICAP_XRESOLUTION                  0x1118
1651 #define ICAP_YRESOLUTION                  0x1119
1652 #define ICAP_MAXFRAMES                    0x111a
1653 #define ICAP_TILES                        0x111b
1654 #define ICAP_BITORDER                     0x111c
1655 #define ICAP_CCITTKFACTOR                 0x111d
1656 #define ICAP_LIGHTPATH                    0x111e
1657 #define ICAP_PIXELFLAVOR                  0x111f
1658 #define ICAP_PLANARCHUNKY                 0x1120
1659 #define ICAP_ROTATION                     0x1121
1660 #define ICAP_SUPPORTEDSIZES               0x1122
1661 #define ICAP_THRESHOLD                    0x1123
1662 #define ICAP_XSCALING                     0x1124
1663 #define ICAP_YSCALING                     0x1125
1664 #define ICAP_BITORDERCODES                0x1126
1665 #define ICAP_PIXELFLAVORCODES             0x1127
1666 #define ICAP_JPEGPIXELTYPE                0x1128
1667 #define ICAP_TIMEFILL                     0x112a
1668 #define ICAP_BITDEPTH                     0x112b
1669 #define ICAP_BITDEPTHREDUCTION            0x112c  /* Added 1.5 */
1670 #define ICAP_UNDEFINEDIMAGESIZE           0x112d  /* Added 1.6 */
1671 #define ICAP_IMAGEDATASET                 0x112e  /* Added 1.7 */
1672 #define ICAP_EXTIMAGEINFO                 0x112f  /* Added 1.7 */
1673 #define ICAP_MINIMUMHEIGHT                0x1130  /* Added 1.7 */
1674 #define ICAP_MINIMUMWIDTH                 0x1131  /* Added 1.7 */
1675 #define ICAP_AUTODISCARDBLANKPAGES        0x1134  /* Added 2.0 */
1676 #define ICAP_FLIPROTATION                 0x1136  /* Added 1.8 */
1677 #define ICAP_BARCODEDETECTIONENABLED      0x1137  /* Added 1.8 */
1678 #define ICAP_SUPPORTEDBARCODETYPES        0x1138  /* Added 1.8 */
1679 #define ICAP_BARCODEMAXSEARCHPRIORITIES   0x1139  /* Added 1.8 */
1680 #define ICAP_BARCODESEARCHPRIORITIES      0x113a  /* Added 1.8 */
1681 #define ICAP_BARCODESEARCHMODE            0x113b  /* Added 1.8 */
1682 #define ICAP_BARCODEMAXRETRIES            0x113c  /* Added 1.8 */
1683 #define ICAP_BARCODETIMEOUT               0x113d  /* Added 1.8 */
1684 #define ICAP_ZOOMFACTOR                   0x113e  /* Added 1.8 */
1685 #define ICAP_PATCHCODEDETECTIONENABLED    0x113f  /* Added 1.8 */
1686 #define ICAP_SUPPORTEDPATCHCODETYPES      0x1140  /* Added 1.8 */
1687 #define ICAP_PATCHCODEMAXSEARCHPRIORITIES 0x1141  /* Added 1.8 */
1688 #define ICAP_PATCHCODESEARCHPRIORITIES    0x1142  /* Added 1.8 */
1689 #define ICAP_PATCHCODESEARCHMODE          0x1143  /* Added 1.8 */
1690 #define ICAP_PATCHCODEMAXRETRIES          0x1144  /* Added 1.8 */
1691 #define ICAP_PATCHCODETIMEOUT             0x1145  /* Added 1.8 */
1692 #define ICAP_FLASHUSED2                   0x1146  /* Added 1.8 */
1693 #define ICAP_IMAGEFILTER                  0x1147  /* Added 1.8 */
1694 #define ICAP_NOISEFILTER                  0x1148  /* Added 1.8 */
1695 #define ICAP_OVERSCAN                     0x1149  /* Added 1.8 */
1696 #define ICAP_AUTOMATICBORDERDETECTION     0x1150  /* Added 1.8 */
1697 #define ICAP_AUTOMATICDESKEW              0x1151  /* Added 1.8 */
1698 #define ICAP_AUTOMATICROTATE              0x1152  /* Added 1.8 */
1699 #define ICAP_JPEGQUALITY                  0x1153  /* Added 1.9 */
1700 #define ICAP_FEEDERTYPE                   0x1154  /* Added 1.91 */
1701 #define ICAP_ICCPROFILE                   0x1155  /* Added 1.91 */
1702 #define ICAP_AUTOSIZE                     0x1156  /* Added 2.0 */
1703 #define ICAP_AUTOMATICCROPUSESFRAME       0x1157  /* Added 2.1 */
1704 #define ICAP_AUTOMATICLENGTHDETECTION     0x1158  /* Added 2.1 */
1705 #define ICAP_AUTOMATICCOLORENABLED        0x1159  /* Added 2.1 */
1706 #define ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE 0x115a  /* Added 2.1 */
1707 #define ICAP_COLORMANAGEMENTENABLED       0x115b  /* Added 2.1 */
1708 #define ICAP_IMAGEMERGE                   0x115c  /* Added 2.1 */
1709 #define ICAP_IMAGEMERGEHEIGHTTHRESHOLD    0x115d  /* Added 2.1 */
1710 #define ICAP_SUPPORTEDEXTIMAGEINFO        0x115e  /* Added 2.1 */
1711 
1712 /* image data sources MAY support these audio caps */
1713 #define ACAP_XFERMECH                     0x1202  /* Added 1.8 */
1714 
1715 
1716 /***************************************************************************
1717  *            Extended Image Info Attributes section  Added 1.7            *
1718  ***************************************************************************/
1719 
1720 #define TWEI_BARCODEX               0x1200
1721 #define TWEI_BARCODEY               0x1201
1722 #define TWEI_BARCODETEXT            0x1202
1723 #define TWEI_BARCODETYPE            0x1203
1724 #define TWEI_DESHADETOP             0x1204
1725 #define TWEI_DESHADELEFT            0x1205
1726 #define TWEI_DESHADEHEIGHT          0x1206
1727 #define TWEI_DESHADEWIDTH           0x1207
1728 #define TWEI_DESHADESIZE            0x1208
1729 #define TWEI_SPECKLESREMOVED        0x1209
1730 #define TWEI_HORZLINEXCOORD         0x120A
1731 #define TWEI_HORZLINEYCOORD         0x120B
1732 #define TWEI_HORZLINELENGTH         0x120C
1733 #define TWEI_HORZLINETHICKNESS      0x120D
1734 #define TWEI_VERTLINEXCOORD         0x120E
1735 #define TWEI_VERTLINEYCOORD         0x120F
1736 #define TWEI_VERTLINELENGTH         0x1210
1737 #define TWEI_VERTLINETHICKNESS      0x1211
1738 #define TWEI_PATCHCODE              0x1212
1739 #define TWEI_ENDORSEDTEXT           0x1213
1740 #define TWEI_FORMCONFIDENCE         0x1214
1741 #define TWEI_FORMTEMPLATEMATCH      0x1215
1742 #define TWEI_FORMTEMPLATEPAGEMATCH  0x1216
1743 #define TWEI_FORMHORZDOCOFFSET      0x1217
1744 #define TWEI_FORMVERTDOCOFFSET      0x1218
1745 #define TWEI_BARCODECOUNT           0x1219
1746 #define TWEI_BARCODECONFIDENCE      0x121A
1747 #define TWEI_BARCODEROTATION        0x121B
1748 #define TWEI_BARCODETEXTLENGTH      0x121C
1749 #define TWEI_DESHADECOUNT           0x121D
1750 #define TWEI_DESHADEBLACKCOUNTOLD   0x121E
1751 #define TWEI_DESHADEBLACKCOUNTNEW   0x121F
1752 #define TWEI_DESHADEBLACKRLMIN      0x1220
1753 #define TWEI_DESHADEBLACKRLMAX      0x1221
1754 #define TWEI_DESHADEWHITECOUNTOLD   0x1222
1755 #define TWEI_DESHADEWHITECOUNTNEW   0x1223
1756 #define TWEI_DESHADEWHITERLMIN      0x1224
1757 #define TWEI_DESHADEWHITERLAVE      0x1225
1758 #define TWEI_DESHADEWHITERLMAX      0x1226
1759 #define TWEI_BLACKSPECKLESREMOVED   0x1227
1760 #define TWEI_WHITESPECKLESREMOVED   0x1228
1761 #define TWEI_HORZLINECOUNT          0x1229
1762 #define TWEI_VERTLINECOUNT          0x122A
1763 #define TWEI_DESKEWSTATUS           0x122B
1764 #define TWEI_SKEWORIGINALANGLE      0x122C
1765 #define TWEI_SKEWFINALANGLE         0x122D
1766 #define TWEI_SKEWCONFIDENCE         0x122E
1767 #define TWEI_SKEWWINDOWX1           0x122F
1768 #define TWEI_SKEWWINDOWY1           0x1230
1769 #define TWEI_SKEWWINDOWX2           0x1231
1770 #define TWEI_SKEWWINDOWY2           0x1232
1771 #define TWEI_SKEWWINDOWX3           0x1233
1772 #define TWEI_SKEWWINDOWY3           0x1234
1773 #define TWEI_SKEWWINDOWX4           0x1235
1774 #define TWEI_SKEWWINDOWY4           0x1236
1775 #define TWEI_BOOKNAME               0x1238  /* added 1.9 */
1776 #define TWEI_CHAPTERNUMBER          0x1239  /* added 1.9 */
1777 #define TWEI_DOCUMENTNUMBER         0x123A  /* added 1.9 */
1778 #define TWEI_PAGENUMBER             0x123B  /* added 1.9 */
1779 #define TWEI_CAMERA                 0x123C  /* added 1.9 */
1780 #define TWEI_FRAMENUMBER            0x123D  /* added 1.9 */
1781 #define TWEI_FRAME                  0x123E  /* added 1.9 */
1782 #define TWEI_PIXELFLAVOR            0x123F  /* added 1.9 */
1783 #define TWEI_ICCPROFILE             0x1240  /* added 1.91 */
1784 #define TWEI_LASTSEGMENT            0x1241  /* added 1.91 */
1785 #define TWEI_SEGMENTNUMBER          0x1242  /* added 1.91 */
1786 #define TWEI_MAGDATA                0x1243  /* added 2.0 */
1787 #define TWEI_MAGTYPE                0x1244  /* added 2.0 */
1788 #define TWEI_PAGESIDE               0x1245  /* added 2.0 */
1789 #define TWEI_FILESYSTEMSOURCE       0x1246  /* added 2.0 */
1790 #define TWEI_IMAGEMERGED            0x1247  /* added 2.1 */
1791 #define TWEI_MAGDATALENGTH          0x1248  /* added 2.1 */
1792 
1793 #define TWEJ_NONE                   0x0000
1794 #define TWEJ_MIDSEPARATOR           0x0001
1795 #define TWEJ_PATCH1                 0x0002
1796 #define TWEJ_PATCH2                 0x0003
1797 #define TWEJ_PATCH3                 0x0004
1798 #define TWEJ_PATCH4                 0x0005
1799 #define TWEJ_PATCH6                 0x0006
1800 #define TWEJ_PATCHT                 0x0007
1801 
1802 
1803 /***************************************************************************
1804  *            Return Codes and Condition Codes section                     *
1805  ***************************************************************************/
1806 
1807 /* Return Codes: DSM_Entry and DS_Entry may return any one of these values. */
1808 #define TWRC_CUSTOMBASE     0x8000
1809 
1810 #define TWRC_SUCCESS          0
1811 #define TWRC_FAILURE          1 /* Application may get TW_STATUS for info on failure */
1812 #define TWRC_CHECKSTATUS      2 /* "tried hard"; get status                  */
1813 #define TWRC_CANCEL           3
1814 #define TWRC_DSEVENT          4
1815 #define TWRC_NOTDSEVENT       5
1816 #define TWRC_XFERDONE         6
1817 #define TWRC_ENDOFLIST        7 /* After MSG_GETNEXT if nothing left         */
1818 #define TWRC_INFONOTSUPPORTED 8
1819 #define TWRC_DATANOTAVAILABLE 9
1820 
1821 /* Condition Codes: Application gets these by doing DG_CONTROL DAT_STATUS MSG_GET.  */
1822 #define TWCC_CUSTOMBASE         0x8000
1823 
1824 #define TWCC_SUCCESS            0 /* It worked!                                */
1825 #define TWCC_BUMMER             1 /* Failure due to unknown causes             */
1826 #define TWCC_LOWMEMORY          2 /* Not enough memory to perform operation    */
1827 #define TWCC_NODS               3 /* No Data Source                            */
1828 #define TWCC_MAXCONNECTIONS     4 /* DS is connected to max possible applications      */
1829 #define TWCC_OPERATIONERROR     5 /* DS or DSM reported error, application shouldn't   */
1830 #define TWCC_BADCAP             6 /* Unknown capability                        */
1831 #define TWCC_BADPROTOCOL        9 /* Unrecognized MSG DG DAT combination       */
1832 #define TWCC_BADVALUE           10 /* Data parameter out of range              */
1833 #define TWCC_SEQERROR           11 /* DG DAT MSG out of expected sequence      */
1834 #define TWCC_BADDEST            12 /* Unknown destination Application/Source in DSM_Entry */
1835 #define TWCC_CAPUNSUPPORTED     13 /* Capability not supported by source            */
1836 #define TWCC_CAPBADOPERATION    14 /* Operation not supported by capability         */
1837 #define TWCC_CAPSEQERROR        15 /* Capability has dependancy on other capability */
1838 #define TWCC_DENIED             16 /* File System operation is denied (file is protected) Added 1.8 */
1839 #define TWCC_FILEEXISTS         17 /* Operation failed because file already exists.       Added 1.8 */
1840 #define TWCC_FILENOTFOUND       18 /* File not found                                      Added 1.8 */
1841 #define TWCC_NOTEMPTY           19 /* Operation failed because directory is not empty     Added 1.8 */
1842 #define TWCC_PAPERJAM           20 /* The feeder is jammed                                Added 1.8 */
1843 #define TWCC_PAPERDOUBLEFEED    21 /* The feeder detected multiple pages                  Added 1.8 */
1844 #define TWCC_FILEWRITEERROR     22 /* Error writing the file (meant for things like disk full conditions)Added 1.8 */
1845 #define TWCC_CHECKDEVICEONLINE  23 /* The device went offline prior to or during this operation Added 1.8 */
1846 #define TWCC_INTERLOCK          24 /* Added 2.0 */
1847 #define TWCC_DAMAGEDCORNER      25 /* Added 2.0 */
1848 #define TWCC_FOCUSERROR         26 /* Added 2.0 */
1849 #define TWCC_DOCTOOLIGHT        27 /* Added 2.0 */
1850 #define TWCC_DOCTOODARK         28 /* Added 2.0 */
1851 #define TWCC_NOMEDIA            29 /* Added 2.1 */
1852 
1853 /* bit patterns: for query the operation that are supported by the data source on a capability */
1854 /* Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
1855 /* Added 1.6 */
1856 #define TWQC_GET              0x0001
1857 #define TWQC_SET              0x0002
1858 #define TWQC_GETDEFAULT       0x0004
1859 #define TWQC_GETCURRENT       0x0008
1860 #define TWQC_RESET            0x0010
1861 
1862 
1863 /****************************************************************************
1864  * Depreciated Items                                                        *
1865  ****************************************************************************/
1866 #if defined(WIN32) || defined(WIN64)
1867         #define TW_HUGE
1868 #elif !defined(TWH_CMP_GNU)
1869         #define TW_HUGE    huge
1870 #else
1871         #define TW_HUGE
1872 #endif
1873 
1874 
1875 
1876 typedef BYTE TW_HUGE * HPBYTE;
1877 typedef void TW_HUGE * HPVOID;
1878 
1879 typedef unsigned char     TW_STR1024[1026],   FAR *pTW_STR1026;
1880 typedef wchar_t           TW_UNI512[512],     FAR *pTW_UNI512;
1881 
1882 #define TWTY_STR1024          0x000d    /* Means Item is a TW_STR1024...added 1.9 */
1883 #define TWTY_UNI512           0x000e    /* Means Item is a TW_UNI512...added 1.9 */
1884 
1885 #define TWFF_JPN              12        /* 1.91 */
1886 
1887 #define DAT_TWUNKIDENTITY     0x000b    /* Additional message required for thunker to request the special identity information. */
1888 #define DAT_SETUPFILEXFER2    0x0301    /* Data transfer via a file. deprecated - use DAT_SETUPFILEXFER instead*/
1889 
1890 #define CAP_SUPPORTEDCAPSEXT      0x100c
1891 #define CAP_FILESYSTEM            //0x????
1892 #define CAP_PAGEMULTIPLEACQUIRE   0x1023    /* Added 1.8 */
1893 #define CAP_PAPERBINDING          0x102f    /* Added 1.8 */
1894 #define CAP_PASSTHRU              0x1031    /* Added 1.8 */
1895 #define CAP_POWERDOWNTIME         0x1034    /* Added 1.8 */  //0x1034 is reused by CAP_CAMERASIDE
1896 #define ACAP_AUDIOFILEFORMAT      0x1201    /* Added 1.8 */
1897 
1898 #define MSG_CHECKSTATUS       0x0201    /* Get status information - use MSG_GET instead */
1899 
1900 #define MSG_INVOKE_CALLBACK   0x0903    /* Mac Only, deprecated - use DAT_NULL and MSG_xxx instead */
1901 
1902 #define TWSX_FILE2            3
1903 
1904 /* CAP_FILESYSTEM values (FS_ means file system) */
1905 #define TWFS_FILESYSTEM       0
1906 #define TWFS_RECURSIVEDELETE  1
1907 
1908 /* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
1909 #define TWPT_SRGB64     11 /* 1.91 */
1910 #define TWPT_BGR        12 /* 1.91 */
1911 #define TWPT_CIELAB     13 /* 1.91 */
1912 #define TWPT_CIELUV     14 /* 1.91 */
1913 #define TWPT_YCBCR      15 /* 1.91 */
1914 
1915 /* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
1916 #define TWSS_B                8
1917 #define TWSS_A4LETTER    TWSS_A4      /* use TWSS_A4 instead */
1918 #define TWSS_B3          TWSS_ISOB3   /* use TWSS_ISOB3 instead */
1919 #define TWSS_B4          TWSS_ISOB4   /* use TWSS_ISOB4 instead */
1920 #define TWSS_B6          TWSS_ISOB6   /* use TWSS_ISOB6 instead */
1921 #define TWSS_B5LETTER    TWSS_JISB5   /* use TWSS_JISB5 instead */
1922 
1923 /* CAP_LANGUAGE Language Constants */
1924 #define TWLG_DAN    TWLG_DANISH           /* use TWLG_DANISH instead */
1925 #define TWLG_DUT    TWLG_DUTCH            /* use TWLG_DUTCH instead */
1926 #define TWLG_ENG    TWLG_ENGLISH          /* use TWLG_ENGLISH instead */
1927 #define TWLG_USA    TWLG_ENGLISH_USA      /* use TWLG_ENGLISH_USA instead */
1928 #define TWLG_FIN    TWLG_FINNISH          /* use TWLG_FINNISH instead */
1929 #define TWLG_FRN    TWLG_FRENCH           /* use TWLG_FRENCH instead */
1930 #define TWLG_FCF    TWLG_FRENCH_CANADIAN  /* use TWLG_FRENCH_CANADIAN instead */
1931 #define TWLG_GER    TWLG_GERMAN           /* use TWLG_GERMAN instead */
1932 #define TWLG_ICE    TWLG_ICELANDIC        /* use TWLG_ICELANDIC instead */
1933 #define TWLG_ITN    TWLG_ITALIAN          /* use TWLG_ITALIAN instead */
1934 #define TWLG_NOR    TWLG_NORWEGIAN        /* use TWLG_NORWEGIAN instead */
1935 #define TWLG_POR    TWLG_PORTUGUESE       /* use TWLG_PORTUGUESE instead */
1936 #define TWLG_SPA    TWLG_SPANISH          /* use TWLG_SPANISH instead */
1937 #define TWLG_SWE    TWLG_SWEDISH          /* use TWLG_SWEDISH instead */
1938 
1939 
1940 /* ACAP_AUDIOFILEFORMAT values (AF_ means audio format).  Added 1.8 */
1941 #define TWAF_WAV      0
1942 #define TWAF_AIFF     1
1943 #define TWAF_AU       3
1944 #define TWAF_SND      4
1945 
1946 
1947 /* DAT_SETUPFILEXFER2. Sets up DS to application data transfer via a file. Added 1.9 */
1948 typedef struct {
1949    TW_MEMREF FileName;     /* Pointer to file name text */
1950    TW_UINT16 FileNameType; /* TWTY_STR1024 or TWTY_UNI512 */
1951    TW_UINT16 Format;       /* Any TWFF_ constant */
1952    TW_INT16  VRefNum;      /* Used for Mac only  */
1953    TW_UINT32 parID;        /* Used for Mac only */
1954 } TW_SETUPFILEXFER2, FAR * pTW_SETUPFILEXFER2;
1955 
1956 /* SDH - 03/21/95 - TWUNK */
1957 /* DAT_TWUNKIDENTITY. Provides DS identity and 'other' information necessary */
1958 /*                    across thunk link. */
1959 typedef struct {
1960    TW_IDENTITY identity;        /* Identity of data source.                 */
1961    TW_STR255   dsPath;          /* Full path and file name of data source.  */
1962 } TW_TWUNKIDENTITY, FAR * pTW_TWUNKIDENTITY;
1963 
1964 /* SDH - 03/21/95 - TWUNK */
1965 /* Provides DS_Entry parameters over thunk link. */
1966 /*  SDH - 03/23/95 - WATCH                                                  */
1967 /*  The thunker requires knowledge about size of data being passed in the   */
1968 /*  lpData parameter to DS_Entry (which is not readily available due to     */
1969 /*  type LPVOID.  Thus, we key off the DAT_ argument to determine the size. */
1970 /*  This has a couple implications:                                         */
1971 /*  1) Any additional DAT_ features require modifications to the thunk code */
1972 /*     for thunker support.                                                 */
1973 /*  2) Any applications which use the custom capabailites are not supported */
1974 /*     under thunking since we have no way of knowing what size data (if    */
1975 /*     any) is being passed.                                                */
1976 typedef struct
1977 {
1978     TW_INT8     destFlag;       /* TRUE if dest is not NULL                 */
1979     TW_IDENTITY dest;           /* Identity of data source (if used)        */
1980     TW_INT32    dataGroup;      /* DSM_Entry dataGroup parameter            */
1981     TW_INT16    dataArgType;    /* DSM_Entry dataArgType parameter          */
1982     TW_INT16    message;        /* DSM_Entry message parameter              */
1983     TW_INT32    pDataSize;      /* Size of pData (0 if NULL)                */
1984     //  TW_MEMREF   pData;      /* Based on implementation specifics, a     */
1985                                 /* pData parameter makes no sense in this   */
1986                                 /* structure, but data (if provided) will be*/
1987                                 /* appended in the data block.              */
1988 } TW_TWUNKDSENTRYPARAMS, FAR * pTW_TWUNKDSENTRYPARAMS;
1989 
1990 /* SDH - 03/21/95 - TWUNK */
1991 /* Provides DS_Entry results over thunk link. */
1992 typedef struct
1993 {
1994     TW_UINT16   returnCode;     /* Thunker DsEntry return code.             */
1995     TW_UINT16   conditionCode;  /* Thunker DsEntry condition code.          */
1996     TW_INT32    pDataSize;      /* Size of pData (0 if NULL)                */
1997     //  TW_MEMREF   pData;      /* Based on implementation specifics, a     */
1998                                 /* pData parameter makes no sense in this   */
1999                                 /* structure, but data (if provided) will be*/
2000                                 /* appended in the data block.              */
2001 } TW_TWUNKDSENTRYRETURN, FAR * pTW_TWUNKDSENTRYRETURN;
2002 
2003 /* WJD - 950818 */
2004 /* Added for 1.6 Specification */
2005 /* TWAIN 1.6 CAP_SUPPORTEDCAPSEXT structure */
2006 typedef struct
2007 {
2008     TW_UINT16 Cap;   /* Which CAP/ICAP info is relevant to */
2009     TW_UINT16 Properties;  /* Messages this CAP/ICAP supports */
2010 } TW_CAPEXT, FAR * pTW_CAPEXT;
2011 
2012 /* DAT_SETUPAUDIOFILEXFER, information required to setup an audio file transfer */
2013 typedef struct {
2014    TW_STR255  FileName; /* full path target file */
2015    TW_UINT16  Format;   /* one of TWAF_xxxx */
2016    TW_INT16 VRefNum;
2017 } TW_SETUPAUDIOFILEXFER, FAR * pTW_SETUPAUDIOFILEXFER;
2018 
2019 
2020 /****************************************************************************
2021  * Entry Points                                                             *
2022  ****************************************************************************/
2023 
2024 /**********************************************************************
2025  * Function: DSM_Entry, the only entry point into the Data Source Manager.
2026  *
2027  * Parameters:
2028  *  pOrigin Identifies the source module of the message. This could
2029  *          identify an Application, a Source, or the Source Manager.
2030  *
2031  *  pDest   Identifies the destination module for the message.
2032  *          This could identify an application or a data source.
2033  *          If this is NULL, the message goes to the Source Manager.
2034  *
2035  *  DG      The Data Group.
2036  *          Example: DG_IMAGE.
2037  *
2038  *  DAT     The Data Attribute Type.
2039  *          Example: DAT_IMAGEMEMXFER.
2040  *
2041  *  MSG     The message.  Messages are interpreted by the destination module
2042  *          with respect to the Data Group and the Data Attribute Type.
2043  *          Example: MSG_GET.
2044  *
2045  *  pData   A pointer to the data structure or variable identified
2046  *          by the Data Attribute Type.
2047  *          Example: (TW_MEMREF)&ImageMemXfer
2048  *                   where ImageMemXfer is a TW_IMAGEMEMXFER structure.
2049  *
2050  * Returns:
2051  *  ReturnCode
2052  *         Example: TWRC_SUCCESS.
2053  *
2054  ********************************************************************/
2055 
2056 /* Don't mangle the name "DSM_Entry" if we're compiling in C++! */
2057 #ifdef  __cplusplus
2058 extern "C" {
2059 #endif  /* __cplusplus */
2060 
2061 #ifdef TWH_CMP_MSC
2062 
2063   TW_UINT16 FAR PASCAL DSM_Entry( pTW_IDENTITY pOrigin,
2064                                   pTW_IDENTITY pDest,
2065                                   TW_UINT32    DG,
2066                                   TW_UINT16    DAT,
2067                                   TW_UINT16    MSG,
2068                                   TW_MEMREF    pData);
2069 
2070   typedef TW_UINT16 (FAR PASCAL *DSMENTRYPROC)(pTW_IDENTITY pOrigin,
2071                                                pTW_IDENTITY pDest,
2072                                                TW_UINT32 DG,
2073                                                TW_UINT16 DAT,
2074                                                TW_UINT16 MSG,
2075                                                TW_MEMREF pData);
2076 
2077 #else
2078 
2079   FAR PASCAL TW_UINT16 DSM_Entry( pTW_IDENTITY pOrigin,
2080                                   pTW_IDENTITY pDest,
2081                                   TW_UINT32    DG,
2082                                   TW_UINT16    DAT,
2083                                   TW_UINT16    MSG,
2084                                   TW_MEMREF    pData);
2085 
2086   typedef TW_UINT16 (*DSMENTRYPROC)(pTW_IDENTITY pOrigin,
2087                                     pTW_IDENTITY pDest,
2088                                     TW_UINT32 DG,
2089                                     TW_UINT16 DAT,
2090                                     TW_UINT16 MSG,
2091                                     TW_MEMREF pData);
2092 
2093 #endif  /* TWH_CMP_MSC */
2094 
2095 #ifdef  __cplusplus
2096 }
2097 #endif  /* cplusplus */
2098 
2099 
2100 /**********************************************************************
2101  * Function: DS_Entry, the entry point provided by a Data Source.
2102  *
2103  * Parameters:
2104  *  pOrigin Identifies the source module of the message. This could
2105  *          identify an application or the Data Source Manager.
2106  *
2107  *  DG      The Data Group.
2108  *          Example: DG_IMAGE.
2109  *
2110  *  DAT     The Data Attribute Type.
2111  *          Example: DAT_IMAGEMEMXFER.
2112  *
2113  *  MSG     The message.  Messages are interpreted by the data source
2114  *          with respect to the Data Group and the Data Attribute Type.
2115  *          Example: MSG_GET.
2116  *
2117  *  pData   A pointer to the data structure or variable identified
2118  *          by the Data Attribute Type.
2119  *          Example: (TW_MEMREF)&ImageMemXfer
2120  *                   where ImageMemXfer is a TW_IMAGEMEMXFER structure.
2121  *
2122  * Returns:
2123  *  ReturnCode
2124  *          Example: TWRC_SUCCESS.
2125  *
2126  * Note:
2127  *  The DSPROC type is only used by an application when it calls
2128  *  a Data Source directly, bypassing the Data Source Manager.
2129  *
2130  ********************************************************************/
2131 /* Don't mangle the name "DS_Entry" if we're compiling in C++! */
2132 #ifdef  __cplusplus
2133 extern "C" {
2134 #endif  /* __cplusplus */
2135 
2136 #ifdef TWH_CMP_MSC
2137 
2138   TW_UINT16 FAR PASCAL DS_Entry(pTW_IDENTITY pOrigin,
2139                                 TW_UINT32 DG,
2140                                 TW_UINT16 DAT,
2141                                 TW_UINT16 MSG,
2142                                 TW_MEMREF pData);
2143 
2144   typedef TW_UINT16 (FAR PASCAL *DSENTRYPROC)(pTW_IDENTITY pOrigin,
2145                                               TW_UINT32 DG,
2146                                               TW_UINT16 DAT,
2147                                               TW_UINT16 MSG,
2148                                               TW_MEMREF pData);
2149 
2150 #else
2151 
2152   FAR PASCAL TW_UINT16 DS_Entry(pTW_IDENTITY pOrigin,
2153                                 TW_UINT32 DG,
2154                                 TW_UINT16 DAT,
2155                                 TW_UINT16 MSG,
2156                                 TW_MEMREF pData);
2157 
2158   typedef TW_UINT16 (*DSENTRYPROC)(pTW_IDENTITY pOrigin,
2159                                    TW_UINT32 DG,
2160                                    TW_UINT16 DAT,
2161                                    TW_UINT16 MSG,
2162                                    TW_MEMREF pData);
2163 
2164 #endif /* TWH_CMP_MSC */
2165 
2166 
2167   typedef TW_HANDLE (PASCAL *DSM_MEMALLOCATE)(TW_UINT32 _size);
2168   typedef void (PASCAL *DSM_MEMFREE)(TW_HANDLE _handle);
2169   typedef TW_MEMREF (PASCAL *DSM_MEMLOCK)(TW_HANDLE _handle);
2170   typedef void (PASCAL *DSM_MEMUNLOCK)(TW_HANDLE _handle);
2171 
2172 #ifdef  __cplusplus
2173 }
2174 #endif  /* __cplusplus */
2175 
2176 /* DAT_ENTRYPOINT. returns essential entry points. */
2177 typedef struct {
2178    TW_UINT32         Size;
2179    DSMENTRYPROC      DSM_Entry;
2180    DSM_MEMALLOCATE   DSM_MemAllocate;
2181    DSM_MEMFREE       DSM_MemFree;
2182    DSM_MEMLOCK       DSM_MemLock;
2183    DSM_MEMUNLOCK     DSM_MemUnlock;
2184 } TW_ENTRYPOINT, FAR * pTW_ENTRYPOINT;
2185 
2186 /* Restore the previous packing alignment: this occurs after all structures are defined */
2187 #ifdef defined(TWH_CMP_MING32)
2188     #pragma pack (pop)
2189 #elif TWH_CMP_MSC
2190     #pragma pack (pop, before_twain)
2191 #elif defined(TWH_CMP_GNU)
2192     #pragma pack (pop, before_twain)
2193 #elif defined(TWH_CMP_BORLAND)
2194     #pragma optiona.
2195 #elif defined(TWH_CMP_XCODE)
2196     #if PRAGMA_STRUCT_ALIGN
2197         #pragma options align=reset
2198     #elif PRAGMA_STRUCT_PACKPUSH
2199         #pragma pack (pop)
2200     #elif PRAGMA_STRUCT_PACK
2201         #pragma pack()
2202     #endif
2203 #endif
2204 
2205 #endif  /* TWAIN */
2206