gdi32: Route WGL context code through gdi32.dll.
[wine] / dlls / gphoto2.ds / gphoto2_main.c
1 /*
2  * SANE.DS functions
3  *
4  * Copyright 2000 Shi Quan He <shiquan@cyberdude.com>
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 "config.h"
23
24 #include <stdarg.h>
25 #include <stdio.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "twain.h"
30 #include "gphoto2_i.h"
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(twain);
34
35 HINSTANCE GPHOTO2_instance;
36
37 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
38 {
39     TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
40
41     switch (fdwReason)
42     {
43         case DLL_PROCESS_ATTACH:
44             GPHOTO2_instance = hinstDLL;
45             DisableThreadLibraryCalls(hinstDLL);
46 #ifdef HAVE_GPHOTO2
47             activeDS.context = gp_context_new ();
48 #endif
49             break;
50
51         case DLL_PROCESS_DETACH:
52             GPHOTO2_instance = NULL;
53             break;
54     }
55
56     return TRUE;
57 }
58
59 #ifdef HAVE_GPHOTO2
60 static TW_UINT16 GPHOTO2_GetIdentity( pTW_IDENTITY, pTW_IDENTITY);
61 static TW_UINT16 GPHOTO2_OpenDS( pTW_IDENTITY, pTW_IDENTITY);
62 #endif
63
64 TW_UINT16 GPHOTO2_SourceControlHandler (
65    pTW_IDENTITY pOrigin,
66    TW_UINT16    DAT,
67    TW_UINT16    MSG,
68    TW_MEMREF    pData)
69 {
70     TW_UINT16 twRC = TWRC_SUCCESS;
71
72     switch (DAT)
73     {
74         case DAT_IDENTITY:
75             switch (MSG)
76             {
77                 case MSG_CLOSEDS:
78 #ifdef HAVE_GPHOTO2
79                      if (activeDS.camera) {
80                         gp_camera_free (activeDS.camera);
81                         activeDS.camera = NULL;
82                      }
83 #endif
84                      break;
85                 case MSG_GET:
86 #ifdef HAVE_GPHOTO2
87                      twRC = GPHOTO2_GetIdentity(pOrigin,(pTW_IDENTITY)pData);
88 #else
89                      twRC = TWRC_FAILURE;
90 #endif
91                      break;
92                 case MSG_OPENDS:
93 #ifdef HAVE_GPHOTO2
94                      twRC = GPHOTO2_OpenDS(pOrigin,(pTW_IDENTITY)pData);
95 #else
96                      twRC = TWRC_FAILURE;
97 #endif
98                      break;
99             }
100             break;
101         case DAT_CAPABILITY:
102             switch (MSG)
103             {
104                 case MSG_GET:
105                     twRC = GPHOTO2_CapabilityGet (pOrigin, pData);
106                     break;
107                 case MSG_GETCURRENT:
108                     twRC = GPHOTO2_CapabilityGetCurrent (pOrigin, pData);
109                     break;
110                 case MSG_GETDEFAULT:
111                     twRC = GPHOTO2_CapabilityGetDefault (pOrigin, pData);
112                     break;
113                 case MSG_QUERYSUPPORT:
114                     twRC = GPHOTO2_CapabilityQuerySupport (pOrigin, pData);
115                     break;
116                 case MSG_RESET:
117                     twRC = GPHOTO2_CapabilityReset (pOrigin, pData);
118                     break;
119                 case MSG_SET:
120                     twRC = GPHOTO2_CapabilitySet (pOrigin, pData);
121                     break;
122                 default:
123                     twRC = TWRC_FAILURE;
124                     FIXME("unrecognized opertion triplet\n");
125             }
126             break;
127
128         case DAT_CUSTOMDSDATA:
129             switch (MSG)
130             {
131                 case MSG_GET:
132                     twRC = GPHOTO2_CustomDSDataGet (pOrigin, pData);
133                     break;
134                 case MSG_SET:
135                     twRC = GPHOTO2_CustomDSDataSet (pOrigin, pData);
136                     break;
137                 default:
138                     break;
139             }
140             break;
141
142         case DAT_FILESYSTEM:
143             switch (MSG)
144             {
145                 /*case MSG_AUTOMATICCAPTUREDIRECTORY:
146                     twRC = GPHOTO2_AutomaticCaptureDirectory
147                                (pOrigin, pData);
148                     break;*/
149                 case MSG_CHANGEDIRECTORY:
150                     twRC = GPHOTO2_ChangeDirectory (pOrigin, pData);
151                     break;
152                 /*case MSG_COPY:
153                     twRC = GPHOTO2_FileSystemCopy (pOrigin, pData);
154                     break;*/
155                 case MSG_CREATEDIRECTORY:
156                     twRC = GPHOTO2_CreateDirectory (pOrigin, pData);
157                     break;
158                 case MSG_DELETE:
159                     twRC = GPHOTO2_FileSystemDelete (pOrigin, pData);
160                     break;
161                 case MSG_FORMATMEDIA:
162                     twRC = GPHOTO2_FormatMedia (pOrigin, pData);
163                     break;
164                 case MSG_GETCLOSE:
165                     twRC = GPHOTO2_FileSystemGetClose (pOrigin, pData);
166                     break;
167                 case MSG_GETFIRSTFILE:
168                     twRC = GPHOTO2_FileSystemGetFirstFile (pOrigin, pData);
169                     break;
170                 case MSG_GETINFO:
171                     twRC = GPHOTO2_FileSystemGetInfo (pOrigin, pData);
172                     break;
173                 case MSG_GETNEXTFILE:
174                     twRC = GPHOTO2_FileSystemGetNextFile (pOrigin, pData);
175                     break;
176                 case MSG_RENAME:
177                     twRC = GPHOTO2_FileSystemRename (pOrigin, pData);
178                     break;
179                 default:
180                     twRC = TWRC_FAILURE;
181                     break;
182             }
183             break;
184
185         case DAT_EVENT:
186             if (MSG == MSG_PROCESSEVENT)
187                 twRC = GPHOTO2_ProcessEvent (pOrigin, pData);
188             else
189                 twRC = TWRC_FAILURE;
190             break;
191
192         case DAT_PASSTHRU:
193             if (MSG == MSG_PASSTHRU)
194                 twRC = GPHOTO2_PassThrough (pOrigin, pData);
195             else
196                 twRC = TWRC_FAILURE;
197             break;
198
199         case DAT_PENDINGXFERS:
200             switch (MSG)
201             {
202                 case MSG_ENDXFER:
203                     twRC = GPHOTO2_PendingXfersEndXfer (pOrigin, pData);
204                     break;
205                 case MSG_GET:
206                     twRC = GPHOTO2_PendingXfersGet (pOrigin, pData);
207                     break;
208                 case MSG_RESET:
209                     twRC = GPHOTO2_PendingXfersReset (pOrigin, pData);
210                     break;
211                 /*case MSG_STOPFEEDER:
212                     twRC = GPHOTO2_PendingXfersStopFeeder (pOrigin, pData);
213                     break;*/
214                 default:
215                     twRC = TWRC_FAILURE;
216             }
217             break;
218
219         case DAT_SETUPFILEXFER:
220             switch (MSG)
221             {
222                 case MSG_GET:
223                     twRC = GPHOTO2_SetupFileXferGet (pOrigin, pData);
224                     break;
225                 case MSG_GETDEFAULT:
226                     twRC = GPHOTO2_SetupFileXferGetDefault (pOrigin, pData);
227                     break;
228                 case MSG_RESET:
229                     twRC = GPHOTO2_SetupFileXferReset (pOrigin, pData);
230                     break;
231                 case MSG_SET:
232                     twRC = GPHOTO2_SetupFileXferSet (pOrigin, pData);
233                     break;
234                 default:
235                     twRC = TWRC_FAILURE;
236                     break;
237             }
238             break;
239
240         /*case DAT_SETUPFILEXFER2:
241             switch (MSG)
242             {
243                 case MSG_GET:
244                     twRC = GPHOTO2_SetupFileXfer2Get (pOrigin, pData);
245                     break;
246                 case MSG_GETDEFAULT:
247                     twRC = GPHOTO2_SetupFileXfer2GetDefault (pOrigin, pData);
248                     break;
249                 case MSG_RESET:
250                     twRC = GPHOTO2_SetupFileXfer2Reset (pOrigin, pData);
251                     break;
252                 case MSG_SET:
253                     twRC = GPHOTO2_SetupFileXfer2Set (pOrigin, pData);
254                     break;
255             }
256             break;*/
257         case DAT_SETUPMEMXFER:
258             if (MSG == MSG_GET)
259                 twRC = GPHOTO2_SetupMemXferGet (pOrigin, pData);
260             else
261                 twRC = TWRC_FAILURE;
262             break;
263
264         case DAT_STATUS:
265             if (MSG == MSG_GET)
266                 twRC = GPHOTO2_GetDSStatus (pOrigin, pData);
267             else
268                 twRC = TWRC_FAILURE;
269             break;
270
271         case DAT_USERINTERFACE:
272             switch (MSG)
273             {
274                 case MSG_DISABLEDS:
275                     twRC = GPHOTO2_DisableDSUserInterface (pOrigin, pData);
276                     break;
277                 case MSG_ENABLEDS:
278                     twRC = GPHOTO2_EnableDSUserInterface (pOrigin, pData);
279                     break;
280                 case MSG_ENABLEDSUIONLY:
281                     twRC = GPHOTO2_EnableDSUIOnly (pOrigin, pData);
282                     break;
283                 default:
284                     twRC = TWRC_FAILURE;
285                     break;
286             }
287             break;
288
289         case DAT_XFERGROUP:
290             switch (MSG)
291             {
292                 case MSG_GET:
293                     twRC = GPHOTO2_XferGroupGet (pOrigin, pData);
294                     break;
295                 case MSG_SET:
296                     twRC = GPHOTO2_XferGroupSet (pOrigin, pData);
297                     break;
298                 default:
299                     twRC = TWRC_FAILURE;
300                     break;
301             }
302             break;
303
304         default:
305             FIXME("code unknown: %d\n", DAT);
306             twRC = TWRC_FAILURE;
307             break;
308     }
309
310     return twRC;
311 }
312
313
314 TW_UINT16 GPHOTO2_ImageGroupHandler (
315            pTW_IDENTITY pOrigin,
316            TW_UINT16    DAT,
317            TW_UINT16    MSG,
318            TW_MEMREF    pData)
319 {
320     TW_UINT16 twRC = TWRC_SUCCESS;
321
322     switch (DAT)
323     {
324         case DAT_CIECOLOR:
325             if (MSG == MSG_GET)
326                 twRC = GPHOTO2_CIEColorGet (pOrigin, pData);
327             else
328                 twRC = TWRC_FAILURE;
329             break;
330
331         case DAT_EXTIMAGEINFO:
332             if (MSG == MSG_GET)
333                 twRC = GPHOTO2_ExtImageInfoGet (pOrigin, pData);
334             else
335                 twRC = TWRC_FAILURE;
336             break;
337
338         case DAT_GRAYRESPONSE:
339             switch (MSG)
340             {
341                 case MSG_RESET:
342                     twRC = GPHOTO2_GrayResponseReset (pOrigin, pData);
343                     break;
344                 case MSG_SET:
345                     twRC = GPHOTO2_GrayResponseSet (pOrigin, pData);
346                     break;
347                 default:
348                     twRC = TWRC_FAILURE;
349                     activeDS.twCC = TWCC_BADPROTOCOL;
350                     FIXME("unrecognized operation triplet\n");
351                     break;
352             }
353             break;
354         case DAT_IMAGEFILEXFER:
355             if (MSG == MSG_GET)
356                 twRC = GPHOTO2_ImageFileXferGet (pOrigin, pData);
357             else
358                 twRC = TWRC_FAILURE;
359             break;
360
361         case DAT_IMAGEINFO:
362             if (MSG == MSG_GET)
363                 twRC = GPHOTO2_ImageInfoGet (pOrigin, pData);
364             else
365                 twRC = TWRC_FAILURE;
366             break;
367
368         case DAT_IMAGELAYOUT:
369             switch (MSG)
370             {
371                 case MSG_GET:
372                     twRC = GPHOTO2_ImageLayoutGet (pOrigin, pData);
373                     break;
374                 case MSG_GETDEFAULT:
375                     twRC = GPHOTO2_ImageLayoutGetDefault (pOrigin, pData);
376                     break;
377                 case MSG_RESET:
378                     twRC = GPHOTO2_ImageLayoutReset (pOrigin, pData);
379                     break;
380                 case MSG_SET:
381                     twRC = GPHOTO2_ImageLayoutSet (pOrigin, pData);
382                     break;
383                 default:
384                     twRC = TWRC_FAILURE;
385                     activeDS.twCC = TWCC_BADPROTOCOL;
386                     ERR("unrecognized operation triplet\n");
387                     break;
388             }
389             break;
390
391         case DAT_IMAGEMEMXFER:
392             if (MSG == MSG_GET)
393                 twRC = GPHOTO2_ImageMemXferGet (pOrigin, pData);
394             else
395                 twRC = TWRC_FAILURE;
396             break;
397
398         case DAT_IMAGENATIVEXFER:
399             if (MSG == MSG_GET)
400                 twRC = GPHOTO2_ImageNativeXferGet (pOrigin, pData);
401             else
402                 twRC = TWRC_FAILURE;
403             break;
404
405         case DAT_JPEGCOMPRESSION:
406             switch (MSG)
407             {
408                 case MSG_GET:
409                     twRC = GPHOTO2_JPEGCompressionGet (pOrigin, pData);
410                     break;
411                 case MSG_GETDEFAULT:
412                     twRC = GPHOTO2_JPEGCompressionGetDefault (pOrigin, pData);
413                     break;
414                 case MSG_RESET:
415                     twRC = GPHOTO2_JPEGCompressionReset (pOrigin, pData);
416                     break;
417                 case MSG_SET:
418                     twRC = GPHOTO2_JPEGCompressionSet (pOrigin, pData);
419                     break;
420                 default:
421                     twRC = TWRC_FAILURE;
422                     activeDS.twCC = TWCC_BADPROTOCOL;
423                     WARN("unrecognized operation triplet\n");
424                     break;
425             }
426             break;
427
428         case DAT_PALETTE8:
429             switch (MSG)
430             {
431                 case MSG_GET:
432                     twRC = GPHOTO2_Palette8Get (pOrigin, pData);
433                     break;
434                 case MSG_GETDEFAULT:
435                     twRC = GPHOTO2_Palette8GetDefault (pOrigin, pData);
436                     break;
437                 case MSG_RESET:
438                     twRC = GPHOTO2_Palette8Reset (pOrigin, pData);
439                     break;
440                 case MSG_SET:
441                     twRC = GPHOTO2_Palette8Set (pOrigin, pData);
442                     break;
443                 default:
444                     twRC = TWRC_FAILURE;
445                     activeDS.twCC = TWCC_BADPROTOCOL;
446                     WARN("unrecognized operation triplet\n");
447             }
448             break;
449
450         case DAT_RGBRESPONSE:
451             switch (MSG)
452             {
453                 case MSG_RESET:
454                     twRC = GPHOTO2_RGBResponseReset (pOrigin, pData);
455                     break;
456                 case MSG_SET:
457                     twRC = GPHOTO2_RGBResponseSet (pOrigin, pData);
458                     break;
459                 default:
460                     twRC = TWRC_FAILURE;
461                     activeDS.twCC = TWCC_BADPROTOCOL;
462                     WARN("unrecognized operation triplet\n");
463                     break;
464             }
465             break;
466
467         default:
468             twRC = TWRC_FAILURE;
469             activeDS.twCC = TWCC_BADPROTOCOL;
470             FIXME("unrecognized DG type %d\n", DAT);
471     }
472     return twRC;
473 }
474
475 /* Main entry point for the TWAIN library */
476 TW_UINT16 WINAPI
477 DS_Entry ( pTW_IDENTITY pOrigin,
478            TW_UINT32    DG,
479            TW_UINT16    DAT,
480            TW_UINT16    MSG,
481            TW_MEMREF    pData)
482 {
483     TW_UINT16 twRC = TWRC_SUCCESS;  /* Return Code */
484
485     TRACE("(DG=%ld DAT=%d MSG=%d)\n", DG, DAT, MSG);
486
487     switch (DG)
488     {
489         case DG_CONTROL:
490             twRC = GPHOTO2_SourceControlHandler (pOrigin,DAT,MSG,pData);
491             break;
492         case DG_IMAGE:
493             twRC = GPHOTO2_ImageGroupHandler (pOrigin,DAT,MSG,pData);
494             break;
495         case DG_AUDIO:
496             FIXME("The audio group of entry codes is not implemented.\n");
497         default:
498             activeDS.twCC = TWCC_BADPROTOCOL;
499             twRC = TWRC_FAILURE;
500     }
501
502     return twRC;
503 }
504
505 #ifdef HAVE_GPHOTO2
506 static GPPortInfoList *port_list;
507 static int curcamera;
508 static CameraList *detected_cameras;
509 static CameraAbilitiesList *abilities_list;
510
511 static TW_UINT16
512 gphoto2_auto_detect() {
513     int result, count;
514
515     if (detected_cameras && (gp_list_count (detected_cameras) == 0)) {
516         /* Reload if previously no cameras, we might detect new ones. */
517         TRACE("Reloading portlist trying to detect cameras.\n");
518         if (port_list) {
519             gp_port_info_list_free (port_list);
520             port_list = NULL;
521         }
522     }
523     if (!port_list) {
524         TRACE("Auto detecting gphoto cameras.\n");
525         TRACE("Loading ports...\n");
526         if (gp_port_info_list_new (&port_list) < GP_OK)
527             return TWRC_FAILURE;
528         result = gp_port_info_list_load (port_list);
529         if (result < 0) {
530             gp_port_info_list_free (port_list);
531             return TWRC_FAILURE;
532         }
533         count = gp_port_info_list_count (port_list);
534         if (count <= 0)
535             return TWRC_FAILURE;
536         if (gp_list_new (&detected_cameras) < GP_OK)
537             return TWRC_FAILURE;
538         if (!abilities_list) { /* Load only once per program start */
539             gp_abilities_list_new (&abilities_list);
540             TRACE("Loading cameras...\n");
541             gp_abilities_list_load (abilities_list, NULL);
542         }
543         TRACE("Detecting cameras...\n");
544         gp_abilities_list_detect (abilities_list, port_list, detected_cameras, NULL);
545         curcamera = 0;
546         TRACE("%d cameras detected\n", gp_list_count(detected_cameras));
547     }
548     return TWRC_SUCCESS;
549 }
550
551 static TW_UINT16
552 GPHOTO2_GetIdentity( pTW_IDENTITY pOrigin, pTW_IDENTITY self) {
553     int count;
554     const char *cname, *pname;
555
556     if (TWRC_SUCCESS != gphoto2_auto_detect())
557         return TWRC_FAILURE;
558
559     count = gp_list_count (detected_cameras);
560     if (count < GP_OK) {
561         gp_list_free (detected_cameras);
562         return TWRC_FAILURE;
563     }
564     TRACE("%d cameras detected.\n", count);
565     self->ProtocolMajor = TWON_PROTOCOLMAJOR;
566     self->ProtocolMinor = TWON_PROTOCOLMINOR;
567     lstrcpynA (self->Manufacturer, "The Wine Team", sizeof(self->Manufacturer) - 1);
568     lstrcpynA (self->ProductFamily, "GPhoto2 Camera", sizeof(self->ProductFamily) - 1);
569
570     if (!count) { /* No camera detected. But we need to return an IDENTITY anyway. */
571         lstrcpynA (self->ProductName, "GPhoto2 Camera", sizeof(self->ProductName) - 1);
572         return TWRC_SUCCESS;
573     }
574     gp_list_get_name  (detected_cameras, curcamera, &cname);
575     gp_list_get_value (detected_cameras, curcamera, &pname);
576     if (count == 1) /* Normal case, only one camera. */
577         snprintf (self->ProductName, sizeof(self->ProductName), "%s", cname);
578     else
579         snprintf (self->ProductName, sizeof(self->ProductName), "%s@%s", cname, pname);
580     curcamera = (curcamera+1) % count;
581     return TWRC_SUCCESS;
582 }
583
584 static TW_UINT16
585 GPHOTO2_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) {
586     int ret, m, p, count, i;
587     CameraAbilities a;
588     GPPortInfo info;
589     const char  *model, *port;
590
591     if (TWRC_SUCCESS != gphoto2_auto_detect())
592         return TWRC_FAILURE;
593
594     if (lstrcmpA(self->ProductFamily,"GPhoto2 Camera")) {
595         FIXME("identity passed is not a gphoto camera, but %s!?!\n", self->ProductFamily);
596         return TWRC_FAILURE;
597     }
598     count = gp_list_count (detected_cameras);
599     if (!count) {
600         ERR("No camera found by autodetection. Returning failure.\n");
601         return TWRC_FAILURE;
602     }
603
604     if (!lstrcmpA (self->ProductName, "GPhoto2 Camera")) {
605         TRACE("Potential undetected camera. Just using the first autodetected one.\n");
606         i = 0;
607     } else {
608         for (i=0;i<count;i++) {
609             const char *cname, *pname;
610             TW_STR32    name;
611
612             gp_list_get_name  (detected_cameras, i, &cname);
613             gp_list_get_value (detected_cameras, i, &pname);
614             if (!lstrcmpA(self->ProductName,cname))
615                 break;
616             snprintf(name, sizeof(name), "%s", cname);
617             if (!lstrcmpA(self->ProductName,name))
618                 break;
619             snprintf(name, sizeof(name), "%s@%s", cname, pname);
620             if (!lstrcmpA(self->ProductName,name))
621                 break;
622         }
623         if (i == count) {
624             TRACE("Camera %s not found in autodetected list. Using first entry.\n", self->ProductName);
625             i=0;
626         }
627     }
628     gp_list_get_name  (detected_cameras, i, &model);
629     gp_list_get_value  (detected_cameras, i, &port);
630     TRACE("model %s, port %s\n", model, port);
631     ret = gp_camera_new (&activeDS.camera);
632     if (ret < GP_OK) {
633         ERR("gp_camera_new: %d\n", ret);
634         return TWRC_FAILURE;
635     }
636     m = gp_abilities_list_lookup_model (abilities_list, model);
637     if (m < GP_OK) {
638         FIXME("Model %s not found, %d!\n", model, m);
639         return TWRC_FAILURE;
640     }
641     ret = gp_abilities_list_get_abilities (abilities_list, m, &a);
642     if (ret < GP_OK) {
643         FIXME("gp_camera_list_get_abilities failed? %d\n", ret);
644         return TWRC_FAILURE;
645     }
646     ret = gp_camera_set_abilities (activeDS.camera, a);
647     if (ret < GP_OK) {
648         FIXME("gp_camera_set_abilities failed? %d\n", ret);
649         return TWRC_FAILURE;
650     }
651
652     p = gp_port_info_list_lookup_path (port_list, port);
653     if (p < GP_OK) {
654         FIXME("port %s not in portlist?\n", port);
655         return TWRC_FAILURE;
656     }
657     ret = gp_port_info_list_get_info (port_list, p, &info);
658     if (ret < GP_OK) {
659         FIXME("could not get portinfo for port %s?\n", port);
660         return TWRC_FAILURE;
661     }
662     ret = gp_camera_set_port_info (activeDS.camera, info);
663     if (ret < GP_OK) {
664         FIXME("could not set portinfo for port %s to camera?\n", port);
665         return TWRC_FAILURE;
666     }
667     list_init( &(activeDS.files) );
668     activeDS.currentState = 4;
669     activeDS.twCC               = TWRC_SUCCESS;
670     activeDS.pixelflavor        = TWPF_CHOCOLATE;
671     activeDS.pixeltype          = TWPT_RGB;
672     activeDS.capXferMech        = TWSX_MEMORY;
673     TRACE("OK!\n");
674     return TWRC_SUCCESS;
675 }
676 #endif