ReactOS 0.4.16-dev-329-g9223134
dsm_ctrl.c
Go to the documentation of this file.
1/*
2 * TWAIN32 Source Manager
3 *
4 * Copyright 2000 Corel Corporation
5 * Copyright 2006 Marcus Meissner
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <stdlib.h>
23#include <stdarg.h>
24#include <stdio.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "winuser.h"
29#include "twain.h"
30#include "twain_i.h"
31#include "resource.h"
32#include "wine/debug.h"
33
35
36static TW_UINT16 DSM_initialized; /* whether Source Manager is initialized */
37static TW_UINT32 DSM_sourceId; /* source id generator */
38static TW_UINT16 DSM_currentDevice; /* keep track of device during enumeration */
41
43 char *modname;
45};
46
47static int nrdevices = 0;
48static struct all_devices *devices = NULL;
49
50static void
51twain_add_onedriver(const char *dsname) {
53 DSENTRYPROC dsEntry;
54 TW_IDENTITY fakeOrigin;
55 TW_IDENTITY sourceId;
57
58 hmod = LoadLibraryA(dsname);
59 if (!hmod) {
60 ERR("Failed to load TWAIN Source %s\n", debugstr_a(dsname));
61 return;
62 }
63 dsEntry = (DSENTRYPROC)GetProcAddress(hmod, "DS_Entry");
64 if (!dsEntry) {
65 ERR("Failed to find DS_Entry() in TWAIN DS %s\n", debugstr_a(dsname));
66 return;
67 }
68 /* Loop to do multiple detects, mostly for sane.ds and gphoto2.ds */
69 do {
70 int i;
71
72 sourceId.Id = DSM_sourceId;
75 ret = dsEntry (&fakeOrigin, DG_CONTROL, DAT_IDENTITY, MSG_GET, &sourceId);
76 if (ret != TWRC_SUCCESS) {
77 ERR("Source->(DG_CONTROL,DAT_IDENTITY,MSG_GET) failed!\n");
78 break;
79 }
80 TRACE("Manufacturer: %s\n", debugstr_a(sourceId.Manufacturer));
81 TRACE("ProductFamily: %s\n", debugstr_a(sourceId.ProductFamily));
82 TRACE("ProductName: %s\n", debugstr_a(sourceId.ProductName));
83
84 for (i=0;i<nrdevices;i++) {
85 if (!strcmp(sourceId.ProductName,devices[i].identity.ProductName))
86 break;
87 }
88 if (i < nrdevices)
89 break;
90 if (nrdevices)
92 else
93 devices = HeapAlloc(GetProcessHeap(), 0, sizeof(devices[0]));
94 if ((devices[nrdevices].modname = HeapAlloc(GetProcessHeap(), 0, strlen(dsname) + 1)))
96 devices[nrdevices].identity = sourceId;
97 nrdevices++;
99 } while (1);
101}
102
104
105static void
107 if (detectionrun) return;
109
110 twain_add_onedriver("sane.ds");
111 twain_add_onedriver("gphoto2.ds");
112#if 0
113 twain_add_onedriver("c:\\windows\\Twain_32\\Largan\\sp503a.ds");
114 twain_add_onedriver("c:\\windows\\Twain_32\\vivicam10\\vivicam10.ds");
115 twain_add_onedriver("c:\\windows\\Twain_32\\ws30slim\\sp500a.ds");
116#endif
117}
118
119/* DG_CONTROL/DAT_NULL/MSG_CLOSEDSREQ|MSG_DEVICEEVENT|MSG_XFERREADY */
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 &&
129 {
131 return TWRC_FAILURE;
132 }
133
134 message = HeapAlloc(GetProcessHeap(), 0, sizeof(*message));
135 if (!message)
136 {
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}
160
161/* Filters MSG_PROCESSEVENT messages before reaching the data source */
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;
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}
198
199/* DG_CONTROL/DAT_IDENTITY/MSG_CLOSEDS */
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) {
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)
228 else /* FIXME: unclear how to get TWCC */
230 return twRC;
231}
232
233/* DG_CONTROL/DAT_IDENTITY/MSG_GETDEFAULT */
235{
236 pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
237
238 TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETDEFAULT\n");
241 if (!nrdevices)
242 return TWRC_FAILURE;
243 *pSourceIdentity = devices[0].identity;
245 return TWRC_SUCCESS;
246}
247
248/* DG_CONTROL/DAT_IDENTITY/MSG_GETFIRST */
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");
258 return TWRC_FAILURE;
259 }
261 *pSourceIdentity = devices[DSM_currentDevice++].identity;
262 return TWRC_SUCCESS;
263}
264
265/* DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT */
267{
268 pTW_IDENTITY pSourceIdentity = (pTW_IDENTITY) pData;
269
270 TRACE("DG_CONTROL/DAT_IDENTITY/MSG_GETNEXT\n");
273 return TWRC_ENDOFLIST;
274 }
275 *pSourceIdentity = devices[DSM_currentDevice++].identity;
276 return TWRC_SUCCESS;
277}
278
279/* DG_CONTROL/DAT_IDENTITY/MSG_OPENDS */
281{
282 TW_UINT16 i = 0;
283 pTW_IDENTITY pIdentity = (pTW_IDENTITY) pData;
284 activeDS *newSource;
285 const char *modname = NULL;
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");
293 return TWRC_FAILURE;
294 }
296 if (!nrdevices) {
297 FIXME("no devs.\n");
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) {
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));
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)) {
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;
344 return TWRC_SUCCESS;
345}
346
347typedef struct {
351
353{
354 switch (msg)
355 {
356 case WM_INITDIALOG:
357 {
359 int i;
360 HWND sourcelist;
361 BOOL any_devices = FALSE;
362
364
365 sourcelist = GetDlgItem(hwnd, IDC_LISTSOURCE);
366
367 for (i=0; i<nrdevices; i++)
368 {
369 TW_IDENTITY *id = &devices[i].identity;
371
372 if ((id->SupportedGroups & data->origin->SupportedGroups) == 0)
373 continue;
374
375 index = SendMessageA(sourcelist, LB_ADDSTRING, 0, (LPARAM)id->ProductName);
377 any_devices = TRUE;
378 }
379
380 if (any_devices)
381 {
383
384 /* FIXME: Select the supplied product name or default source. */
385 SendMessageW(sourcelist, LB_SETCURSEL, 0, 0);
386 }
387
388 return TRUE;
389 }
390 case WM_CLOSE:
391 EndDialog(hwnd, 0);
392 return TRUE;
393 case WM_COMMAND:
395 {
396 EndDialog(hwnd, 0);
397 return TRUE;
398 }
399 else if (wparam == MAKEWPARAM(IDOK, BN_CLICKED) ||
401 {
403 HWND sourcelist;
405
406 sourcelist = GetDlgItem(hwnd, IDC_LISTSOURCE);
407
408 index = SendMessageW(sourcelist, LB_GETCURSEL, 0, 0);
409
410 if (index == LB_ERR)
411 return TRUE;
412
413 index = SendMessageW(sourcelist, LB_GETITEMDATA, (WPARAM)index, 0);
414
415 *data->result = devices[index].identity;
416
417 /* FIXME: Save this as the default source */
418
419 EndDialog(hwnd, 1);
420 return TRUE;
421 }
422 break;
423 }
424 return FALSE;
425}
426
427/* DG_CONTROL/DAT_IDENTITY/MSG_USERSELECT */
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");
446 return TWRC_CANCEL;
447 }
448
449 TRACE("<-- %s\n", wine_dbgstr_a(param.result->ProductName));
451 return TWRC_SUCCESS;
452}
453
454/* DG_CONTROL/DAT_PARENT/MSG_CLOSEDSM */
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 }
476 return TWRC_SUCCESS;
477 } else {
479 return TWRC_FAILURE;
480 }
481}
482
483/* DG_CONTROL/DAT_PARENT/MSG_OPENDSM */
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");
494 twRC = TWRC_SUCCESS;
495 } else {
496 /* operation invoked in invalid state */
498 twRC = TWRC_FAILURE;
499 }
501 return twRC;
502}
503
504/* DG_CONTROL/DAT_STATUS/MSG_GET */
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 MSG
Definition: Mailslot.c:11
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: list.h:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define DLG_USERSELECT
Definition: resource.h:22
#define IDC_LISTSOURCE
Definition: resource.h:24
r parent
Definition: btrfs.c:3010
static void twain_add_onedriver(const char *dsname)
Definition: dsm_ctrl.c:51
static INT_PTR CALLBACK userselect_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dsm_ctrl.c:352
static BOOL detectionrun
Definition: dsm_ctrl.c:103
static TW_UINT16 DSM_initialized
Definition: dsm_ctrl.c:36
TW_UINT16 TWAIN_CloseDS(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:200
TW_UINT16 TWAIN_IdentityGetDefault(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:234
TW_UINT16 TWAIN_IdentityGetFirst(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:249
TW_UINT16 TWAIN_UserSelect(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:428
static TW_UINT16 DSM_currentDevice
Definition: dsm_ctrl.c:38
static struct all_devices * devices
Definition: dsm_ctrl.c:48
static UINT event_message
Definition: dsm_ctrl.c:40
TW_UINT16 TWAIN_GetDSMStatus(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:505
TW_UINT16 TWAIN_IdentityGetNext(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:266
TW_UINT16 TWAIN_ProcessEvent(pTW_IDENTITY pOrigin, activeDS *pSource, TW_MEMREF pData)
Definition: dsm_ctrl.c:162
static int nrdevices
Definition: dsm_ctrl.c:47
TW_UINT16 TWAIN_OpenDS(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:280
TW_UINT16 TWAIN_CloseDSM(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:455
static HWND DSM_parent
Definition: dsm_ctrl.c:39
static void twain_autodetect(void)
Definition: dsm_ctrl.c:106
static TW_UINT32 DSM_sourceId
Definition: dsm_ctrl.c:37
TW_UINT16 TWAIN_ControlNull(pTW_IDENTITY pOrigin, pTW_IDENTITY pDest, activeDS *pSource, TW_UINT16 MSG, TW_MEMREF pData)
Definition: dsm_ctrl.c:120
TW_UINT16 TWAIN_OpenDSM(pTW_IDENTITY pOrigin, TW_MEMREF pData)
Definition: dsm_ctrl.c:484
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _cl_event * event
Definition: glext.h:7739
GLuint index
Definition: glext.h:6031
GLfloat param
Definition: glext.h:5796
GLuint64EXT * result
Definition: glext.h:11304
GLuint id
Definition: glext.h:5910
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
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
#define TRACE(s)
Definition: solgame.cpp:4
TW_STR32 Manufacturer
Definition: twain.h:262
TW_STR32 ProductName
Definition: twain.h:264
TW_STR32 ProductFamily
Definition: twain.h:263
TW_UINT32 SupportedGroups
Definition: twain.h:261
TW_UINT16 ProtocolMinor
Definition: twain.h:260
TW_UINT16 ProtocolMajor
Definition: twain.h:259
TW_UINT32 Id
Definition: twain.h:257
TW_UINT16 ConditionCode
Definition: twain.h:352
char * modname
Definition: dsm_ctrl.c:43
TW_IDENTITY identity
Definition: dsm_ctrl.c:44
Definition: list.h:15
Definition: tftpd.h:60
HWND ui_window
Definition: twain_i.h:44
DSENTRYPROC dsEntry
Definition: twain_i.h:42
struct tagActiveDS * next
Definition: twain_i.h:39
TW_IDENTITY identity
Definition: twain_i.h:40
struct list pending_messages
Definition: twain_i.h:43
HMODULE hmod
Definition: twain_i.h:41
HWND event_window
Definition: twain_i.h:45
pTW_IDENTITY result
Definition: dsm_ctrl.c:349
pTW_IDENTITY origin
Definition: dsm_ctrl.c:348
#define LIST_ENTRY(type)
Definition: queue.h:175
TW_UINT16 DSM_twCC
Definition: twain32_main.c:32
HINSTANCE DSM_hinstance
Definition: twain32_main.c:34
activeDS * activeSources
Definition: twain32_main.c:33
#define TWRC_FAILURE
Definition: twain.h:1665
#define TWCC_OPERATIONERROR
Definition: twain.h:1683
#define DAT_IDENTITY
Definition: twain.h:1337
#define TWCC_SEQERROR
Definition: twain.h:1687
#define MSG_OPENDS
Definition: twain.h:1409
#define TWON_PROTOCOLMINOR
Definition: twain.h:69
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define MSG_XFERREADY
Definition: twain.h:1395
struct TW_STATUS * pTW_STATUS
#define MSG_CLOSEDS
Definition: twain.h:1410
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define TWRC_DSEVENT
Definition: twain.h:1668
unsigned short TW_UINT16
Definition: twain.h:119
#define TWCC_NODS
Definition: twain.h:1681
#define TWRC_ENDOFLIST
Definition: twain.h:1671
#define TWRC_CANCEL
Definition: twain.h:1667
ULONG TW_UINT32
Definition: twain.h:120
#define TWRC_SUCCESS
Definition: twain.h:1664
#define MSG_NULL
Definition: twain.h:1381
#define MSG_DEVICEEVENT
Definition: twain.h:1399
#define TWRC_NOTDSEVENT
Definition: twain.h:1669
struct TW_IDENTITY * pTW_IDENTITY
Definition: twain.h:1762
#define MSG_GET
Definition: twain.h:1385
#define TWCC_BADPROTOCOL
Definition: twain.h:1685
#define MSG_CLOSEDSREQ
Definition: twain.h:1396
#define DG_CONTROL
Definition: twain.h:1311
#define TWCC_SUCCESS
Definition: twain.h:1678
#define TWCC_LOWMEMORY
Definition: twain.h:1680
#define TWON_PROTOCOLMAJOR
Definition: twain.h:70
int32_t INT_PTR
Definition: typedefs.h:64
int ret
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_ERR
Definition: winuser.h:2435
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CLOSE
Definition: winuser.h:1624
#define LB_GETITEMDATA
Definition: winuser.h:2044
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
#define DWLP_USER
Definition: winuser.h:875
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define IDCANCEL
Definition: winuser.h:834
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LBN_DBLCLK
Definition: winuser.h:2074
#define WM_COMMAND
Definition: winuser.h:1743
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_INITDIALOG
Definition: winuser.h:1742
#define LB_ADDSTRING
Definition: winuser.h:2034
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LB_SETITEMDATA
Definition: winuser.h:2068
#define BN_CLICKED
Definition: winuser.h:1928
#define LB_SETCURSEL
Definition: winuser.h:2066
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LB_GETCURSEL
Definition: winuser.h:2042
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define PM_NOREMOVE
Definition: winuser.h:1198
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)