d3dx9: Implement UpdateSemantics mesh method.
[wine/multimedia.git] / dlls / capi2032 / cap20wxx.c
bloba6f3e3fc95f58b955db31bfd3374484485fc1381
1 /*
2 * cap20wxx.c
4 * Copyright 2002-2003 AVM Computersysteme Vertriebs GmbH
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define __NO_CAPIUTILS__
24 #include "config.h"
25 #include "wine/port.h"
27 #include <stdio.h>
28 #include <sys/types.h>
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
33 #define __user
34 #ifdef HAVE_LINUX_CAPI_H
35 # include <linux/capi.h>
36 #endif
37 #ifdef HAVE_CAPI20_H
38 # include <capi20.h>
39 #endif
40 #include "wine/library.h"
41 #include "wine/debug.h"
42 #include "cap20wxx.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(capi);
46 #ifdef SONAME_LIBCAPI20
48 static unsigned (*pcapi20_register)(unsigned, unsigned, unsigned, unsigned *) = NULL;
49 static unsigned (*pcapi20_release)(unsigned) = NULL;
50 static unsigned (*pcapi20_put_message)(unsigned, unsigned char *) = NULL;
51 static unsigned (*pcapi20_get_message)(unsigned, unsigned char **) = NULL;
52 static unsigned (*pcapi20_waitformessage)(unsigned, struct timeval *) = NULL;
53 static unsigned (*pcapi20_isinstalled)(void) = NULL;
54 static unsigned (*pcapi20_get_profile)(unsigned, unsigned char *) = NULL;
55 static unsigned char *(*pcapi20_get_manufacturer)(unsigned, unsigned char *) = NULL;
56 static unsigned char *(*pcapi20_get_serial_number)(unsigned, unsigned char *) = NULL;
57 static unsigned char *(*pcapi20_get_version)(unsigned, unsigned char *) = NULL;
59 static void load_functions(void) {
60 void *capi_handle = NULL;
62 if (pcapi20_register) /* loaded already */
63 return;
64 capi_handle = wine_dlopen(SONAME_LIBCAPI20, RTLD_NOW, NULL, 0);
65 if(!capi_handle) {
66 FIXME("Wine cannot find the library %s, capi2032.dll not working.\n", SONAME_LIBCAPI20);
67 return;
69 #define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(capi_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); return;}
70 LOAD_FUNCPTR(capi20_register);
71 LOAD_FUNCPTR(capi20_release);
72 LOAD_FUNCPTR(capi20_put_message);
73 LOAD_FUNCPTR(capi20_get_message);
74 LOAD_FUNCPTR(capi20_waitformessage);
75 LOAD_FUNCPTR(capi20_isinstalled);
76 LOAD_FUNCPTR(capi20_get_profile);
77 LOAD_FUNCPTR(capi20_get_manufacturer);
78 LOAD_FUNCPTR(capi20_get_serial_number);
79 LOAD_FUNCPTR(capi20_get_version);
80 #undef LOAD_FUNCPTR
83 #endif
85 /*===========================================================================*\
86 \*===========================================================================*/
88 DWORD WINAPI wrapCAPI_REGISTER (DWORD MessageBufferSize, DWORD maxLogicalConnection, DWORD maxBDataBlocks, DWORD maxBDataLen, DWORD *pApplID) {
89 #ifdef SONAME_LIBCAPI20
90 unsigned aid = 0;
91 DWORD fret;
93 load_functions();
94 if (!pcapi20_register)
95 return 0x1009;
96 fret = pcapi20_register (maxLogicalConnection, maxBDataBlocks, maxBDataLen, &aid);
97 *pApplID = aid;
98 TRACE ( "(%x) -> %x\n", *pApplID, fret);
99 return fret;
100 #else
101 FIXME ( "(), no CAPI4LINUX support compiled into WINE.\n" );
102 return 0x1009;
103 #endif
106 /*---------------------------------------------------------------------------*\
107 \*---------------------------------------------------------------------------*/
108 DWORD WINAPI wrapCAPI_RELEASE (DWORD ApplID) {
109 #ifdef SONAME_LIBCAPI20
110 DWORD fret;
112 load_functions();
113 if (!pcapi20_release)
114 return 0x1109;
115 fret = pcapi20_release (ApplID);
116 TRACE ("(%x) -> %x\n", ApplID, fret);
117 return fret;
118 #else
119 return 0x1109;
120 #endif
123 /*---------------------------------------------------------------------------*\
124 \*---------------------------------------------------------------------------*/
125 DWORD WINAPI wrapCAPI_PUT_MESSAGE (DWORD ApplID, PVOID pCAPIMessage) {
126 #ifdef SONAME_LIBCAPI20
127 DWORD fret;
129 load_functions();
130 if (!pcapi20_put_message)
131 return 0x1109;
132 fret = pcapi20_put_message (ApplID, pCAPIMessage);
133 TRACE ("(%x) -> %x\n", ApplID, fret);
134 return fret;
135 #else
136 return 0x1109;
137 #endif
140 /*---------------------------------------------------------------------------*\
141 \*---------------------------------------------------------------------------*/
142 DWORD WINAPI wrapCAPI_GET_MESSAGE (DWORD ApplID, PVOID *ppCAPIMessage) {
143 #ifdef SONAME_LIBCAPI20
144 DWORD fret;
146 load_functions();
147 if (!pcapi20_get_message)
148 return 0x1109;
149 fret = pcapi20_get_message (ApplID, (unsigned char **)ppCAPIMessage);
150 TRACE ("(%x) -> %x\n", ApplID, fret);
151 return fret;
152 #else
153 return 0x1109;
154 #endif
157 /*---------------------------------------------------------------------------*\
158 \*---------------------------------------------------------------------------*/
159 DWORD WINAPI wrapCAPI_WAIT_FOR_SIGNAL (DWORD ApplID) {
160 #ifdef SONAME_LIBCAPI20
161 TRACE ("(%x)\n", ApplID);
163 load_functions();
164 if (!pcapi20_waitformessage)
165 return 0x1109;
167 return pcapi20_waitformessage (ApplID, NULL);
168 #else
169 return 0x1109;
170 #endif
173 /*---------------------------------------------------------------------------*\
174 \*---------------------------------------------------------------------------*/
175 DWORD WINAPI wrapCAPI_GET_MANUFACTURER (char *SzBuffer) {
176 #ifdef SONAME_LIBCAPI20
177 DWORD fret;
179 load_functions();
180 if (!pcapi20_get_manufacturer)
181 return 0x1109;
183 fret = (pcapi20_get_manufacturer (0, (unsigned char *) SzBuffer) != 0) ? 0 : 0x1108;
184 if (!strncmp (SzBuffer, "AVM", 3)) {
185 strcpy (SzBuffer, "AVM-GmbH");
187 TRACE ("(%s) -> %x\n", SzBuffer, fret);
188 return fret;
189 #else
190 return 0x1109;
191 #endif
194 /*---------------------------------------------------------------------------*\
195 \*---------------------------------------------------------------------------*/
196 DWORD WINAPI wrapCAPI_GET_VERSION (DWORD *pCAPIMajor, DWORD *pCAPIMinor, DWORD *pManufacturerMajor, DWORD *pManufacturerMinor) {
197 #ifdef SONAME_LIBCAPI20
198 unsigned char version[4 * sizeof (unsigned)];
199 DWORD fret;
201 load_functions();
202 if (!pcapi20_get_version)
203 return 0x1109;
204 fret = (pcapi20_get_version (0, version) != 0) ? 0 : 0x1108;
205 *pCAPIMajor = *(unsigned *)(version + 0 * sizeof (unsigned));
206 *pCAPIMinor = *(unsigned *)(version + 1 * sizeof (unsigned));
207 *pManufacturerMajor = *(unsigned *)(version + 2 * sizeof (unsigned));
208 *pManufacturerMinor = *(unsigned *)(version + 3 * sizeof (unsigned));
209 TRACE ("(%x.%x,%x.%x) -> %x\n", *pCAPIMajor, *pCAPIMinor, *pManufacturerMajor,
210 *pManufacturerMinor, fret);
211 return fret;
212 #else
213 return 0x1109;
214 #endif
217 /*---------------------------------------------------------------------------*\
218 \*---------------------------------------------------------------------------*/
219 DWORD WINAPI wrapCAPI_GET_SERIAL_NUMBER (char *SzBuffer) {
220 #ifdef SONAME_LIBCAPI20
221 DWORD fret;
223 load_functions();
224 if (!pcapi20_get_serial_number)
225 return 0x1109;
226 fret = (pcapi20_get_serial_number (0, (unsigned char*) SzBuffer) != 0) ? 0 : 0x1108;
227 TRACE ("(%s) -> %x\n", SzBuffer, fret);
228 return fret;
229 #else
230 return 0x1109;
231 #endif
234 /*---------------------------------------------------------------------------*\
235 \*---------------------------------------------------------------------------*/
236 DWORD WINAPI wrapCAPI_GET_PROFILE (PVOID SzBuffer, DWORD CtlrNr) {
237 #ifdef SONAME_LIBCAPI20
238 DWORD fret;
240 load_functions();
241 if (!pcapi20_get_profile)
242 return 0x1109;
244 fret = pcapi20_get_profile (CtlrNr, SzBuffer);
245 TRACE ("(%x,%x) -> %x\n", CtlrNr, *(unsigned short *)SzBuffer, fret);
246 return fret;
247 #else
248 return 0x1109;
249 #endif
252 /*---------------------------------------------------------------------------*\
253 \*---------------------------------------------------------------------------*/
254 DWORD WINAPI wrapCAPI_INSTALLED (void) {
255 #ifdef SONAME_LIBCAPI20
256 DWORD fret;
258 load_functions();
259 if (!pcapi20_isinstalled)
260 return 0x1109;
261 fret = pcapi20_isinstalled();
262 TRACE ("() -> %x\n", fret);
263 return fret;
264 #else
265 return 0x1109;
266 #endif
269 /*---------------------------------------------------------------------------*\
270 \*---------------------------------------------------------------------------*/
271 DWORD WINAPI wrapCAPI_MANUFACTURER (DWORD Class, DWORD Function, DWORD Ctlr, PVOID pParams, DWORD ParamsLen) {
272 FIXME ("(), not supported!\n");
273 return 0x1109;
276 /*---------------------------------------------------------------------------*\
277 \*---------------------------------------------------------------------------*/