Started TWAIN implementation.

Marcus Meissner <marcus@jet.franken.de>
Merged into WineHQ, made sure it works without SANE.
This commit is contained in:
Shi Quan He 2002-03-21 02:58:39 +00:00 committed by Alexandre Julliard
parent 1cefed8122
commit 6b0720f5d6
17 changed files with 5409 additions and 441 deletions

1035
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -360,6 +360,30 @@ AC_CHECK_LIB(cups,cupsGetPPD,
)
AC_SUBST(CUPSLIBS)
dnl **** Check for SANE ****
AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
if test "$sane_devel" = "no"
then
SANELIBS=""
SANEINCL=""
else
SANELIBS="`$sane_devel --libs`"
SANEINCL="`$sane_devel --cflags`"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $SANEINCL"
LIBS="$LIBS $SANELIBS"
AC_CHECK_HEADER(sane/sane.h,[
AC_CHECK_LIB(sane,sane_open,[AC_DEFINE(HAVE_SANE, 1, [Define if we have SANE development environment])],
SANELIBS=""
])
)
LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
fi
AC_SUBST(SANELIBS)
AC_SUBST(SANEINCL)
dnl **** Check for FreeType 2 ****
AC_CHECK_LIB(freetype,FT_Init_FreeType,ft_lib=yes,ft_lib=no,$X_LIBS)
if test "$ft_lib" = "no"
@ -1330,6 +1354,7 @@ dlls/shlwapi/Makefile
dlls/sti/Makefile
dlls/tapi32/Makefile
dlls/ttydrv/Makefile
dlls/twain/Makefile
dlls/url/Makefile
dlls/urlmon/Makefile
dlls/user/Makefile

View File

@ -69,6 +69,7 @@ SUBDIRS = \
sti \
tapi32 \
ttydrv \
twain \
url \
urlmon \
user \
@ -195,6 +196,7 @@ all: \
tapi32.dll$(DLLEXT) \
toolhelp.dll$(DLLEXT) \
ttydrv.dll$(DLLEXT) \
twain_32.dll$(DLLEXT) \
typelib.dll$(DLLEXT) \
url.dll$(DLLEXT) \
urlmon.dll$(DLLEXT) \
@ -426,6 +428,9 @@ tapi32.dll$(DLLEXT): tapi32/tapi32.dll$(DLLEXT)
ttydrv.dll$(DLLEXT): ttydrv/ttydrv.dll$(DLLEXT)
$(RM) $@ && $(LN_S) ttydrv/ttydrv.dll$(DLLEXT) $@
twain_32.dll$(DLLEXT): twain/twain_32.dll$(DLLEXT)
$(RM) $@ && $(LN_S) twain/twain_32.dll$(DLLEXT) $@
url.dll$(DLLEXT): url/url.dll$(DLLEXT)
$(RM) $@ && $(LN_S) url/url.dll$(DLLEXT) $@
@ -690,6 +695,10 @@ ttydrv/ttydrv.dll$(DLLEXT): dummy user32.dll$(DLLEXT) gdi32.dll$(DLLEXT) \
libkernel32.dll.$(LIBEXT) libntdll.dll.$(LIBEXT)
@cd ttydrv && $(MAKE) ttydrv.dll$(DLLEXT)
twain/twain_32.dll$(DLLEXT): dummy user32.dll$(DLLEXT) gdi32.dll$(DLLEXT) \
kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
@cd twain && $(MAKE) twain_32.dll$(DLLEXT)
url/url.dll$(DLLEXT): dummy ntdll.dll$(DLLEXT)
@cd url && $(MAKE) url.dll$(DLLEXT)

2
dlls/twain/.cvsignore Normal file
View File

@ -0,0 +1,2 @@
Makefile
twain_32.spec.c

22
dlls/twain/Makefile.in Normal file
View File

@ -0,0 +1,22 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = twain_32.dll
EXTRALIBS = @SANELIBS@
EXTRAINCL = @SANEINCL@
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
capability.c \
ds_audio.c \
ds_ctrl.c \
ds_image.c \
dsm_ctrl.c \
twain32_main.c
@MAKE_DLL_RULES@
### Dependencies:

54
dlls/twain/README Normal file
View File

@ -0,0 +1,54 @@
----- Old Corel README, probably outdated ----------------------------------
1. INTRODUCTION
This library (twain32.dll) is an implementation of TWAIN API for providing image acquisition devices (scanner or digital camera) support. It uses SANE drivers as the backend and translates TWAIN API calls into SANE API calls. Unlike the twain32 library on Windows platform, it combines the Data Source Manager and Data Sources into a single library. Thus it is our responsiblity to provide a graphical user interface and capability negotiation, which usually are performed by data sources.
2. WHAT'S IMPLEMENTED
- Functions that dispatch operations specified by the operation triplets to the coresponding function.
- All the operation triplets related to the Data Source Manager are implemented. Appplication is able to enumerate data sources and open them.
- The operation triplets that deal with the UI (such as DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS, MSG_DISABLEDS and MSG_ENABLEDSUIONLY) are partially implemented although it does not really do much.
- The operation triplets that deal with native image transfering (DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET) are also partially implemented. Still need to figure out how to convert the image data obtained from sane to the Windows DIB format.
- Only the CAP_ICAPXFERMECH capability is implemented.
3. TO-DO
- Image native transfer is not working correctly right now. It crashed the application due to the invalid DIB created. We need to fix this.
- Implement other image transfer mode such as file transfer and memory transfer.
- Support all required TWAIN capabilities that have not been implemented currently. There are a fixed number of capabilities specified by the TWAIN Specification. However, device capabilities are dynamic in SANE and there isn't a standard about the capability names. It would be difficult to negotiate capabilities in TWAIN given that we don't know what capabilities a SANE driver would provide. One possible solution to use a device configuration file to describe the mapping between capabilities supported by a SANE driver and those specified by TWAIN.
- Build a dynamic user interface that reflects the capabilities of different scanner devices. According to the TWAIN specification, each TWAIN driver need to provide its own user interface. However the SANE drivers do not have graphical frontends. Building a frontend for each SANE driver is a huge task. It is possible to have a dynamic frontend similar to xscanimage or xsane that works for all the devices. This is possibly the most difficult part.
- check into legal issues regarding:
- TWAIN header file
- linking to SANE (maybe should dynamically link at run time?)
- add autoconf rules for enabling based on whether sane is installed
4. FILE LISTING
twain32_main.c Functions to regconize operation tripets and dispatch
the requests to the corresponding functions.
dsm_ctrl.c Implementation of DG_CONTROL group operation triplets
destinated for source manager.
ds_ctrl.c Implementation of DG_CONTROL group operation triplets
destinated for data source.
ds_image.c Implementation of DG_IMAGE group operation triplets
destinated for data source.
ds_audio.c Implementation of DG_AUDIO group operation triplets
destinated for data source
capability.c Functions for negotiating capabilities
twain.h The original TWAIN header file
twain_i.h Header file for the internal twain functions
--
Shi Quan He
shiquan@cyberdude.com

172
dlls/twain/TWAIN Normal file
View File

