File indexing completed on 2024-04-28 04:32:19

0001 // krazy:skip
0002 /* ======================================================================== *\
0003 
0004   Copyright (C) 1991, 1992 TWAIN Working Group: Aldus, Caere, Eastman-Kodak,
0005   Hewlett-Packard and Logitech Corporations.  All rights reserved.
0006 
0007   Copyright (C) 1997 TWAIN Working Group: Bell+Howell, Canon, DocuMagix,
0008   Fujitsu, Genoa Technology, Hewlett-Packard, Kofax Imaging Products, and
0009   Ricoh Corporation.  All rights reserved.
0010 
0011   Copyright © 1998 TWAIN Working Group: Adobe Systems Incorporated,
0012   Canon Information Systems, Eastman Kodak Company,
0013   Fujitsu Computer Products of America, Genoa Technology,
0014   Hewlett-Packard Company, Intel Corporation, Kofax Image Products,
0015   JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
0016   All rights reserved.
0017 
0018   Copyright © 2000 TWAIN Working Group: Adobe Systems Incorporated,
0019   Canon Information Systems, Digimarc Corporation, Eastman Kodak Company,
0020   Fujitsu Computer Products of America, Hewlett-Packard Company,
0021   JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
0022   All rights reserved.
0023 
0024   TWAIN.h -  This is the definitive include file for applications and
0025           data sources written to the TWAIN specification.
0026           It defines constants, data structures, messages etc.
0027           for the public interface to TWAIN.
0028 
0029   Revision History:
0030     version 1.0, March 6, 1992.  TWAIN 1.0.
0031     version 1.1, January 1993.   Tech Notes 1.1
0032     version 1.5, June 1993.      Specification Update 1.5
0033                                  Change DC to TW
0034                                  Change filename from DC.H to TWAIN.H
0035     version 1.5, July 1993.      Remove spaces from country identifiers
0036 
0037     version 1.7, July 1997       Added Capabilities and data structure for
0038                                  document imaging and digital cameras.
0039                                  KHL.
0040     version 1.7, July 1997       Inserted Borland compatible structure packing
0041                                  directives provided by Mentor.  JMH
0042     version 1.7, Aug 1997        Expanded file tabs to spaces.
0043                                  NOTE: future authors should be sure to have
0044                                  their editors set to automatically expand tabs
0045                                  to spaces (original tab setting was 4 spaces).
0046     version 1.7, Sept 1997       Added job control values
0047                                  Added return codes
0048     version 1.7, Sept 1997       changed definition of pRGBRESPONSE to
0049                                  pTW_RGBRESPONSE
0050     version 1.7  Aug 1998        Added missing TWEI_BARCODEROTATION values
0051                                  TWBCOR_ types JMH
0052     version 1.8  August 1998     Added new types and definitions required
0053                                  for 1.8 Specification JMH
0054     version 1.8  January 1999    Changed search mode from SRCH_ to TWBD_ as
0055                                  in 1.8 Specification, added TWBT_MAXICODE  JMH
0056     version 1.8  January 1999    Removed undocumented duplicate AUTO<cap> JMH
0057     version 1.8  March 1999      Removed undocumented 1.8 caps:
0058                                  CAP_FILESYSTEM
0059                                  CAP_PAPERBINDING
0060                                  CAP_PASSTHRU
0061                                  CAP_POWERDOWNTIME
0062                                  ICAP_AUTODISCARDBLANKPAGES
0063                                  * CAP_PAGEMULTIPLEACQUIRE - is CAP_REACQUIREALLOWED,
0064                                  requires spec change.  JMH
0065                                  Added Mac structure packing modifications JMH
0066     version 1.9  March 2000      Added new types and definitions required
0067                                  for 1.9 Specification MLM
0068     version 1.9  March 2000      Added ICAP_JPEGQUALITY, TWJQ_ values,
0069                                  updated TWON_PROTOCOLMINOR for Release v1.9 MN
0070 \* ======================================================================== */
0071 
0072 #ifndef TWAIN
0073 #define TWAIN
0074 
0075 /*  SDH - 02/08/95 - TWUNK */
0076 /*  Force 32-bit twain to use same packing of twain structures as existing */
0077 /*  16-bit twain.  This allows 16/32-bit thunking.                         */
0078 #ifdef  WIN32
0079 
0080 #include <windows.h>
0081 
0082 #ifdef __MINGW32__
0083 #pragma pack (push, 2)
0084 #elif __BORLANDC__ //(Mentor June 13, 1996) if using a Borland compiler
0085 #pragma option -a2  //(Mentor June 13, 1996) switch to word alignment
0086 #else   //(Mentor June 13, 1996) if we're using some other compiler
0087 #pragma pack (push, before_twain)
0088 #pragma pack (2)
0089 #endif  //(Mentor June 13, 1996)
0090 #else   /* WIN32 */
0091 #endif  /* WIN32 */
0092 
0093 /****************************************************************************
0094  * TWAIN Version                                                            *
0095  ****************************************************************************/
0096 #define TWON_PROTOCOLMINOR   9        /* Changed for Version 1.9            */
0097 #define TWON_PROTOCOLMAJOR   1
0098 
0099 /****************************************************************************
0100  * Platform Dependent Definitions and Typedefs                              *
0101  ****************************************************************************/
0102 
0103 /* Define one of the following, depending on the platform */
0104 /* #define _MAC_   */
0105 /* #define _UNIX_  */
0106 #define _MSWIN_
0107 
0108 #ifdef  _MSWIN_
0109 typedef HANDLE         TW_HANDLE;
0110 typedef LPVOID         TW_MEMREF;
0111 
0112 /*  SDH - 05/05/95 - TWUNK */
0113 /*  For common code between 16 and 32 bits.  */
0114 #ifdef  WIN32
0115 #define TW_HUGE
0116 #else   /* WIN32 */
0117 #define TW_HUGE    huge
0118 #endif  /* WIN32 */
0119 typedef BYTE TW_HUGE *HPBYTE;
0120 typedef void TW_HUGE *HPVOID;
0121 #endif  /* _MSWIN_ */
0122 
0123 #ifdef  _MAC_
0124 /*
0125 * NOTE:
0126 * Corrected to allow building of TWAIN MacOS PowerPC Applications
0127 * and MacOS PowerPC TWAIN sources.
0128 *
0129 * The modification allows a PowerPC Application to use a
0130 * TWAIN 68k Source and a PowerPC Source to be used by a 68k Application.
0131 *
0132 * The modification concerns the data alignment of the C-Structures used by
0133 * TWAIN during the communication between the Application and Source.
0134 *
0135 * The Data Alignment must be  68k code and not PowerPC.
0136 * - Paul Plaquette, LOGi 27, FRANCE-Montpellier
0137 */
0138 #if PRAGMA_STRUCT_ALIGN
0139 #pragma options align=mac68k
0140 #elif PRAGMA_STRUCT_PACKPUSH
0141 #pragma pack(push, 2)
0142 #elif PRAGMA_STRUCT_PACK
0143 #pragma pack(2)
0144 #endif
0145 
0146 #define PASCAL         pascal
0147 #define FAR
0148 typedef Handle         TW_HANDLE;
0149 typedef char          *TW_MEMREF;
0150 #endif  /* _MAC_ */
0151 
0152 #ifdef  _UNIX_
0153 #define PASCAL         pascal
0154 typedef unsigned char *TW_HANDLE;
0155 typedef unsigned char *TW_MEMREF;
0156 #endif  /* _UNIX_ */
0157 
0158 /****************************************************************************
0159  * Type Definitions                                                         *
0160  ****************************************************************************/
0161 
0162 /* String types. These include room for the strings and a NULL char,     *
0163  * or, on the Mac, a length byte followed by the string.                 *
0164  * TW_STR255 must hold less than 256 chars so length fits in first byte. */
0165 typedef char    TW_STR32[34],     FAR *pTW_STR32;
0166 typedef char    TW_STR64[66],     FAR *pTW_STR64;
0167 typedef char    TW_STR128[130],   FAR *pTW_STR128;
0168 typedef char    TW_STR255[256],   FAR *pTW_STR255;
0169 typedef char    TW_STR1024[1026], FAR *pTW_STR1024;   /* added 1.9 */
0170 typedef wchar_t TW_UNI512[512],   FAR *pTW_UNI512;    /* added 1.9 */
0171 
0172 /* Numeric types. */
0173 typedef char           TW_INT8,   FAR *pTW_INT8;
0174 typedef short          TW_INT16,  FAR *pTW_INT16;
0175 typedef long           TW_INT32,  FAR *pTW_INT32;
0176 typedef unsigned char  TW_UINT8,  FAR *pTW_UINT8;
0177 typedef unsigned short TW_UINT16, FAR *pTW_UINT16;
0178 typedef unsigned long  TW_UINT32, FAR *pTW_UINT32;
0179 typedef unsigned short TW_BOOL,   FAR *pTW_BOOL;
0180 
0181 /* Fixed point structure type. */
0182 typedef struct {
0183     TW_INT16     Whole;        /* maintains the sign */
0184     TW_UINT16    Frac;
0185 } TW_FIX32,  FAR *pTW_FIX32;
0186 
0187 /****************************************************************************
0188  * Structure Definitions                                                    *
0189  ****************************************************************************/
0190 
0191 /* No DAT needed. */
0192 typedef struct {
0193     TW_FIX32   X;
0194     TW_FIX32   Y;
0195     TW_FIX32   Z;
0196 } TW_CIEPOINT, FAR *pTW_CIEPOINT;
0197 
0198 /* No DAT needed. */
0199 typedef struct {
0200     TW_FIX32   StartIn;
0201     TW_FIX32   BreakIn;
0202     TW_FIX32   EndIn;
0203     TW_FIX32   StartOut;
0204     TW_FIX32   BreakOut;
0205     TW_FIX32   EndOut;
0206     TW_FIX32   Gamma;
0207     TW_FIX32   SampleCount;  /* if =0 use the gamma */
0208 } TW_DECODEFUNCTION, FAR *pTW_DECODEFUNCTION;
0209 
0210 /* No DAT needed. */
0211 typedef struct {
0212     TW_UINT8    Index;    /* Value used to index into the color table. */
0213     TW_UINT8    Channel1; /* First  tri-stimulus value (e.g Red)       */
0214     TW_UINT8    Channel2; /* Second tri-stimulus value (e.g Green)     */
0215     TW_UINT8    Channel3; /* Third  tri-stimulus value (e.g Blue)      */
0216 } TW_ELEMENT8, FAR *pTW_ELEMENT8;
0217 
0218 /* No DAT.  Defines a frame rectangle in ICAP_UNITS coordinates. */
0219 typedef struct {
0220     TW_FIX32   Left;
0221     TW_FIX32   Top;
0222     TW_FIX32   Right;
0223     TW_FIX32   Bottom;
0224 } TW_FRAME, FAR *pTW_FRAME;
0225 
0226 /* No DAT needed.  Used to manage memory buffers. */
0227 typedef struct {
0228     TW_UINT32  Flags;  /* Any combination of the TWMF_ constants.           */
0229     TW_UINT32  Length; /* Number of bytes stored in buffer TheMem.          */
0230     TW_MEMREF  TheMem; /* Pointer or handle to the allocated memory buffer. */
0231 } TW_MEMORY, FAR *pTW_MEMORY;
0232 
0233 /* No DAT needed. */
0234 typedef struct {
0235     TW_DECODEFUNCTION   Decode[3];
0236     TW_FIX32            Mix[3][3];
0237 } TW_TRANSFORMSTAGE, FAR *pTW_TRANSFORMSTAGE;
0238 
0239 /* No DAT needed.  Describes version of software currently running. */
0240 typedef struct {
0241     TW_UINT16  MajorNum;  /* Major revision number of the software. */
0242     TW_UINT16  MinorNum;  /* Incremental revision number of the software. */
0243     TW_UINT16  Language;  /* e.g. TWLG_SWISSFRENCH */
0244     TW_UINT16  Country;   /* e.g. TWCY_SWITZERLAND */
0245     TW_STR32   Info;      /* e.g. "1.0b3 Beta release" */
0246 } TW_VERSION, FAR *pTW_VERSION;
0247 
0248 /* TWON_ARRAY. Container for array of values (a simplified TW_ENUMERATION) */
0249 typedef struct {
0250     TW_UINT16  ItemType;
0251     TW_UINT32  NumItems;    /* How many items in ItemList           */
0252     TW_UINT8   ItemList[1]; /* Array of ItemType values starts here */
0253 } TW_ARRAY, FAR *pTW_ARRAY;
0254 
0255 /* TWON_ENUMERATION. Container for a collection of values. */
0256 typedef struct {
0257     TW_UINT16  ItemType;
0258     TW_UINT32  NumItems;     /* How many items in ItemList                 */
0259     TW_UINT32  CurrentIndex; /* Current value is in ItemList[CurrentIndex] */
0260     TW_UINT32  DefaultIndex; /* Powerup value is in ItemList[DefaultIndex] */
0261     TW_UINT8   ItemList[1];  /* Array of ItemType values starts here       */
0262 } TW_ENUMERATION, FAR *pTW_ENUMERATION;
0263 
0264 /* TWON_ONEVALUE. Container for one value. */
0265 typedef struct {
0266     TW_UINT16  ItemType;
0267     TW_UINT32  Item;
0268 } TW_ONEVALUE, FAR *pTW_ONEVALUE;
0269 
0270 /* TWON_RANGE. Container for a range of values. */
0271 typedef struct {
0272     TW_UINT16  ItemType;
0273     TW_UINT32  MinValue;     /* Starting value in the range.           */
0274     TW_UINT32  MaxValue;     /* Final value in the range.              */
0275     TW_UINT32  StepSize;     /* Increment from MinValue to MaxValue.   */
0276     TW_UINT32  DefaultValue; /* Power-up value.                        */
0277     TW_UINT32  CurrentValue; /* The value that is currently in effect. */
0278 } TW_RANGE, FAR *pTW_RANGE;
0279 
0280 /* DAT_CAPABILITY. Used by application to get/set capability from/in a data source. */
0281 typedef struct {
0282     TW_UINT16  Cap; /* id of capability to set or get, e.g. CAP_BRIGHTNESS */
0283     TW_UINT16  ConType; /* TWON_ONEVALUE, _RANGE, _ENUMERATION or _ARRAY   */
0284     TW_HANDLE  hContainer; /* Handle to container of type Dat              */
0285 } TW_CAPABILITY, FAR *pTW_CAPABILITY;
0286 
0287 /* DAT_CIECOLOR. */
0288 typedef struct {
0289     TW_UINT16           ColorSpace;
0290     TW_INT16            LowEndian;
0291     TW_INT16            DeviceDependent;
0292     TW_INT32            VersionNumber;
0293     TW_TRANSFORMSTAGE   StageABC;
0294     TW_TRANSFORMSTAGE   StageLMN;
0295     TW_CIEPOINT         WhitePoint;
0296     TW_CIEPOINT         BlackPoint;
0297     TW_CIEPOINT         WhitePaper;
0298     TW_CIEPOINT         BlackInk;
0299     TW_FIX32            Samples[1];
0300 } TW_CIECOLOR, FAR *pTW_CIECOLOR;
0301 
0302 /* DAT_EVENT. For passing events down from the application to the DS. */
0303 typedef struct {
0304     TW_MEMREF  pEvent;    /* Windows pMSG or Mac pEvent.                 */
0305     TW_UINT16  TWMessage; /* TW msg from data source, e.g. MSG_XFERREADY */
0306 } TW_EVENT, FAR *pTW_EVENT;
0307 
0308 /* DAT_GRAYRESPONSE */
0309 typedef struct {
0310     TW_ELEMENT8         Response[1];
0311 } TW_GRAYRESPONSE, FAR *pTW_GRAYRESPONSE;
0312 
0313 /* DAT_IDENTITY. Identifies the program/library/code resource. */
0314 typedef struct {
0315     TW_UINT32  Id;              /* Unique number.  In Windows, application hWnd      */
0316     TW_VERSION Version;         /* Identifies the piece of code              */
0317     TW_UINT16  ProtocolMajor;   /* Application and DS must set to TWON_PROTOCOLMAJOR */
0318     TW_UINT16  ProtocolMinor;   /* Application and DS must set to TWON_PROTOCOLMINOR */
0319     TW_UINT32  SupportedGroups; /* Bit field OR combination of DG_ constants */
0320     TW_STR32   Manufacturer;    /* Manufacturer name, e.g. "Hewlett-Packard" */
0321     TW_STR32   ProductFamily;   /* Product family name, e.g. "ScanJet"       */
0322     TW_STR32   ProductName;     /* Product name, e.g. "ScanJet Plus"         */
0323 } TW_IDENTITY, FAR *pTW_IDENTITY;
0324 
0325 /* DAT_IMAGEINFO. Application gets detailed image info from DS with this. */
0326 typedef struct {
0327     TW_FIX32   XResolution;      /* Resolution in the horizontal             */
0328     TW_FIX32   YResolution;      /* Resolution in the vertical               */
0329     TW_INT32   ImageWidth;       /* Columns in the image, -1 if unknown by DS*/
0330     TW_INT32   ImageLength;      /* Rows in the image, -1 if unknown by DS   */
0331     TW_INT16   SamplesPerPixel;  /* Number of samples per pixel, 3 for RGB   */
0332     TW_INT16   BitsPerSample[8]; /* Number of bits for each sample           */
0333     TW_INT16   BitsPerPixel;     /* Number of bits for each padded pixel     */
0334     TW_BOOL    Planar;           /* True if Planar, False if chunky          */
0335     TW_INT16   PixelType;        /* How to interp data; photo interp (TWPT_) */
0336     TW_UINT16  Compression;      /* How the data is compressed (TWCP_xxxx)   */
0337 } TW_IMAGEINFO, FAR *pTW_IMAGEINFO;
0338 
0339 /* DAT_IMAGELAYOUT. Provides image layout information in current units. */
0340 typedef struct {
0341     TW_FRAME   Frame;          /* Frame coords within larger document */
0342     TW_UINT32  DocumentNumber;
0343     TW_UINT32  PageNumber;     /* Reset when you go to next document  */
0344     TW_UINT32  FrameNumber;    /* Reset when you go to next page      */
0345 } TW_IMAGELAYOUT, FAR *pTW_IMAGELAYOUT;
0346 
0347 /* DAT_IMAGEMEMXFER. Used to pass image data (e.g. in strips) from DS to application.*/
0348 typedef struct {
0349     TW_UINT16  Compression;  /* How the data is compressed                */
0350     TW_UINT32  BytesPerRow;  /* Number of bytes in a row of data          */
0351     TW_UINT32  Columns;      /* How many columns                          */
0352     TW_UINT32  Rows;         /* How many rows                             */
0353     TW_UINT32  XOffset;      /* How far from the side of the image        */
0354     TW_UINT32  YOffset;      /* How far from the top of the image         */
0355     TW_UINT32  BytesWritten; /* How many bytes written in Memory          */
0356     TW_MEMORY  Memory;       /* Mem struct used to pass actual image data */
0357 } TW_IMAGEMEMXFER, FAR *pTW_IMAGEMEMXFER;
0358 
0359 /* Changed in 1.1: QuantTable, HuffmanDC, HuffmanAC TW_MEMREF -> TW_MEMORY  */
0360 /* DAT_JPEGCOMPRESSION. Based on JPEG Draft International Std, ver 10918-1. */
0361 typedef struct {
0362     TW_UINT16   ColorSpace;       /* One of the TWPT_xxxx values                */
0363     TW_UINT32   SubSampling;      /* Two word "array" for subsampling values    */
0364     TW_UINT16   NumComponents;    /* Number of color components in image        */
0365     TW_UINT16   RestartFrequency; /* Frequency of restart marker codes in MDU's */
0366     TW_UINT16   QuantMap[4];      /* Mapping of components to QuantTables       */
0367     TW_MEMORY   QuantTable[4];    /* Quantization tables                        */
0368     TW_UINT16   HuffmanMap[4];    /* Mapping of components to Huffman tables    */
0369     TW_MEMORY   HuffmanDC[2];     /* DC Huffman tables                          */
0370     TW_MEMORY   HuffmanAC[2];     /* AC Huffman tables                          */
0371 } TW_JPEGCOMPRESSION, FAR *pTW_JPEGCOMPRESSION;
0372 
0373 /* DAT_PALETTE8. Color palette when TWPT_PALETTE pixels xfer'd in mem buf. */
0374 typedef struct {
0375     TW_UINT16    NumColors;   /* Number of colors in the color table.  */
0376     TW_UINT16    PaletteType; /* TWPA_xxxx, specifies type of palette. */
0377     TW_ELEMENT8  Colors[256]; /* Array of palette values starts here.  */
0378 } TW_PALETTE8, FAR *pTW_PALETTE8;
0379 
0380 /* DAT_PENDINGXFERS. Used with MSG_ENDXFER to indicate additional data. */
0381 typedef struct {
0382     TW_UINT16 Count;
0383     union {
0384         TW_UINT32 EOJ;
0385         TW_UINT32 Reserved;
0386     };
0387 } TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
0388 
0389 /* DAT_RGBRESPONSE */
0390 typedef struct {
0391     TW_ELEMENT8         Response[1];
0392 } TW_RGBRESPONSE, FAR *pTW_RGBRESPONSE;
0393 
0394 /* DAT_SETUPFILEXFER. Sets up DS to application data transfer via a file. */
0395 typedef struct {
0396     TW_STR255 FileName;
0397     TW_UINT16 Format;   /* Any TWFF_ constant */
0398     TW_INT16  VRefNum;  /* Used for Mac only  */
0399 } TW_SETUPFILEXFER, FAR *pTW_SETUPFILEXFER;
0400 
0401 /* DAT_SETUPFILEXFER2. Sets up DS to application data transfer via a file. */
0402 /* Added 1.9                                                               */
0403 typedef struct {
0404     TW_MEMREF FileName;     /* Pointer to file name text */
0405     TW_UINT16 FileNameType; /* TWTY_STR1024 or TWTY_UNI512 */
0406     TW_UINT16 Format;       /* Any TWFF_ constant */
0407     TW_INT16  VRefNum;      /* Used for Mac only  */
0408     TW_UINT32 parID;        /* Used for Mac only */
0409 } TW_SETUPFILEXFER2, FAR *pTW_SETUPFILEXFER2;
0410 
0411 /* DAT_SETUPMEMXFER. Sets up DS to application data transfer via a memory buffer. */
0412 typedef struct {
0413     TW_UINT32 MinBufSize;
0414     TW_UINT32 MaxBufSize;
0415     TW_UINT32 Preferred;
0416 } TW_SETUPMEMXFER, FAR *pTW_SETUPMEMXFER;
0417 
0418 /* DAT_STATUS. Application gets detailed status info from a data source with this. */
0419 typedef struct {
0420     TW_UINT16  ConditionCode; /* Any TWCC_ constant     */
0421     TW_UINT16  Reserved;      /* Future expansion space */
0422 } TW_STATUS, FAR *pTW_STATUS;
0423 
0424 /* DAT_USERINTERFACE. Coordinates UI between application and data source. */
0425 typedef struct {
0426     TW_BOOL    ShowUI;  /* TRUE if DS should bring up its UI           */
0427     TW_BOOL    ModalUI; /* For Mac only - true if the DS's UI is modal */
0428     TW_HANDLE  hParent; /* For windows only - Application window handle        */
0429 } TW_USERINTERFACE, FAR *pTW_USERINTERFACE;
0430 
0431 /* SDH - 03/21/95 - TWUNK */
0432 /* DAT_TWUNKIDENTITY. Provides DS identity and 'other' information necessary */
0433 /*                    across thunk link. */
0434 typedef struct {
0435     TW_IDENTITY identity;        /* Identity of data source.                 */
0436     TW_STR255   dsPath;          /* Full path and file name of data source.  */
0437 } TW_TWUNKIDENTITY, FAR *pTW_TWUNKIDENTITY;
0438 
0439 /* SDH - 03/21/95 - TWUNK */
0440 /* Provides DS_Entry parameters over thunk link. */
0441 typedef struct {
0442     TW_INT8     destFlag;       /* TRUE if dest is not NULL                 */
0443     TW_IDENTITY dest;           /* Identity of data source (if used)        */
0444     TW_INT32    dataGroup;      /* DSM_Entry dataGroup parameter            */
0445     TW_INT16    dataArgType;    /* DSM_Entry dataArgType parameter          */
0446     TW_INT16    message;        /* DSM_Entry message parameter              */
0447     TW_INT32    pDataSize;      /* Size of pData (0 if NULL)                */
0448     //  TW_MEMREF   pData;      /* Based on implementation specifics, a     */
0449     /* pData parameter makes no sense in this   */
0450     /* structure, but data (if provided) will be*/
0451     /* appended in the data block.              */
0452 } TW_TWUNKDSENTRYPARAMS, FAR *pTW_TWUNKDSENTRYPARAMS;
0453 
0454 /* SDH - 03/21/95 - TWUNK */
0455 /* Provides DS_Entry results over thunk link. */
0456 typedef struct {
0457     TW_UINT16   returnCode;     /* Thunker DsEntry return code.             */
0458     TW_UINT16   conditionCode;  /* Thunker DsEntry condition code.          */
0459     TW_INT32    pDataSize;      /* Size of pData (0 if NULL)                */
0460     //  TW_MEMREF   pData;      /* Based on implementation specifics, a     */
0461     /* pData parameter makes no sense in this   */
0462     /* structure, but data (if provided) will be*/
0463     /* appended in the data block.              */
0464 } TW_TWUNKDSENTRYRETURN, FAR *pTW_TWUNKDSENTRYRETURN;
0465 
0466 /* WJD - 950818 */
0467 /* Added for 1.6 Specification */
0468 /* TWAIN 1.6 CAP_SUPPORTEDCAPSEXT structure */
0469 typedef struct {
0470     TW_UINT16 Cap;   /* Which CAP/ICAP info is relevant to */
0471     TW_UINT16 Properties;  /* Messages this CAP/ICAP supports */
0472 } TW_CAPEXT, FAR *pTW_CAPEXT;
0473 
0474 /* ----------------------------------------------------------------------- *\
0475 
0476   Version 1.7:      Added Following data structure for Document Imaging
0477   July 1997         Enhancement.
0478   KHL               TW_CUSTOMDSDATA --  For Saving and Restoring Source's
0479                                         state.
0480                     TW_INFO         --  Each attribute for extended image
0481                                         information.
0482                     TW_EXTIMAGEINFO --  Extended image information structure.
0483 
0484 \* ----------------------------------------------------------------------- */
0485 
0486 typedef struct {
0487     TW_UINT32  InfoLength;     /* Length of Information in bytes.  */
0488     TW_HANDLE  hData;          /* Place holder for data, DS Allocates */
0489 } TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
0490 
0491 typedef struct {
0492     TW_UINT16   InfoID;
0493     TW_UINT16   ItemType;
0494     TW_UINT16   NumItems;
0495     TW_UINT16   CondCode;
0496     TW_UINT32   Item;
0497 } TW_INFO, FAR *pTW_INFO;
0498 
0499 typedef struct {
0500     TW_UINT32   NumInfos;
0501     TW_INFO     Info[1];
0502 } TW_EXTIMAGEINFO, FAR *pTW_EXTIMAGEINFO;
0503 
0504 /* Added 1.8 */
0505 
0506 /* DAT_AUDIOINFO, information about audio data */
0507 typedef struct {
0508     TW_STR255  Name;       /* name of audio data */
0509     TW_UINT32  Reserved;   /* reserved space */
0510 } TW_AUDIOINFO, FAR *pTW_AUDIOINFO;
0511 
0512 /* DAT_DEVICEEVENT, information about events */
0513 typedef struct {
0514     TW_UINT32  Event;                  /* One of the TWDE_xxxx values. */
0515     TW_STR255  DeviceName;             /* The name of the device that generated the event */
0516     TW_UINT32  BatteryMinutes;         /* Battery Minutes Remaining    */
0517     TW_INT16   BatteryPercentage;      /* Battery Percentage Remaining */
0518     TW_INT32   PowerSupply;            /* Power Supply                 */
0519     TW_FIX32   XResolution;            /* Resolution                   */
0520     TW_FIX32   YResolution;            /* Resolution                   */
0521     TW_UINT32  FlashUsed2;             /* Flash Used2                  */
0522     TW_UINT32  AutomaticCapture;       /* Automatic Capture            */
0523     TW_UINT32  TimeBeforeFirstCapture; /* Automatic Capture            */
0524     TW_UINT32  TimeBetweenCaptures;    /* Automatic Capture            */
0525 } TW_DEVICEEVENT, FAR *pTW_DEVICEEVENT;
0526 
0527 /* DAT_FILESYSTEM, information about TWAIN file system */
0528 typedef struct {
0529     /* DG_CONTROL / DAT_FILESYSTEM / MSG_xxxx fields     */
0530     TW_STR255  InputName; /* The name of the input or source file */
0531     TW_STR255  OutputName; /* The result of an operation or the name of a destination file */
0532     TW_MEMREF  Context; /* Source specific data used to remember state information */
0533     /* DG_CONTROL / DAT_FILESYSTEM / MSG_DELETE field    */
0534     int        Recursive; /* recursively delete all sub-directories */
0535     /* DG_CONTROL / DAT_FILESYSTEM / MSG_GETINFO fields  */
0536     TW_INT32   FileType; /* One of the TWFT_xxxx values */
0537     TW_UINT32  Size; /* Size of current FileType */
0538     TW_STR32   CreateTimeDate; /* creation date of the file */
0539     TW_STR32   ModifiedTimeDate; /* last date the file was modified */
0540     TW_UINT32  FreeSpace; /* bytes of free space on the current device */
0541     TW_INT32   NewImageSize; /* estimate of the amount of space a new image would take up */
0542     TW_UINT32  NumberOfFiles; /* number of files, depends on FileType */
0543     TW_UINT32  NumberOfSnippets; /* number of audio snippets */
0544     TW_UINT32  DeviceGroupMask; /* used to group cameras (ex: front/rear bitonal, front/rear grayscale...) */
0545     char       Reserved[508]; /**/
0546 } TW_FILESYSTEM, FAR *pTW_FILESYSTEM;
0547 
0548 /* DAT_PASSTHRU, device dependent data to pass through Data Source */
0549 typedef struct {
0550     TW_MEMREF  pCommand;        /* Pointer to Command buffer */
0551     TW_UINT32  CommandBytes;    /* Number of bytes in Command buffer */
0552     TW_INT32   Direction;       /* One of the TWDR_xxxx values.  Defines the direction of data flow */
0553     TW_MEMREF  pData;           /* Pointer to Data buffer */
0554     TW_UINT32  DataBytes;       /* Number of bytes in Data buffer */
0555     TW_UINT32  DataBytesXfered; /* Number of bytes successfully transferred */
0556 } TW_PASSTHRU, FAR *pTW_PASSTHRU;
0557 
0558 /* DAT_SETUPAUDIOFILEXFER, information required to setup an audio file transfer */
0559 typedef struct {
0560     TW_STR255  FileName; /* full path target file */
0561     TW_UINT16  Format;   /* one of TWAF_xxxx */
0562     TW_INT16 VRefNum;
0563 } TW_SETUPAUDIOFILEXFER, FAR *pTW_SETUPAUDIOFILEXFER;
0564 
0565 #ifdef _MAC_
0566 /*
0567 * Restore original Macintosh structure packing
0568 */
0569 #if PRAGMA_STRUCT_ALIGN
0570 #pragma options align=reset
0571 #elif PRAGMA_STRUCT_PACKPUSH
0572 #pragma pack(pop)
0573 #elif PRAGMA_STRUCT_PACK
0574 #pragma pack()
0575 #endif
0576 #endif /* _MAC_ */
0577 
0578 /****************************************************************************
0579  * Generic Constants                                                        *
0580  ****************************************************************************/
0581 
0582 #define TWON_ARRAY           3 /* indicates TW_ARRAY container       */
0583 #define TWON_ENUMERATION     4 /* indicates TW_ENUMERATION container */
0584 #define TWON_ONEVALUE        5 /* indicates TW_ONEVALUE container    */
0585 #define TWON_RANGE           6 /* indicates TW_RANGE container       */
0586 
0587 #define TWON_ICONID          962 /* res Id of icon used in USERSELECT lbox */
0588 #define TWON_DSMID           461 /* res Id of the DSM version num resource */
0589 #define TWON_DSMCODEID       63  /* res Id of the Mac SM Code resource     */
0590 
0591 #define TWON_DONTCARE8       0xff
0592 #define TWON_DONTCARE16      0xffff
0593 #define TWON_DONTCARE32      0xffffffff
0594 
0595 /* Flags used in TW_MEMORY structure. */
0596 #define TWMF_APPOWNS     0x1
0597 #define TWMF_DSMOWNS     0x2
0598 #define TWMF_DSOWNS      0x4
0599 #define TWMF_POINTER     0x8
0600 #define TWMF_HANDLE      0x10
0601 
0602 /* Palette types for TW_PALETTE8 */
0603 #define TWPA_RGB         0
0604 #define TWPA_GRAY        1
0605 #define TWPA_CMY         2
0606 
0607 /* There are four containers used for capabilities negotiation:
0608  *    TWON_ONEVALUE, TWON_RANGE, TWON_ENUMERATION, TWON_ARRAY
0609  * In each container structure ItemType can be TWTY_INT8, TWTY_INT16, etc.
0610  * The kind of data stored in the container can be determined by doing
0611  * DCItemSize[ItemType] where the following is defined in TWAIN glue code:
0612  *          DCItemSize[]= { sizeof(TW_INT8),
0613  *                          sizeof(TW_INT16),
0614  *                          etc.
0615  *                          sizeof(TW_UINT32) };
0616  *
0617  */
0618 
0619 #define TWTY_INT8        0x0000    /* Means Item is a TW_INT8   */
0620 #define TWTY_INT16       0x0001    /* Means Item is a TW_INT16  */
0621 #define TWTY_INT32       0x0002    /* Means Item is a TW_INT32  */
0622 
0623 #define TWTY_UINT8       0x0003    /* Means Item is a TW_UINT8  */
0624 #define TWTY_UINT16      0x0004    /* Means Item is a TW_UINT16 */
0625 #define TWTY_UINT32      0x0005    /* Means Item is a TW_UINT32 */
0626 
0627 #define TWTY_BOOL        0x0006    /* Means Item is a TW_BOOL   */
0628 
0629 #define TWTY_FIX32       0x0007    /* Means Item is a TW_FIX32  */
0630 
0631 #define TWTY_FRAME       0x0008    /* Means Item is a TW_FRAME  */
0632 
0633 #define TWTY_STR32       0x0009    /* Means Item is a TW_STR32  */
0634 #define TWTY_STR64       0x000a    /* Means Item is a TW_STR64  */
0635 #define TWTY_STR128      0x000b    /* Means Item is a TW_STR128 */
0636 #define TWTY_STR255      0x000c    /* Means Item is a TW_STR255 */
0637 #define TWTY_STR1024     0x000d    /* Means Item is a TW_STR1024...added 1.9 */
0638 #define TWTY_UNI512      0x000e    /* Means Item is a TW_UNI512...added 1.9 */
0639 
0640 /****************************************************************************
0641  * Capability Constants                                                     *
0642  ****************************************************************************/
0643 
0644 /* ICAP_BITORDER values (BO_ means Bit Order) */
0645 #define TWBO_LSBFIRST    0
0646 #define TWBO_MSBFIRST    1
0647 
0648 /* ICAP_COMPRESSION values (CP_ means ComPression ) */
0649 #define TWCP_NONE        0
0650 #define TWCP_PACKBITS    1
0651 #define TWCP_GROUP31D    2 /* Follows CCITT spec (no End Of Line)          */
0652 #define TWCP_GROUP31DEOL 3 /* Follows CCITT spec (has End Of Line)         */
0653 #define TWCP_GROUP32D    4 /* Follows CCITT spec (use cap for K Factor)    */
0654 #define TWCP_GROUP4      5 /* Follows CCITT spec                           */
0655 #define TWCP_JPEG        6 /* Use capability for more info                 */
0656 #define TWCP_LZW         7 /* Must license from Unisys and IBM to use      */
0657 #define TWCP_JBIG        8 /* For Bitonal images  -- Added 1.7 KHL         */
0658 /* Added 1.8 */
0659 #define TWCP_PNG         9
0660 #define TWCP_RLE4        10
0661 #define TWCP_RLE8        11
0662 #define TWCP_BITFIELDS   12
0663 
0664 /* ICAP_IMAGEFILEFORMAT values (FF_means File Format)   */
0665 #define TWFF_TIFF        0    /* Tagged Image File Format     */
0666 #define TWFF_PICT        1    /* Macintosh PICT               */
0667 #define TWFF_BMP         2    /* Windows Bitmap               */
0668 #define TWFF_XBM         3    /* X-Windows Bitmap             */
0669 #define TWFF_JFIF        4    /* JPEG File Interchange Format */
0670 #define TWFF_FPX         5    /* Flash Pix                    */
0671 #define TWFF_TIFFMULTI   6    /* Multi-page tiff file         */
0672 #define TWFF_PNG         7
0673 #define TWFF_SPIFF       8
0674 #define TWFF_EXIF        9
0675 
0676 /* ICAP_FILTER values (FT_ means Filter Type) */
0677 #define TWFT_RED         0
0678 #define TWFT_GREEN       1
0679 #define TWFT_BLUE        2
0680 #define TWFT_NONE        3
0681 #define TWFT_WHITE       4
0682 #define TWFT_CYAN        5
0683 #define TWFT_MAGENTA     6
0684 #define TWFT_YELLOW      7
0685 #define TWFT_BLACK       8
0686 
0687 /* ICAP_LIGHTPATH values (LP_ means Light Path) */
0688 #define TWLP_REFLECTIVE   0
0689 #define TWLP_TRANSMISSIVE 1
0690 
0691 /* ICAP_LIGHTSOURCE values (LS_ means Light Source) */
0692 #define TWLS_RED         0
0693 #define TWLS_GREEN       1
0694 #define TWLS_BLUE        2
0695 #define TWLS_NONE        3
0696 #define TWLS_WHITE       4
0697 #define TWLS_UV          5
0698 #define TWLS_IR          6
0699 
0700 /* ICAP_ORIENTATION values (OR_ means ORientation) */
0701 #define TWOR_ROT0        0
0702 #define TWOR_ROT90       1
0703 #define TWOR_ROT180      2
0704 #define TWOR_ROT270      3
0705 #define TWOR_PORTRAIT    TWOR_ROT0
0706 #define TWOR_LANDSCAPE   TWOR_ROT270
0707 
0708 /* ICAP_PLANARCHUNKY values (PC_ means Planar/Chunky ) */
0709 #define TWPC_CHUNKY      0
0710 #define TWPC_PLANAR      1
0711 
0712 /* ICAP_PIXELFLAVOR values (PF_ means Pixel Flavor) */
0713 #define TWPF_CHOCOLATE   0  /* zero pixel represents darkest shade  */
0714 #define TWPF_VANILLA     1  /* zero pixel represents lightest shade */
0715 
0716 /* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
0717 #define TWPT_BW          0 /* Black and White */
0718 #define TWPT_GRAY        1
0719 #define TWPT_RGB         2
0720 #define TWPT_PALETTE     3
0721 #define TWPT_CMY         4
0722 #define TWPT_CMYK        5
0723 #define TWPT_YUV         6
0724 #define TWPT_YUVK        7
0725 #define TWPT_CIEXYZ      8
0726 
0727 /* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
0728 #define TWSS_NONE        0
0729 #define TWSS_A4LETTER    1
0730 #define TWSS_B5LETTER    2
0731 #define TWSS_USLETTER    3
0732 #define TWSS_USLEGAL     4
0733 /* Added 1.5 */
0734 #define TWSS_A5          5
0735 #define TWSS_B4          6
0736 #define TWSS_B6          7
0737 //#define TWSS_B          8
0738 /* Added 1.7 */
0739 #define TWSS_USLEDGER    9
0740 #define TWSS_USEXECUTIVE 10
0741 #define TWSS_A3          11
0742 #define TWSS_B3          12
0743 #define TWSS_A6          13
0744 #define TWSS_C4          14
0745 #define TWSS_C5          15
0746 #define TWSS_C6          16
0747 /* Added 1.8 */
0748 #define TWSS_4A0          17
0749 #define TWSS_2A0          18
0750 #define TWSS_A0           19
0751 #define TWSS_A1           20
0752 #define TWSS_A2           21
0753 #define TWSS_A4           TWSS_A4LETTER
0754 #define TWSS_A7           22
0755 #define TWSS_A8           23
0756 #define TWSS_A9           24
0757 #define TWSS_A10          25
0758 #define TWSS_ISOB0        26
0759 #define TWSS_ISOB1        27
0760 #define TWSS_ISOB2        28
0761 #define TWSS_ISOB3        TWSS_B3
0762 #define TWSS_ISOB4        TWSS_B4
0763 #define TWSS_ISOB5        29
0764 #define TWSS_ISOB6        TWSS_B6
0765 #define TWSS_ISOB7        30
0766 #define TWSS_ISOB8        31
0767 #define TWSS_ISOB9        32
0768 #define TWSS_ISOB10       33
0769 #define TWSS_JISB0        34
0770 #define TWSS_JISB1        35
0771 #define TWSS_JISB2        36
0772 #define TWSS_JISB3        37
0773 #define TWSS_JISB4        38
0774 #define TWSS_JISB5        TWSS_B5LETTER
0775 #define TWSS_JISB6        39
0776 #define TWSS_JISB7        40
0777 #define TWSS_JISB8        41
0778 #define TWSS_JISB9        42
0779 #define TWSS_JISB10       43
0780 #define TWSS_C0           44
0781 #define TWSS_C1           45
0782 #define TWSS_C2           46
0783 #define TWSS_C3           47
0784 #define TWSS_C7           48
0785 #define TWSS_C8           49
0786 #define TWSS_C9           50
0787 #define TWSS_C10          51
0788 #define TWSS_USSTATEMENT  52
0789 #define TWSS_BUSINESSCARD 53
0790 
0791 /* ICAP_XFERMECH values (SX_ means Setup XFer) */
0792 #define TWSX_NATIVE      0
0793 #define TWSX_FILE        1
0794 #define TWSX_MEMORY      2
0795 #define TWSX_FILE2       3    /* added 1.9 */
0796 
0797 /* ICAP_UNITS values (UN_ means UNits) */
0798 #define TWUN_INCHES      0
0799 #define TWUN_CENTIMETERS 1
0800 #define TWUN_PICAS       2
0801 #define TWUN_POINTS      3
0802 #define TWUN_TWIPS       4
0803 #define TWUN_PIXELS      5
0804 
0805 /* Added 1.5 */
0806 /* ICAP_BITDEPTHREDUCTION values (BR_ means Bitdepth Reduction) */
0807 #define TWBR_THRESHOLD     0
0808 #define TWBR_HALFTONE      1
0809 #define TWBR_CUSTHALFTONE  2
0810 #define TWBR_DIFFUSION     3
0811 
0812 /* Added 1.7 */
0813 /* ICAP_DUPLEX values */
0814 #define TWDX_NONE         0
0815 #define TWDX_1PASSDUPLEX  1
0816 #define TWDX_2PASSDUPLEX  2
0817 
0818 /* Added 1.7 */
0819 /* TWEI_BARCODETYPE values */
0820 #define TWBT_3OF9                 0
0821 #define TWBT_2OF5INTERLEAVED      1
0822 #define TWBT_2OF5NONINTERLEAVED   2
0823 #define TWBT_CODE93               3
0824 #define TWBT_CODE128              4
0825 #define TWBT_UCC128               5
0826 #define TWBT_CODABAR              6
0827 #define TWBT_UPCA                 7
0828 #define TWBT_UPCE                 8
0829 #define TWBT_EAN8                 9
0830 #define TWBT_EAN13                10
0831 #define TWBT_POSTNET              11
0832 #define TWBT_PDF417               12
0833 /* Added 1.8 */
0834 #define TWBT_2OF5INDUSTRIAL       13
0835 #define TWBT_2OF5MATRIX           14
0836 #define TWBT_2OF5DATALOGIC        15
0837 #define TWBT_2OF5IATA             16
0838 #define TWBT_3OF9FULLASCII        17
0839 #define TWBT_CODABARWITHSTARTSTOP 18
0840 #define TWBT_MAXICODE             19
0841 
0842 /* Added 1.7 */
0843 /* TWEI_DESKEWSTATUS values */
0844 #define TWDSK_SUCCESS     0
0845 #define TWDSK_REPORTONLY  1
0846 #define TWDSK_FAIL        2
0847 #define TWDSK_DISABLED    3
0848 
0849 /* Added 1.7 */
0850 /* TWEI_PATCHCODE values */
0851 #define TWPCH_PATCH1      0
0852 #define TWPCH_PATCH2      1
0853 #define TWPCH_PATCH3      2
0854 #define TWPCH_PATCH4      3
0855 #define TWPCH_PATCH6      4
0856 #define TWPCH_PATCHT      5
0857 
0858 /* Added 1.7 */
0859 /* CAP_JOBCONTROL values */
0860 #define TWJC_NONE   0
0861 #define TWJC_JSIC   1
0862 #define TWJC_JSIS   2
0863 #define TWJC_JSXC   3
0864 #define TWJC_JSXS   4
0865 
0866 /* Added 1.7 */
0867 /* TWEI_BARCODEROTATION values (BCOR_ means barcode rotation) */
0868 #define TWBCOR_ROT0   0
0869 #define TWBCOR_ROT90  1
0870 #define TWBCOR_ROT180 2
0871 #define TWBCOR_ROT270 3
0872 #define TWBCOR_ROTX   4
0873 
0874 /* Added 1.8 */
0875 /* ACAP_AUDIOFILEFORMAT values (AF_ means audio format) */
0876 #define TWAF_WAV      0
0877 #define TWAF_AIFF     1
0878 #define TWAF_AU       3
0879 #define TWAF_SND      4
0880 
0881 /* CAP_ALARMS values (AL_ means alarms) */
0882 #define TWAL_ALARM          0
0883 #define TWAL_FEEDERERROR    1
0884 #define TWAL_FEEDERWARNING  2
0885 #define TWAL_BARCODE        3
0886 #define TWAL_DOUBLEFEED     4
0887 #define TWAL_JAM            5
0888 #define TWAL_PATCHCODE      6
0889 #define TWAL_POWER          7
0890 #define TWAL_SKEW           8
0891 
0892 /* CAP_CLEARBUFFERS values (CB_ means clear buffers) */
0893 #define TWCB_AUTO           0
0894 #define TWCB_CLEAR          1
0895 #define TWCB_NOCLEAR        2
0896 
0897 /* CAP_DEVICEEVENT values (DE_ means device event) */
0898 #define TWDE_CUSTOMEVENTS           0x8000
0899 #define TWDE_CHECKAUTOMATICCAPTURE  0
0900 #define TWDE_CHECKBATTERY           1
0901 #define TWDE_CHECKDEVICEONLINE      2
0902 #define TWDE_CHECKFLASH             3
0903 #define TWDE_CHECKPOWERSUPPLY       4
0904 #define TWDE_CHECKRESOLUTION        5
0905 #define TWDE_DEVICEADDED            6
0906 #define TWDE_DEVICEOFFLINE          7
0907 #define TWDE_DEVICEREADY            8
0908 #define TWDE_DEVICEREMOVED          9
0909 #define TWDE_IMAGECAPTURED          10
0910 #define TWDE_IMAGEDELETED           11
0911 #define TWDE_PAPERDOUBLEFEED        12
0912 #define TWDE_PAPERJAM               13
0913 #define TWDE_LAMPFAILURE            14
0914 #define TWDE_POWERSAVE              15
0915 #define TWDE_POWERSAVENOTIFY        16
0916 
0917 /* CAP_FEEDERALIGNMENT values (FA_ means feeder alignment) */
0918 #define TWFA_NONE   0
0919 #define TWFA_LEFT   1
0920 #define TWFA_CENTER 2
0921 #define TWFA_RIGHT  3
0922 
0923 /* CAP_FEEDERORDER values (FO_ means feeder order) */
0924 #define TWFO_FIRSTPAGEFIRST 0
0925 #define TWFO_LASTPAGEFIRST  1
0926 
0927 /* CAP_FILESYSTEM values (FS_ means file system) */
0928 #define TWFS_FILESYSTEM       0
0929 #define TWFS_RECURSIVEDELETE  1
0930 
0931 /* CAP_POWERSUPPLY values (PS_ means power supply) */
0932 #define TWPS_EXTERNAL 0
0933 #define TWPS_BATTERY  1
0934 
0935 /* CAP_PRINTER values (PR_ means printer) */
0936 #define TWPR_IMPRINTERTOPBEFORE     0
0937 #define TWPR_IMPRINTERTOPAFTER      1
0938 #define TWPR_IMPRINTERBOTTOMBEFORE  2
0939 #define TWPR_IMPRINTERBOTTOMAFTER   3
0940 #define TWPR_ENDORSERTOPBEFORE      4
0941 #define TWPR_ENDORSERTOPAFTER       5
0942 #define TWPR_ENDORSERBOTTOMBEFORE   6
0943 #define TWPR_ENDORSERBOTTOMAFTER    7
0944 
0945 /* CAP_PRINTERMODE values (PM_ means printer mode) */
0946 #define TWPM_SINGLESTRING     0
0947 #define TWPM_MULTISTRING      1
0948 #define TWPM_COMPOUNDSTRING   2
0949 
0950 /* ICAP_BARCODESEARCHMODE values (TWBD_ means search) */
0951 #define TWBD_HORZ     0
0952 #define TWBD_VERT     1
0953 #define TWBD_HORZVERT 2
0954 #define TWBD_VERTHORZ 3
0955 
0956 /* ICAP_FLASHUSED2 values (FL_ means flash) */
0957 #define TWFL_NONE     0
0958 #define TWFL_OFF      1
0959 #define TWFL_ON       2
0960 #define TWFL_AUTO     3
0961 #define TWFL_REDEYE   4
0962 
0963 /* ICAP_FLIPROTATION values (FR_ means flip rotation) */
0964 #define TWFR_BOOK     0
0965 #define TWFR_FANFOLD  1
0966 
0967 /* ICAP_IMAGEFILTER values (IF_ means image filter) */
0968 #define TWIF_NONE     0
0969 #define TWIF_AUTO     1
0970 #define TWIF_LOWPASS  2
0971 #define TWIF_BANDPASS 3
0972 #define TWIF_HIGHPASS 4
0973 #define TWIF_TEXT     TWIF_BANDPASS
0974 #define TWIF_FINELINE TWIF_HIGHPASS
0975 
0976 /* ICAP_NOISEFILTER values (NF_ means noise filter) */
0977 #define TWNF_NONE         0
0978 #define TWNF_AUTO         1
0979 #define TWNF_LONEPIXEL    2
0980 #define TWNF_MAJORITYRULE 3
0981 
0982 /* ICAP_OVERSCAN values (OV_ means overscan) */
0983 #define TWOV_NONE       0
0984 #define TWOV_AUTO       1
0985 #define TWOV_TOPBOTTOM  2
0986 #define TWOV_LEFTRIGHT  3
0987 #define TWOV_ALL        4
0988 
0989 /* TW_FILESYSTEM.FileType values (FT_ means file type) */
0990 #define TWFY_CAMERA         0
0991 #define TWFY_CAMERATOP      1
0992 #define TWFY_CAMERABOTTOM   2
0993 #define TWFY_CAMERAPREVIEW  3
0994 #define TWFY_DOMAIN         4
0995 #define TWFY_HOST           5
0996 #define TWFY_DIRECTORY      6
0997 #define TWFY_IMAGE          7
0998 #define TWFY_UNKNOWN        8
0999 
1000 /* ICAP_JPEGQUALITY values (JQ_ means jpeg quality) */
1001 #define TWJQ_UNKNOWN       -4
1002 #define TWJQ_LOW           -3
1003 #define TWJQ_MEDIUM        -2
1004 #define TWJQ_HIGH          -1
1005 
1006 /****************************************************************************
1007  * Country Constants                                                        *
1008  ****************************************************************************/
1009 
1010 #define TWCY_AFGHANISTAN   1001
1011 #define TWCY_ALGERIA        213
1012 #define TWCY_AMERICANSAMOA  684
1013 #define TWCY_ANDORRA        033
1014 #define TWCY_ANGOLA        1002
1015 #define TWCY_ANGUILLA      8090
1016 #define TWCY_ANTIGUA       8091
1017 #define TWCY_ARGENTINA       54
1018 #define TWCY_ARUBA          297
1019 #define TWCY_ASCENSIONI     247
1020 #define TWCY_AUSTRALIA       61
1021 #define TWCY_AUSTRIA         43
1022 #define TWCY_BAHAMAS       8092
1023 #define TWCY_BAHRAIN        973
1024 #define TWCY_BANGLADESH     880
1025 #define TWCY_BARBADOS      8093
1026 #define TWCY_BELGIUM         32
1027 #define TWCY_BELIZE         501
1028 #define TWCY_BENIN          229
1029 #define TWCY_BERMUDA       8094
1030 #define TWCY_BHUTAN        1003
1031 #define TWCY_BOLIVIA        591
1032 #define TWCY_BOTSWANA       267
1033 #define TWCY_BRITAIN          6
1034 #define TWCY_BRITVIRGINIS  8095
1035 #define TWCY_BRAZIL          55
1036 #define TWCY_BRUNEI         673
1037 #define TWCY_BULGARIA       359
1038 #define TWCY_BURKINAFASO   1004
1039 #define TWCY_BURMA         1005
1040 #define TWCY_BURUNDI       1006
1041 #define TWCY_CAMAROON       237
1042 #define TWCY_CANADA           2
1043 #define TWCY_CAPEVERDEIS    238
1044 #define TWCY_CAYMANIS      8096
1045 #define TWCY_CENTRALAFREP  1007
1046 #define TWCY_CHAD          1008
1047 #define TWCY_CHILE           56
1048 #define TWCY_CHINA           86
1049 #define TWCY_CHRISTMASIS   1009
1050 #define TWCY_COCOSIS       1009
1051 #define TWCY_COLOMBIA        57
1052 #define TWCY_COMOROS       1010
1053 #define TWCY_CONGO         1011
1054 #define TWCY_COOKIS        1012
1055 #define TWCY_COSTARICA     506
1056 #define TWCY_CUBA           005
1057 #define TWCY_CYPRUS         357
1058 #define TWCY_CZECHOSLOVAKIA  42
1059 #define TWCY_DENMARK         45
1060 #define TWCY_DJIBOUTI      1013
1061 #define TWCY_DOMINICA      8097
1062 #define TWCY_DOMINCANREP   8098
1063 #define TWCY_EASTERIS      1014
1064 #define TWCY_ECUADOR        593
1065 #define TWCY_EGYPT           20
1066 #define TWCY_ELSALVADOR     503
1067 #define TWCY_EQGUINEA      1015
1068 #define TWCY_ETHIOPIA       251
1069 #define TWCY_FALKLANDIS    1016
1070 #define TWCY_FAEROEIS       298
1071 #define TWCY_FIJIISLANDS    679
1072 #define TWCY_FINLAND        358
1073 #define TWCY_FRANCE          33
1074 #define TWCY_FRANTILLES     596
1075 #define TWCY_FRGUIANA       594
1076 #define TWCY_FRPOLYNEISA    689
1077 #define TWCY_FUTANAIS      1043
1078 #define TWCY_GABON          241
1079 #define TWCY_GAMBIA         220
1080 #define TWCY_GERMANY         49
1081 #define TWCY_GHANA          233
1082 #define TWCY_GIBRALTER      350
1083 #define TWCY_GREECE          30
1084 #define TWCY_GREENLAND      299
1085 #define TWCY_GRENADA       8099
1086 #define TWCY_GRENEDINES    8015
1087 #define TWCY_GUADELOUPE     590
1088 #define TWCY_GUAM           671
1089 #define TWCY_GUANTANAMOBAY 5399
1090 #define TWCY_GUATEMALA      502
1091 #define TWCY_GUINEA         224
1092 #define TWCY_GUINEABISSAU  1017
1093 #define TWCY_GUYANA         592
1094 #define TWCY_HAITI          509
1095 #define TWCY_HONDURAS       504
1096 #define TWCY_HONGKONG      852
1097 #define TWCY_HUNGARY         36
1098 #define TWCY_ICELAND        354
1099 #define TWCY_INDIA           91
1100 #define TWCY_INDONESIA       62
1101 #define TWCY_IRAN            98
1102 #define TWCY_IRAQ           964
1103 #define TWCY_IRELAND        353
1104 #define TWCY_ISRAEL         972
1105 #define TWCY_ITALY           39
1106 #define TWCY_IVORYCOAST    225
1107 #define TWCY_JAMAICA       8010
1108 #define TWCY_JAPAN           81
1109 #define TWCY_JORDAN         962
1110 #define TWCY_KENYA          254
1111 #define TWCY_KIRIBATI      1018
1112 #define TWCY_KOREA           82
1113 #define TWCY_KUWAIT         965
1114 #define TWCY_LAOS          1019
1115 #define TWCY_LEBANON       1020
1116 #define TWCY_LIBERIA        231
1117 #define TWCY_LIBYA          218
1118 #define TWCY_LIECHTENSTEIN   41
1119 #define TWCY_LUXENBOURG     352
1120 #define TWCY_MACAO          853
1121 #define TWCY_MADAGASCAR    1021
1122 #define TWCY_MALAWI         265
1123 #define TWCY_MALAYSIA        60
1124 #define TWCY_MALDIVES       960
1125 #define TWCY_MALI          1022
1126 #define TWCY_MALTA          356
1127 #define TWCY_MARSHALLIS     692
1128 #define TWCY_MAURITANIA    1023
1129 #define TWCY_MAURITIUS      230
1130 #define TWCY_MEXICO           3
1131 #define TWCY_MICRONESIA     691
1132 #define TWCY_MIQUELON       508
1133 #define TWCY_MONACO          33
1134 #define TWCY_MONGOLIA      1024
1135 #define TWCY_MONTSERRAT    8011
1136 #define TWCY_MOROCCO        212
1137 #define TWCY_MOZAMBIQUE    1025
1138 #define TWCY_NAMIBIA        264
1139 #define TWCY_NAURU         1026
1140 #define TWCY_NEPAL          977
1141 #define TWCY_NETHERLANDS     31
1142 #define TWCY_NETHANTILLES   599
1143 #define TWCY_NEVIS         8012
1144 #define TWCY_NEWCALEDONIA   687
1145 #define TWCY_NEWZEALAND      64
1146 #define TWCY_NICARAGUA      505
1147 #define TWCY_NIGER          227
1148 #define TWCY_NIGERIA        234
1149 #define TWCY_NIUE          1027
1150 #define TWCY_NORFOLKI      1028
1151 #define TWCY_NORWAY          47
1152 #define TWCY_OMAN           968
1153 #define TWCY_PAKISTAN        92
1154 #define TWCY_PALAU         1029
1155 #define TWCY_PANAMA         507
1156 #define TWCY_PARAGUAY       595
1157 #define TWCY_PERU            51
1158 #define TWCY_PHILLIPPINES    63
1159 #define TWCY_PITCAIRNIS    1030
1160 #define TWCY_PNEWGUINEA     675
1161 #define TWCY_POLAND          48
1162 #define TWCY_PORTUGAL       351
1163 #define TWCY_QATAR          974
1164 #define TWCY_REUNIONI      1031
1165 #define TWCY_ROMANIA         40
1166 #define TWCY_RWANDA         250
1167 #define TWCY_SAIPAN         670
1168 #define TWCY_SANMARINO       39
1169 #define TWCY_SAOTOME       1033
1170 #define TWCY_SAUDIARABIA    966
1171 #define TWCY_SENEGAL        221
1172 #define TWCY_SEYCHELLESIS  1034
1173 #define TWCY_SIERRALEONE   1035
1174 #define TWCY_SINGAPORE       65
1175 #define TWCY_SOLOMONIS     1036
1176 #define TWCY_SOMALI        1037
1177 #define TWCY_SOUTHAFRICA    27
1178 #define TWCY_SPAIN           34
1179 #define TWCY_SRILANKA        94
1180 #define TWCY_STHELENA      1032
1181 #define TWCY_STKITTS       8013
1182 #define TWCY_STLUCIA       8014
1183 #define TWCY_STPIERRE       508
1184 #define TWCY_STVINCENT     8015
1185 #define TWCY_SUDAN         1038
1186 #define TWCY_SURINAME       597
1187 #define TWCY_SWAZILAND      268
1188 #define TWCY_SWEDEN          46
1189 #define TWCY_SWITZERLAND     41
1190 #define TWCY_SYRIA         1039
1191 #define TWCY_TAIWAN         886
1192 #define TWCY_TANZANIA       255
1193 #define TWCY_THAILAND        66
1194 #define TWCY_TOBAGO        8016
1195 #define TWCY_TOGO           228
1196 #define TWCY_TONGAIS        676
1197 #define TWCY_TRINIDAD      8016
1198 #define TWCY_TUNISIA        216
1199 #define TWCY_TURKEY          90
1200 #define TWCY_TURKSCAICOS   8017
1201 #define TWCY_TUVALU        1040
1202 #define TWCY_UGANDA         256
1203 #define TWCY_USSR             7
1204 #define TWCY_UAEMIRATES     971
1205 #define TWCY_UNITEDKINGDOM   44
1206 #define TWCY_USA              1
1207 #define TWCY_URUGUAY        598
1208 #define TWCY_VANUATU       1041
1209 #define TWCY_VATICANCITY     39
1210 #define TWCY_VENEZUELA       58
1211 #define TWCY_WAKE          1042
1212 #define TWCY_WALLISIS      1043
1213 #define TWCY_WESTERNSAHARA 1044
1214 #define TWCY_WESTERNSAMOA  1045
1215 #define TWCY_YEMEN         1046
1216 #define TWCY_YUGOSLAVIA      38
1217 #define TWCY_ZAIRE          243
1218 #define TWCY_ZAMBIA         260
1219 #define TWCY_ZIMBABWE       263
1220 /* Added for 1.8 */
1221 #define TWCY_ALBANIA        355
1222 #define TWCY_ARMENIA        374
1223 #define TWCY_AZERBAIJAN     994
1224 #define TWCY_BELARUS        375
1225 #define TWCY_BOSNIAHERZGO   387
1226 #define TWCY_CAMBODIA       855
1227 #define TWCY_CROATIA        385
1228 #define TWCY_CZECHREPUBLIC  420
1229 #define TWCY_DIEGOGARCIA    246
1230 #define TWCY_ERITREA        291
1231 #define TWCY_ESTONIA        372
1232 #define TWCY_GEORGIA        995
1233 #define TWCY_LATVIA         371
1234 #define TWCY_LESOTHO        266
1235 #define TWCY_LITHUANIA      370
1236 #define TWCY_MACEDONIA      389
1237 #define TWCY_MAYOTTEIS      269
1238 #define TWCY_MOLDOVA        373
1239 #define TWCY_MYANMAR        95
1240 #define TWCY_NORTHKOREA     850
1241 #define TWCY_PUERTORICO     787
1242 #define TWCY_RUSSIA         7
1243 #define TWCY_SERBIA         381
1244 #define TWCY_SLOVAKIA       421
1245 #define TWCY_SLOVENIA       386
1246 #define TWCY_SOUTHKOREA     82
1247 #define TWCY_UKRAINE        380
1248 #define TWCY_USVIRGINIS     340
1249 #define TWCY_VIETNAM        84
1250 
1251 /****************************************************************************
1252  * Language Constants                                                       *
1253  ****************************************************************************/
1254 
1255 #define TWLG_DAN              0 /* Danish                 */
1256 #define TWLG_DUT              1 /* Dutch                  */
1257 #define TWLG_ENG              2 /* International English  */
1258 #define TWLG_FCF              3 /* French Canadian        */
1259 #define TWLG_FIN              4 /* Finnish                */
1260 #define TWLG_FRN              5 /* French                 */
1261 #define TWLG_GER              6 /* German                 */
1262 #define TWLG_ICE              7 /* Icelandic              */
1263 #define TWLG_ITN              8 /* Italian                */
1264 #define TWLG_NOR              9 /* Norwegian              */
1265 #define TWLG_POR             10 /* Portuguese             */
1266 #define TWLG_SPA             11 /* Spanish                */
1267 #define TWLG_SWE             12 /* Swedish                */
1268 #define TWLG_USA             13 /* U.S. English           */
1269 /* Added for 1.8 */
1270 #define TWLG_USERLOCALE           -1
1271 #define TWLG_AFRIKAANS            14
1272 #define TWLG_ALBANIA              15
1273 #define TWLG_ARABIC               16
1274 #define TWLG_ARABIC_ALGERIA       17
1275 #define TWLG_ARABIC_BAHRAIN       18
1276 #define TWLG_ARABIC_EGYPT         19
1277 #define TWLG_ARABIC_IRAQ          20
1278 #define TWLG_ARABIC_JORDAN        21
1279 #define TWLG_ARABIC_KUWAIT        22
1280 #define TWLG_ARABIC_LEBANON       23
1281 #define TWLG_ARABIC_LIBYA         24
1282 #define TWLG_ARABIC_MOROCCO       25
1283 #define TWLG_ARABIC_OMAN          26
1284 #define TWLG_ARABIC_QATAR         27
1285 #define TWLG_ARABIC_SAUDIARABIA   28
1286 #define TWLG_ARABIC_SYRIA         29
1287 #define TWLG_ARABIC_TUNISIA       30
1288 #define TWLG_ARABIC_UAE           31 /* United Arabic Emirates */
1289 #define TWLG_ARABIC_YEMEN         32
1290 #define TWLG_BASQUE               33
1291 #define TWLG_BYELORUSSIAN         34
1292 #define TWLG_BULGARIAN            35
1293 #define TWLG_CATALAN              36
1294 #define TWLG_CHINESE              37
1295 #define TWLG_CHINESE_HONGKONG     38
1296 #define TWLG_CHINESE_PRC          39 /* People's Republic of China */
1297 #define TWLG_CHINESE_SINGAPORE    40
1298 #define TWLG_CHINESE_SIMPLIFIED   41
1299 #define TWLG_CHINESE_TAIWAN       42
1300 #define TWLG_CHINESE_TRADITIONAL  43
1301 #define TWLG_CROATIA              44
1302 #define TWLG_CZECH                45
1303 #define TWLG_DANISH               TWLG_DAN
1304 #define TWLG_DUTCH                TWLG_DUT
1305 #define TWLG_DUTCH_BELGIAN        46
1306 #define TWLG_ENGLISH              TWLG_ENG
1307 #define TWLG_ENGLISH_AUSTRALIAN   47
1308 #define TWLG_ENGLISH_CANADIAN     48
1309 #define TWLG_ENGLISH_IRELAND      49
1310 #define TWLG_ENGLISH_NEWZEALAND   50
1311 #define TWLG_ENGLISH_SOUTHAFRICA  51
1312 #define TWLG_ENGLISH_UK           52
1313 #define TWLG_ENGLISH_USA          TWLG_USA
1314 #define TWLG_ESTONIAN             53
1315 #define TWLG_FAEROESE             54
1316 #define TWLG_FARSI                55
1317 #define TWLG_FINNISH              TWLG_FIN
1318 #define TWLG_FRENCH               TWLG_FRN
1319 #define TWLG_FRENCH_BELGIAN       56
1320 #define TWLG_FRENCH_CANADIAN      TWLG_FCF
1321 #define TWLG_FRENCH_LUXEMBOURG    57
1322 #define TWLG_FRENCH_SWISS         58
1323 #define TWLG_GERMAN               TWLG_GER
1324 #define TWLG_GERMAN_AUSTRIAN      59
1325 #define TWLG_GERMAN_LUXEMBOURG    60
1326 #define TWLG_GERMAN_LIECHTENSTEIN 61
1327 #define TWLG_GERMAN_SWISS         62
1328 #define TWLG_GREEK                63
1329 #define TWLG_HEBREW               64
1330 #define TWLG_HUNGARIAN            65
1331 #define TWLG_ICELANDIC            TWLG_ICE
1332 #define TWLG_INDONESIAN           66
1333 #define TWLG_ITALIAN              TWLG_ITN
1334 #define TWLG_ITALIAN_SWISS        67
1335 #define TWLG_JAPANESE             68
1336 #define TWLG_KOREAN               69
1337 #define TWLG_KOREAN_JOHAB         70
1338 #define TWLG_LATVIAN              71
1339 #define TWLG_LITHUANIAN           72
1340 #define TWLG_NORWEGIAN            TWLG_NOR
1341 #define TWLG_NORWEGIAN_BOKMAL     73
1342 #define TWLG_NORWEGIAN_NYNORSK    74
1343 #define TWLG_POLISH               75
1344 #define TWLG_PORTUGUESE           TWLG_POR
1345 #define TWLG_PORTUGUESE_BRAZIL    76
1346 #define TWLG_ROMANIAN             77
1347 #define TWLG_RUSSIAN              78
1348 #define TWLG_SERBIAN_LATIN        79
1349 #define TWLG_SLOVAK               80
1350 #define TWLG_SLOVENIAN            81
1351 #define TWLG_SPANISH              TWLG_SPA
1352 #define TWLG_SPANISH_MEXICAN      82
1353 #define TWLG_SPANISH_MODERN       83
1354 #define TWLG_SWEDISH              TWLG_SWE
1355 #define TWLG_THAI                 84
1356 #define TWLG_TURKISH              85
1357 #define TWLG_UKRANIAN             86
1358 /* More stuff added for 1.8 */
1359 #define TWLG_ASSAMESE             87
1360 #define TWLG_BENGALI              88
1361 #define TWLG_BIHARI               89
1362 #define TWLG_BODO                 90
1363 #define TWLG_DOGRI                91
1364 #define TWLG_GUJARATI             92
1365 #define TWLG_HARYANVI             93
1366 #define TWLG_HINDI                94
1367 #define TWLG_KANNADA              95
1368 #define TWLG_KASHMIRI             96
1369 #define TWLG_MALAYALAM            97
1370 #define TWLG_MARATHI              98
1371 #define TWLG_MARWARI              99
1372 #define TWLG_MEGHALAYAN          100
1373 #define TWLG_MIZO                101
1374 #define TWLG_NAGA                102
1375 #define TWLG_ORISSI              103
1376 #define TWLG_PUNJABI             104
1377 #define TWLG_PUSHTU              105
1378 #define TWLG_SERBIAN_CYRILLIC    106
1379 #define TWLG_SIKKIMI             107
1380 #define TWLG_SWEDISH_FINLAND     108
1381 #define TWLG_TAMIL               109
1382 #define TWLG_TELUGU              110
1383 #define TWLG_TRIPURI             111
1384 #define TWLG_URDU                112
1385 #define TWLG_VIETNAMESE          113
1386 
1387 /****************************************************************************
1388  * Data Groups                                                              *
1389  ****************************************************************************/
1390 
1391 /* More Data Groups may be added in the future.
1392  * Possible candidates include text, vector graphics, sound, etc.
1393  * NOTE: Data Group constants must be powers of 2 as they are used
1394  *       as bitflags when Application asks DSM to present a list of DSs.
1395  */
1396 
1397 #define DG_CONTROL          0x0001L /* data pertaining to control       */
1398 #define DG_IMAGE            0x0002L /* data pertaining to raster images */
1399 /* Added 1.8 */
1400 #define DG_AUDIO            0x0004L /* data pertaining to audio */
1401 
1402 /****************************************************************************
1403  * Data Argument Types                                                      *
1404  ****************************************************************************/
1405 
1406 /*  SDH - 03/23/95 - WATCH                                                  */
1407 /*  The thunker requires knowledge about size of data being passed in the   */
1408 /*  lpData parameter to DS_Entry (which is not readily available due to     */
1409 /*  type LPVOID.  Thus, we key off the DAT_ argument to determine the size. */
1410 /*  This has a couple implications:                                         */
1411 /*  1) Any additional DAT_ features require modifications to the thunk code */
1412 /*     for thunker support.                                                 */
1413 /*  2) Any applications which use the custom capabilities are not supported */
1414 /*     under thunking since we have no way of knowing what size data (if    */
1415 /*     any) is being passed.                                                */
1416 
1417 #define DAT_NULL            0x0000 /* No data or structure. */
1418 #define DAT_CUSTOMBASE      0x8000 /* Base of custom DATs.  */
1419 
1420 /* Data Argument Types for the DG_CONTROL Data Group. */
1421 #define DAT_CAPABILITY      0x0001 /* TW_CAPABILITY                        */
1422 #define DAT_EVENT           0x0002 /* TW_EVENT                             */
1423 #define DAT_IDENTITY        0x0003 /* TW_IDENTITY                          */
1424 #define DAT_PARENT          0x0004 /* TW_HANDLE, application win handle in Windows */
1425 #define DAT_PENDINGXFERS    0x0005 /* TW_PENDINGXFERS                      */
1426 #define DAT_SETUPMEMXFER    0x0006 /* TW_SETUPMEMXFER                      */
1427 #define DAT_SETUPFILEXFER   0x0007 /* TW_SETUPFILEXFER                     */
1428 #define DAT_STATUS          0x0008 /* TW_STATUS                            */
1429 #define DAT_USERINTERFACE   0x0009 /* TW_USERINTERFACE                     */
1430 #define DAT_XFERGROUP       0x000a /* TW_UINT32                            */
1431 /*  SDH - 03/21/95 - TWUNK                                         */
1432 /*  Additional message required for thunker to request the special */
1433 /*  identity information.                                          */
1434 #define DAT_TWUNKIDENTITY   0x000b /* TW_TWUNKIDENTITY                     */
1435 #define DAT_CUSTOMDSDATA    0x000c /* TW_CUSTOMDSDATA.                     */
1436 /* Added 1.8 */
1437 #define DAT_DEVICEEVENT     0x000d /* TW_DEVICEEVENT                       */
1438 #define DAT_FILESYSTEM      0x000e /* TW_FILESYSTEM                        */
1439 #define DAT_PASSTHRU        0x000f /* TW_PASSTHRU                          */
1440 
1441 /* Data Argument Types for the DG_IMAGE Data Group. */
1442 #define DAT_IMAGEINFO       0x0101 /* TW_IMAGEINFO                         */
1443 #define DAT_IMAGELAYOUT     0x0102 /* TW_IMAGELAYOUT                       */
1444 #define DAT_IMAGEMEMXFER    0x0103 /* TW_IMAGEMEMXFER                      */
1445 #define DAT_IMAGENATIVEXFER 0x0104 /* TW_UINT32 loword is hDIB, PICHandle  */
1446 #define DAT_IMAGEFILEXFER   0x0105 /* Null data                            */
1447 #define DAT_CIECOLOR        0x0106 /* TW_CIECOLOR                          */
1448 #define DAT_GRAYRESPONSE    0x0107 /* TW_GRAYRESPONSE                      */
1449 #define DAT_RGBRESPONSE     0x0108 /* TW_RGBRESPONSE                       */
1450 #define DAT_JPEGCOMPRESSION 0x0109 /* TW_JPEGCOMPRESSION                   */
1451 #define DAT_PALETTE8        0x010a /* TW_PALETTE8                          */
1452 #define DAT_EXTIMAGEINFO    0x010b /* TW_EXTIMAGEINFO -- for 1.7 Spec.     */
1453 
1454 /* Added 1.8 */
1455 /* Data Argument Types for the DG_AUDIO Data Group. */
1456 #define DAT_AUDIOFILEXFER   0x0201 /* Null data                            */
1457 #define DAT_AUDIOINFO       0x0202 /* TW_AUDIOINFO                         */
1458 #define DAT_AUDIONATIVEXFER 0x0203 /* TW_UINT32 handle to WAV, (AIFF Mac)  */
1459 
1460 /* Added 1.9 */
1461 #define DAT_ SETUPFILEXFER2 0x0301 /* New file xfer operation              */
1462 
1463 /****************************************************************************
1464  * Messages                                                                 *
1465  ****************************************************************************/
1466 
1467 /* All message constants are unique.
1468  * Messages are grouped according to which DATs they are used with.*/
1469 
1470 #define MSG_NULL         0x0000 /* Used in TW_EVENT structure               */
1471 #define MSG_CUSTOMBASE   0x8000 /* Base of custom messages                  */
1472 
1473 /* Generic messages may be used with any of several DATs.                   */
1474 #define MSG_GET          0x0001 /* Get one or more values                   */
1475 #define MSG_GETCURRENT   0x0002 /* Get current value                        */
1476 #define MSG_GETDEFAULT   0x0003 /* Get default (e.g. power up) value        */
1477 #define MSG_GETFIRST     0x0004 /* Get first of a series of items, e.g. DSs */
1478 #define MSG_GETNEXT      0x0005 /* Iterate through a series of items.       */
1479 #define MSG_SET          0x0006 /* Set one or more values                   */
1480 #define MSG_RESET        0x0007 /* Set current value to default value       */
1481 #define MSG_QUERYSUPPORT 0x0008 /* Get supported operations on the cap.     */
1482 
1483 /* Messages used with DAT_NULL                                              */
1484 #define MSG_XFERREADY    0x0101 /* The data source has data ready           */
1485 #define MSG_CLOSEDSREQ   0x0102 /* Request for Application. to close DS             */
1486 #define MSG_CLOSEDSOK    0x0103 /* Tell the Application. to save the state.         */
1487 /* Added 1.8 */
1488 #define MSG_DEVICEEVENT  0X0104 /* Some event has taken place               */
1489 
1490 /* Messages used with a pointer to a DAT_STATUS structure                   */
1491 #define MSG_CHECKSTATUS  0x0201 /* Get status information                   */
1492 
1493 /* Messages used with a pointer to DAT_PARENT data                          */
1494 #define MSG_OPENDSM      0x0301 /* Open the DSM                             */
1495 #define MSG_CLOSEDSM     0x0302 /* Close the DSM                            */
1496 
1497 /* Messages used with a pointer to a DAT_IDENTITY structure                 */
1498 #define MSG_OPENDS       0x0401 /* Open a data source                       */
1499 #define MSG_CLOSEDS      0x0402 /* Close a data source                      */
1500 #define MSG_USERSELECT   0x0403 /* Put up a dialog of all DS                */
1501 
1502 /* Messages used with a pointer to a DAT_USERINTERFACE structure            */
1503 #define MSG_DISABLEDS    0x0501 /* Disable data transfer in the DS          */
1504 #define MSG_ENABLEDS     0x0502 /* Enable data transfer in the DS           */
1505 #define MSG_ENABLEDSUIONLY  0x0503  /* Enable for saving DS state only.     */
1506 
1507 /* Messages used with a pointer to a DAT_EVENT structure                    */
1508 #define MSG_PROCESSEVENT 0x0601
1509 
1510 /* Messages used with a pointer to a DAT_PENDINGXFERS structure             */
1511 #define MSG_ENDXFER      0x0701
1512 #define MSG_STOPFEEDER   0x0702
1513 
1514 /* Added 1.8 */
1515 /* Messages used with a pointer to a DAT_FILESYSTEM structure               */
1516 #define MSG_CHANGEDIRECTORY   0x0801
1517 #define MSG_CREATEDIRECTORY   0x0802
1518 #define MSG_DELETE            0x0803
1519 #define MSG_FORMATMEDIA       0x0804
1520 #define MSG_GETCLOSE          0x0805
1521 #define MSG_GETFIRSTFILE      0x0806
1522 #define MSG_GETINFO           0x0807
1523 #define MSG_GETNEXTFILE       0x0808
1524 #define MSG_RENAME            0x0809
1525 #define MSG_COPY              0x080A
1526 #define MSG_AUTOMATICCAPTUREDIRECTORY 0x080B
1527 
1528 /* Messages used with a pointer to a DAT_PASSTHRU structure                 */
1529 #define MSG_PASSTHRU          0x0901
1530 
1531 /****************************************************************************
1532  * Capabilities                                                             *
1533  ****************************************************************************/
1534 
1535 #define CAP_CUSTOMBASE          0x8000 /* Base of custom capabilities */
1536 
1537 /* all data sources are REQUIRED to support these caps */
1538 #define CAP_XFERCOUNT           0x0001
1539 
1540 /* image data sources are REQUIRED to support these caps */
1541 #define ICAP_COMPRESSION        0x0100
1542 #define ICAP_PIXELTYPE          0x0101
1543 #define ICAP_UNITS              0x0102 /* default is TWUN_INCHES */
1544 #define ICAP_XFERMECH           0x0103
1545 
1546 /* all data sources MAY support these caps */
1547 #define CAP_AUTHOR                  0x1000
1548 #define CAP_CAPTION                 0x1001
1549 #define CAP_FEEDERENABLED           0x1002
1550 #define CAP_FEEDERLOADED            0x1003
1551 #define CAP_TIMEDATE                0x1004
1552 #define CAP_SUPPORTEDCAPS           0x1005
1553 #define CAP_EXTENDEDCAPS            0x1006
1554 #define CAP_AUTOFEED                0x1007
1555 #define CAP_CLEARPAGE               0x1008
1556 #define CAP_FEEDPAGE                0x1009
1557 #define CAP_REWINDPAGE              0x100a
1558 #define CAP_INDICATORS              0x100b   /* Added 1.1 */
1559 #define CAP_SUPPORTEDCAPSEXT        0x100c   /* Added 1.6 */
1560 #define CAP_PAPERDETECTABLE         0x100d   /* Added 1.6 */
1561 #define CAP_UICONTROLLABLE          0x100e   /* Added 1.6 */
1562 #define CAP_DEVICEONLINE            0x100f   /* Added 1.6 */
1563 #define CAP_AUTOSCAN                0x1010   /* Added 1.6 */
1564 #define CAP_THUMBNAILSENABLED       0x1011   /* Added 1.7 */
1565 #define CAP_DUPLEX                  0x1012   /* Added 1.7 */
1566 #define CAP_DUPLEXENABLED           0x1013   /* Added 1.7 */
1567 #define CAP_ENABLEDSUIONLY          0x1014   /* Added 1.7 */
1568 #define CAP_CUSTOMDSDATA            0x1015   /* Added 1.7 */
1569 #define CAP_ENDORSER                0x1016   /* Added 1.7 */
1570 #define CAP_JOBCONTROL              0x1017   /* Added 1.7 */
1571 #define CAP_ALARMS                  0x1018   /* Added 1.8 */
1572 #define CAP_ALARMVOLUME             0x1019   /* Added 1.8 */
1573 #define CAP_AUTOMATICCAPTURE        0x101a   /* Added 1.8 */
1574 #define CAP_TIMEBEFOREFIRSTCAPTURE  0x101b   /* Added 1.8 */
1575 #define CAP_TIMEBETWEENCAPTURES     0x101c   /* Added 1.8 */
1576 #define CAP_CLEARBUFFERS            0x101d   /* Added 1.8 */
1577 #define CAP_MAXBATCHBUFFERS         0x101e   /* Added 1.8 */
1578 #define CAP_DEVICETIMEDATE          0x101f   /* Added 1.8 */
1579 #define CAP_POWERSUPPLY             0x1020   /* Added 1.8 */
1580 #define CAP_CAMERAPREVIEWUI         0x1021   /* Added 1.8 */
1581 #define CAP_DEVICEEVENT             0x1022   /* Added 1.8 */
1582 #define CAP_SERIALNUMBER            0x1024   /* Added 1.8 */
1583 #define CAP_PRINTER                 0x1026   /* Added 1.8 */
1584 #define CAP_PRINTERENABLED          0x1027   /* Added 1.8 */
1585 #define CAP_PRINTERINDEX            0x1028   /* Added 1.8 */
1586 #define CAP_PRINTERMODE             0x1029   /* Added 1.8 */
1587 #define CAP_PRINTERSTRING           0x102a   /* Added 1.8 */
1588 #define CAP_PRINTERSUFFIX           0x102b   /* Added 1.8 */
1589 #define CAP_LANGUAGE                0x102c   /* Added 1.8 */
1590 #define CAP_FEEDERALIGNMENT         0x102d   /* Added 1.8 */
1591 #define CAP_FEEDERORDER             0x102e   /* Added 1.8 */
1592 #define CAP_REACQUIREALLOWED        0x1030   /* Added 1.8 */
1593 #define CAP_BATTERYMINUTES          0x1032   /* Added 1.8 */
1594 #define CAP_BATTERYPERCENTAGE       0x1033   /* Added 1.8 */
1595 
1596 /* image data sources MAY support these caps */
1597 #define ICAP_AUTOBRIGHT                   0x1100
1598 #define ICAP_BRIGHTNESS                   0x1101
1599 #define ICAP_CONTRAST                     0x1103
1600 #define ICAP_CUSTHALFTONE                 0x1104
1601 #define ICAP_EXPOSURETIME                 0x1105
1602 #define ICAP_FILTER                       0x1106
1603 #define ICAP_FLASHUSED                    0x1107
1604 #define ICAP_GAMMA                        0x1108
1605 #define ICAP_HALFTONES                    0x1109
1606 #define ICAP_HIGHLIGHT                    0x110a
1607 #define ICAP_IMAGEFILEFORMAT              0x110c
1608 #define ICAP_LAMPSTATE                    0x110d
1609 #define ICAP_LIGHTSOURCE                  0x110e
1610 #define ICAP_ORIENTATION                  0x1110
1611 #define ICAP_PHYSICALWIDTH                0x1111
1612 #define ICAP_PHYSICALHEIGHT               0x1112
1613 #define ICAP_SHADOW                       0x1113
1614 #define ICAP_FRAMES                       0x1114
1615 #define ICAP_XNATIVERESOLUTION            0x1116
1616 #define ICAP_YNATIVERESOLUTION            0x1117
1617 #define ICAP_XRESOLUTION                  0x1118
1618 #define ICAP_YRESOLUTION                  0x1119
1619 #define ICAP_MAXFRAMES                    0x111a
1620 #define ICAP_TILES                        0x111b
1621 #define ICAP_BITORDER                     0x111c
1622 #define ICAP_CCITTKFACTOR                 0x111d
1623 #define ICAP_LIGHTPATH                    0x111e
1624 #define ICAP_PIXELFLAVOR                  0x111f
1625 #define ICAP_PLANARCHUNKY                 0x1120
1626 #define ICAP_ROTATION                     0x1121
1627 #define ICAP_SUPPORTEDSIZES               0x1122
1628 #define ICAP_THRESHOLD                    0x1123
1629 #define ICAP_XSCALING                     0x1124
1630 #define ICAP_YSCALING                     0x1125
1631 #define ICAP_BITORDERCODES                0x1126
1632 #define ICAP_PIXELFLAVORCODES             0x1127
1633 #define ICAP_JPEGPIXELTYPE                0x1128
1634 #define ICAP_TIMEFILL                     0x112a
1635 #define ICAP_BITDEPTH                     0x112b
1636 #define ICAP_BITDEPTHREDUCTION            0x112c  /* Added 1.5 */
1637 #define ICAP_UNDEFINEDIMAGESIZE           0x112d  /* Added 1.6 */
1638 #define ICAP_IMAGEDATASET                 0x112e  /* Added 1.7 */
1639 #define ICAP_EXTIMAGEINFO                 0x112f  /* Added 1.7 */
1640 #define ICAP_MINIMUMHEIGHT                0x1130  /* Added 1.7 */
1641 #define ICAP_MINIMUMWIDTH                 0x1131  /* Added 1.7 */
1642 #define ICAP_FLIPROTATION                 0x1136  /* Added 1.8 */
1643 #define ICAP_BARCODEDETECTIONENABLED      0x1137  /* Added 1.8 */
1644 #define ICAP_SUPPORTEDBARCODETYPES        0x1138  /* Added 1.8 */
1645 #define ICAP_BARCODEMAXSEARCHPRIORITIES   0x1139  /* Added 1.8 */
1646 #define ICAP_BARCODESEARCHPRIORITIES      0x113a  /* Added 1.8 */
1647 #define ICAP_BARCODESEARCHMODE            0x113b  /* Added 1.8 */
1648 #define ICAP_BARCODEMAXRETRIES            0x113c  /* Added 1.8 */
1649 #define ICAP_BARCODETIMEOUT               0x113d  /* Added 1.8 */
1650 #define ICAP_ZOOMFACTOR                   0x113e  /* Added 1.8 */
1651 #define ICAP_PATCHCODEDETECTIONENABLED    0x113f  /* Added 1.8 */
1652 #define ICAP_SUPPORTEDPATCHCODETYPES      0x1140  /* Added 1.8 */
1653 #define ICAP_PATCHCODEMAXSEARCHPRIORITIES 0x1141  /* Added 1.8 */
1654 #define ICAP_PATCHCODESEARCHPRIORITIES    0x1142  /* Added 1.8 */
1655 #define ICAP_PATCHCODESEARCHMODE          0x1143  /* Added 1.8 */
1656 #define ICAP_PATCHCODEMAXRETRIES          0x1144  /* Added 1.8 */
1657 #define ICAP_PATCHCODETIMEOUT             0x1145  /* Added 1.8 */
1658 #define ICAP_FLASHUSED2                   0x1146  /* Added 1.8 */
1659 #define ICAP_IMAGEFILTER                  0x1147  /* Added 1.8 */
1660 #define ICAP_NOISEFILTER                  0x1148  /* Added 1.8 */
1661 #define ICAP_OVERSCAN                     0x1149  /* Added 1.8 */
1662 #define ICAP_AUTOMATICBORDERDETECTION     0x1150  /* Added 1.8 */
1663 #define ICAP_AUTOMATICDESKEW              0x1151  /* Added 1.8 */
1664 #define ICAP_AUTOMATICROTATE              0x1152  /* Added 1.8 */
1665 #define ICAP_JPEGQUALITY                  0x1153  /* Added 1.9 */
1666 
1667 /* image data sources MAY support these audio caps */
1668 #define ACAP_AUDIOFILEFORMAT    0x1201  /* Added 1.8 */
1669 #define ACAP_XFERMECH           0x1202  /* Added 1.8 */
1670 
1671 /* ----------------------------------------------------------------------- *\
1672 
1673   Version 1.7:      Following is Extended Image Info Attributes.
1674   July 1997
1675   KHL
1676 
1677 \* ----------------------------------------------------------------------- */
1678 
1679 #define TWEI_BARCODEX               0x1200
1680 #define TWEI_BARCODEY               0x1201
1681 #define TWEI_BARCODETEXT            0x1202
1682 #define TWEI_BARCODETYPE            0x1203
1683 #define TWEI_DESHADETOP             0x1204
1684 #define TWEI_DESHADELEFT            0x1205
1685 #define TWEI_DESHADEHEIGHT          0x1206
1686 #define TWEI_DESHADEWIDTH           0x1207
1687 #define TWEI_DESHADESIZE            0x1208
1688 #define TWEI_SPECKLESREMOVED        0x1209
1689 #define TWEI_HORZLINEXCOORD         0x120A
1690 #define TWEI_HORZLINEYCOORD         0x120B
1691 #define TWEI_HORZLINELENGTH         0x120C
1692 #define TWEI_HORZLINETHICKNESS      0x120D
1693 #define TWEI_VERTLINEXCOORD         0x120E
1694 #define TWEI_VERTLINEYCOORD         0x120F
1695 #define TWEI_VERTLINELENGTH         0x1210
1696 #define TWEI_VERTLINETHICKNESS      0x1211
1697 #define TWEI_PATCHCODE              0x1212
1698 #define TWEI_ENDORSEDTEXT           0x1213
1699 #define TWEI_FORMCONFIDENCE         0x1214
1700 #define TWEI_FORMTEMPLATEMATCH      0x1215
1701 #define TWEI_FORMTEMPLATEPAGEMATCH  0x1216
1702 #define TWEI_FORMHORZDOCOFFSET      0x1217
1703 #define TWEI_FORMVERTDOCOFFSET      0x1218
1704 #define TWEI_BARCODECOUNT           0x1219
1705 #define TWEI_BARCODECONFIDENCE      0x121A
1706 #define TWEI_BARCODEROTATION        0x121B
1707 #define TWEI_BARCODETEXTLENGTH      0x121C
1708 #define TWEI_DESHADECOUNT           0x121D
1709 #define TWEI_DESHADEBLACKCOUNTOLD   0x121E
1710 #define TWEI_DESHADEBLACKCOUNTNEW   0x121F
1711 #define TWEI_DESHADEBLACKRLMIN      0x1220
1712 #define TWEI_DESHADEBLACKRLMAX      0x1221
1713 #define TWEI_DESHADEWHITECOUNTOLD   0x1222
1714 #define TWEI_DESHADEWHITECOUNTNEW   0x1223
1715 #define TWEI_DESHADEWHITERLMIN      0x1224
1716 #define TWEI_DESHADEWHITERLAVE      0x1225
1717 #define TWEI_DESHADEWHITERLMAX      0x1226
1718 #define TWEI_BLACKSPECKLESREMOVED   0x1227
1719 #define TWEI_WHITESPECKLESREMOVED   0x1228
1720 #define TWEI_HORZLINECOUNT          0x1229
1721 #define TWEI_VERTLINECOUNT          0x122A
1722 #define TWEI_DESKEWSTATUS           0x122B
1723 #define TWEI_SKEWORIGINALANGLE      0x122C
1724 #define TWEI_SKEWFINALANGLE         0x122D
1725 #define TWEI_SKEWCONFIDENCE         0x122E
1726 #define TWEI_SKEWWINDOWX1           0x122F
1727 #define TWEI_SKEWWINDOWY1           0x1230
1728 #define TWEI_SKEWWINDOWX2           0x1231
1729 #define TWEI_SKEWWINDOWY2           0x1232
1730 #define TWEI_SKEWWINDOWX3           0x1233
1731 #define TWEI_SKEWWINDOWY3           0x1234
1732 #define TWEI_SKEWWINDOWX4           0x1235
1733 #define TWEI_SKEWWINDOWY4           0x1236
1734 #define TWEI_BOOKNAME               0x1238  /* added 1.9 */
1735 #define TWEI_CHAPTERNUMBER          0x1239  /* added 1.9 */
1736 #define TWEI_DOCUMENTNUMBER         0x123A  /* added 1.9 */
1737 #define TWEI_PAGENUMBER             0x123B  /* added 1.9 */
1738 #define TWEI_CAMERA                 0x123C  /* added 1.9 */
1739 #define TWEI_FRAMENUMBER            0x123D  /* added 1.9 */
1740 #define TWEI_FRAME              0x123E  /* added 1.9 */
1741 #define TWEI_PIXELFLAVOR            0x123F  /* added 1.9 */
1742 
1743 #define TWEJ_NONE                   0x0000
1744 #define TWEJ_MIDSEPARATOR           0x0001
1745 #define TWEJ_PATCH1                 0x0002
1746 #define TWEJ_PATCH2                 0x0003
1747 #define TWEJ_PATCH3                 0x0004
1748 #define TWEJ_PATCH4                 0x0005
1749 #define TWEJ_PATCH6                 0x0006
1750 #define TWEJ_PATCHT                 0x0007
1751 
1752 /* Added 1.8 */
1753 /* TW_PASSTHRU.Direction values */
1754 #define TWDR_GET                1
1755 #define TWDR_SET                2
1756 
1757 /***************************************************************************
1758  *            Return Codes and Condition Codes section                     *
1759  ***************************************************************************/
1760 
1761 /* Return Codes: DSM_Entry and DS_Entry may return any one of these values. */
1762 #define TWRC_CUSTOMBASE     0x8000
1763 
1764 #define TWRC_SUCCESS          0
1765 #define TWRC_FAILURE          1 /* Application may get TW_STATUS for info on failure */
1766 #define TWRC_CHECKSTATUS      2 /* "tried hard"; get status                  */
1767 #define TWRC_CANCEL           3
1768 #define TWRC_DSEVENT          4
1769 #define TWRC_NOTDSEVENT       5
1770 #define TWRC_XFERDONE         6
1771 #define TWRC_ENDOFLIST        7 /* After MSG_GETNEXT if nothing left         */
1772 #define TWRC_INFONOTSUPPORTED 8
1773 #define TWRC_DATANOTAVAILABLE 9
1774 
1775 /* Condition Codes: Application gets these by doing DG_CONTROL DAT_STATUS MSG_GET.  */
1776 #define TWCC_CUSTOMBASE         0x8000
1777 
1778 #define TWCC_SUCCESS            0 /* It worked!                                */
1779 #define TWCC_BUMMER             1 /* Failure due to unknown causes             */
1780 #define TWCC_LOWMEMORY          2 /* Not enough memory to perform operation    */
1781 #define TWCC_NODS               3 /* No Data Source                            */
1782 #define TWCC_MAXCONNECTIONS     4 /* DS is connected to max possible applications      */
1783 #define TWCC_OPERATIONERROR     5 /* DS or DSM reported error, application shouldn't   */
1784 #define TWCC_BADCAP             6 /* Unknown capability                        */
1785 #define TWCC_BADPROTOCOL        9 /* Unrecognized MSG DG DAT combination       */
1786 #define TWCC_BADVALUE           10 /* Data parameter out of range              */
1787 #define TWCC_SEQERROR           11 /* DG DAT MSG out of expected sequence      */
1788 #define TWCC_BADDEST            12 /* Unknown destination Application/Source in DSM_Entry */
1789 #define TWCC_CAPUNSUPPORTED     13 /* Capability not supported by source            */
1790 #define TWCC_CAPBADOPERATION    14 /* Operation not supported by capability         */
1791 #define TWCC_CAPSEQERROR        15 /* Capability has dependency on other capability */
1792 /* Added 1.8 */
1793 #define TWCC_DENIED             16 /* File System operation is denied (file is protected) */
1794 #define TWCC_FILEEXISTS         17 /* Operation failed because file already exists. */
1795 #define TWCC_FILENOTFOUND       18 /* File not found */
1796 #define TWCC_NOTEMPTY           19 /* Operation failed because directory is not empty */
1797 #define TWCC_PAPERJAM           20  /* The feeder is jammed */
1798 #define TWCC_PAPERDOUBLEFEED    21  /* The feeder detected multiple pages */
1799 #define TWCC_FILEWRITEERROR     22  /* Error writing the file (meant for things like disk full conditions) */
1800 #define TWCC_CHECKDEVICEONLINE  23  /* The device went offline prior to or during this operation */
1801 
1802 /* bit patterns: for query the operation that are supported by the data source on a capability */
1803 /* Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
1804 /* Added 1.6 */
1805 #define TWQC_GET           0x0001
1806 #define TWQC_SET           0x0002
1807 #define TWQC_GETDEFAULT    0x0004
1808 #define TWQC_GETCURRENT    0x0008
1809 #define TWQC_RESET         0x0010
1810 
1811 /****************************************************************************
1812  * Entry Points                                                             *
1813  ****************************************************************************/
1814 
1815 /**********************************************************************
1816  * Function: DSM_Entry, the only entry point into the Data Source Manager.
1817  *
1818  * Parameters:
1819  *  pOrigin Identifies the source module of the message. This could
1820  *          identify an Application, a Source, or the Source Manager.
1821  *
1822  *  pDest   Identifies the destination module for the message.
1823  *          This could identify an application or a data source.
1824  *          If this is NULL, the message goes to the Source Manager.
1825  *
1826  *  DG      The Data Group.
1827  *          Example: DG_IMAGE.
1828  *
1829  *  DAT     The Data Attribute Type.
1830  *          Example: DAT_IMAGEMEMXFER.
1831  *
1832  *  MSG     The message.  Messages are interpreted by the destination module
1833  *          with respect to the Data Group and the Data Attribute Type.
1834  *          Example: MSG_GET.
1835  *
1836  *  pData   A pointer to the data structure or variable identified
1837  *          by the Data Attribute Type.
1838  *          Example: (TW_MEMREF)&ImageMemXfer
1839  *                   where ImageMemXfer is a TW_IMAGEMEMXFER structure.
1840  *
1841  * Returns:
1842  *  ReturnCode
1843  *         Example: TWRC_SUCCESS.
1844  *
1845  ********************************************************************/
1846 
1847 /* Don't mangle the name "DSM_Entry" if we're compiling in C++! */
1848 #ifdef  __cplusplus
1849 extern "C" {
1850 #endif  /* __cplusplus */
1851 
1852 #ifdef  _MSWIN_
1853 TW_UINT16 FAR PASCAL DSM_Entry(pTW_IDENTITY pOrigin,
1854                                pTW_IDENTITY pDest,
1855                                TW_UINT32    DG,
1856                                TW_UINT16    DAT,
1857                                TW_UINT16    MSG,
1858                                TW_MEMREF    pData);
1859 
1860 typedef TW_UINT16(FAR PASCAL *DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
1861         TW_UINT32,    TW_UINT16,
1862         TW_UINT16,    TW_MEMREF);
1863 #else   /* _MSWIN_ */
1864 
1865 FAR PASCAL TW_UINT16 DSM_Entry(pTW_IDENTITY pOrigin,
1866                                pTW_IDENTITY pDest,
1867                                TW_UINT32    DG,
1868                                TW_UINT16    DAT,
1869                                TW_UINT16    MSG,
1870                                TW_MEMREF    pData);
1871 
1872 typedef TW_UINT16(*DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
1873                                  TW_UINT32,    TW_UINT16,
1874                                  TW_UINT16,    TW_MEMREF);
1875 #endif  /* _MSWIN_ */
1876 
1877 #ifdef  __cplusplus
1878 }
1879 #endif  /* cplusplus */
1880 
1881 /**********************************************************************
1882  * Function: DS_Entry, the entry point provided by a Data Source.
1883  *
1884  * Parameters:
1885  *  pOrigin Identifies the source module of the message. This could
1886  *          identify an application or the Data Source Manager.
1887  *
1888  *  DG      The Data Group.
1889  *          Example: DG_IMAGE.
1890  *
1891  *  DAT     The Data Attribute Type.
1892  *          Example: DAT_IMAGEMEMXFER.
1893  *
1894  *  MSG     The message.  Messages are interpreted by the data source
1895  *          with respect to the Data Group and the Data Attribute Type.
1896  *          Example: MSG_GET.
1897  *
1898  *  pData   A pointer to the data structure or variable identified
1899  *          by the Data Attribute Type.
1900  *          Example: (TW_MEMREF)&ImageMemXfer
1901  *                   where ImageMemXfer is a TW_IMAGEMEMXFER structure.
1902  *
1903  * Returns:
1904  *  ReturnCode
1905  *          Example: TWRC_SUCCESS.
1906  *
1907  * Note:
1908  *  The DSPROC type is only used by an application when it calls
1909  *  a Data Source directly, bypassing the Data Source Manager.
1910  *
1911  ********************************************************************/
1912 /* Don't mangle the name "DS_Entry" if we're compiling in C++! */
1913 #ifdef  __cplusplus
1914 extern "C" {
1915 #endif  /* __cplusplus */
1916 
1917 #ifdef  _MSWIN_
1918 #ifdef _WIN32
1919 __declspec(dllexport) TW_UINT16 FAR PASCAL DS_Entry(pTW_IDENTITY pOrigin,
1920         TW_UINT32    DG,
1921         TW_UINT16    DAT,
1922         TW_UINT16    MSG,
1923         TW_MEMREF    pData);
1924 #else   /* _WIN32 */
1925 TW_UINT16 FAR PASCAL DS_Entry(pTW_IDENTITY pOrigin,
1926                               TW_UINT32    DG,
1927                               TW_UINT16    DAT,
1928                               TW_UINT16    MSG,
1929                               TW_MEMREF    pData);
1930 #endif  /* _WIN32 */
1931 
1932 typedef TW_UINT16(FAR PASCAL *DSENTRYPROC)(pTW_IDENTITY pOrigin,
1933         TW_UINT32    DG,
1934         TW_UINT16    DAT,
1935         TW_UINT16    MSG,
1936         TW_MEMREF    pData);
1937 #else   /* _MSWIN_ */
1938 FAR PASCAL TW_UINT16 DS_Entry(pTW_IDENTITY pOrigin,
1939                               TW_UINT32    DG,
1940                               TW_UINT16    DAT,
1941                               TW_UINT16    MSG,
1942                               TW_MEMREF    pData);
1943 
1944 typedef TW_UINT16(*DSENTRYPROC)(pTW_IDENTITY,
1945                                 TW_UINT32,    TW_UINT16,
1946                                 TW_UINT16,    TW_MEMREF);
1947 #endif  /* _MSWIN_ */
1948 
1949 #ifdef  __cplusplus
1950 }
1951 #endif  /* cplusplus */
1952 
1953 /*  SDH - 02/08/95 - TWUNK */
1954 /*  Force 32-bit twain to use same packing of twain structures as existing */
1955 /*  16-bit twain.  This allows 16/32-bit thunking. */
1956 #ifdef  WIN32
1957 #ifdef __MINGW32__
1958 #pragma pack (pop)
1959 #elif __BORLANDC__ //(Mentor June 13, 1996) if we're using a Borland compiler
1960 #pragma option -a.  //(Mentor October 30, 1996) switch back to original alignment
1961 #else   //(Mentor June 13, 1996) if NOT using a Borland compiler
1962 #pragma pack (pop, before_twain)
1963 #endif  //(Mentor June 13, 1996)
1964 #else   /* WIN32 */
1965 #endif  /* WIN32 */
1966 
1967 #endif  /* TWAIN */