oleaut32: Fix remaining memory leak (coverity).
[wine.git] / dlls / sane.ds / sane_i.h
blobae58159d596e39c4b9372f72e421a476e48bba7a
1 /*
2 * Copyright 2000 Corel Corporation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef _TWAIN32_H
20 #define _TWAIN32_H
22 #ifndef __WINE_CONFIG_H
23 # error You must include config.h first
24 #endif
26 #include <stdarg.h>
28 #ifdef SONAME_LIBSANE
29 # include <sane/sane.h>
30 # include <sane/saneopts.h>
31 #endif
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winuser.h"
36 #include "twain.h"
38 #ifdef SONAME_LIBSANE
39 #define MAKE_FUNCPTR(f) typeof(f) * p##f DECLSPEC_HIDDEN;
40 MAKE_FUNCPTR(sane_init)
41 MAKE_FUNCPTR(sane_exit)
42 MAKE_FUNCPTR(sane_get_devices)
43 MAKE_FUNCPTR(sane_open)
44 MAKE_FUNCPTR(sane_close)
45 MAKE_FUNCPTR(sane_get_option_descriptor)
46 MAKE_FUNCPTR(sane_control_option)
47 MAKE_FUNCPTR(sane_get_parameters)
48 MAKE_FUNCPTR(sane_start)
49 MAKE_FUNCPTR(sane_read)
50 MAKE_FUNCPTR(sane_cancel)
51 MAKE_FUNCPTR(sane_set_io_mode)
52 MAKE_FUNCPTR(sane_get_select_fd)
53 MAKE_FUNCPTR(sane_strstatus)
54 #undef MAKE_FUNCPTR
55 #endif
57 extern HINSTANCE SANE_instance DECLSPEC_HIDDEN;
59 #define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
61 /* internal information about an active data source */
62 struct tagActiveDS
64 struct tagActiveDS *next; /* next active DS */
65 TW_IDENTITY identity; /* identity */
66 TW_UINT16 currentState; /* current state */
67 UINT windowMessage; /* message to use to send status */
68 TW_UINT16 twCC; /* condition code */
69 HWND hwndOwner; /* window handle of the app */
70 HWND progressWnd; /* window handle of the scanning window */
71 #ifdef SONAME_LIBSANE
72 SANE_Handle deviceHandle; /* device handle */
73 SANE_Parameters sane_param; /* parameters about the image
74 transferred */
75 BOOL sane_param_valid; /* true if valid sane_param*/
76 BOOL sane_started; /* If sane_start has been called */
77 INT deviceIndex; /* index of the current device */
78 #endif
79 /* Capabilities */
80 TW_UINT16 capXferMech; /* ICAP_XFERMECH */
81 BOOL PixelTypeSet;
82 TW_UINT16 defaultPixelType; /* ICAP_PIXELTYPE */
83 BOOL XResolutionSet;
84 TW_FIX32 defaultXResolution;
85 BOOL YResolutionSet;
86 TW_FIX32 defaultYResolution;
87 } activeDS DECLSPEC_HIDDEN;
89 /* Helper functions */
90 extern TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action) DECLSPEC_HIDDEN;
91 extern TW_UINT16 SANE_SaneSetDefaults (void) DECLSPEC_HIDDEN;
93 /* Implementation of operation triplets
94 * From Application to Source (Control Information) */
95 TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
96 TW_UINT16 SANE_CapabilityGetCurrent
97 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
98 TW_UINT16 SANE_CapabilityGetDefault
99 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
100 TW_UINT16 SANE_CapabilityQuerySupport
101 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
102 TW_UINT16 SANE_CapabilityReset
103 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
104 TW_UINT16 SANE_CapabilitySet
105 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
106 TW_UINT16 SANE_CustomDSDataGet
107 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
108 TW_UINT16 SANE_CustomDSDataSet
109 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
110 TW_UINT16 SANE_AutomaticCaptureDirectory
111 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
112 TW_UINT16 SANE_ChangeDirectory
113 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
114 TW_UINT16 SANE_FileSystemCopy
115 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
116 TW_UINT16 SANE_CreateDirectory
117 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
118 TW_UINT16 SANE_FileSystemDelete
119 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
120 TW_UINT16 SANE_FormatMedia
121 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
122 TW_UINT16 SANE_FileSystemGetClose
123 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
124 TW_UINT16 SANE_FileSystemGetFirstFile
125 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
126 TW_UINT16 SANE_FileSystemGetInfo
127 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
128 TW_UINT16 SANE_FileSystemGetNextFile
129 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
130 TW_UINT16 SANE_FileSystemRename
131 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
132 TW_UINT16 SANE_ProcessEvent
133 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
134 TW_UINT16 SANE_PassThrough
135 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
136 TW_UINT16 SANE_PendingXfersEndXfer
137 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
138 TW_UINT16 SANE_PendingXfersGet
139 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
140 TW_UINT16 SANE_PendingXfersReset
141 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
142 TW_UINT16 SANE_PendingXfersStopFeeder
143 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
144 TW_UINT16 SANE_SetupFileXferGet
145 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
146 TW_UINT16 SANE_SetupFileXferGetDefault
147 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
148 TW_UINT16 SANE_SetupFileXferReset
149 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
150 TW_UINT16 SANE_SetupFileXferSet
151 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
152 TW_UINT16 SANE_SetupFileXfer2Get
153 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
154 TW_UINT16 SANE_SetupFileXfer2GetDefault
155 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
156 TW_UINT16 SANE_SetupFileXfer2Reset
157 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
158 TW_UINT16 SANE_SetupFileXfer2Set
159 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
160 TW_UINT16 SANE_SetupMemXferGet
161 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
162 TW_UINT16 SANE_GetDSStatus
163 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
164 TW_UINT16 SANE_DisableDSUserInterface
165 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
166 TW_UINT16 SANE_EnableDSUserInterface
167 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
168 TW_UINT16 SANE_EnableDSUIOnly
169 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
170 TW_UINT16 SANE_XferGroupGet
171 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
172 TW_UINT16 SANE_XferGroupSet
173 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
175 /* Implementation of operation triplets
176 * From Application to Source (Image Information) */
177 TW_UINT16 SANE_CIEColorGet
178 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
179 TW_UINT16 SANE_ExtImageInfoGet
180 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
181 TW_UINT16 SANE_GrayResponseReset
182 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
183 TW_UINT16 SANE_GrayResponseSet
184 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
185 TW_UINT16 SANE_ImageFileXferGet
186 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
187 TW_UINT16 SANE_ImageInfoGet
188 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
189 TW_UINT16 SANE_ImageLayoutGet
190 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
191 TW_UINT16 SANE_ImageLayoutGetDefault
192 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
193 TW_UINT16 SANE_ImageLayoutReset
194 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
195 TW_UINT16 SANE_ImageLayoutSet
196 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
197 TW_UINT16 SANE_ImageMemXferGet
198 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
199 TW_UINT16 SANE_ImageNativeXferGet
200 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
201 TW_UINT16 SANE_JPEGCompressionGet
202 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
203 TW_UINT16 SANE_JPEGCompressionGetDefault
204 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
205 TW_UINT16 SANE_JPEGCompressionReset
206 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
207 TW_UINT16 SANE_JPEGCompressionSet
208 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
209 TW_UINT16 SANE_Palette8Get
210 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
211 TW_UINT16 SANE_Palette8GetDefault
212 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
213 TW_UINT16 SANE_Palette8Reset
214 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
215 TW_UINT16 SANE_Palette8Set
216 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
217 TW_UINT16 SANE_RGBResponseReset
218 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
219 TW_UINT16 SANE_RGBResponseSet
220 (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
222 /* UI function */
223 BOOL DoScannerUI(void) DECLSPEC_HIDDEN;
224 HWND ScanningDialogBox(HWND dialog, LONG progress) DECLSPEC_HIDDEN;
226 /* Option functions */
227 #ifdef SONAME_LIBSANE
228 SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val) DECLSPEC_HIDDEN;
229 SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status) DECLSPEC_HIDDEN;
230 SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status) DECLSPEC_HIDDEN;
231 SANE_Status sane_option_set_str(SANE_Handle h, const char *option_name, SANE_String val, SANE_Int *status) DECLSPEC_HIDDEN;
232 SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant) DECLSPEC_HIDDEN;
233 SANE_Status sane_option_probe_mode(SANE_Handle h, SANE_String_Const **choices, char *current, int current_size) DECLSPEC_HIDDEN;
234 SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name, SANE_Fixed *val,
235 SANE_Unit *unit, SANE_Fixed *min, SANE_Fixed *max, SANE_Fixed *quant) DECLSPEC_HIDDEN;
236 SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status) DECLSPEC_HIDDEN;
237 SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status) DECLSPEC_HIDDEN;
238 SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status) DECLSPEC_HIDDEN;
239 TW_UINT16 sane_status_to_twcc(SANE_Status rc) DECLSPEC_HIDDEN;
240 BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype) DECLSPEC_HIDDEN;
241 #endif
244 #endif