@ -0,0 +1,172 @@
Requirements to be a TWAIN-Compliant Source
Requirements
TWAIN-compliant Sources must support the following:
Operations
----------
DG_CONTROL / DAT_CAPABILITY / MSG_GET
DG_CONTROL / DAT_CAPABILITY / MSG_GETCURRENT
DG_CONTROL / DAT_CAPABILITY / MSG_GETDEFAULT
DG_CONTROL / DAT_CAPABILITY / MSG_RESET
DG_CONTROL / DAT_CAPABILITY / MSG_SET
DG_CONTROL / DAT_EVENT / MSG_PROCESSEVENT
DG_CONTROL / DAT_IDENTITY / MSG_GET
DG_CONTROL / DAT_IDENTITY / MSG_OPENDS
DG_CONTROL / DAT_IDENTITY / MSG_CLOSEDS
DG_CONTROL / DAT_PENDINGXFERS / MSG_ENDXFER
DG_CONTROL / DAT_PENDINGXFERS / MSG_GET
DG_CONTROL / DAT_PENDINGXFERS / MSG_RESET
DG_CONTROL / DAT_SETUPMEMXFER / MSG_GET
DG_CONTROL / DAT_STATUS / MSG_GET
DG_CONTROL / DAT_USERINTERFACE / MSG_DISABLEDS
DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS
DG_CONTROL / DAT_XFERGROUP / MSG_GET
DG_IMAGE / DAT_IMAGEINFO / MSG_GET
DG_IMAGE / DAT_IMAGELAYOUT / MSG_GET
DG_IMAGE / DAT_IMAGELAYOUT / MSG_GETDEFAULT
DG_IMAGE / DAT_IMAGELAYOUT / MSG_RESET
DG_IMAGE / DAT_IMAGELAYOUT / MSG_SET
DG_IMAGE / DAT_IMAGEMEMXFER / MSG_GET
DG_IMAGE / DAT_IMAGENATIVEXFER / MSG_GET
Capabilities
------------
Every Source must support all five DG_CONTROL / DAT_CAPABILITY operations on:
CAP_XFERCOUNT
Every Source must support DG_CONTROL / DAT_CAPABILITY MSG_GET on:
CAP_SUPPORTEDCAPS
CAP_UICONTROLLABLE
Sources that supply image information must support DG_CONTROL / DAT_CAPABILITY /
MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT on:
ICAP_COMPRESSION
ICAP_PLANARCHUNKY
ICAP_PHYSICALHEIGHT
ICAP_PHYSICALWIDTH
ICAP_PIXELFLAVOR
Sources that supply image information must support DG_CONTROL / DAT_CAPABILITY /
MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT, MSG_RESET and MSG_SET on:
ICAP_BITDEPTH
ICAP_BITORDER
ICAP_PIXELTYPE
ICAP_UNITS
ICAP_XFERMECH
ICAP_XRESOLUTION
ICAP_YRESOLUTION
All Sources must implement the advertised features supported by their devices. They must
make these features available to applications via the TWAIN protocol. For example, a Source
thats connected to a device that has an ADF must support DG_CONTROL /
DAT_CAPABILITY / MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT on:
CAP_FEEDERENABLED
CAP_FEEDERLOADED
and DG_CONTROL / DAT_CAPABILITY / MSG_GET, MSG_GETCURRENT,
MSG_GETDEFAULT, MSG_RESET and MSG_SET on:
CAP_AUTOFEED
If the ADF also supports ejecting and rewinding of pages then the Source should also support
DG_CONTROL / DAT_CAPABILITY / MSG_GET, MSG_GETCURRENT,
MSG_GETDEFAULT, MSG_RESET and MSG_SET on:
CAP_CLEARPAGE
CAP_REWINDPAGE
*******************************************************************************
From Application to Source Manager (Control Information)
Data Group Data Argument Type Message
DG_CONTROL DAT_IDENTITY MSG_CLOSEDS
MSG_GETDEFAULT
MSG_GETFIRST
MSG_GETNEXT
MSG_OPENDS
MSG_USERSELECT
DG_CONTROL DAT_PARENT MSG_CLOSEDSM
MSG_OPENDSM
DG_CONTROL DAT_STATUS MSG_GET
From Application to Source (Control Information)
Data Group Data Argument Type Message
DG_CONTROL DAT_CAPABILITY MSG_GET
MSG_GETCURRENT
MSG_GETDEFAULT
MSG_QUERYSUPPORT
MSG_RESET
MSG_SET
DG_CONTROL DAT_CUSTOMDSDATA MSG_GET
MSG_SET
DG_CONTROL DAT_FILESYSTEM MSG_AUTOMATICCAPTURE
DIRECTORY
MSG_CHANGEDIRECTORY
MSG_COPY
MSG_CREATEDIRECTORY
MSG_DELETE
MSG_FORMATMEDIA
MSG_GETCLOSE
MSG_GETFIRSTFILE
MSG_GETINFO
MSG_GETNEXTFILE
MSG_RENAME
DG_CONTROL DAT_EVENT MSG_PROCESSEVENT
DG_CONTROL DAT_PASSTHRU MSG_PASSTHRU
DG_CONTROL DAT_PENDINGXFERS MSG_ENDXFER
MSG_GET
MSG_RESET
MSG_STOPFEEDER
DG_CONTROL DAT_SETUPFILEXFER MSG_GET
MSG_GETDEFAULT
MSG_RESET
MSG_SET
DG_CONTROL DAT_SETUPFILEXFER2 MSG_GET
MSG_GETDEFAULT
MSG_RESET
MSG_SET
DG_CONTROL DAT_SETUPMEMXFER MSG_GET
DG_CONTROL DAT_STATUS MSG_GET
DG_CONTROL DAT_USERINTERFACE MSG_DISABLEDS
MSG_ENABLEDS
MSG_ENABLEDSUIONLY
DG_CONTROL DAT_XFERGROUP MSG_GET
MSG_SET
From Application to Source (Image Information)
Data Group Data Argument Type Message
DG_IMAGE DAT_CIECOLOR MSG_GET
DG_IMAGE DAT_EXTIMAGEINFO MSG_GET
DG_IMAGE DAT_GRAYRESPONSE MSG_RESET
MSG_SET
DG_IMAGE DAT_IMAGEFILEXFER MSG_GET
DG_IMAGE DAT_IMAGEINFO MSG_GET
DG_IMAGE DAT_IMAGELAYOUT MSG_GET
MSG_GETDEFAULT
MSG_RESET
MSG_SET
DG_IMAGE DAT_IMAGEMEMXFER MSG_GET
DG_IMAGE DAT_IMAGENATIVEXFER MSG_GET
DG_IMAGE DAT_JPEGCOMPRESSION MSG_GET
MSG_GETDEFAULT
MSG_RESET
MSG_SET
DG_IMAGE DAT_PALETTE8 MSG_GET
MSG_GETDEFAULT
MSG_RESET
MSG_SET
DG_IMAGE DAT_RGBRESPONSE MSG_RESET
MSG_SET
From Application to Source (Audio Information)
Data Group Data Argument Type Message
DG_AUDIO DAT_AUDIOFILEXFER MSG_GET
DG_AUDIO DAT_AUDIOINFO MSG_GET
DG_AUDIO DAT_AUDIONATIVEXFER MSG_GET
From Source Manager to Source (Control Information)
Data Group Data Argument Type Message
DG_CONTROL DAT_IDENTITY MSG_CLOSEDS
MSG_GET
MSG_OPENDS
From Source to Application (Control Information via the Source Manager)
(Used by Windows Sources only)
Data Group Data Argument Type Message
DG_CONTROL DAT_NULL MSG_CLOSEDSOK
MSG_CLOSEDSREQ
MSG_DEVICEEVENT
MSG_XFERREADY

241
dlls/twain/capability.c Normal file
View File

