gdi32: Use NtGdiPolyPolyDraw for PolylineTo implementation.
[wine.git] / dlls / wldap32 / modrdn.c
blob3e1969163d73649a23c3ec219dbc7d66d5f430c8
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_modrdnA (WLDAP32.@)
35 * See ldap_modrdnW.
37 ULONG CDECL ldap_modrdnA( LDAP *ld, char *dn, char *newdn )
39 ULONG ret = LDAP_NO_MEMORY;
40 WCHAR *dnW = NULL, *newdnW = NULL;
42 TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) );
44 if (!ld || !newdn) return ~0u;
46 if (dn && !(dnW = strAtoW( dn ))) goto exit;
47 if (!(newdnW = strAtoW( newdn ))) goto exit;
49 ret = ldap_modrdnW( ld, dnW, newdnW );
51 exit:
52 free( dnW );
53 free( newdnW );
54 return ret;
57 /***********************************************************************
58 * ldap_modrdnW (WLDAP32.@)
60 * Change the RDN of a directory entry (asynchronous operation).
62 * PARAMS
63 * ld [I] Pointer to an LDAP context.
64 * dn [I] DN of the entry to change.
65 * newdn [I] New DN for the entry.
67 * RETURNS
68 * Success: Message ID of the modrdn operation.
69 * Failure: An LDAP error code.
71 * NOTES
72 * Call ldap_result with the message ID to get the result of
73 * the operation. Cancel the operation by calling ldap_abandon
74 * with the message ID.
76 ULONG CDECL ldap_modrdnW( LDAP *ld, WCHAR *dn, WCHAR *newdn )
78 TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
79 return ldap_modrdn2W( ld, dn, newdn, 1 );
82 /***********************************************************************
83 * ldap_modrdn2A (WLDAP32.@)
85 * See ldap_modrdn2W.
87 ULONG CDECL ldap_modrdn2A( LDAP *ld, char *dn, char *newdn, int delete )
89 ULONG ret = LDAP_NO_MEMORY;
90 WCHAR *dnW = NULL, *newdnW = NULL;
92 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
94 if (!ld || !newdn) return ~0u;
96 if (dn && !(dnW = strAtoW( dn ))) goto exit;
97 if (!(newdnW = strAtoW( newdn ))) goto exit;
99 ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
101 exit:
102 free( dnW );
103 free( newdnW );
104 return ret;
107 /***********************************************************************
108 * ldap_modrdn2W (WLDAP32.@)
110 * Change the RDN of a directory entry (asynchronous operation).
112 * PARAMS
113 * ld [I] Pointer to an LDAP context.
114 * dn [I] DN of the entry to change.
115 * newdn [I] New DN for the entry.
116 * delete [I] Delete old DN?
118 * RETURNS
119 * Success: Message ID of the modrdn operation.
120 * Failure: An LDAP error code.
122 * NOTES
123 * Call ldap_result with the message ID to get the result of
124 * the operation. Cancel the operation by calling ldap_abandon
125 * with the message ID.
127 ULONG CDECL ldap_modrdn2W( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
129 ULONG ret = LDAP_NO_MEMORY;
130 char *dnU = NULL, *newdnU = NULL;
131 ULONG msg;
133 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
135 if (!ld || !newdn) return ~0u;
137 if (dn && !(dnU = strWtoU( dn ))) goto exit;
138 if (!(newdnU = strWtoU( newdn ))) goto exit;
140 ret = ldap_funcs->fn_ldap_rename( CTX(ld), dnU, newdnU, NULL, delete, NULL, NULL, &msg );
141 if (ret == LDAP_SUCCESS)
142 ret = msg;
143 else
144 ret = ~0u;
146 exit:
147 free( dnU );
148 free( newdnU );
149 return ret;
152 /***********************************************************************
153 * ldap_modrdn2_sA (WLDAP32.@)
155 * See ldap_modrdn2_sW.
157 ULONG CDECL ldap_modrdn2_sA( LDAP *ld, char *dn, char *newdn, int delete )
159 ULONG ret = LDAP_NO_MEMORY;
160 WCHAR *dnW = NULL, *newdnW = NULL;
162 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
164 if (!ld || !newdn) return LDAP_PARAM_ERROR;
166 if (dn && !(dnW = strAtoW( dn ))) goto exit;
167 if (!(newdnW = strAtoW( newdn ))) goto exit;
169 ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
171 exit:
172 free( dnW );
173 free( newdnW );
174 return ret;
177 /***********************************************************************
178 * ldap_modrdn2_sW (WLDAP32.@)
180 * Change the RDN of a directory entry (synchronous operation).
182 * PARAMS
183 * ld [I] Pointer to an LDAP context.
184 * dn [I] DN of the entry to change.
185 * newdn [I] New DN for the entry.
186 * delete [I] Delete old DN?
188 * RETURNS
189 * Success: LDAP_SUCCESS
190 * Failure: An LDAP error code.
192 ULONG CDECL ldap_modrdn2_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
194 ULONG ret = LDAP_NO_MEMORY;
195 char *dnU = NULL, *newdnU = NULL;
197 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
199 if (!ld || !newdn) return LDAP_PARAM_ERROR;
201 if (dn && !(dnU = strWtoU( dn ))) goto exit;
202 if (!(newdnU = strWtoU( newdn ))) goto exit;
204 ret = map_error( ldap_funcs->fn_ldap_rename_s( CTX(ld), dnU, newdnU, NULL, delete, NULL, NULL ));
206 exit:
207 free( dnU );
208 free( newdnU );
209 return ret;
212 /***********************************************************************
213 * ldap_modrdn_sA (WLDAP32.@)
215 * See ldap_modrdn_sW.
217 ULONG CDECL ldap_modrdn_sA( LDAP *ld, char *dn, char *newdn )
219 ULONG ret = LDAP_NO_MEMORY;
220 WCHAR *dnW = NULL, *newdnW = NULL;
222 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
224 if (!ld || !newdn) return LDAP_PARAM_ERROR;
226 if (dn && !(dnW = strAtoW( dn ))) goto exit;
227 if (!(newdnW = strAtoW( newdn ))) goto exit;
229 ret = ldap_modrdn_sW( ld, dnW, newdnW );
231 exit:
232 free( dnW );
233 free( newdnW );
234 return ret;
237 /***********************************************************************
238 * ldap_modrdn_sW (WLDAP32.@)
240 * Change the RDN of a directory entry (synchronous operation).
242 * PARAMS
243 * ld [I] Pointer to an LDAP context.
244 * dn [I] DN of the entry to change.
245 * newdn [I] New DN for the entry.
247 * RETURNS
248 * Success: LDAP_SUCCESS
249 * Failure: An LDAP error code.
251 ULONG CDECL ldap_modrdn_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn )
253 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
254 return ldap_modrdn2_sW( ld, dn, newdn, 1 );