gdi32: Use NtGdiPolyPolyDraw for PolylineTo implementation.
[wine.git] / dlls / wldap32 / delete.c
blob21fd8d08d4be87bd67d0da64c01f7904fb589a83
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_deleteA (WLDAP32.@)
35 * See ldap_deleteW.
37 ULONG CDECL ldap_deleteA( LDAP *ld, char *dn )
39 ULONG ret;
40 WCHAR *dnW = NULL;
42 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
44 if (!ld) return ~0u;
45 if (dn && !(dnW = strAtoW( dn ))) return LDAP_NO_MEMORY;
47 ret = ldap_deleteW( ld, dnW );
48 free( dnW );
49 return ret;
52 /***********************************************************************
53 * ldap_deleteW (WLDAP32.@)
55 * Delete an entry from a directory tree (asynchronous operation).
57 * PARAMS
58 * ld [I] Pointer to an LDAP context.
59 * dn [I] DN of the entry to delete.
61 * RETURNS
62 * Success: Message ID of the add operation.
63 * Failure: An LDAP error code.
65 * NOTES
66 * Call ldap_result with the message ID to get the result of
67 * the operation. Cancel the operation by calling ldap_abandon
68 * with the message ID.
70 ULONG CDECL ldap_deleteW( LDAP *ld, WCHAR *dn )
72 ULONG ret, msg;
74 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
76 ret = ldap_delete_extW( ld, dn, NULL, NULL, &msg );
77 if (ret == LDAP_SUCCESS) return msg;
78 return ~0u;
81 /***********************************************************************
82 * ldap_delete_extA (WLDAP32.@)
84 * See ldap_delete_extW.
86 ULONG CDECL ldap_delete_extA( LDAP *ld, char *dn, LDAPControlA **serverctrls, LDAPControlA **clientctrls,
87 ULONG *message )
89 ULONG ret = LDAP_NO_MEMORY;
90 WCHAR *dnW = NULL;
91 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
93 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls, clientctrls, message );
95 if (!ld) return LDAP_PARAM_ERROR;
97 if (dn && !(dnW = strAtoW( dn ))) goto exit;
98 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
99 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
101 ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message );
103 exit:
104 free( dnW );
105 controlarrayfreeW( serverctrlsW );
106 controlarrayfreeW( clientctrlsW );
107 return ret;
110 /***********************************************************************
111 * ldap_delete_extW (WLDAP32.@)
113 * Delete an entry from a directory tree (asynchronous operation).
115 * PARAMS
116 * ld [I] Pointer to an LDAP context.
117 * dn [I] DN of the entry to delete.
118 * serverctrls [I] Array of LDAP server controls.
119 * clientctrls [I] Array of LDAP client controls.
120 * message [O] Message ID of the delete operation.
122 * RETURNS
123 * Success: LDAP_SUCCESS
124 * Failure: An LDAP error code.
126 * NOTES
127 * Call ldap_result with the message ID to get the result of
128 * the operation. The serverctrls and clientctrls parameters are
129 * optional and should be set to NULL if not used.
131 ULONG CDECL ldap_delete_extW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls, LDAPControlW **clientctrls,
132 ULONG *message )
134 ULONG ret = LDAP_NO_MEMORY;
135 char *dnU = NULL;
136 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
138 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls, clientctrls, message );
140 if (!ld) return LDAP_PARAM_ERROR;
142 if (dn && !(dnU = strWtoU( dn ))) goto exit;
143 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
144 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
146 ret = map_error( ldap_funcs->fn_ldap_delete_ext( CTX(ld), dnU, serverctrlsU, clientctrlsU, message ) );
148 exit:
149 free( dnU );
150 controlarrayfreeU( serverctrlsU );
151 controlarrayfreeU( clientctrlsU );
152 return ret;
155 /***********************************************************************
156 * ldap_delete_ext_sA (WLDAP32.@)
158 * See ldap_delete_ext_sW.
160 ULONG CDECL ldap_delete_ext_sA( LDAP *ld, char *dn, LDAPControlA **serverctrls, LDAPControlA **clientctrls )
162 ULONG ret = LDAP_NO_MEMORY;
163 WCHAR *dnW = NULL;
164 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
166 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls, clientctrls );
168 if (!ld) return LDAP_PARAM_ERROR;
170 if (dn && !(dnW = strAtoW( dn ))) goto exit;
171 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
172 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
174 ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW );
176 exit:
177 free( dnW );
178 controlarrayfreeW( serverctrlsW );
179 controlarrayfreeW( clientctrlsW );
180 return ret;
183 /***********************************************************************
184 * ldap_delete_ext_sW (WLDAP32.@)
186 * Delete an entry from a directory tree (synchronous operation).
188 * PARAMS
189 * ld [I] Pointer to an LDAP context.
190 * dn [I] DN of the entry to delete.
191 * serverctrls [I] Array of LDAP server controls.
192 * clientctrls [I] Array of LDAP client controls.
194 * RETURNS
195 * Success: LDAP_SUCCESS
196 * Failure: An LDAP error code.
198 * NOTES
199 * The serverctrls and clientctrls parameters are optional and
200 * should be set to NULL if not used.
202 ULONG CDECL ldap_delete_ext_sW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls, LDAPControlW **clientctrls )
204 ULONG ret = LDAP_NO_MEMORY;
205 char *dnU = NULL;
206 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
208 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls, clientctrls );
210 if (!ld) return LDAP_PARAM_ERROR;
212 if (dn && !(dnU = strWtoU( dn ))) goto exit;
213 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
214 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
216 ret = map_error( ldap_funcs->fn_ldap_delete_ext_s( CTX(ld), dnU, serverctrlsU, clientctrlsU ) );
218 exit:
219 free( dnU );
220 controlarrayfreeU( serverctrlsU );
221 controlarrayfreeU( clientctrlsU );
222 return ret;
225 /***********************************************************************
226 * ldap_delete_sA (WLDAP32.@)
228 * See ldap_delete_sW.
230 ULONG CDECL ldap_delete_sA( LDAP *ld, char *dn )
232 ULONG ret;
233 WCHAR *dnW = NULL;
235 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
237 if (!ld) return LDAP_PARAM_ERROR;
238 if (dn && !(dnW = strAtoW( dn ))) return LDAP_NO_MEMORY;
240 ret = ldap_delete_sW( ld, dnW );
241 free( dnW );
242 return ret;
245 /***********************************************************************
246 * ldap_delete_sW (WLDAP32.@)
248 * Delete an entry from a directory tree (synchronous operation).
250 * PARAMS
251 * ld [I] Pointer to an LDAP context.
252 * dn [I] DN of the entry to delete.
254 * RETURNS
255 * Success: LDAP_SUCCESS
256 * Failure: An LDAP error code.
258 ULONG CDECL ldap_delete_sW( LDAP *ld, WCHAR *dn )
260 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
261 return ldap_delete_ext_sW( ld, dn, NULL, NULL );