kernelbase: Let GetModuleBaseName succeed on 64bit modules in wow64.
[wine.git] / dlls / wldap32 / modify.c
bloba062bf4bb15d32c558ba62784185cdcbe331f3ef
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"
26 #include "wine/debug.h"
27 #include "winldap_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
31 /***********************************************************************
32 * ldap_modifyA (WLDAP32.@)
34 ULONG CDECL ldap_modifyA( LDAP *ld, char *dn, LDAPModA **mods )
36 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
37 WCHAR *dnW = NULL;
38 LDAPModW **modsW = NULL;
40 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
42 if (!ld) return ~0u;
44 if (dn && !(dnW = strAtoW( dn ))) goto exit;
45 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
47 ret = ldap_modifyW( ld, dnW, modsW );
49 exit:
50 free( dnW );
51 modarrayfreeW( modsW );
52 return ret;
55 /***********************************************************************
56 * ldap_modifyW (WLDAP32.@)
58 ULONG CDECL ldap_modifyW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
60 ULONG ret, msg;
62 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
64 ret = ldap_modify_extW( ld, dn, mods, NULL, NULL, &msg );
65 if (ret == WLDAP32_LDAP_SUCCESS) return msg;
66 return ~0u;
69 /***********************************************************************
70 * ldap_modify_extA (WLDAP32.@)
72 ULONG CDECL ldap_modify_extA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
73 LDAPControlA **clientctrls, ULONG *message )
75 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
76 WCHAR *dnW = NULL;
77 LDAPModW **modsW = NULL;
78 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
80 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls, message );
82 if (!ld) return ~0u;
84 if (dn && !(dnW = strAtoW( dn ))) goto exit;
85 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
86 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
87 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
89 ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
91 exit:
92 free( dnW );
93 modarrayfreeW( modsW );
94 controlarrayfreeW( serverctrlsW );
95 controlarrayfreeW( clientctrlsW );
96 return ret;
99 /***********************************************************************
100 * ldap_modify_extW (WLDAP32.@)
102 ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
103 LDAPControlW **clientctrls, ULONG *message )
105 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
106 char *dnU = NULL;
107 LDAPMod **modsU = NULL;
108 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
110 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls, message );
112 if (!ld) return ~0u;
114 if (dn && !(dnU = strWtoU( dn ))) goto exit;
115 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
116 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
117 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
118 else
120 ret = map_error( ldap_modify_ext( CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU, (int *)message ) );
123 exit:
124 free( dnU );
125 modarrayfreeU( modsU );
126 controlarrayfreeU( serverctrlsU );
127 controlarrayfreeU( clientctrlsU );
128 return ret;
131 /***********************************************************************
132 * ldap_modify_ext_sA (WLDAP32.@)
134 ULONG CDECL ldap_modify_ext_sA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
135 LDAPControlA **clientctrls )
137 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
138 WCHAR *dnW = NULL;
139 LDAPModW **modsW = NULL;
140 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
142 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls );
144 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
146 if (dn && !(dnW = strAtoW( dn ))) goto exit;
147 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
148 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
149 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
151 ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
153 exit:
154 free( dnW );
155 modarrayfreeW( modsW );
156 controlarrayfreeW( serverctrlsW );
157 controlarrayfreeW( clientctrlsW );
158 return ret;
161 /***********************************************************************
162 * ldap_modify_ext_sW (WLDAP32.@)
164 ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
165 LDAPControlW **clientctrls )
167 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
168 char *dnU = NULL;
169 LDAPMod **modsU = NULL;
170 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
172 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls );
174 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
176 if (dn && !(dnU = strWtoU( dn ))) goto exit;
177 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
178 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
179 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
180 else
182 ret = map_error( ldap_modify_ext_s( CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU ) );
185 exit:
186 free( dnU );
187 modarrayfreeU( modsU );
188 controlarrayfreeU( serverctrlsU );
189 controlarrayfreeU( clientctrlsU );
190 return ret;
193 /***********************************************************************
194 * ldap_modify_sA (WLDAP32.@)
196 ULONG CDECL ldap_modify_sA( LDAP *ld, char *dn, LDAPModA **mods )
198 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
199 WCHAR *dnW = NULL;
200 LDAPModW **modsW = NULL;
202 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
204 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
206 if (dn && !(dnW = strAtoW( dn ))) goto exit;
207 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
209 ret = ldap_modify_sW( ld, dnW, modsW );
211 exit:
212 free( dnW );
213 modarrayfreeW( modsW );
214 return ret;
217 /***********************************************************************
218 * ldap_modify_sW (WLDAP32.@)
220 ULONG CDECL ldap_modify_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
222 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
223 return ldap_modify_ext_sW( ld, dn, mods, NULL, NULL );