@ -0,0 +1,241 @@
/*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "winbase.h"
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
TW_UINT16 TWAIN_SaneCapability (activeDS *pSource, pTW_CAPABILITY pCapability,
TW_UINT16 action)
{
TW_UINT16 twCC = TWCC_SUCCESS;
TRACE("capability=%d action=%d\n", pCapability->Cap, action);
switch (pCapability->Cap)
{
case CAP_DEVICEEVENT:
case CAP_ALARMS:
case CAP_ALARMVOLUME:
case ACAP_AUDIOFILEFORMAT:
case ACAP_XFERMECH:
case ICAP_AUTOMATICBORDERDETECTION:
case ICAP_AUTOMATICDESKEW:
case ICAP_AUTODISCARDBLANKPAGES:
case ICAP_AUTOMATICROTATE:
case ICAP_FLIPROTATION:
case CAP_AUTOMATICCAPTURE:
case CAP_TIMEBEFOREFIRSTCAPTURE:
case CAP_TIMEBETWEENCAPTURES:
case CAP_AUTOSCAN:
case CAP_CLEARBUFFERS:
case CAP_MAXBATCHBUFFERS:
case ICAP_BARCODEDETECTIONENABLED:
case ICAP_SUPPORTEDBARCODETYPES:
case ICAP_BARCODEMAXSEARCHPRIORITIES:
case ICAP_BARCODESEARCHPRIORITIES:
case ICAP_BARCODESEARCHMODE:
case ICAP_BARCODEMAXRETRIES:
case ICAP_BARCODETIMEOUT:
case CAP_EXTENDEDCAPS:
case CAP_SUPPORTEDCAPS:
case ICAP_FILTER:
case ICAP_GAMMA:
case ICAP_PLANARCHUNKY:
case ICAP_BITORDERCODES:
case ICAP_CCITTKFACTOR:
case ICAP_COMPRESSION:
case ICAP_JPEGPIXELTYPE:
/*case ICAP_JPEGQUALITY:*/
case ICAP_PIXELFLAVORCODES:
case ICAP_TIMEFILL:
case CAP_DEVICEONLINE:
case CAP_DEVICETIMEDATE:
case CAP_SERIALNUMBER:
case ICAP_EXPOSURETIME:
case ICAP_FLASHUSED2:
case ICAP_IMAGEFILTER:
case ICAP_LAMPSTATE:
case ICAP_LIGHTPATH:
case ICAP_NOISEFILTER:
case ICAP_OVERSCAN:
case ICAP_PHYSICALHEIGHT:
case ICAP_PHYSICALWIDTH:
case ICAP_UNITS:
case ICAP_ZOOMFACTOR:
case CAP_PRINTER:
case CAP_PRINTERENABLED:
case CAP_PRINTERINDEX:
case CAP_PRINTERMODE:
case CAP_PRINTERSTRING:
case CAP_PRINTERSUFFIX:
case CAP_AUTHOR:
case CAP_CAPTION:
case CAP_TIMEDATE:
case ICAP_AUTOBRIGHT:
case ICAP_BRIGHTNESS:
case ICAP_CONTRAST:
case ICAP_HIGHLIGHT:
case ICAP_ORIENTATION:
case ICAP_ROTATION:
case ICAP_SHADOW:
case ICAP_XSCALING:
case ICAP_YSCALING:
case ICAP_BITDEPTH:
case ICAP_BITDEPTHREDUCTION:
case ICAP_BITORDER:
case ICAP_CUSTHALFTONE:
case ICAP_HALFTONES:
case ICAP_PIXELFLAVOR:
case ICAP_PIXELTYPE:
case ICAP_THRESHOLD:
case CAP_LANGUAGE:
case ICAP_FRAMES:
case ICAP_MAXFRAMES:
case ICAP_SUPPORTEDSIZES:
case CAP_AUTOFEED:
case CAP_CLEARPAGE:
case CAP_FEEDERALIGNMENT:
case CAP_FEEDERENABLED:
case CAP_FEEDERLOADED:
case CAP_FEEDERORDER:
case CAP_FEEDPAGE:
case CAP_PAPERBINDING:
case CAP_PAPERDETECTABLE:
case CAP_REACQUIREALLOWED:
case CAP_REWINDPAGE:
case ICAP_PATCHCODEDETECTIONENABLED:
case ICAP_SUPPORTEDPATCHCODETYPES:
case ICAP_PATCHCODEMAXSEARCHPRIORITIES:
case ICAP_PATCHCODESEARCHPRIORITIES:
case ICAP_PATCHCODESEARCHMODE:
case ICAP_PATCHCODEMAXRETRIES:
case ICAP_PATCHCODETIMEOUT:
case CAP_BATTERYMINUTES:
case CAP_BATTERYPERCENTAGE:
case CAP_POWERDOWNTIME:
case CAP_POWERSUPPLY:
case ICAP_XNATIVERESOLUTION:
case ICAP_XRESOLUTION:
case ICAP_YNATIVERESOLUTION:
case ICAP_YRESOLUTION:
twCC = TWCC_CAPUNSUPPORTED;
break;
case CAP_XFERCOUNT:
/* This is a required capability that every source need to
support but we havev't implemented yet. */
twCC = TWCC_SUCCESS;
break;
/*case ICAP_COMPRESSION:*/
case ICAP_IMAGEFILEFORMAT:
case ICAP_TILES:
twCC = TWCC_CAPUNSUPPORTED;
break;
case ICAP_XFERMECH:
twCC = TWAIN_ICAPXferMech (pSource, pCapability, action);
break;
case ICAP_UNDEFINEDIMAGESIZE:
case CAP_CAMERAPREVIEWUI:
case CAP_ENABLEDSUIONLY:
case CAP_INDICATORS:
case CAP_UICONTROLLABLE:
twCC = TWCC_CAPUNSUPPORTED;
break;
default:
twCC = TWRC_FAILURE;
}
return twCC;
}
TW_BOOL TWAIN_OneValueSet (pTW_CAPABILITY pCapability, TW_UINT32 value)
{
pCapability->hContainer = (TW_HANDLE)GlobalAlloc (0, sizeof(TW_ONEVALUE));
if (pCapability->hContainer)
{
pTW_ONEVALUE pVal = GlobalLock ((HGLOBAL) pCapability->hContainer);
pVal->ItemType = TWTY_UINT32;
pVal->Item = value;
GlobalUnlock ((HGLOBAL) pCapability->hContainer);
return TRUE;
}
else
return FALSE;
}
TW_BOOL TWAIN_OneValueGet (pTW_CAPABILITY pCapability, TW_UINT32 *pValue)
{
pTW_ONEVALUE pVal = GlobalLock ((HGLOBAL) pCapability->hContainer);
if (pVal)
{
*pValue = pVal->Item;
GlobalUnlock ((HGLOBAL) pCapability->hContainer);
return TRUE;
}
else
return FALSE;
}
/* ICAP_XFERMECH */
TW_UINT16 TWAIN_ICAPXferMech (activeDS *pSource, pTW_CAPABILITY pCapability,
TW_UINT16 action)
{
TRACE("ICAP_XFERMECH\n");
switch (action)
{
case MSG_GET:
if (pCapability->ConType == TWON_ONEVALUE)
{
if (!TWAIN_OneValueSet (pCapability, pSource->capXferMech))
return TWCC_LOWMEMORY;
}
break;
case MSG_SET:
if (pCapability->ConType == TWON_ONEVALUE)
{
TW_UINT32 xfermechtemp;
if (!TWAIN_OneValueGet (pCapability, &xfermechtemp))
return TWCC_LOWMEMORY;
pSource->capXferMech = xfermechtemp;
}
else if (pCapability->ConType == TWON_ENUMERATION)
{
}
break;
case MSG_GETCURRENT:
if (!TWAIN_OneValueSet (pCapability, pSource->capXferMech))
return TWCC_LOWMEMORY;
break;
case MSG_GETDEFAULT:
if (!TWAIN_OneValueSet (pCapability, TWSX_NATIVE))
return TWCC_LOWMEMORY;
break;
case MSG_RESET:
pSource->capXferMech = TWSX_NATIVE;
break;
}
return TWCC_SUCCESS;
}

51
dlls/twain/ds_audio.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
/* DG_AUDIO/DAT_AUDIOFILEXFER/MSG_GET */
TW_UINT16 TWAIN_AudioFileXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_AUDIO/DAT_AUDIOINFO/MSG_GET */
TW_UINT16 TWAIN_AudioInfoGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_AUDIO/DAT_AUDIONATIVEXFER/MSG_GET */
TW_UINT16 TWAIN_AudioNativeXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}

696
dlls/twain/ds_ctrl.c Normal file
View File

