kernelbase: Let GetModuleBaseName succeed on 64bit modules in wow64.
[wine.git] / dlls / wldap32 / modrdn.c
blob4acf16eb5e4b392e834978c52b76c37ea1339951
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_modrdnA (WLDAP32.@)
34 ULONG CDECL ldap_modrdnA( LDAP *ld, char *dn, char *newdn )
36 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
37 WCHAR *dnW = NULL, *newdnW = NULL;
39 TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) );
41 if (!ld || !newdn) return ~0u;
43 if (dn && !(dnW = strAtoW( dn ))) goto exit;
44 if (!(newdnW = strAtoW( newdn ))) goto exit;
46 ret = ldap_modrdnW( ld, dnW, newdnW );
48 exit:
49 free( dnW );
50 free( newdnW );
51 return ret;
54 /***********************************************************************
55 * ldap_modrdnW (WLDAP32.@)
57 ULONG CDECL ldap_modrdnW( LDAP *ld, WCHAR *dn, WCHAR *newdn )
59 TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
60 return ldap_modrdn2W( ld, dn, newdn, 1 );
63 /***********************************************************************
64 * ldap_modrdn2A (WLDAP32.@)
66 ULONG CDECL ldap_modrdn2A( LDAP *ld, char *dn, char *newdn, int delete )
68 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
69 WCHAR *dnW = NULL, *newdnW = NULL;
71 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
73 if (!ld || !newdn) return ~0u;
75 if (dn && !(dnW = strAtoW( dn ))) goto exit;
76 if (!(newdnW = strAtoW( newdn ))) goto exit;
78 ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
80 exit:
81 free( dnW );
82 free( newdnW );
83 return ret;
86 /***********************************************************************
87 * ldap_modrdn2W (WLDAP32.@)
89 ULONG CDECL ldap_modrdn2W( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
91 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
92 char *dnU = NULL, *newdnU = NULL;
93 int msg;
95 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
97 if (!ld || !newdn) return ~0u;
99 if (dn && !(dnU = strWtoU( dn ))) return WLDAP32_LDAP_NO_MEMORY;
101 if ((newdnU = strWtoU( newdn )))
103 ret = ldap_rename( CTX(ld), dnU, newdnU, NULL, delete, NULL, NULL, &msg );
104 if (ret == WLDAP32_LDAP_SUCCESS)
105 ret = msg;
106 else
107 ret = ~0u;
108 free( newdnU );
110 free( dnU );
111 return ret;
114 /***********************************************************************
115 * ldap_modrdn2_sA (WLDAP32.@)
117 ULONG CDECL ldap_modrdn2_sA( LDAP *ld, char *dn, char *newdn, int delete )
119 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
120 WCHAR *dnW = NULL, *newdnW = NULL;
122 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
124 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
126 if (dn && !(dnW = strAtoW( dn ))) goto exit;
127 if (!(newdnW = strAtoW( newdn ))) goto exit;
129 ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
131 exit:
132 free( dnW );
133 free( newdnW );
134 return ret;
137 /***********************************************************************
138 * ldap_modrdn2_sW (WLDAP32.@)
140 ULONG CDECL ldap_modrdn2_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
142 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
143 char *dnU = NULL, *newdnU = NULL;
145 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
147 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
149 if (dn && !(dnU = strWtoU( dn ))) return WLDAP32_LDAP_NO_MEMORY;
151 if ((newdnU = strWtoU( newdn )))
153 ret = map_error( ldap_rename_s( CTX(ld), dnU, newdnU, NULL, delete, NULL, NULL ) );
154 free( newdnU );
156 free( dnU );
157 return ret;
160 /***********************************************************************
161 * ldap_modrdn_sA (WLDAP32.@)
163 ULONG CDECL ldap_modrdn_sA( LDAP *ld, char *dn, char *newdn )
165 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
166 WCHAR *dnW = NULL, *newdnW = NULL;
168 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
170 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
172 if (dn && !(dnW = strAtoW( dn ))) goto exit;
173 if (!(newdnW = strAtoW( newdn ))) goto exit;
175 ret = ldap_modrdn_sW( ld, dnW, newdnW );
177 exit:
178 free( dnW );
179 free( newdnW );
180 return ret;
183 /***********************************************************************
184 * ldap_modrdn_sW (WLDAP32.@)
186 ULONG CDECL ldap_modrdn_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn )
188 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
189 return ldap_modrdn2_sW( ld, dn, newdn, 1 );