Enhance uxtheme to store the themed system metrics in the registry and
[wine] / dlls / wldap32 / option.c
1 /*
2  * WLDAP32 - LDAP support for Wine
3  *
4  * Copyright 2005 Hans Leidekker
5  *
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.
10  *
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.
15  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #include "wine/port.h"
24 #include "wine/debug.h"
25
26 #include <stdarg.h>
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winnls.h"
31
32 #ifdef HAVE_LDAP_H
33 #include <ldap.h>
34 #else
35 #define LDAP_NOT_SUPPORTED  0x5c
36 #endif
37
38 #include "winldap_private.h"
39 #include "wldap32.h"
40
41 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
42
43 ULONG ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
44 {
45     ULONG ret = LDAP_NOT_SUPPORTED;
46 #ifdef HAVE_LDAP
47
48     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
49
50     if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
51
52     switch (option)
53     {
54     case LDAP_OPT_DEREF:
55     case LDAP_OPT_DESC:
56     case LDAP_OPT_ERROR_NUMBER:
57     case LDAP_OPT_PROTOCOL_VERSION:
58     case LDAP_OPT_REFERRALS:
59     case LDAP_OPT_SIZELIMIT:
60     case LDAP_OPT_TIMELIMIT:
61         return ldap_get_optionW( ld, option, value );
62
63     case LDAP_OPT_CACHE_ENABLE:
64     case LDAP_OPT_CACHE_FN_PTRS:
65     case LDAP_OPT_CACHE_STRATEGY:
66     case LDAP_OPT_IO_FN_PTRS:
67     case LDAP_OPT_REBIND_ARG:
68     case LDAP_OPT_REBIND_FN:
69     case LDAP_OPT_RESTART:
70     case LDAP_OPT_THREAD_FN_PTRS:
71         return LDAP_LOCAL_ERROR;
72
73     case LDAP_OPT_API_FEATURE_INFO:
74     case LDAP_OPT_API_INFO:
75     case LDAP_OPT_AREC_EXCLUSIVE:
76     case LDAP_OPT_AUTO_RECONNECT:
77     case LDAP_OPT_CLIENT_CERTIFICATE:
78     case LDAP_OPT_DNSDOMAIN_NAME:
79     case LDAP_OPT_ENCRYPT:
80     case LDAP_OPT_ERROR_STRING:
81     case LDAP_OPT_FAST_CONCURRENT_BIND:
82     case LDAP_OPT_GETDSNAME_FLAGS:
83     case LDAP_OPT_HOST_NAME:
84     case LDAP_OPT_HOST_REACHABLE:
85     case LDAP_OPT_PING_KEEP_ALIVE:
86     case LDAP_OPT_PING_LIMIT:
87     case LDAP_OPT_PING_WAIT_TIME:
88     case LDAP_OPT_PROMPT_CREDENTIALS:
89     case LDAP_OPT_REF_DEREF_CONN_PER_MSG:
90     case LDAP_OPT_REFERRAL_CALLBACK:
91     case LDAP_OPT_REFERRAL_HOP_LIMIT:
92     case LDAP_OPT_ROOTDSE_CACHE:
93     case LDAP_OPT_SASL_METHOD:
94     case LDAP_OPT_SECURITY_CONTEXT:
95     case LDAP_OPT_SEND_TIMEOUT:
96     case LDAP_OPT_SERVER_CERTIFICATE:
97     case LDAP_OPT_SERVER_ERROR:
98     case LDAP_OPT_SERVER_EXT_ERROR:
99     case LDAP_OPT_SIGN:
100     case LDAP_OPT_SSL:
101     case LDAP_OPT_SSL_INFO:
102     case LDAP_OPT_SSPI_FLAGS:
103     case LDAP_OPT_TCP_KEEPALIVE:
104         FIXME( "Unsupported option: 0x%02x\n", option );
105         return LDAP_NOT_SUPPORTED;
106
107     default:
108         FIXME( "Unknown option: 0x%02x\n", option );
109         return LDAP_LOCAL_ERROR;
110     }
111
112 #endif
113     return ret;
114 }
115
116 ULONG ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
117 {
118     ULONG ret = LDAP_NOT_SUPPORTED;
119 #ifdef HAVE_LDAP
120
121     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
122
123     if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
124
125     switch (option)
126     {
127     case LDAP_OPT_DEREF:
128     case LDAP_OPT_DESC:
129     case LDAP_OPT_ERROR_NUMBER:
130     case LDAP_OPT_PROTOCOL_VERSION:
131     case LDAP_OPT_REFERRALS:
132     case LDAP_OPT_SIZELIMIT:
133     case LDAP_OPT_TIMELIMIT:
134         return ldap_get_option( ld, option, value );
135
136     case LDAP_OPT_CACHE_ENABLE:
137     case LDAP_OPT_CACHE_FN_PTRS:
138     case LDAP_OPT_CACHE_STRATEGY:
139     case LDAP_OPT_IO_FN_PTRS:
140     case LDAP_OPT_REBIND_ARG:
141     case LDAP_OPT_REBIND_FN:
142     case LDAP_OPT_RESTART:
143     case LDAP_OPT_THREAD_FN_PTRS:
144         return LDAP_LOCAL_ERROR;
145
146     case LDAP_OPT_API_FEATURE_INFO:
147     case LDAP_OPT_API_INFO:
148     case LDAP_OPT_AREC_EXCLUSIVE:
149     case LDAP_OPT_AUTO_RECONNECT:
150     case LDAP_OPT_CLIENT_CERTIFICATE:
151     case LDAP_OPT_DNSDOMAIN_NAME:
152     case LDAP_OPT_ENCRYPT:
153     case LDAP_OPT_ERROR_STRING:
154     case LDAP_OPT_FAST_CONCURRENT_BIND:
155     case LDAP_OPT_GETDSNAME_FLAGS:
156     case LDAP_OPT_HOST_NAME:
157     case LDAP_OPT_HOST_REACHABLE:
158     case LDAP_OPT_PING_KEEP_ALIVE:
159     case LDAP_OPT_PING_LIMIT:
160     case LDAP_OPT_PING_WAIT_TIME:
161     case LDAP_OPT_PROMPT_CREDENTIALS:
162     case LDAP_OPT_REF_DEREF_CONN_PER_MSG:
163     case LDAP_OPT_REFERRAL_CALLBACK:
164     case LDAP_OPT_REFERRAL_HOP_LIMIT:
165     case LDAP_OPT_ROOTDSE_CACHE:
166     case LDAP_OPT_SASL_METHOD:
167     case LDAP_OPT_SECURITY_CONTEXT:
168     case LDAP_OPT_SEND_TIMEOUT:
169     case LDAP_OPT_SERVER_CERTIFICATE:
170     case LDAP_OPT_SERVER_ERROR:
171     case LDAP_OPT_SERVER_EXT_ERROR:
172     case LDAP_OPT_SIGN:
173     case LDAP_OPT_SSL:
174     case LDAP_OPT_SSL_INFO:
175     case LDAP_OPT_SSPI_FLAGS:
176     case LDAP_OPT_TCP_KEEPALIVE:
177         FIXME( "Unsupported option: 0x%02x\n", option );
178         return LDAP_NOT_SUPPORTED;
179
180     default:
181         FIXME( "Unknown option: 0x%02x\n", option );
182         return LDAP_LOCAL_ERROR;
183     }
184
185 #endif
186     return ret;
187 }
188
189 ULONG ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
190 {
191     ULONG ret = LDAP_NOT_SUPPORTED;
192 #ifdef HAVE_LDAP
193
194     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
195
196     if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
197
198     switch (option)
199     {
200     case LDAP_OPT_DEREF:
201     case LDAP_OPT_DESC:
202     case LDAP_OPT_ERROR_NUMBER:
203     case LDAP_OPT_PROTOCOL_VERSION:
204     case LDAP_OPT_REFERRALS:
205     case LDAP_OPT_SIZELIMIT:
206     case LDAP_OPT_TIMELIMIT:
207         return ldap_set_optionW( ld, option, value );
208
209     case LDAP_OPT_CACHE_ENABLE:
210     case LDAP_OPT_CACHE_FN_PTRS:
211     case LDAP_OPT_CACHE_STRATEGY:
212     case LDAP_OPT_IO_FN_PTRS:
213     case LDAP_OPT_REBIND_ARG:
214     case LDAP_OPT_REBIND_FN:
215     case LDAP_OPT_RESTART:
216     case LDAP_OPT_THREAD_FN_PTRS:
217         return LDAP_LOCAL_ERROR;
218
219     case LDAP_OPT_API_FEATURE_INFO:
220     case LDAP_OPT_API_INFO:
221     case LDAP_OPT_AREC_EXCLUSIVE:
222     case LDAP_OPT_AUTO_RECONNECT:
223     case LDAP_OPT_CLIENT_CERTIFICATE:
224     case LDAP_OPT_DNSDOMAIN_NAME:
225     case LDAP_OPT_ENCRYPT:
226     case LDAP_OPT_ERROR_STRING:
227     case LDAP_OPT_FAST_CONCURRENT_BIND:
228     case LDAP_OPT_GETDSNAME_FLAGS:
229     case LDAP_OPT_HOST_NAME:
230     case LDAP_OPT_HOST_REACHABLE:
231     case LDAP_OPT_PING_KEEP_ALIVE:
232     case LDAP_OPT_PING_LIMIT:
233     case LDAP_OPT_PING_WAIT_TIME:
234     case LDAP_OPT_PROMPT_CREDENTIALS:
235     case LDAP_OPT_REF_DEREF_CONN_PER_MSG:
236     case LDAP_OPT_REFERRAL_CALLBACK:
237     case LDAP_OPT_REFERRAL_HOP_LIMIT:
238     case LDAP_OPT_ROOTDSE_CACHE:
239     case LDAP_OPT_SASL_METHOD:
240     case LDAP_OPT_SECURITY_CONTEXT:
241     case LDAP_OPT_SEND_TIMEOUT:
242     case LDAP_OPT_SERVER_CERTIFICATE:
243     case LDAP_OPT_SERVER_ERROR:
244     case LDAP_OPT_SERVER_EXT_ERROR:
245     case LDAP_OPT_SIGN:
246     case LDAP_OPT_SSL:
247     case LDAP_OPT_SSL_INFO:
248     case LDAP_OPT_SSPI_FLAGS:
249     case LDAP_OPT_TCP_KEEPALIVE:
250         FIXME( "Unsupported option: 0x%02x\n", option );
251         return LDAP_NOT_SUPPORTED;
252
253     default:
254         FIXME( "Unknown option: 0x%02x\n", option );
255         return LDAP_LOCAL_ERROR;
256     }
257
258 #endif
259     return ret;
260 }
261
262 ULONG ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
263 {
264     ULONG ret = LDAP_NOT_SUPPORTED;
265 #ifdef HAVE_LDAP
266
267     TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
268
269     if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
270
271     switch (option)
272     {
273     case LDAP_OPT_DEREF:
274     case LDAP_OPT_DESC:
275     case LDAP_OPT_ERROR_NUMBER:
276     case LDAP_OPT_PROTOCOL_VERSION:
277     case LDAP_OPT_REFERRALS:
278     case LDAP_OPT_SIZELIMIT:
279     case LDAP_OPT_TIMELIMIT:
280         return ldap_set_option( ld, option, value );
281
282     case LDAP_OPT_CACHE_ENABLE:
283     case LDAP_OPT_CACHE_FN_PTRS:
284     case LDAP_OPT_CACHE_STRATEGY:
285     case LDAP_OPT_IO_FN_PTRS:
286     case LDAP_OPT_REBIND_ARG:
287     case LDAP_OPT_REBIND_FN:
288     case LDAP_OPT_RESTART:
289     case LDAP_OPT_THREAD_FN_PTRS:
290         return LDAP_LOCAL_ERROR;
291
292     case LDAP_OPT_API_FEATURE_INFO:
293     case LDAP_OPT_API_INFO:
294     case LDAP_OPT_AREC_EXCLUSIVE:
295     case LDAP_OPT_AUTO_RECONNECT:
296     case LDAP_OPT_CLIENT_CERTIFICATE:
297     case LDAP_OPT_DNSDOMAIN_NAME:
298     case LDAP_OPT_ENCRYPT:
299     case LDAP_OPT_ERROR_STRING:
300     case LDAP_OPT_FAST_CONCURRENT_BIND:
301     case LDAP_OPT_GETDSNAME_FLAGS:
302     case LDAP_OPT_HOST_NAME:
303     case LDAP_OPT_HOST_REACHABLE:
304     case LDAP_OPT_PING_KEEP_ALIVE:
305     case LDAP_OPT_PING_LIMIT:
306     case LDAP_OPT_PING_WAIT_TIME:
307     case LDAP_OPT_PROMPT_CREDENTIALS:
308     case LDAP_OPT_REF_DEREF_CONN_PER_MSG:
309     case LDAP_OPT_REFERRAL_CALLBACK:
310     case LDAP_OPT_REFERRAL_HOP_LIMIT:
311     case LDAP_OPT_ROOTDSE_CACHE:
312     case LDAP_OPT_SASL_METHOD:
313     case LDAP_OPT_SECURITY_CONTEXT:
314     case LDAP_OPT_SEND_TIMEOUT:
315     case LDAP_OPT_SERVER_CERTIFICATE:
316     case LDAP_OPT_SERVER_ERROR:
317     case LDAP_OPT_SERVER_EXT_ERROR:
318     case LDAP_OPT_SIGN:
319     case LDAP_OPT_SSL:
320     case LDAP_OPT_SSL_INFO:
321     case LDAP_OPT_SSPI_FLAGS:
322     case LDAP_OPT_TCP_KEEPALIVE:
323         FIXME( "Unsupported option: 0x%02x\n", option );
324         return LDAP_NOT_SUPPORTED;
325
326     default:
327         FIXME( "Unknown option: 0x%02x\n", option );
328         return LDAP_LOCAL_ERROR;
329     }
330
331 #endif
332     return ret;
333 }