@ -0,0 +1,696 @@
/*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <unistd.h>
#include <stdlib.h>
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
/* DG_CONTROL/DAT_CAPABILITY/MSG_GET */
TW_UINT16 TWAIN_CapabilityGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GET\n");
if (!pDest)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 4 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
twCC = TWAIN_SaneCapability (pSource, pCapability, MSG_GET);
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
pSource->twCC = twCC;
}
return twRC;
}
/* DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT */
TW_UINT16 TWAIN_CapabilityGetCurrent (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 4 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
twCC = TWAIN_SaneCapability (pSource, pCapability, MSG_GETCURRENT);
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
pSource->twCC = twCC;
}
return twRC;
}
/* DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT */
TW_UINT16 TWAIN_CapabilityGetDefault (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest, TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT\n");
if (!pDest)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 4 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
twCC = TWAIN_SaneCapability (pSource, pCapability, MSG_GETDEFAULT);
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
pSource->twCC = twCC;
}
return twRC;
}
/* DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
TW_UINT16 TWAIN_CapabilityQuerySupport (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest, TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_CAPABILITY/MSG_RESET */
TW_UINT16 TWAIN_CapabilityReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_RESET\n");
if (!pDest)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 4 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
twCC = TWAIN_SaneCapability (pSource, pCapability, MSG_RESET);
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
pSource->twCC = twCC;
}
return twRC;
}
/* DG_CONTROL/DAT_CAPABILITY/MSG_SET */
TW_UINT16 TWAIN_CapabilitySet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE ("DG_CONTROL/DAT_CAPABILITY/MSG_SET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 4)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
twCC = TWAIN_SaneCapability (pSource, pCapability, MSG_SET);
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
pSource->twCC = twCC;
}
return twRC;
}
/* DG_CONTROL/DAT_CUSTOMDSDATA/MSG_GET */
TW_UINT16 TWAIN_CustomDSDataGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_CUSTOMDSDATA/MSG_SET */
TW_UINT16 TWAIN_CustomDSDataSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_AUTOMATICCAPTUREDIRECTORY */
TW_UINT16 TWAIN_AutomaticCaptureDirectory (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_CHANGEDIRECTORY */
TW_UINT16 TWAIN_ChangeDirectory (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_COPY */
TW_UINT16 TWAIN_FileSystemCopy (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_CREATEDIRECTORY */
TW_UINT16 TWAIN_CreateDirectory (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_DELETE */
TW_UINT16 TWAIN_FileSystemDelete (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_FORMATMEDIA */
TW_UINT16 TWAIN_FormatMedia (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_GETCLOSE */
TW_UINT16 TWAIN_FileSystemGetClose (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_GETFIRSTFILE */
TW_UINT16 TWAIN_FileSystemGetFirstFile (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_GETINFO */
TW_UINT16 TWAIN_FileSystemGetInfo (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_GETNEXTFILE */
TW_UINT16 TWAIN_FileSystemGetNextFile (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_FILESYSTEM/MSG_RENAME */
TW_UINT16 TWAIN_FileSystemRename (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT */
TW_UINT16 TWAIN_ProcessEvent (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_EVENT pEvent = (pTW_EVENT) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 5 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
if (pSource->pendingEvent.TWMessage != MSG_NULL)
{
pEvent->TWMessage = pSource->pendingEvent.TWMessage;
pSource->pendingEvent.TWMessage = MSG_NULL;
twRC = TWRC_DSEVENT;
}
else
{
pEvent->TWMessage = MSG_NULL; /* no message to the application */
twRC = TWRC_NOTDSEVENT;
}
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_PASSTHRU/MSG_PASSTHRU */
TW_UINT16 TWAIN_PassThrough (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER */
TW_UINT16 TWAIN_PendingXfersEndXfer (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
activeDS *pSource = TWAIN_LookupSource (pData);
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 6 && pSource->currentState != 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
if (pPendingXfers->Count != 0)
{
pPendingXfers->Count --;
pSource->currentState = 6;
}
else
{
pSource->currentState = 5;
/* Notify the application that it can close the data source */
pSource->pendingEvent.TWMessage = MSG_CLOSEDSREQ;
}
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_GET */
TW_UINT16 TWAIN_PendingXfersGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_GET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState < 4 || pSource->currentState > 7)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_SEQERROR;
}
else
{
/* FIXME: we shouldn't return 1 here */
pPendingXfers->Count = 1;
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET */
TW_UINT16 TWAIN_PendingXfersReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 6)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_SEQERROR;
}
else
{
pPendingXfers->Count = 0;
pSource->currentState = 5;
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_STOPFEEDER */
TW_UINT16 TWAIN_PendingXfersStopFeeder (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest, TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER/MSG_GET */
TW_UINT16 TWAIN_SetupFileXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPXFER/MSG_GETDEFAULT */
TW_UINT16 TWAIN_SetupFileXferGetDefault (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER/MSG_RESET */
TW_UINT16 TWAIN_SetupFileXferReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER/MSG_SET */
TW_UINT16 TWAIN_SetupFileXferSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_GET */
TW_UINT16 TWAIN_SetupFileXfer2Get (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_GETDEFAULT */
TW_UINT16 TWAIN_SetupFileXfer2GetDefault (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_RESET */
TW_UINT16 TWAIN_SetupFileXfer2Reset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_SET */
TW_UINT16 TWAIN_SetupFileXfer2Set (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET */
TW_UINT16 TWAIN_SetupMemXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_STATUS/MSG_GET */
TW_UINT16 TWAIN_GetDSStatus (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_FAILURE;
pTW_STATUS pSourceStatus = (pTW_STATUS) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE ("DG_CONTROL/DAT_STATUS/MSG_GET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
pSourceStatus->ConditionCode = TWCC_BADDEST;
}
else
{
twRC = TWRC_SUCCESS;
pSourceStatus->ConditionCode = pSource->twCC;
/* Reset the condition code */
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS */
TW_UINT16 TWAIN_DisableDSUserInterface (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest, TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 5)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
pSource->currentState = 4;
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS */
TW_UINT16 TWAIN_EnableDSUserInterface (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest, TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 4)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
if (pUserInterface->ShowUI)
{
pSource->currentState = 5; /* Transitions to state 5 */
/* FIXME: we should replace xscanimage with our own device UI */
system ("xscanimage");
pSource->currentState = 6;
pSource->pendingEvent.TWMessage = MSG_XFERREADY;
}
else
{
/* no UI will be displayed, so source is ready to transfer data */
pSource->pendingEvent.TWMessage = MSG_XFERREADY;
pSource->currentState = 6; /* Transitions to state 6 directly */
}
pSource->hwndOwner = pUserInterface->hParent;
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY */
TW_UINT16 TWAIN_EnableDSUIOnly (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
TRACE("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 4)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
/* FIXME: we should replace xscanimage with our own UI */
system ("xscanimage");
pSource->currentState = 5;
twRC = TWRC_SUCCESS;
pSource->twCC = TWCC_SUCCESS;
}
return twRC;
}
/* DG_CONTROL/DAT_XFERGROUP/MSG_GET */
TW_UINT16 TWAIN_XferGroupGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_CONTROL/DAT_XFERGROUP/MSG_SET */
TW_UINT16 TWAIN_XferGroupSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}

377
dlls/twain/ds_image.c Normal file
View File

@ -0,0 +1,377 @@
/*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
/* DG_IMAGE/DAT_CIECOLOR/MSG_GET */
TW_UINT16 TWAIN_CIEColorGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_EXTIMAGEINFO/MSG_GET */
TW_UINT16 TWAIN_ExtImageInfoGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_GRAYRESPONSE/MSG_RESET */
TW_UINT16 TWAIN_GrayResponseReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_GRAYRESPONSE/MSG_SET */
TW_UINT16 TWAIN_GrayResponseSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGEFILEXFER/MSG_GET */
TW_UINT16 TWAIN_ImageFileXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGEINFO/MSG_GET */
TW_UINT16 TWAIN_ImageInfoGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_IMAGEINFO pImageInfo = (pTW_IMAGEINFO) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
SANE_Status status;
TRACE("DG_IMAGE/DAT_IMAGEINFO/MSG_GET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADDEST;
}
else if (pSource->currentState != 6 && pSource->currentState != 7)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
if (pSource->currentState == 6)
{
/* return general image description information about the image about to be transfer */
status = sane_get_parameters (pSource->deviceHandle, &pSource->sane_param);
}
pImageInfo->XResolution.Whole = -1;
pImageInfo->XResolution.Frac = 0;
pImageInfo->YResolution.Whole = -1;
pImageInfo->YResolution.Frac = 0;
pImageInfo->ImageWidth = pSource->sane_param.pixels_per_line;
pImageInfo->ImageLength = pSource->sane_param.lines;
if (pSource->sane_param.depth == 24)
{
pImageInfo->SamplesPerPixel = 3;
pImageInfo->BitsPerSample[0] = 8;
pImageInfo->BitsPerSample[1] = 8;
pImageInfo->BitsPerSample[2] = 8;
pImageInfo->BitsPerPixel = 24;
pImageInfo->Planar = TRUE;
pImageInfo->PixelType = TWPT_RGB;
pImageInfo->Compression = TWCP_NONE;
}
else if (pSource->sane_param.depth == 8)
{
/* FIXME: fill the image info structure for 8-bit image */
}
}
return twRC;
#endif
}
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GET */
TW_UINT16 TWAIN_ImageLayoutGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GETDEFAULT */
TW_UINT16 TWAIN_ImageLayoutGetDefault (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_RESET */
TW_UINT16 TWAIN_ImageLayoutReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET */
TW_UINT16 TWAIN_ImageLayoutSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGEMEMXFER/MSG_GET */
TW_UINT16 TWAIN_ImageMemXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET */
TW_UINT16 TWAIN_ImageNativeXferGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_UINT32 pHandle = (pTW_UINT32) pData;
activeDS *pSource = TWAIN_LookupSource (pDest);
SANE_Status status;
SANE_Byte buffer[32*1024];
int buff_len;
HBITMAP hDIB;
BITMAPINFO bmpInfo;
VOID *pBits;
HDC dc;
TRACE("DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET\n");
if (!pSource)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
else if (pSource->currentState != 6)
{
twRC = TWRC_FAILURE;
pSource->twCC = TWCC_SEQERROR;
}
else
{
/* Transfer an image from the source to the application */
status = sane_start (pSource->deviceHandle);
if (status != SANE_STATUS_GOOD)
{
WARN("sane_start: %s\n", sane_strstatus (status));
sane_cancel (pSource->deviceHandle);
pSource->twCC = TWCC_OPERATIONERROR;
return TWRC_FAILURE;
}
status = sane_get_parameters (pSource->deviceHandle, &pSource->sane_param);
if (status != SANE_STATUS_GOOD)
{
WARN("sane_get_parameters: %s\n", sane_strstatus (status));
sane_cancel (pSource->deviceHandle);
pSource->twCC = TWCC_OPERATIONERROR;
return TWRC_FAILURE;
}
TRACE("Acquiring image %dx%dx%d bits (format=%d last=%d) from sane...\n"
, pSource->sane_param.pixels_per_line, pSource->sane_param.lines,
pSource->sane_param.depth, pSource->sane_param.format,
pSource->sane_param.last_frame);
ZeroMemory (&bmpInfo, sizeof (BITMAPINFO));
bmpInfo.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
bmpInfo.bmiHeader.biWidth = pSource->sane_param.pixels_per_line;
bmpInfo.bmiHeader.biHeight = pSource->sane_param.lines;
bmpInfo.bmiHeader.biPlanes = 1;
bmpInfo.bmiHeader.biBitCount = pSource->sane_param.depth;
bmpInfo.bmiHeader.biCompression = BI_RGB;
bmpInfo.bmiHeader.biSizeImage = 0;
bmpInfo.bmiHeader.biXPelsPerMeter = 0;
bmpInfo.bmiHeader.biYPelsPerMeter = 0;
bmpInfo.bmiHeader.biClrUsed = 1;
bmpInfo.bmiHeader.biClrImportant = 0;
bmpInfo.bmiColors[0].rgbBlue = 128;
bmpInfo.bmiColors[0].rgbGreen = 128;
bmpInfo.bmiColors[0].rgbRed = 128;
hDIB = CreateDIBSection ((dc = GetDC(pSource->hwndOwner)), &bmpInfo,
DIB_RGB_COLORS, &pBits, 0, 0);
if (!hDIB)
{
sane_cancel (pSource->deviceHandle);
pSource->twCC = TWCC_LOWMEMORY;
return TWRC_FAILURE;
}
do
{
status = sane_read (pSource->deviceHandle, buffer,
sizeof (buffer), &buff_len);
if (status == SANE_STATUS_GOOD)
{
/* FIXME: put code for coverting the image data into DIB here */
}
else if (status != SANE_STATUS_EOF)
{
WARN("sane_read: %s\n", sane_strstatus (status));
sane_cancel (pSource->deviceHandle);
pSource->twCC = TWCC_OPERATIONERROR;
return TWRC_FAILURE;
}
} while (status == SANE_STATUS_GOOD);
sane_cancel (pSource->deviceHandle);
ReleaseDC (pSource->hwndOwner, dc);
*pHandle = hDIB;
twRC = TWRC_XFERDONE;
pSource->twCC = TWCC_SUCCESS;
pSource->currentState = 7;
}
return twRC;
#endif
}
/* DG_IMAGE/DAT_JPEGCOMPRESSION/MSG_GET */
TW_UINT16 TWAIN_JPEGCompressionGet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_JPEGCOMPRESSION/MSG_GETDEFAULT */
TW_UINT16 TWAIN_JPEGCompressionGetDefault (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_JPEGCOMPRESSION/MSG_RESET */
TW_UINT16 TWAIN_JPEGCompressionReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_JPEGCOMPRESSION/MSG_SET */
TW_UINT16 TWAIN_JPEGCompressionSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_PALETTE8/MSG_GET */
TW_UINT16 TWAIN_Palette8Get (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_PALETTE8/MSG_GETDEFAULT */
TW_UINT16 TWAIN_Palette8GetDefault (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_PALETTE8/MSG_RESET */
TW_UINT16 TWAIN_Palette8Reset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_PALETTE8/MSG_SET */
TW_UINT16 TWAIN_Palette8Set (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_RGBRESPONSE/MSG_RESET */
TW_UINT16 TWAIN_RGBResponseReset (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}
/* DG_IMAGE/DAT_RGBRESPONSE/MSG_SET */
TW_UINT16 TWAIN_RGBResponseSet (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_MEMREF pData)
{
FIXME ("stub!\n");
return TWRC_FAILURE;
}

395
dlls/twain/dsm_ctrl.c Normal file
View File

@ -0,0 +1,395 @@
/*
* TWAIN32 Source Manager
*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include "winbase.h"
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
/* DG_CONTROL/DAT_IDENTITY/MSG_CLOSEDS */
TW_UINT16 TWAIN_CloseDS (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_IDENTITY pIdentity = (pTW_IDENTITY) pData;
activeDS *currentDS = NULL, *prevDS = NULL;
TRACE ("DG_CONTROL/DAT_IDENTITY/MSG_CLOSEDS\n");
for (currentDS = activeSources; currentDS; currentDS = currentDS->next)
{
if (currentDS->identity.Id == pIdentity->Id)
break;
prevDS = currentDS;
}
if (currentDS)
{
/* Only valid to close a data source if it is in state 4 */
if (currentDS->currentState == 4)
{
sane_close (currentDS->deviceHandle);
/* remove the data source from active data source list */
if (prevDS)
prevDS->next = currentDS->next;
else
activeSources = currentDS->next;
HeapFree (GetProcessHeap(), 0, currentDS);
twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS;
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_SEQERROR;
}
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_IDENTITY/MSG_GETDEFAULT */
TW_UINT16 TWAIN_IdentityGetDefault (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETDEFAULT\n");
if (!device_list)
{
if ((sane_get_devices (&device_list, SANE_FALSE) != SANE_STATUS_GOOD))
{
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
}
}
/* FIXME: the default device is not necessarily the first device. *
* Users should be able to choose the default device */
if (device_list && device_list[0])
{
pSourceIdentity->Id = DSM_sourceId ++;
strcpy (pSourceIdentity->ProductName, device_list[0]->name);
strcpy (pSourceIdentity->Manufacturer, device_list[0]->vendor);
strcpy (pSourceIdentity->ProductFamily, device_list[0]->model);
pSourceIdentity->ProtocolMajor = TWON_PROTOCOLMAJOR;
pSourceIdentity->ProtocolMinor = TWON_PROTOCOLMINOR;
twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS;
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST */
TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_IDENTITY pSourceIdentity;/* = (pTW_IDENTITY) pData;*/
SANE_Status status;
TRACE ("DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST\n");
status = sane_get_devices (&device_list, SANE_FALSE);
if (status == SANE_STATUS_GOOD)
{
if (device_list[0])
{
pSourceIdentity->Id = DSM_sourceId ++;
strcpy (pSourceIdentity->ProductName, device_list[0]->name);
strcpy (pSourceIdentity->Manufacturer, device_list[0]->vendor);
strcpy (pSourceIdentity->ProductFamily, device_list[0]->model);
pSourceIdentity->ProtocolMajor = TWON_PROTOCOLMAJOR;
pSourceIdentity->ProtocolMinor = TWON_PROTOCOLMINOR;
}
DSM_currentDevice = 1;
twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS;
}
else if (status == SANE_STATUS_NO_MEM)
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_LOWMEMORY;
}
else
{
WARN("sane_get_devices() failed: %s\n", sane_strstatus (status));
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT */
TW_UINT16 TWAIN_IdentityGetNext (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
DSM_twCC = TWCC_SUCCESS;
return TWRC_ENDOFLIST;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT\n");
if (device_list && device_list[DSM_currentDevice])
{
pSourceIdentity->Id = DSM_sourceId ++;
strcpy (pSourceIdentity->ProductName, device_list[DSM_currentDevice]->name);
strcpy (pSourceIdentity->Manufacturer, device_list[DSM_currentDevice]->vendor);
strcpy (pSourceIdentity->ProductFamily, device_list[DSM_currentDevice]->model);
pSourceIdentity->ProtocolMajor = TWON_PROTOCOLMAJOR;
pSourceIdentity->ProtocolMinor = TWON_PROTOCOLMINOR;
DSM_currentDevice ++;
twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS;
}
else
{
DSM_twCC = TWCC_SUCCESS;
twRC = TWRC_ENDOFLIST;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_IDENTITY/MSG_OPENDS */
TW_UINT16 TWAIN_OpenDS (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS, i = 0;
pTW_IDENTITY pIdentity = (pTW_IDENTITY) pData;
activeDS *newSource;
SANE_Status status;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_OPENDS\n");
if (DSM_currentState != 3)
{
DSM_twCC = TWCC_SEQERROR;
return TWRC_FAILURE;
}
if (!device_list &&
(sane_get_devices (&device_list, SANE_FALSE) != SANE_STATUS_GOOD))
{
DSM_twCC = TWCC_NODS;
return TWRC_FAILURE;
}
if (pIdentity->ProductName[0] != '\0')
{
/* Make sure the source to be open exists in the device list */
for (i = 0; device_list[i]; i ++)
{
if (strcmp (device_list[i]->name, pIdentity->ProductName) == 0)
break;
}
}
if (device_list[i])
{
/* the source is found in the device list */
newSource = HeapAlloc (GetProcessHeap(), 0, sizeof (activeDS));
if (newSource)
{
status = sane_open(device_list[i]->name,&newSource->deviceHandle);
if (status == SANE_STATUS_GOOD)
{
/* Assign name and id for the opened data source */
strcpy (pIdentity->ProductName, device_list[i]->name);
pIdentity->Id = DSM_sourceId ++;
/* add the data source to an internal active source list */
newSource->next = activeSources;
newSource->identity.Id = pIdentity->Id;
strcpy (newSource->identity.ProductName, pIdentity->ProductName);
newSource->currentState = 4; /*transition into state 4*/
newSource->twCC = TWCC_SUCCESS;
activeSources = newSource;
twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS;
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_OPERATIONERROR;
}
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_LOWMEMORY;
}
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_IDENTITY/MSG_USERSELECT */
TW_UINT16 TWAIN_UserSelect (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
return TWRC_SUCCESS;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
TRACE("DG_CONTROL/DAT_IDENTITY/MSG_USERSELECT\n");
/* FIXME: we should replace xscanimage with our own User Select UI */
system("xscanimage");
DSM_twCC = TWCC_SUCCESS;
return twRC;
#endif
}
/* DG_CONTROL/DAT_PARENT/MSG_CLOSEDSM */
TW_UINT16 TWAIN_CloseDSM (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
activeDS *currentDS = activeSources, *nextDS;
TRACE("DG_CONTROL/DAT_PARENT/MSG_CLOSEDSM\n");
if (DSM_currentState == 3)
{
sane_exit ();
DSM_initialized = FALSE;
DSM_parentHWND = 0;
DSM_currentState = 2;
/* If there are data sources still open, close them now. */
while (currentDS != NULL)
{
nextDS = currentDS->next;
sane_close (currentDS->deviceHandle);
HeapFree (GetProcessHeap(), 0, currentDS);
currentDS = nextDS;
}
activeSources = NULL;
DSM_twCC = TWCC_SUCCESS;
twRC = TWRC_SUCCESS;
}
else
{
DSM_twCC = TWCC_SEQERROR;
twRC = TWRC_FAILURE;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_PARENT/MSG_OPENDSM */
TW_UINT16 TWAIN_OpenDSM (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
#ifndef HAVE_SANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
SANE_Status status;
SANE_Int version_code;
TRACE("DG_CONTROL/DAT_PARENT/MSG_OPENDSM\n");
if (DSM_currentState == 2)
{
if (!DSM_initialized)
{
DSM_initialized = TRUE;
status = sane_init (&version_code, NULL);
device_list = NULL;
DSM_currentDevice = 0;
DSM_sourceId = 0;
}
DSM_parentHWND = *pData;
DSM_currentState = 3; /* transition to state 3 */
DSM_twCC = TWCC_SUCCESS;
twRC = TWRC_SUCCESS;
}
else
{
/* operation invoked in invalid state */
DSM_twCC = TWCC_SEQERROR;
twRC = TWRC_FAILURE;
}
return twRC;
#endif
}
/* DG_CONTROL/DAT_STATUS/MSG_GET */
TW_UINT16 TWAIN_GetDSMStatus (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{
pTW_STATUS pSourceStatus = (pTW_STATUS) pData;
TRACE ("DG_CONTROL/DAT_STATUS/MSG_GET\n");
pSourceStatus->ConditionCode = DSM_twCC;
DSM_twCC = TWCC_SUCCESS; /* clear the condition code */
return TWRC_SUCCESS;
}

1876
dlls/twain/twain.h Normal file

File diff suppressed because it is too large Load Diff

641
dlls/twain/twain32_main.c Normal file
View File

@ -0,0 +1,641 @@
/*
* TWAIN32 functions
*
* Copyright 2000 Shi Quan He <shiquan@cyberdude.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "windef.h"
#include "winbase.h"
#include "twain.h"
#include "twain_i.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(twain);
BOOL WINAPI
TWAIN_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DSM_currentState = 2;
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
DSM_currentState = 1;
break;
}
return TRUE;
}
TW_UINT16 TWAIN_SourceManagerHandler (
pTW_IDENTITY pOrigin,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
switch (DAT)
{
case DAT_IDENTITY:
switch (MSG)
{
case MSG_CLOSEDS:
twRC = TWAIN_CloseDS (pOrigin, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_IdentityGetDefault (pOrigin, pData);
break;
case MSG_GETFIRST:
twRC = TWAIN_IdentityGetFirst (pOrigin, pData);
break;
case MSG_GETNEXT:
twRC = TWAIN_IdentityGetNext (pOrigin, pData);
break;
case MSG_OPENDS:
twRC = TWAIN_OpenDS (pOrigin, pData);
break;
case MSG_USERSELECT:
twRC = TWAIN_UserSelect (pOrigin, pData);
break;
default:
/* Unrecognized operation triplet */
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
break;
case DAT_PARENT:
switch (MSG)
{
case MSG_CLOSEDSM:
twRC = TWAIN_CloseDSM (pOrigin, pData);
break;
case MSG_OPENDSM:
twRC = TWAIN_OpenDSM (pOrigin, pData);
break;
default:
/* Unrecognized operation triplet */
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
}
break;
case DAT_STATUS:
if (MSG == MSG_GET)
{
twRC = TWAIN_GetDSMStatus (pOrigin, pData);
}
else
{
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
}
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
return twRC;
}
TW_UINT16 TWAIN_SourceControlHandler (
pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
switch (DAT)
{
case DAT_CAPABILITY:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_CapabilityGet (pOrigin, pDest, pData);
break;
case MSG_GETCURRENT:
twRC = TWAIN_CapabilityGetCurrent (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_CapabilityGetDefault (pOrigin, pDest, pData);
break;
case MSG_QUERYSUPPORT:
twRC = TWAIN_CapabilityQuerySupport (pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_CapabilityReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_CapabilitySet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
WARN("unrecognized opertion triplet\n");
}
break;
case DAT_CUSTOMDSDATA:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_CustomDSDataGet (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_CustomDSDataSet (pOrigin, pDest, pData);
break;
default:
break;
}
break;
case DAT_FILESYSTEM:
switch (MSG)
{
/*case MSG_AUTOMATICCAPTUREDIRECTORY:
twRC = TWAIN_AutomaticCaptureDirectory
(pOrigin, pDest, pData);
break;*/
case MSG_CHANGEDIRECTORY:
twRC = TWAIN_ChangeDirectory (pOrigin, pDest, pData);
break;
/*case MSG_COPY:
twRC = TWAIN_FileSystemCopy (pOrigin, pDest, pData);
break;*/
case MSG_CREATEDIRECTORY:
twRC = TWAIN_CreateDirectory (pOrigin, pDest, pData);
break;
case MSG_DELETE:
twRC = TWAIN_FileSystemDelete (pOrigin, pDest, pData);
break;
case MSG_FORMATMEDIA:
twRC = TWAIN_FormatMedia (pOrigin, pDest, pData);
break;
case MSG_GETCLOSE:
twRC = TWAIN_FileSystemGetClose (pOrigin, pDest, pData);
break;
case MSG_GETFIRSTFILE:
twRC = TWAIN_FileSystemGetFirstFile
(pOrigin, pDest, pData);
break;
case MSG_GETINFO:
twRC = TWAIN_FileSystemGetInfo (pOrigin, pDest, pData);
break;
case MSG_GETNEXTFILE:
twRC = TWAIN_FileSystemGetNextFile
(pOrigin, pDest, pData);
break;
case MSG_RENAME:
twRC = TWAIN_FileSystemRename (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
break;
}
break;
case DAT_EVENT:
if (MSG == MSG_PROCESSEVENT)
twRC = TWAIN_ProcessEvent (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_PASSTHRU:
if (MSG == MSG_PASSTHRU)
twRC = TWAIN_PassThrough (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_PENDINGXFERS:
switch (MSG)
{
case MSG_ENDXFER:
twRC = TWAIN_PendingXfersEndXfer (pOrigin, pDest, pData);
break;
case MSG_GET:
twRC = TWAIN_PendingXfersGet (pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_PendingXfersReset (pOrigin, pDest, pData);
break;
/*case MSG_STOPFEEDER:
twRC = TWAIN_PendingXfersStopFeeder
(pOrigin, pDest, pData);
break;*/
default:
twRC = TWRC_FAILURE;
}
break;
case DAT_SETUPFILEXFER:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_SetupFileXferGet (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_SetupFileXferGetDefault
(pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_SetupFileXferReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_SetupFileXferSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
break;
}
break;
/*case DAT_SETUPFILEXFER2:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_SetupFileXfer2Get (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_SetupFileXfer2GetDefault
(pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_SetupFileXfer2Reset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_SetupFileXfer2Set (pOrigin, pDest, pData);
break;
}
break;*/
case DAT_SETUPMEMXFER:
if (MSG == MSG_GET)
twRC = TWAIN_SetupMemXferGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_STATUS:
if (MSG == MSG_GET)
twRC = TWAIN_GetDSStatus (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_USERINTERFACE:
switch (MSG)
{
case MSG_DISABLEDS:
twRC = TWAIN_DisableDSUserInterface
(pOrigin, pDest, pData);
break;
case MSG_ENABLEDS:
twRC = TWAIN_EnableDSUserInterface
(pOrigin, pDest, pData);
break;
case MSG_ENABLEDSUIONLY:
twRC = TWAIN_EnableDSUIOnly (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
break;
}
break;
case DAT_XFERGROUP:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_XferGroupGet (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_XferGroupSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
break;
}
break;
default:
twRC = TWRC_FAILURE;
break;
}
return twRC;
}
TW_UINT16 TWAIN_ControlGroupHandler (
pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
if (pDest)
{
/* This operation's destination is a source */
twRC = TWAIN_SourceControlHandler (pOrigin, pDest, DAT, MSG, pData);
}
else
{
/* This operation's destination is the Source Manager */
twRC = TWAIN_SourceManagerHandler (pOrigin, DAT, MSG, pData);
}
return twRC;
}
TW_UINT16 TWAIN_ImageGroupHandler (
pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS;
if (pDest == NULL)
{
DSM_twCC = TWCC_BADDEST;
return TWRC_FAILURE;
}
switch (DAT)
{
case DAT_CIECOLOR:
if (MSG == MSG_GET)
twRC = TWAIN_CIEColorGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_EXTIMAGEINFO:
if (MSG == MSG_GET)
twRC = TWAIN_ExtImageInfoGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_GRAYRESPONSE:
switch (MSG)
{
case MSG_RESET:
twRC = TWAIN_GrayResponseReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_GrayResponseSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
break;
case DAT_IMAGEFILEXFER:
if (MSG == MSG_GET)
twRC = TWAIN_ImageFileXferGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_IMAGEINFO:
if (MSG == MSG_GET)
twRC = TWAIN_ImageInfoGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_IMAGELAYOUT:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_ImageLayoutGet (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_ImageLayoutGetDefault (pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_ImageLayoutReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_ImageLayoutSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
break;
case DAT_IMAGEMEMXFER:
if (MSG == MSG_GET)
twRC = TWAIN_ImageMemXferGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_IMAGENATIVEXFER:
if (MSG == MSG_GET)
twRC = TWAIN_ImageNativeXferGet (pOrigin, pDest, pData);
else
twRC = TWRC_FAILURE;
break;
case DAT_JPEGCOMPRESSION:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_JPEGCompressionGet (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_JPEGCompressionGetDefault
(pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_JPEGCompressionReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_JPEGCompressionSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
break;
case DAT_PALETTE8:
switch (MSG)
{
case MSG_GET:
twRC = TWAIN_Palette8Get (pOrigin, pDest, pData);
break;
case MSG_GETDEFAULT:
twRC = TWAIN_Palette8GetDefault (pOrigin, pDest, pData);
break;
case MSG_RESET:
twRC = TWAIN_Palette8Reset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_Palette8Set (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
}
break;
case DAT_RGBRESPONSE:
switch (MSG)
{
case MSG_RESET:
twRC = TWAIN_RGBResponseReset (pOrigin, pDest, pData);
break;
case MSG_SET:
twRC = TWAIN_RGBResponseSet (pOrigin, pDest, pData);
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
break;
}
break;
default:
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_BADPROTOCOL;
WARN("unrecognized operation triplet\n");
}
return twRC;
}
TW_UINT16 TWAIN_AudioGroupHandler (
pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_FAILURE;
switch (DAT)
{
case DAT_AUDIOFILEXFER:
if (MSG == MSG_GET)
twRC = TWAIN_AudioFileXferGet (pOrigin, pDest, pData);
break;
case DAT_AUDIOINFO:
if (MSG == MSG_GET)
twRC = TWAIN_AudioInfoGet (pOrigin, pDest, pData);
break;
case DAT_AUDIONATIVEXFER:
if (MSG == MSG_GET)
twRC = TWAIN_AudioNativeXferGet (pOrigin, pDest, pData);
break;
default:
DSM_twCC = TWCC_BADPROTOCOL;
twRC = TWRC_FAILURE;
break;
}
return twRC;
}
/* Main entry point for the TWAIN library */
TW_UINT16 WINAPI
DSM_Entry (pTW_IDENTITY pOrigin,
pTW_IDENTITY pDest,
TW_UINT32 DG,
TW_UINT16 DAT,
TW_UINT16 MSG,
TW_MEMREF pData)
{
TW_UINT16 twRC = TWRC_SUCCESS; /* Return Code */
TRACE("(DG=%ld DAT=%d MSG=%d)\n", DG, DAT, MSG);
switch (DG)
{
case DG_CONTROL:
twRC = TWAIN_ControlGroupHandler (pOrigin,pDest,DAT,MSG,pData);
break;
case DG_IMAGE:
twRC = TWAIN_ImageGroupHandler (pOrigin,pDest,DAT,MSG,pData);
break;
case DG_AUDIO:
twRC = TWAIN_AudioGroupHandler (pOrigin,pDest,DAT,MSG,pData);
break;
default:
DSM_twCC = TWCC_BADPROTOCOL;
twRC = TWRC_FAILURE;
}
return twRC;
}
/* A helper function that looks up a destination identity in the active
source list */
activeDS *TWAIN_LookupSource (pTW_IDENTITY pDest)
{
activeDS *pSource;
for (pSource = activeSources; pSource; pSource = pSource->next)
if (pSource->identity.Id == pDest->Id)
break;
return pSource;
}

12
dlls/twain/twain_32.spec Normal file
View File

@ -0,0 +1,12 @@
name twain_32
type win32
init TWAIN_LibMain
import user32.dll
import gdi32.dll
import kernel32.dll
import ntdll.dll
debug_channels (twain)
@ stdcall DSM_Entry(ptr ptr long long long ptr) DSM_Entry

239
dlls/twain/twain_i.h Normal file
View File

@ -0,0 +1,239 @@
/*
* Copyright 2000 Corel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _TWAIN32_H
#define _TWAIN32_H
#ifdef HAVE_SANE
# include <sane/sane.h>
#endif
#include "twain.h"
#include "windef.h"
/* internel information about an active data source */
typedef struct tagActiveDS
{
struct tagActiveDS *next; /* next active DS */
TW_IDENTITY identity; /* identity */
TW_UINT16 currentState; /* current state */
TW_EVENT pendingEvent; /* pending event to be sent to
application */
TW_UINT16 twCC; /* condition code */
HWND hwndOwner; /* window handle of the app */
#ifdef HAVE_SANE
SANE_Handle deviceHandle; /* device handle */
SANE_Parameters sane_param; /* parameters about the image
transfered */
#endif
/* Capabiblities */
TW_UINT16 capXferMech; /* ICAP_XFERMECH */
} activeDS;
TW_UINT16 DSM_initialized; /* whether Source Manager is initialized */
TW_UINT16 DSM_currentState; /* current state of Source Manager */
TW_UINT16 DSM_twCC; /* current condition code of Source Manager */
TW_INT32 DSM_parentHWND; /* window handle of the Source's "parent" */
TW_UINT32 DSM_sourceId; /* source id generator */
TW_UINT16 DSM_currentDevice; /* keep track of device during enumeration */
#ifdef HAVE_SANE
const SANE_Device **device_list;/* a list of all sane devices */
#endif
activeDS *activeSources; /* list of active data sources */
/* Helper functions */
extern activeDS *TWAIN_LookupSource (pTW_IDENTITY pDest);
extern TW_UINT16 TWAIN_SaneCapability (activeDS *pSource,
pTW_CAPABILITY pCapability, TW_UINT16 action);
/* */
extern TW_UINT16 TWAIN_ControlGroupHandler (
pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 TWAIN_ImageGroupHandler (
pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 TWAIN_AudioGroupHandler (
pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,
TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
extern TW_UINT16 TWAIN_SourceManagerHandler (
pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
/* Implementation of operation triplets (From Application to Source Manager) */
extern TW_UINT16 TWAIN_CloseDS
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_IdentityGetDefault
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_IdentityGetFirst
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_IdentityGetNext
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_OpenDS
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_UserSelect
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_CloseDSM
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_OpenDSM
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
extern TW_UINT16 TWAIN_GetDSMStatus
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
/* Implementation of operation triplets
* From Application to Source (Control Information) */
TW_UINT16 TWAIN_CapabilityGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CapabilityGetCurrent
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest,TW_MEMREF pData);
TW_UINT16 TWAIN_CapabilityGetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CapabilityQuerySupport
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CapabilityReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CapabilitySet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CustomDSDataGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CustomDSDataSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_AutomaticCaptureDirectory
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ChangeDirectory
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemCopy
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_CreateDirectory
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemDelete
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FormatMedia
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemGetClose
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemGetFirstFile
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemGetInfo
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemGetNextFile
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_FileSystemRename
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ProcessEvent
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_PassThrough
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_PendingXfersEndXfer
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_PendingXfersGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_PendingXfersReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_PendingXfersStopFeeder
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXferGetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXferReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXferSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXfer2Get
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXfer2GetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXfer2Reset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupFileXfer2Set
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_SetupMemXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_GetDSStatus
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_DisableDSUserInterface
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_EnableDSUserInterface
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_EnableDSUIOnly
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_XferGroupGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_XferGroupSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
/* Implementation of operation triplets
* From Application to Source (Image Information) */
TW_UINT16 TWAIN_CIEColorGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ExtImageInfoGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_GrayResponseReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_GrayResponseSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageFileXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageInfoGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageLayoutGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageLayoutGetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageLayoutReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageLayoutSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageMemXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_ImageNativeXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_JPEGCompressionGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_JPEGCompressionGetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_JPEGCompressionReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_JPEGCompressionSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_Palette8Get
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_Palette8GetDefault
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_Palette8Reset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_Palette8Set
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_RGBResponseReset
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_RGBResponseSet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
/* Implementation of operation triplets
* From Application to Source (Audio Information) */
TW_UINT16 TWAIN_AudioFileXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_AudioInfoGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
TW_UINT16 TWAIN_AudioNativeXferGet
(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, TW_MEMREF pData);
/* Implementation of TWAIN capabilities */
TW_UINT16 TWAIN_ICAPXferMech
(activeDS *pSource, pTW_CAPABILITY pCapability, TW_UINT16 action);
#endif

View File

@ -334,6 +334,9 @@
/* Define if you have the `rfork' function. */
#undef HAVE_RFORK
/* Define if we have SANE development environment */
#undef HAVE_SANE
/* Define if you have the <sched.h> header file. */
#undef HAVE_SCHED_H