ReactOS  0.4.15-dev-492-ga1108f6
twain_i.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "twain.h"
#include "wine/list.h"
Include dependency graph for twain_i.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pending_message
 
struct  tagActiveDS
 

Typedefs

typedef struct tagActiveDS activeDS
 

Functions

TW_UINT16 TWAIN_CloseDS (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_IdentityGetDefault (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_IdentityGetNext (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_OpenDS (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_UserSelect (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_CloseDSM (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_OpenDSM (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_GetDSMStatus (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_ControlNull (pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, activeDS *pSource, TW_UINT16 MSG, TW_MEMREF pData) DECLSPEC_HIDDEN
 
TW_UINT16 TWAIN_ProcessEvent (pTW_IDENTITY pOrigin, activeDS *pSource, TW_MEMREF pData) DECLSPEC_HIDDEN
 

Variables

TW_UINT16 DSM_twCC DECLSPEC_HIDDEN
 

Typedef Documentation

◆ activeDS

Function Documentation

◆ TWAIN_CloseDS()

TW_UINT16 TWAIN_CloseDS ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 200 of file dsm_ctrl.c.

201 {
202  TW_UINT16 twRC = TWRC_SUCCESS;
203  pTW_IDENTITY pIdentity = (pTW_IDENTITY) pData;
204  activeDS *currentDS = NULL, *prevDS = NULL;
205 
206  TRACE ("DG_CONTROL/DAT_IDENTITY/MSG_CLOSEDS\n");
207 
208  for (currentDS = activeSources; currentDS; currentDS = currentDS->next) {
209  if (currentDS->identity.Id == pIdentity->Id)
210  break;
211  prevDS = currentDS;
212  }
213  if (!currentDS) {
214  DSM_twCC = TWCC_NODS;
215  return TWRC_FAILURE;
216  }
217  twRC = currentDS->dsEntry (pOrigin, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, pData);
218  /* This causes crashes due to still open Windows, so leave out for now.
219  * FreeLibrary (currentDS->hmod);
220  */
221  if (prevDS)
222  prevDS->next = currentDS->next;
223  else
224  activeSources = currentDS->next;
225  HeapFree (GetProcessHeap(), 0, currentDS);
226  if (twRC == TWRC_SUCCESS)
227  DSM_twCC = TWCC_SUCCESS;
228  else /* FIXME: unclear how to get TWCC */
229  DSM_twCC = TWCC_SEQERROR;
230  return twRC;
231 }
struct tagActiveDS * next
Definition: twain_i.h:39
#define TWRC_SUCCESS
Definition: twain.h:1664
unsigned short TW_UINT16
Definition: twain.h:119
TW_IDENTITY identity
Definition: twain_i.h:40
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
#define MSG_CLOSEDS
Definition: twain.h:1410
DSENTRYPROC dsEntry
Definition: twain_i.h:42
#define DG_CONTROL
Definition: twain.h:1311
#define TWCC_SUCCESS
Definition: twain.h:1678
TW_UINT32 Id
Definition: twain.h:257
#define TWRC_FAILURE
Definition: twain.h:1665
#define TWCC_NODS
Definition: twain.h:1681
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762
#define HeapFree(x, y, z)
Definition: compat.h:403
#define TWCC_SEQERROR
Definition: twain.h:1687
#define DAT_IDENTITY
Definition: twain.h:1337

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_CloseDSM()

TW_UINT16 TWAIN_CloseDSM ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 455 of file dsm_ctrl.c.

456 {
457  activeDS *currentDS = activeSources, *nextDS;
458 
459  TRACE("DG_CONTROL/DAT_PARENT/MSG_CLOSEDSM\n");
460 
461  if (DSM_initialized)
462  {
464 
465  /* If there are data sources still open, close them now. */
466  while (currentDS != NULL)
467  {
468  nextDS = currentDS->next;
469  currentDS->dsEntry (pOrigin, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, pData);
470  HeapFree (GetProcessHeap(), 0, currentDS);
471  currentDS = nextDS;
472  }
473  activeSources = NULL;
474  DSM_parent = NULL;
475  DSM_twCC = TWCC_SUCCESS;
476  return TWRC_SUCCESS;
477  } else {
478  DSM_twCC = TWCC_SEQERROR;
479  return TWRC_FAILURE;
480  }
481 }
struct tagActiveDS * next
Definition: twain_i.h:39
#define TWRC_SUCCESS
Definition: twain.h:1664
smooth NULL
Definition: ftsmooth.c:416
static HWND DSM_parent
Definition: dsm_ctrl.c:39
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
#define MSG_CLOSEDS
Definition: twain.h:1410
DSENTRYPROC dsEntry
Definition: twain_i.h:42
#define DG_CONTROL
Definition: twain.h:1311
#define TWCC_SUCCESS
Definition: twain.h:1678
static TW_UINT16 DSM_initialized
Definition: dsm_ctrl.c:36
#define TWRC_FAILURE
Definition: twain.h:1665
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define HeapFree(x, y, z)
Definition: compat.h:403
#define TWCC_SEQERROR
Definition: twain.h:1687
#define DAT_IDENTITY
Definition: twain.h:1337

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_ControlNull()

TW_UINT16 TWAIN_ControlNull ( pTW_IDENTITY  pOrigin,
pTW_IDENTITY  pDest,
activeDS pSource,
TW_UINT16  MSG,
TW_MEMREF  pData 
)

Definition at line 120 of file dsm_ctrl.c.

121 {
122  struct pending_message *message;
123 
124  TRACE ("DG_CONTROL/DAT_NULL MSG=%i\n", MSG);
125 
126  if (MSG != MSG_CLOSEDSREQ &&
127  MSG != MSG_DEVICEEVENT &&
128  MSG != MSG_XFERREADY)
129  {
130  DSM_twCC = TWCC_BADPROTOCOL;
131  return TWRC_FAILURE;
132  }
133 
134  message = HeapAlloc(GetProcessHeap(), 0, sizeof(*message));
135  if (!message)
136  {
137  DSM_twCC = TWCC_LOWMEMORY;
138  return TWRC_FAILURE;
139  }
140 
141  message->msg = MSG;
142  list_add_tail(&pSource->pending_messages, &message->entry);
143 
144  /* Delphi twain only sends us messages from one window, and it
145  doesn't even give us the real handle to that window. Other
146  applications might decide to forward messages sent to DSM_parent
147  or to the one supplied to ENABLEDS. So let's try very hard to
148  find a window that will work. */
149  if (DSM_parent)
151  if (pSource->ui_window && pSource->ui_window != DSM_parent)
152  PostMessageW(pSource->ui_window, event_message, 0, 0);
153  if (pSource->event_window && pSource->event_window != pSource->ui_window &&
154  pSource->event_window != DSM_parent)
155  PostMessageW(pSource->event_window, event_message, 0, 0);
156  PostMessageW(0, event_message, 0, 0);
157 
158  return TWRC_SUCCESS;
159 }
HWND event_window
Definition: twain_i.h:45
Definition: tftpd.h:59
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define TWCC_LOWMEMORY
Definition: twain.h:1680
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
#define TWRC_SUCCESS
Definition: twain.h:1664
#define MSG_XFERREADY
Definition: twain.h:1395
static UINT event_message
Definition: dsm_ctrl.c:40
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
HWND ui_window
Definition: twain_i.h:44
#define MSG_CLOSEDSREQ
Definition: twain.h:1396
static HWND DSM_parent
Definition: dsm_ctrl.c:39
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MSG_DEVICEEVENT
Definition: twain.h:1399
#define MSG
Definition: Mailslot.c:11
#define TWCC_BADPROTOCOL
Definition: twain.h:1685
struct list pending_messages
Definition: twain_i.h:43
#define TWRC_FAILURE
Definition: twain.h:1665
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DSM_Entry().

◆ TWAIN_GetDSMStatus()

TW_UINT16 TWAIN_GetDSMStatus ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 505 of file dsm_ctrl.c.

506 {
507  pTW_STATUS pSourceStatus = (pTW_STATUS) pData;
508 
509  TRACE ("DG_CONTROL/DAT_STATUS/MSG_GET\n");
510 
511  pSourceStatus->ConditionCode = DSM_twCC;
512  DSM_twCC = TWCC_SUCCESS; /* clear the condition code */
513  return TWRC_SUCCESS;
514 }
#define TWRC_SUCCESS
Definition: twain.h:1664
#define TRACE(s)
Definition: solgame.cpp:4
struct TW_STATUS * pTW_STATUS
#define TWCC_SUCCESS
Definition: twain.h:1678
TW_UINT16 ConditionCode
Definition: twain.h:352
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_IdentityGetDefault()

TW_UINT16 TWAIN_IdentityGetDefault ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 234 of file dsm_ctrl.c.

235 {
236  pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
237 
238  TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETDEFAULT\n");
239  DSM_twCC = TWCC_NODS;
241  if (!nrdevices)
242  return TWRC_FAILURE;
243  *pSourceIdentity = devices[0].identity;
244  DSM_twCC = TWCC_SUCCESS;
245  return TWRC_SUCCESS;
246 }
static void twain_autodetect(void)
Definition: dsm_ctrl.c:106
#define TWRC_SUCCESS
Definition: twain.h:1664
static int nrdevices
Definition: dsm_ctrl.c:47
#define TRACE(s)
Definition: solgame.cpp:4
static struct all_devices * devices
Definition: dsm_ctrl.c:48
#define TWCC_SUCCESS
Definition: twain.h:1678
#define TWRC_FAILURE
Definition: twain.h:1665
#define TWCC_NODS
Definition: twain.h:1681
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_IdentityGetFirst()

TW_UINT16 TWAIN_IdentityGetFirst ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 249 of file dsm_ctrl.c.

250 {
251  pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
252 
253  TRACE ("DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST\n");
255  if (!nrdevices) {
256  TRACE ("no entries found.\n");
257  DSM_twCC = TWCC_NODS;
258  return TWRC_FAILURE;
259  }
260  DSM_currentDevice = 0;
261  *pSourceIdentity = devices[DSM_currentDevice++].identity;
262  return TWRC_SUCCESS;
263 }
static void twain_autodetect(void)
Definition: dsm_ctrl.c:106
#define TWRC_SUCCESS
Definition: twain.h:1664
static TW_UINT16 DSM_currentDevice
Definition: dsm_ctrl.c:38
static int nrdevices
Definition: dsm_ctrl.c:47
#define TRACE(s)
Definition: solgame.cpp:4
static struct all_devices * devices
Definition: dsm_ctrl.c:48
#define TWRC_FAILURE
Definition: twain.h:1665
#define TWCC_NODS
Definition: twain.h:1681
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_IdentityGetNext()

TW_UINT16 TWAIN_IdentityGetNext ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 266 of file dsm_ctrl.c.

267 {
268  pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
269 
270  TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT\n");
271  if (!nrdevices || (DSM_currentDevice == nrdevices)) {
272  DSM_twCC = TWCC_SUCCESS;
273  return TWRC_ENDOFLIST;
274  }
275  *pSourceIdentity = devices[DSM_currentDevice++].identity;
276  return TWRC_SUCCESS;
277 }
#define TWRC_SUCCESS
Definition: twain.h:1664
static TW_UINT16 DSM_currentDevice
Definition: dsm_ctrl.c:38
static int nrdevices
Definition: dsm_ctrl.c:47
#define TRACE(s)
Definition: solgame.cpp:4
static struct all_devices * devices
Definition: dsm_ctrl.c:48
#define TWCC_SUCCESS
Definition: twain.h:1678
#define TWRC_ENDOFLIST
Definition: twain.h:1671
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_OpenDS()

TW_UINT16 TWAIN_OpenDS ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 280 of file dsm_ctrl.c.

281 {
282  TW_UINT16 i = 0;
283  pTW_IDENTITY pIdentity = (pTW_IDENTITY) pData;
284  activeDS *newSource;
285  const char *modname = NULL;
286  HMODULE hmod;
287 
288  TRACE("DG_CONTROL/DAT_IDENTITY/MSG_OPENDS\n");
289  TRACE("pIdentity is %s\n", pIdentity->ProductName);
290  if (!DSM_initialized) {
291  FIXME("seq error\n");
292  DSM_twCC = TWCC_SEQERROR;
293  return TWRC_FAILURE;
294  }
296  if (!nrdevices) {
297  FIXME("no devs.\n");
298  DSM_twCC = TWCC_NODS;
299  return TWRC_FAILURE;
300  }
301 
302  if (pIdentity->ProductName[0] != '\0') {
303  /* Make sure the source to be opened exists in the device list */
304  for (i = 0; i<nrdevices; i++)
305  if (!strcmp (devices[i].identity.ProductName, pIdentity->ProductName))
306  break;
307  if (i == nrdevices)
308  i = 0;
309  } /* else use the first device */
310 
311  /* the source is found in the device list */
312  newSource = HeapAlloc (GetProcessHeap(), 0, sizeof (activeDS));
313  if (!newSource) {
314  DSM_twCC = TWCC_LOWMEMORY;
315  FIXME("Out of memory.\n");
316  return TWRC_FAILURE;
317  }
318  hmod = LoadLibraryA(devices[i].modname);
319  if (!hmod) {
320  ERR("Failed to load TWAIN Source %s\n", debugstr_a(modname));
321  DSM_twCC = TWCC_OPERATIONERROR;
322  HeapFree(GetProcessHeap(), 0, newSource);
323  return TWRC_FAILURE;
324  }
325  newSource->hmod = hmod;
326  newSource->dsEntry = (DSENTRYPROC)GetProcAddress(hmod, "DS_Entry");
327  /* Assign id for the opened data source */
328  pIdentity->Id = DSM_sourceId ++;
329  if (TWRC_SUCCESS != newSource->dsEntry (pOrigin, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, pIdentity)) {
330  DSM_twCC = TWCC_OPERATIONERROR;
331  HeapFree(GetProcessHeap(), 0, newSource);
332  DSM_sourceId--;
333  return TWRC_FAILURE;
334  }
335  /* add the data source to an internal active source list */
336  newSource->next = activeSources;
337  newSource->identity.Id = pIdentity->Id;
338  strcpy (newSource->identity.ProductName, pIdentity->ProductName);
339  list_init(&newSource->pending_messages);
340  newSource->ui_window = NULL;
341  newSource->event_window = NULL;
342  activeSources = newSource;
343  DSM_twCC = TWCC_SUCCESS;
344  return TWRC_SUCCESS;
345 }
static TW_UINT32 DSM_sourceId
Definition: dsm_ctrl.c:37
HWND event_window
Definition: twain_i.h:45
struct tagActiveDS * next
Definition: twain_i.h:39
#define TWCC_LOWMEMORY
Definition: twain.h:1680
static void twain_autodetect(void)
Definition: dsm_ctrl.c:106
#define TWRC_SUCCESS
Definition: twain.h:1664
unsigned short TW_UINT16
Definition: twain.h:119
TW_IDENTITY identity
Definition: twain_i.h:40
#define TWCC_OPERATIONERROR
Definition: twain.h:1683
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HWND ui_window
Definition: twain_i.h:44
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define FIXME(fmt,...)
Definition: debug.h:111
static int nrdevices
Definition: dsm_ctrl.c:47
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
DSENTRYPROC dsEntry
Definition: twain_i.h:42
static struct all_devices * devices
Definition: dsm_ctrl.c:48
TW_STR32 ProductName
Definition: twain.h:264
#define DG_CONTROL
Definition: twain.h:1311
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define ERR(fmt,...)
Definition: debug.h:110
struct list pending_messages
Definition: twain_i.h:43
#define TWCC_SUCCESS
Definition: twain.h:1678
static TW_UINT16 DSM_initialized
Definition: dsm_ctrl.c:36
TW_UINT32 Id
Definition: twain.h:257
#define TWRC_FAILURE
Definition: twain.h:1665
#define TWCC_NODS
Definition: twain.h:1681
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HMODULE hmod
Definition: twain_i.h:41
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define GetProcAddress(x, y)
Definition: compat.h:419
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762
#define HeapFree(x, y, z)
Definition: compat.h:403
#define TWCC_SEQERROR
Definition: twain.h:1687
#define MSG_OPENDS
Definition: twain.h:1409
#define DAT_IDENTITY
Definition: twain.h:1337

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_OpenDSM()

TW_UINT16 TWAIN_OpenDSM ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 484 of file dsm_ctrl.c.

485 {
486  TW_UINT16 twRC = TWRC_SUCCESS;
487 
488  TRACE("DG_CONTROL/DAT_PARENT/MSG_OPENDSM\n");
489  if (!DSM_initialized) {
490  event_message = RegisterWindowMessageA("WINE TWAIN_32 EVENT");
491  DSM_currentDevice = 0;
493  DSM_twCC = TWCC_SUCCESS;
494  twRC = TWRC_SUCCESS;
495  } else {
496  /* operation invoked in invalid state */
497  DSM_twCC = TWCC_SEQERROR;
498  twRC = TWRC_FAILURE;
499  }
500  DSM_parent = (HWND)pData;
501  return twRC;
502 }
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:13
#define TWRC_SUCCESS
Definition: twain.h:1664
static UINT event_message
Definition: dsm_ctrl.c:40
unsigned short TW_UINT16
Definition: twain.h:119
static TW_UINT16 DSM_currentDevice
Definition: dsm_ctrl.c:38
static HWND DSM_parent
Definition: dsm_ctrl.c:39
#define TRACE(s)
Definition: solgame.cpp:4
#define TWCC_SUCCESS
Definition: twain.h:1678
static TW_UINT16 DSM_initialized
Definition: dsm_ctrl.c:36
#define TWRC_FAILURE
Definition: twain.h:1665
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define TWCC_SEQERROR
Definition: twain.h:1687
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

Referenced by TWAIN_SourceManagerHandler().

◆ TWAIN_ProcessEvent()

TW_UINT16 TWAIN_ProcessEvent ( pTW_IDENTITY  pOrigin,
activeDS pSource,
TW_MEMREF  pData 
)

Definition at line 162 of file dsm_ctrl.c.

163 {
164  TW_EVENT *event = (TW_EVENT*)pData;
165  MSG *msg = (MSG*)event->pEvent;
167 
168  TRACE("%x,%x\n", msg->message, event_message);
169 
170  if (msg->message == event_message)
171  {
172  if (!list_empty (&pSource->pending_messages))
173  {
174  struct list *entry = list_head (&pSource->pending_messages);
176  event->TWMessage = message->msg;
177  list_remove (entry);
178  TRACE("<-- %x\n", event->TWMessage);
179  }
180  else
181  event->TWMessage = MSG_NULL;
183  }
184 
185  if (msg->hwnd)
186  {
187  MSG dummy;
188  pSource->event_window = msg->hwnd;
189  if (!list_empty (&pSource->pending_messages) &&
191  {
192  PostMessageW(msg->hwnd, event_message, 0, 0);
193  }
194  }
195 
196  return result;
197 }
HWND event_window
Definition: twain_i.h:45
Definition: tftpd.h:59
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define MSG_NULL
Definition: twain.h:1381
static UINT event_message
Definition: dsm_ctrl.c:40
unsigned short TW_UINT16
Definition: twain.h:119
#define PM_NOREMOVE
Definition: winuser.h:1181
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define TWRC_DSEVENT
Definition: twain.h:1668
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define TWRC_NOTDSEVENT
Definition: twain.h:1669
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
struct _cl_event * event
Definition: glext.h:7739
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
struct list pending_messages
Definition: twain_i.h:43
unsigned char dummy
Definition: maze.c:118
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define LIST_ENTRY(type)
Definition: queue.h:175
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
GLuint64EXT * result
Definition: glext.h:11304

Referenced by DSM_Entry().

◆ TWAIN_UserSelect()

TW_UINT16 TWAIN_UserSelect ( pTW_IDENTITY  pOrigin,
TW_MEMREF  pData 
)

Definition at line 428 of file dsm_ctrl.c.

429 {
430  userselect_data param = {pOrigin, pData};
432 
433  TRACE("DG_CONTROL/DAT_IDENTITY/MSG_USERSELECT SupportedGroups=0x%x ProductName=%s\n",
434  pOrigin->SupportedGroups, wine_dbgstr_a(param.result->ProductName));
435 
437 
438  if (!IsWindow(parent))
439  parent = NULL;
440 
443  {
444  TRACE("canceled\n");
445  DSM_twCC = TWCC_SUCCESS;
446  return TWRC_CANCEL;
447  }
448 
449  TRACE("<-- %s\n", wine_dbgstr_a(param.result->ProductName));
450  DSM_twCC = TWCC_SUCCESS;
451  return TWRC_SUCCESS;
452 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
BOOL WINAPI IsWindow(_In_opt_ HWND)
static void twain_autodetect(void)
Definition: dsm_ctrl.c:106
#define TWRC_SUCCESS
Definition: twain.h:1664
TW_UINT32 SupportedGroups
Definition: twain.h:261
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static HWND DSM_parent
Definition: dsm_ctrl.c:39
#define TRACE(s)
Definition: solgame.cpp:4
r parent
Definition: btrfs.c:2944
GLfloat param
Definition: glext.h:5796
#define TWRC_CANCEL
Definition: twain.h:1667
#define TWCC_SUCCESS
Definition: twain.h:1678
#define DLG_USERSELECT
Definition: resource.h:22
static INT_PTR CALLBACK userselect_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dsm_ctrl.c:352
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HINSTANCE DSM_hinstance
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Referenced by TWAIN_SourceManagerHandler().

Variable Documentation

◆ DECLSPEC_HIDDEN

HINSTANCE DSM_hinstance DECLSPEC_HIDDEN

Definition at line 48 of file twain_i.h.