From: Bernd Herd codeberg@herdsoft.com
Implement DG_CONTROL/DAT_ENTRYPOINT/MSG_GET as a first step towards implementing Twain 2.0 extensions to the protocol --- dlls/twaindsm/dsm_ctrl.c | 34 ++++++++++++++++++++++++++++++++++ dlls/twaindsm/twain32_main.c | 15 +++++++++++++++ dlls/twaindsm/twain_i.h | 1 + include/twain.h | 2 ++ 4 files changed, 52 insertions(+)
diff --git a/dlls/twaindsm/dsm_ctrl.c b/dlls/twaindsm/dsm_ctrl.c index c77f4f32b6b..8addc688188 100644 --- a/dlls/twaindsm/dsm_ctrl.c +++ b/dlls/twaindsm/dsm_ctrl.c @@ -582,6 +582,12 @@ TW_UINT16 TWAIN_OpenDSM (pTW_IDENTITY pOrigin, TW_MEMREF pData) TRACE("DG_CONTROL/DAT_PARENT/MSG_OPENDSM\n"); if (!DSM_initialized) { event_message = RegisterWindowMessageA("WINE TWAIN_32 EVENT"); + + if (pOrigin->SupportedGroups & DF_APP2) + { + pOrigin->SupportedGroups |= DF_DSM2; + } + DSM_currentDevice = 0; DSM_initialized = TRUE; DSM_twCC = TWCC_SUCCESS; @@ -606,3 +612,31 @@ TW_UINT16 TWAIN_GetDSMStatus (pTW_IDENTITY pOrigin, TW_MEMREF pData) DSM_twCC = TWCC_SUCCESS; /* clear the condition code */ return TWRC_SUCCESS; } + + +/* DG_CONTROL/DAT_ENTRYPOINT/MSG_GET */ +TW_UINT16 TWAIN_GetEntrypoint(TW_ENTRYPOINT *pEntrypoint) +{ + TW_UINT16 twRC; + + if (!pEntrypoint) + { + ERR("pEntrypoint is null\n"); + twRC = TWRC_FAILURE; + DSM_twCC = TWCC_BADVALUE; + } + else if (pEntrypoint->Size < sizeof(TW_ENTRYPOINT)) + { + ERR("pEntrypoint->Size=%ld too small\n", pEntrypoint->Size); + twRC = TWRC_FAILURE; + DSM_twCC = TWCC_BADVALUE; + } + else + { + memcpy(pEntrypoint, &_entrypoints, sizeof(_entrypoints)); + twRC = TWRC_SUCCESS; + DSM_twCC = TWCC_SUCCESS; + } + + return twRC; +} diff --git a/dlls/twaindsm/twain32_main.c b/dlls/twaindsm/twain32_main.c index a8b11a9bbfe..8edbad40327 100644 --- a/dlls/twaindsm/twain32_main.c +++ b/dlls/twaindsm/twain32_main.c @@ -126,6 +126,21 @@ static TW_UINT16 TWAIN_SourceManagerHandler ( } break;
+ case DAT_ENTRYPOINT: + switch (MSG) + { + case MSG_GET: + twRC = TWAIN_GetEntrypoint((TW_ENTRYPOINT *) 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); diff --git a/dlls/twaindsm/twain_i.h b/dlls/twaindsm/twain_i.h index 7ff608d2e95..a4aa37a5dbd 100644 --- a/dlls/twaindsm/twain_i.h +++ b/dlls/twaindsm/twain_i.h @@ -63,5 +63,6 @@ extern TW_UINT16 TWAIN_OpenDSM(pTW_IDENTITY pOrigin, TW_MEMREF pData); extern TW_UINT16 TWAIN_GetDSMStatus(pTW_IDENTITY pOrigin, TW_MEMREF pData); extern TW_UINT16 TWAIN_ControlNull(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, activeDS *pSource, TW_UINT16 MSG, TW_MEMREF pData); extern TW_UINT16 TWAIN_ProcessEvent(pTW_IDENTITY pOrigin, activeDS *pSource, TW_MEMREF pData); +extern TW_UINT16 TWAIN_GetEntrypoint(TW_ENTRYPOINT *pEntrypoint);
#endif diff --git a/include/twain.h b/include/twain.h index ec17a4fe519..0dc65fcd8d0 100644 --- a/include/twain.h +++ b/include/twain.h @@ -1845,6 +1845,8 @@ typedef TW_UINT16 (*DSENTRYPROC)(pTW_IDENTITY,
/* Definitions from TWAIN 2.x used by our builtin data sources */ #define DAT_ENTRYPOINT 0x0403 +#define DF_DSM2 0x10000000L +#define DF_APP2 0x20000000L #define DF_DS2 0x40000000
#ifdef __cplusplus