d2d1: Create feature level 10.0 device context state objects.
[wine.git] / dlls / wldap32 / modify.c
blob7c7f2c61293a107f0b2da8f62d7920e766edfb4c
1 /*
2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
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
21 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winnls.h"
25 #include "winldap.h"
27 #include "wine/debug.h"
28 #include "winldap_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
32 /***********************************************************************
33 * ldap_modifyA (WLDAP32.@)
35 * See ldap_modifyW.
37 ULONG CDECL ldap_modifyA( LDAP *ld, char *dn, LDAPModA **mods )
39 ULONG ret = LDAP_NO_MEMORY;
40 WCHAR *dnW = NULL;
41 LDAPModW **modsW = NULL;
43 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
45 if (!ld) return ~0u;
47 if (dn && !(dnW = strAtoW( dn ))) goto exit;
48 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
50 ret = ldap_modifyW( ld, dnW, modsW );
52 exit:
53 free( dnW );
54 modarrayfreeW( modsW );
55 return ret;
58 /***********************************************************************
59 * ldap_modifyW (WLDAP32.@)
61 * Change an entry in a directory tree (asynchronous operation).
63 * PARAMS
64 * ld [I] Pointer to an LDAP context.
65 * dn [I] DN of the entry to change.
66 * mods [I] Pointer to an array of LDAPModW structures, each
67 * specifying an attribute and its values to change.
69 * RETURNS
70 * Success: Message ID of the modify operation.
71 * Failure: An LDAP error code.
73 * NOTES
74 * Call ldap_result with the message ID to get the result of
75 * the operation. Cancel the operation by calling ldap_abandon
76 * with the message ID.
78 ULONG CDECL ldap_modifyW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
80 ULONG ret, msg;
82 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
84 ret = ldap_modify_extW( ld, dn, mods, NULL, NULL, &msg );
85 if (ret == LDAP_SUCCESS) return msg;
86 return ~0u;
89 /***********************************************************************
90 * ldap_modify_extA (WLDAP32.@)
92 * See ldap_modify_extW.
94 ULONG CDECL ldap_modify_extA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
95 LDAPControlA **clientctrls, ULONG *message )
97 ULONG ret = LDAP_NO_MEMORY;
98 WCHAR *dnW = NULL;
99 LDAPModW **modsW = NULL;
100 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
102 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls, message );
104 if (!ld) return ~0u;
106 if (dn && !(dnW = strAtoW( dn ))) goto exit;
107 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
108 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
109 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
111 ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
113 exit:
114 free( dnW );
115 modarrayfreeW( modsW );
116 controlarrayfreeW( serverctrlsW );
117 controlarrayfreeW( clientctrlsW );
118 return ret;
121 /***********************************************************************
122 * ldap_modify_extW (WLDAP32.@)
124 * Change an entry in a directory tree (asynchronous operation).
126 * PARAMS
127 * ld [I] Pointer to an LDAP context.
128 * dn [I] DN of the entry to change.
129 * mods [I] Pointer to an array of LDAPModW structures, each
130 * specifying an attribute and its values to change.
131 * serverctrls [I] Array of LDAP server controls.
132 * clientctrls [I] Array of LDAP client controls.
133 * message [O] Message ID of the modify operation.
135 * RETURNS
136 * Success: LDAP_SUCCESS
137 * Failure: An LDAP error code.
139 * NOTES
140 * Call ldap_result with the message ID to get the result of
141 * the operation. The serverctrls and clientctrls parameters are
142 * optional and should be set to NULL if not used.
144 ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
145 LDAPControlW **clientctrls, ULONG *message )
147 ULONG ret = LDAP_NO_MEMORY;
148 char *dnU = NULL;
149 LDAPModU **modsU = NULL;
150 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
152 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls, message );
154 if (!ld) return ~0u;
156 if (dn && !(dnU = strWtoU( dn ))) goto exit;
157 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
158 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
159 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
160 else
162 struct ldap_modify_ext_params params = { CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU, message };
163 ret = map_error( LDAP_CALL( ldap_modify_ext, &params ));
166 exit:
167 free( dnU );
168 modarrayfreeU( modsU );
169 controlarrayfreeU( serverctrlsU );
170 controlarrayfreeU( clientctrlsU );
171 return ret;
174 /***********************************************************************
175 * ldap_modify_ext_sA (WLDAP32.@)
177 * See ldap_modify_ext_sW.
179 ULONG CDECL ldap_modify_ext_sA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
180 LDAPControlA **clientctrls )
182 ULONG ret = LDAP_NO_MEMORY;
183 WCHAR *dnW = NULL;
184 LDAPModW **modsW = NULL;
185 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
187 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls );
189 if (!ld) return LDAP_PARAM_ERROR;
191 if (dn && !(dnW = strAtoW( dn ))) goto exit;
192 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
193 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
194 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
196 ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
198 exit:
199 free( dnW );
200 modarrayfreeW( modsW );
201 controlarrayfreeW( serverctrlsW );
202 controlarrayfreeW( clientctrlsW );
203 return ret;
206 /***********************************************************************
207 * ldap_modify_ext_sW (WLDAP32.@)
209 * Change an entry in a directory tree (synchronous operation).
211 * PARAMS
212 * ld [I] Pointer to an LDAP context.
213 * dn [I] DN of the entry to change.
214 * mods [I] Pointer to an array of LDAPModW structures, each
215 * specifying an attribute and its values to change.
216 * serverctrls [I] Array of LDAP server controls.
217 * clientctrls [I] Array of LDAP client controls.
219 * RETURNS
220 * Success: LDAP_SUCCESS
221 * Failure: An LDAP error code.
223 * NOTES
224 * The serverctrls and clientctrls parameters are optional and
225 * should be set to NULL if not used.
227 ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
228 LDAPControlW **clientctrls )
230 ULONG ret = LDAP_NO_MEMORY;
231 char *dnU = NULL;
232 LDAPModU **modsU = NULL;
233 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
235 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls );
237 if (!ld) return LDAP_PARAM_ERROR;
239 if (dn && !(dnU = strWtoU( dn ))) goto exit;
240 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
241 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
242 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
243 else
245 struct ldap_modify_ext_s_params params = { CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU };
246 ret = map_error( LDAP_CALL( ldap_modify_ext_s, &params ));
249 exit:
250 free( dnU );
251 modarrayfreeU( modsU );
252 controlarrayfreeU( serverctrlsU );
253 controlarrayfreeU( clientctrlsU );
254 return ret;
257 /***********************************************************************
258 * ldap_modify_sA (WLDAP32.@)
260 * See ldap_modify_sW.
262 ULONG CDECL ldap_modify_sA( LDAP *ld, char *dn, LDAPModA **mods )
264 ULONG ret = LDAP_NO_MEMORY;
265 WCHAR *dnW = NULL;
266 LDAPModW **modsW = NULL;
268 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
270 if (!ld) return LDAP_PARAM_ERROR;
272 if (dn && !(dnW = strAtoW( dn ))) goto exit;
273 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
275 ret = ldap_modify_sW( ld, dnW, modsW );
277 exit:
278 free( dnW );
279 modarrayfreeW( modsW );
280 return ret;
283 /***********************************************************************
284 * ldap_modify_sW (WLDAP32.@)
286 * Change an entry in a directory tree (synchronous operation).
288 * PARAMS
289 * ld [I] Pointer to an LDAP context.
290 * dn [I] DN of the entry to change.
291 * attrs [I] Pointer to an array of LDAPModW structures, each
292 * specifying an attribute and its values to change.
294 * RETURNS
295 * Success: LDAP_SUCCESS
296 * Failure: An LDAP error code.
298 ULONG CDECL ldap_modify_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
300 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
301 return ldap_modify_ext_sW( ld, dn, mods, NULL, NULL );