From e6368408c2ca4204ee77f36725b6b729605c7954 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 24 Mar 2018 13:20:30 +0100 Subject: [PATCH] [WLDAP32] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/wldap32/CMakeLists.txt | 4 +- dll/win32/wldap32/add.c | 16 +++ dll/win32/wldap32/ber.c | 11 +- dll/win32/wldap32/bind.c | 16 +++ dll/win32/wldap32/compare.c | 16 +++ dll/win32/wldap32/control.c | 19 ++- dll/win32/wldap32/delete.c | 16 +++ dll/win32/wldap32/dn.c | 16 +++ dll/win32/wldap32/error.c | 19 ++- dll/win32/wldap32/extended.c | 16 +++ dll/win32/wldap32/init.c | 36 ++++-- dll/win32/wldap32/main.c | 10 +- dll/win32/wldap32/misc.c | 17 ++- dll/win32/wldap32/modify.c | 16 +++ dll/win32/wldap32/modrdn.c | 16 +++ dll/win32/wldap32/option.c | 16 +++ dll/win32/wldap32/page.c | 25 +++- dll/win32/wldap32/parse.c | 16 +++ dll/win32/wldap32/precomp.h | 25 ++++ dll/win32/wldap32/rename.c | 16 +++ dll/win32/wldap32/search.c | 16 +++ dll/win32/wldap32/value.c | 26 +++- dll/win32/wldap32/winldap_private.h | 26 +--- dll/win32/wldap32/wldap32.h | 177 +++++++++++----------------- dll/win32/wldap32/wldap32.rc | 2 +- media/doc/README.WINE | 2 +- 26 files changed, 416 insertions(+), 175 deletions(-) create mode 100644 dll/win32/wldap32/precomp.h diff --git a/dll/win32/wldap32/CMakeLists.txt b/dll/win32/wldap32/CMakeLists.txt index 0b7ef75c528..2f1375099fe 100644 --- a/dll/win32/wldap32/CMakeLists.txt +++ b/dll/win32/wldap32/CMakeLists.txt @@ -23,7 +23,7 @@ list(APPEND SOURCE rename.c search.c value.c - winldap_private.h + precomp.h ${CMAKE_CURRENT_BINARY_DIR}/wldap32_stubs.c) add_library(wldap32 SHARED @@ -35,5 +35,5 @@ add_library(wldap32 SHARED set_module_type(wldap32 win32dll) target_link_libraries(wldap32 wine) add_importlibs(wldap32 user32 msvcrt kernel32 ntdll) -add_pch(wldap32 winldap_private.h SOURCE) +add_pch(wldap32 precomp.h SOURCE) add_cd_file(TARGET wldap32 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/wldap32/add.c b/dll/win32/wldap32/add.c index 34bc186fe9e..0a24d95f324 100644 --- a/dll/win32/wldap32/add.c +++ b/dll/win32/wldap32/add.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); #ifdef HAVE_LDAP static LDAPMod *nullattrs[] = { NULL }; diff --git a/dll/win32/wldap32/ber.c b/dll/win32/wldap32/ber.c index 6687fe11ed4..c2c6f269490 100644 --- a/dll/win32/wldap32/ber.c +++ b/dll/win32/wldap32/ber.c @@ -18,15 +18,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include +#include "windef.h" +#include "winbase.h" +#include "winldap.h" +#include "wine/debug.h" -#include -#include -#include - -#include WINE_DEFAULT_DEBUG_CHANNEL(wldap32); #ifndef LBER_ERROR diff --git a/dll/win32/wldap32/bind.c b/dll/win32/wldap32/bind.c index 057661b7fd7..0e9404ec504 100644 --- a/dll/win32/wldap32/bind.c +++ b/dll/win32/wldap32/bind.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_bindA (WLDAP32.@) diff --git a/dll/win32/wldap32/compare.c b/dll/win32/wldap32/compare.c index c7df577c6d1..7cadc2a970b 100644 --- a/dll/win32/wldap32/compare.c +++ b/dll/win32/wldap32/compare.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_compareA (WLDAP32.@) diff --git a/dll/win32/wldap32/control.c b/dll/win32/wldap32/control.c index dfe79863024..c661f5e9011 100644 --- a/dll/win32/wldap32/control.c +++ b/dll/win32/wldap32/control.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_control_freeA (WLDAP32.@) @@ -260,8 +276,7 @@ INT CDECL ldap_create_vlv_controlW( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info, static inline void bv_val_dup( const struct WLDAP32_berval *src, struct WLDAP32_berval *dst ) { - dst->bv_val = HeapAlloc( GetProcessHeap(), 0, src->bv_len ); - if (dst->bv_val) + if ((dst->bv_val = heap_alloc( src->bv_len ))) { memcpy( dst->bv_val, src->bv_val, src->bv_len ); dst->bv_len = src->bv_len; diff --git a/dll/win32/wldap32/delete.c b/dll/win32/wldap32/delete.c index 2665455e558..47e1cb4f2cb 100644 --- a/dll/win32/wldap32/delete.c +++ b/dll/win32/wldap32/delete.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_deleteA (WLDAP32.@) diff --git a/dll/win32/wldap32/dn.c b/dll/win32/wldap32/dn.c index 49b766d9c7f..fbe1a0c091c 100644 --- a/dll/win32/wldap32/dn.c +++ b/dll/win32/wldap32/dn.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_dn2ufnA (WLDAP32.@) diff --git a/dll/win32/wldap32/error.c b/dll/win32/wldap32/error.c index 39b0a648694..2e09e9e3990 100644 --- a/dll/win32/wldap32/error.c +++ b/dll/win32/wldap32/error.c @@ -18,9 +18,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "winldap_private.h" +#include "config.h" +#include "wine/port.h" -#include +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winnls.h" + +#include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); ULONG map_error( int error ) { diff --git a/dll/win32/wldap32/extended.c b/dll/win32/wldap32/extended.c index 839d17118d4..b05c3c5f1a5 100644 --- a/dll/win32/wldap32/extended.c +++ b/dll/win32/wldap32/extended.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_close_extended_op (WLDAP32.@) diff --git a/dll/win32/wldap32/init.c b/dll/win32/wldap32/init.c index 7b3e467ec8f..fdb79084b50 100644 --- a/dll/win32/wldap32/init.c +++ b/dll/win32/wldap32/init.c @@ -18,7 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" #ifdef HAVE_LDAP /* Should eventually be determined by the algorithm documented on MSDN. */ @@ -47,10 +62,9 @@ static char **split_hostnames( const char *hostnames ) p++; } - res = HeapAlloc( GetProcessHeap(), 0, (i + 1) * sizeof(char *) ); - if (!res) + if (!(res = heap_alloc( (i + 1) * sizeof(char *) ))) { - HeapFree( GetProcessHeap(), 0, str ); + heap_free( str ); return NULL; } @@ -59,7 +73,7 @@ static char **split_hostnames( const char *hostnames ) q = p; i = 0; - + while (*p) { if (p[1] != '\0') @@ -70,7 +84,7 @@ static char **split_hostnames( const char *hostnames ) res[i] = strdupU( q ); if (!res[i]) goto oom; i++; - + while (isspace( *p )) p++; q = p; } @@ -85,14 +99,14 @@ static char **split_hostnames( const char *hostnames ) } res[i] = NULL; - HeapFree( GetProcessHeap(), 0, str ); + heap_free( str ); return res; oom: while (i > 0) strfreeU( res[--i] ); - HeapFree( GetProcessHeap(), 0, res ); - HeapFree( GetProcessHeap(), 0, str ); + heap_free( res ); + heap_free( str ); return NULL; } @@ -139,9 +153,7 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum } size += (i - 1) * strlen( sep ); - - res = HeapAlloc( GetProcessHeap(), 0, size + 1 ); - if (!res) return NULL; + if (!(res = heap_alloc( size + 1 ))) return NULL; p = res; for (v = hostnames; *v; v++) @@ -189,6 +201,8 @@ static char *urlify_hostnames( const char *scheme, char *hostnames, ULONG port ) } #endif +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); + #ifdef HAVE_LDAP static LDAP *create_context( const char *url ) { diff --git a/dll/win32/wldap32/main.c b/dll/win32/wldap32/main.c index ccd2a9b1815..ce9e60367b9 100644 --- a/dll/win32/wldap32/main.c +++ b/dll/win32/wldap32/main.c @@ -18,10 +18,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "winldap_private.h" +#include "config.h" + +#include "wine/debug.h" +#include + +#include "windef.h" +#include "winbase.h" HINSTANCE hwldap32; +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); + BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { TRACE( "(%p, %d, %p)\n", hinst, reason, reserved ); diff --git a/dll/win32/wldap32/misc.c b/dll/win32/wldap32/misc.c index fb998b76c0a..9c421f94707 100644 --- a/dll/win32/wldap32/misc.c +++ b/dll/win32/wldap32/misc.c @@ -18,9 +18,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "winldap_private.h" +#include "config.h" +#include "wine/port.h" +#include #include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + +#include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_abandon (WLDAP32.@) diff --git a/dll/win32/wldap32/modify.c b/dll/win32/wldap32/modify.c index 060ce59f61b..292fa831a84 100644 --- a/dll/win32/wldap32/modify.c +++ b/dll/win32/wldap32/modify.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); #ifdef HAVE_LDAP static LDAPMod *nullmods[] = { NULL }; diff --git a/dll/win32/wldap32/modrdn.c b/dll/win32/wldap32/modrdn.c index 5daebd22be5..3e2c8679566 100644 --- a/dll/win32/wldap32/modrdn.c +++ b/dll/win32/wldap32/modrdn.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_modrdnA (WLDAP32.@) diff --git a/dll/win32/wldap32/option.c b/dll/win32/wldap32/option.c index 65caa75f568..ddc5ca49339 100644 --- a/dll/win32/wldap32/option.c +++ b/dll/win32/wldap32/option.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_get_optionA (WLDAP32.@) diff --git a/dll/win32/wldap32/page.c b/dll/win32/wldap32/page.c index fe92f8f9388..7cf7d93245a 100644 --- a/dll/win32/wldap32/page.c +++ b/dll/win32/wldap32/page.c @@ -18,12 +18,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "winldap_private.h" +#include "config.h" +#include "wine/port.h" +#include +#ifdef HAVE_LDAP_H +#include +#endif #ifndef LDAP_MAXINT #define LDAP_MAXINT 2147483647 #endif +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + +#include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); + /*********************************************************************** * ldap_create_page_controlA (WLDAP32.@) * @@ -84,17 +99,15 @@ static ULONG create_page_control( ULONG pagesize, struct WLDAP32_berval *cookie, return WLDAP32_LDAP_NO_MEMORY; /* copy the berval so it can be properly freed by the caller */ - val = HeapAlloc( GetProcessHeap(), 0, berval->bv_len ); - if (!val) return WLDAP32_LDAP_NO_MEMORY; + if (!(val = heap_alloc( berval->bv_len ))) return WLDAP32_LDAP_NO_MEMORY; len = berval->bv_len; memcpy( val, berval->bv_val, len ); ber_bvfree( berval ); - ctrl = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) ); - if (!ctrl) + if (!(ctrl = heap_alloc( sizeof(LDAPControlW) ))) { - HeapFree( GetProcessHeap(), 0, val ); + heap_free( val ); return WLDAP32_LDAP_NO_MEMORY; } diff --git a/dll/win32/wldap32/parse.c b/dll/win32/wldap32/parse.c index 4594b2a04e3..62ffdbab0da 100644 --- a/dll/win32/wldap32/parse.c +++ b/dll/win32/wldap32/parse.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_parse_extended_resultA (WLDAP32.@) diff --git a/dll/win32/wldap32/precomp.h b/dll/win32/wldap32/precomp.h new file mode 100644 index 00000000000..5729a396f03 --- /dev/null +++ b/dll/win32/wldap32/precomp.h @@ -0,0 +1,25 @@ + +#ifndef _WINLDAP_PRECOMP_H_ +#define _WINLDAP_PRECOMP_H_ + +#include + +#include + +#ifdef HAVE_LDAP_H +#include +#endif + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include +#include + +#include + +#include "winldap_private.h" +#include "wldap32.h" + +#endif /* !_WINLDAP_PRECOMP_H_ */ diff --git a/dll/win32/wldap32/rename.c b/dll/win32/wldap32/rename.c index cb253736648..2de50818b74 100644 --- a/dll/win32/wldap32/rename.c +++ b/dll/win32/wldap32/rename.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_rename_extA (WLDAP32.@) diff --git a/dll/win32/wldap32/search.c b/dll/win32/wldap32/search.c index 7680ac7b3c7..7e774f68948 100644 --- a/dll/win32/wldap32/search.c +++ b/dll/win32/wldap32/search.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_searchA (WLDAP32.@) diff --git a/dll/win32/wldap32/value.c b/dll/win32/wldap32/value.c index 0a8a23e6331..bcfa9a2f6b8 100644 --- a/dll/win32/wldap32/value.c +++ b/dll/win32/wldap32/value.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include +#ifdef HAVE_LDAP_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + #include "winldap_private.h" +#include "wldap32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wldap32); /*********************************************************************** * ldap_count_values_len (WLDAP32.@) @@ -140,8 +156,7 @@ static char *bv2str( struct berval *bv ) char *str = NULL; unsigned int len = bv->bv_len; - str = HeapAlloc( GetProcessHeap(), 0, len + 1 ); - if (str) + if ((str = heap_alloc( len + 1 ))) { memcpy( str, bv->bv_val, len ); str[len] = '\0'; @@ -160,8 +175,7 @@ static char **bv2str_array( struct berval **bv ) len++; p++; } - str = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(char *) ); - if (!str) return NULL; + if (!(str = heap_alloc( (len + 1) * sizeof(char *) ))) return NULL; p = bv; while (*p) @@ -169,8 +183,8 @@ static char **bv2str_array( struct berval **bv ) str[i] = bv2str( *p ); if (!str[i]) { - while (i > 0) HeapFree( GetProcessHeap(), 0, str[--i] ); - HeapFree( GetProcessHeap(), 0, str ); + while (i > 0) heap_free( str[--i] ); + heap_free( str ); return NULL; } i++; diff --git a/dll/win32/wldap32/winldap_private.h b/dll/win32/wldap32/winldap_private.h index 2da56116534..c0039eb0fdf 100644 --- a/dll/win32/wldap32/winldap_private.h +++ b/dll/win32/wldap32/winldap_private.h @@ -22,29 +22,7 @@ * native headers. */ -#ifndef _WINLDAP_PRIVATE_H_ -#define _WINLDAP_PRIVATE_H_ - -#include - -#include - -#ifdef HAVE_LDAP_H -#include -#endif - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include -#include -#include - -#include -WINE_DEFAULT_DEBUG_CHANNEL(wldap32); - -#include "wldap32.h" +#pragma once typedef enum { WLDAP32_LDAP_SUCCESS = 0x00, @@ -480,5 +458,3 @@ ULONG CDECL LdapGetLastError(void); ULONG CDECL LdapMapErrorToWin32(ULONG); int CDECL LdapUnicodeToUTF8(LPCWSTR,int,LPSTR,int); int CDECL LdapUTF8ToUnicode(LPCSTR,int,LPWSTR,int); - -#endif /* _WINLDAP_PRIVATE_H_ */ diff --git a/dll/win32/wldap32/wldap32.h b/dll/win32/wldap32/wldap32.h index 5a58fe8583b..4b80b83ecec 100644 --- a/dll/win32/wldap32/wldap32.h +++ b/dll/win32/wldap32/wldap32.h @@ -20,7 +20,8 @@ #pragma once -#include +#include "wine/heap.h" +#include "wine/unicode.h" extern HINSTANCE hwldap32 DECLSPEC_HIDDEN; @@ -33,22 +34,16 @@ ULONG map_error( int ) DECLSPEC_HIDDEN; static inline char *strdupU( const char *src ) { char *dst; - if (!src) return NULL; - dst = HeapAlloc( GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) ); - if (dst) - strcpy( dst, src ); + if ((dst = heap_alloc( (strlen( src ) + 1) * sizeof(char) ))) strcpy( dst, src ); return dst; } static inline WCHAR *strdupW( const WCHAR *src ) { WCHAR *dst; - if (!src) return NULL; - dst = HeapAlloc( GetProcessHeap(), 0, (strlenW( src ) + 1) * sizeof(WCHAR) ); - if (dst) - strcpyW( dst, src ); + if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src ); return dst; } @@ -58,7 +53,7 @@ static inline LPWSTR strAtoW( LPCSTR str ) if (str) { DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + if ((ret = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); } return ret; @@ -70,7 +65,7 @@ static inline LPSTR strWtoA( LPCWSTR str ) if (str) { DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL ); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) + if ((ret = heap_alloc( len ))) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); } return ret; @@ -82,7 +77,7 @@ static inline char *strWtoU( LPCWSTR str ) if (str) { DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL ); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) + if ((ret = heap_alloc( len ))) WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL ); } return ret; @@ -94,7 +89,7 @@ static inline LPWSTR strUtoW( char *str ) if (str) { DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 ); - if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + if ((ret = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len ); } return ret; @@ -102,17 +97,17 @@ static inline LPWSTR strUtoW( char *str ) static inline void strfreeA( LPSTR str ) { - HeapFree( GetProcessHeap(), 0, str ); + heap_free( str ); } static inline void strfreeW( LPWSTR str ) { - HeapFree( GetProcessHeap(), 0, str ); + heap_free( str ); } static inline void strfreeU( char *str ) { - HeapFree( GetProcessHeap(), 0, str ); + heap_free( str ); } static inline DWORD strarraylenA( LPSTR *strarray ) @@ -144,9 +139,7 @@ static inline LPWSTR *strarrayAtoW( LPSTR *strarray ) if (strarray) { size = sizeof(WCHAR*) * (strarraylenA( strarray ) + 1); - strarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (strarrayW) + if ((strarrayW = heap_alloc( size ))) { LPSTR *p = strarray; LPWSTR *q = strarrayW; @@ -166,9 +159,7 @@ static inline LPSTR *strarrayWtoA( LPWSTR *strarray ) if (strarray) { size = sizeof(LPSTR) * (strarraylenW( strarray ) + 1); - strarrayA = HeapAlloc( GetProcessHeap(), 0, size ); - - if (strarrayA) + if ((strarrayA = heap_alloc( size ))) { LPWSTR *p = strarray; LPSTR *q = strarrayA; @@ -188,9 +179,7 @@ static inline char **strarrayWtoU( LPWSTR *strarray ) if (strarray) { size = sizeof(char*) * (strarraylenW( strarray ) + 1); - strarrayU = HeapAlloc( GetProcessHeap(), 0, size ); - - if (strarrayU) + if ((strarrayU = heap_alloc( size ))) { LPWSTR *p = strarray; char **q = strarrayU; @@ -210,9 +199,7 @@ static inline LPWSTR *strarrayUtoW( char **strarray ) if (strarray) { size = sizeof(WCHAR*) * (strarraylenU( strarray ) + 1); - strarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (strarrayW) + if ((strarrayW = heap_alloc( size ))) { char **p = strarray; LPWSTR *q = strarrayW; @@ -230,7 +217,7 @@ static inline void strarrayfreeA( LPSTR *strarray ) { LPSTR *p = strarray; while (*p) strfreeA( *p++ ); - HeapFree( GetProcessHeap(), 0, strarray ); + heap_free( strarray ); } } @@ -240,7 +227,7 @@ static inline void strarrayfreeW( LPWSTR *strarray ) { LPWSTR *p = strarray; while (*p) strfreeW( *p++ ); - HeapFree( GetProcessHeap(), 0, strarray ); + heap_free( strarray ); } } @@ -250,7 +237,7 @@ static inline void strarrayfreeU( char **strarray ) { char **p = strarray; while (*p) strfreeU( *p++ ); - HeapFree( GetProcessHeap(), 0, strarray ); + heap_free( strarray ); } } @@ -261,8 +248,7 @@ static inline struct berval *bvdup( struct berval *bv ) struct berval *berval; DWORD size = sizeof(struct berval) + bv->bv_len; - berval = HeapAlloc( GetProcessHeap(), 0, size ); - if (berval) + if ((berval = heap_alloc( size ))) { char *val = (char *)berval + sizeof(struct berval); @@ -288,9 +274,7 @@ static inline struct berval **bvarraydup( struct berval **bv ) if (bv) { size = sizeof(struct berval *) * (bvarraylen( bv ) + 1); - berval = HeapAlloc( GetProcessHeap(), 0, size ); - - if (berval) + if ((berval = heap_alloc( size ))) { struct berval **p = bv; struct berval **q = berval; @@ -305,16 +289,15 @@ static inline struct berval **bvarraydup( struct berval **bv ) static inline void bvarrayfree( struct berval **bv ) { struct berval **p = bv; - while (*p) HeapFree( GetProcessHeap(), 0, *p++ ); - HeapFree( GetProcessHeap(), 0, bv ); + while (*p) heap_free( *p++ ); + heap_free( bv ); } static inline LDAPModW *modAtoW( LDAPModA *mod ) { LDAPModW *modW; - modW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPModW) ); - if (modW) + if ((modW = heap_alloc( sizeof(LDAPModW) ))) { modW->mod_op = mod->mod_op; modW->mod_type = strAtoW( mod->mod_type ); @@ -331,8 +314,7 @@ static inline LDAPMod *modWtoU( LDAPModW *mod ) { LDAPMod *modU; - modU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPMod) ); - if (modU) + if ((modU = heap_alloc( sizeof(LDAPMod) ))) { modU->mod_op = mod->mod_op; modU->mod_type = strWtoU( mod->mod_type ); @@ -351,7 +333,7 @@ static inline void modfreeW( LDAPModW *mod ) bvarrayfree( mod->mod_vals.modv_bvals ); else strarrayfreeW( mod->mod_vals.modv_strvals ); - HeapFree( GetProcessHeap(), 0, mod ); + heap_free( mod ); } static inline void modfreeU( LDAPMod *mod ) @@ -360,7 +342,7 @@ static inline void modfreeU( LDAPMod *mod ) bvarrayfree( mod->mod_vals.modv_bvals ); else strarrayfreeU( mod->mod_vals.modv_strvals ); - HeapFree( GetProcessHeap(), 0, mod ); + heap_free( mod ); } static inline DWORD modarraylenA( LDAPModA **modarray ) @@ -385,9 +367,7 @@ static inline LDAPModW **modarrayAtoW( LDAPModA **modarray ) if (modarray) { size = sizeof(LDAPModW*) * (modarraylenA( modarray ) + 1); - modarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (modarrayW) + if ((modarrayW = heap_alloc( size ))) { LDAPModA **p = modarray; LDAPModW **q = modarrayW; @@ -407,9 +387,7 @@ static inline LDAPMod **modarrayWtoU( LDAPModW **modarray ) if (modarray) { size = sizeof(LDAPMod*) * (modarraylenW( modarray ) + 1); - modarrayU = HeapAlloc( GetProcessHeap(), 0, size ); - - if (modarrayU) + if ((modarrayU = heap_alloc( size ))) { LDAPModW **p = modarray; LDAPMod **q = modarrayU; @@ -427,7 +405,7 @@ static inline void modarrayfreeW( LDAPModW **modarray ) { LDAPModW **p = modarray; while (*p) modfreeW( *p++ ); - HeapFree( GetProcessHeap(), 0, modarray ); + heap_free( modarray ); } } @@ -437,7 +415,7 @@ static inline void modarrayfreeU( LDAPMod **modarray ) { LDAPMod **p = modarray; while (*p) modfreeU( *p++ ); - HeapFree( GetProcessHeap(), 0, modarray ); + heap_free( modarray ); } } @@ -449,15 +427,13 @@ static inline LDAPControlW *controlAtoW( LDAPControlA *control ) if (control->ldctl_value.bv_val) { - val = HeapAlloc( GetProcessHeap(), 0, len ); - if (!val) return NULL; + if (!(val = heap_alloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) ); - if (!controlW) + if (!(controlW = heap_alloc( sizeof(LDAPControlW) ))) { - HeapFree( GetProcessHeap(), 0, val ); + heap_free( val ); return NULL; } @@ -477,15 +453,13 @@ static inline LDAPControlA *controlWtoA( LDAPControlW *control ) if (control->ldctl_value.bv_val) { - val = HeapAlloc( GetProcessHeap(), 0, len ); - if (!val) return NULL; + if (!(val = heap_alloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - controlA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlA) ); - if (!controlA) + if (!(controlA = heap_alloc( sizeof(LDAPControlA) ))) { - HeapFree( GetProcessHeap(), 0, val ); + heap_free( val ); return NULL; } @@ -505,15 +479,13 @@ static inline LDAPControl *controlWtoU( LDAPControlW *control ) if (control->ldctl_value.bv_val) { - val = HeapAlloc( GetProcessHeap(), 0, len ); - if (!val) return NULL; + if (!(val = heap_alloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - controlU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControl) ); - if (!controlU) + if (!(controlU = heap_alloc( sizeof(LDAPControl) ))) { - HeapFree( GetProcessHeap(), 0, val ); + heap_free( val ); return NULL; } @@ -533,15 +505,13 @@ static inline LDAPControlW *controlUtoW( LDAPControl *control ) if (control->ldctl_value.bv_val) { - val = HeapAlloc( GetProcessHeap(), 0, len ); - if (!val) return NULL; + if (!(val = heap_alloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) ); - if (!controlW) + if (!(controlW = heap_alloc( sizeof(LDAPControlW) ))) { - HeapFree( GetProcessHeap(), 0, val ); + heap_free( val ); return NULL; } @@ -549,7 +519,7 @@ static inline LDAPControlW *controlUtoW( LDAPControl *control ) controlW->ldctl_value.bv_len = len; controlW->ldctl_value.bv_val = val; controlW->ldctl_iscritical = control->ldctl_iscritical; - + return controlW; } @@ -558,8 +528,8 @@ static inline void controlfreeA( LDAPControlA *control ) if (control) { strfreeA( control->ldctl_oid ); - HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - HeapFree( GetProcessHeap(), 0, control ); + heap_free( control->ldctl_value.bv_val ); + heap_free( control ); } } @@ -568,8 +538,8 @@ static inline void controlfreeW( LDAPControlW *control ) if (control) { strfreeW( control->ldctl_oid ); - HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - HeapFree( GetProcessHeap(), 0, control ); + heap_free( control->ldctl_value.bv_val ); + heap_free( control ); } } @@ -578,8 +548,8 @@ static inline void controlfreeU( LDAPControl *control ) if (control) { strfreeU( control->ldctl_oid ); - HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - HeapFree( GetProcessHeap(), 0, control ); + heap_free( control->ldctl_value.bv_val ); + heap_free( control ); } } @@ -612,9 +582,7 @@ static inline LDAPControlW **controlarrayAtoW( LDAPControlA **controlarray ) if (controlarray) { size = sizeof(LDAPControlW*) * (controlarraylenA( controlarray ) + 1); - controlarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (controlarrayW) + if ((controlarrayW = heap_alloc( size ))) { LDAPControlA **p = controlarray; LDAPControlW **q = controlarrayW; @@ -634,9 +602,7 @@ static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray ) if (controlarray) { size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1); - controlarrayA = HeapAlloc( GetProcessHeap(), 0, size ); - - if (controlarrayA) + if ((controlarrayA = heap_alloc( size ))) { LDAPControlW **p = controlarray; LDAPControlA **q = controlarrayA; @@ -656,9 +622,7 @@ static inline LDAPControl **controlarrayWtoU( LDAPControlW **controlarray ) if (controlarray) { size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1); - controlarrayU = HeapAlloc( GetProcessHeap(), 0, size ); - - if (controlarrayU) + if ((controlarrayU = heap_alloc( size ))) { LDAPControlW **p = controlarray; LDAPControl **q = controlarrayU; @@ -678,9 +642,7 @@ static inline LDAPControlW **controlarrayUtoW( LDAPControl **controlarray ) if (controlarray) { size = sizeof(LDAPControlW*) * (controlarraylenU( controlarray ) + 1); - controlarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (controlarrayW) + if ((controlarrayW = heap_alloc( size ))) { LDAPControl **p = controlarray; LDAPControlW **q = controlarrayW; @@ -698,7 +660,7 @@ static inline void controlarrayfreeA( LDAPControlA **controlarray ) { LDAPControlA **p = controlarray; while (*p) controlfreeA( *p++ ); - HeapFree( GetProcessHeap(), 0, controlarray ); + heap_free( controlarray ); } } @@ -708,7 +670,7 @@ static inline void controlarrayfreeW( LDAPControlW **controlarray ) { LDAPControlW **p = controlarray; while (*p) controlfreeW( *p++ ); - HeapFree( GetProcessHeap(), 0, controlarray ); + heap_free( controlarray ); } } @@ -718,7 +680,7 @@ static inline void controlarrayfreeU( LDAPControl **controlarray ) { LDAPControl **p = controlarray; while (*p) controlfreeU( *p++ ); - HeapFree( GetProcessHeap(), 0, controlarray ); + heap_free( controlarray ); } } @@ -726,8 +688,7 @@ static inline LDAPSortKeyW *sortkeyAtoW( LDAPSortKeyA *sortkey ) { LDAPSortKeyW *sortkeyW; - sortkeyW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyW) ); - if (sortkeyW) + if ((sortkeyW = heap_alloc( sizeof(LDAPSortKeyW) ))) { sortkeyW->sk_attrtype = strAtoW( sortkey->sk_attrtype ); sortkeyW->sk_matchruleoid = strAtoW( sortkey->sk_matchruleoid ); @@ -740,8 +701,7 @@ static inline LDAPSortKeyA *sortkeyWtoA( LDAPSortKeyW *sortkey ) { LDAPSortKeyA *sortkeyA; - sortkeyA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyA) ); - if (sortkeyA) + if ((sortkeyA = heap_alloc( sizeof(LDAPSortKeyA) ))) { sortkeyA->sk_attrtype = strWtoA( sortkey->sk_attrtype ); sortkeyA->sk_matchruleoid = strWtoA( sortkey->sk_matchruleoid ); @@ -754,8 +714,7 @@ static inline LDAPSortKey *sortkeyWtoU( LDAPSortKeyW *sortkey ) { LDAPSortKey *sortkeyU; - sortkeyU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKey) ); - if (sortkeyU) + if ((sortkeyU = heap_alloc( sizeof(LDAPSortKey) ))) { sortkeyU->attributeType = strWtoU( sortkey->sk_attrtype ); sortkeyU->orderingRule = strWtoU( sortkey->sk_matchruleoid ); @@ -770,7 +729,7 @@ static inline void sortkeyfreeA( LDAPSortKeyA *sortkey ) { strfreeA( sortkey->sk_attrtype ); strfreeA( sortkey->sk_matchruleoid ); - HeapFree( GetProcessHeap(), 0, sortkey ); + heap_free( sortkey ); } } @@ -780,7 +739,7 @@ static inline void sortkeyfreeW( LDAPSortKeyW *sortkey ) { strfreeW( sortkey->sk_attrtype ); strfreeW( sortkey->sk_matchruleoid ); - HeapFree( GetProcessHeap(), 0, sortkey ); + heap_free( sortkey ); } } @@ -790,7 +749,7 @@ static inline void sortkeyfreeU( LDAPSortKey *sortkey ) { strfreeU( sortkey->attributeType ); strfreeU( sortkey->orderingRule ); - HeapFree( GetProcessHeap(), 0, sortkey ); + heap_free( sortkey ); } } @@ -816,9 +775,7 @@ static inline LDAPSortKeyW **sortkeyarrayAtoW( LDAPSortKeyA **sortkeyarray ) if (sortkeyarray) { size = sizeof(LDAPSortKeyW*) * (sortkeyarraylenA( sortkeyarray ) + 1); - sortkeyarrayW = HeapAlloc( GetProcessHeap(), 0, size ); - - if (sortkeyarrayW) + if ((sortkeyarrayW = heap_alloc( size ))) { LDAPSortKeyA **p = sortkeyarray; LDAPSortKeyW **q = sortkeyarrayW; @@ -838,9 +795,7 @@ static inline LDAPSortKey **sortkeyarrayWtoU( LDAPSortKeyW **sortkeyarray ) if (sortkeyarray) { size = sizeof(LDAPSortKey*) * (sortkeyarraylenW( sortkeyarray ) + 1); - sortkeyarrayU = HeapAlloc( GetProcessHeap(), 0, size ); - - if (sortkeyarrayU) + if ((sortkeyarrayU = heap_alloc( size ))) { LDAPSortKeyW **p = sortkeyarray; LDAPSortKey **q = sortkeyarrayU; @@ -858,7 +813,7 @@ static inline void sortkeyarrayfreeW( LDAPSortKeyW **sortkeyarray ) { LDAPSortKeyW **p = sortkeyarray; while (*p) sortkeyfreeW( *p++ ); - HeapFree( GetProcessHeap(), 0, sortkeyarray ); + heap_free( sortkeyarray ); } } @@ -868,7 +823,7 @@ static inline void sortkeyarrayfreeU( LDAPSortKey **sortkeyarray ) { LDAPSortKey **p = sortkeyarray; while (*p) sortkeyfreeU( *p++ ); - HeapFree( GetProcessHeap(), 0, sortkeyarray ); + heap_free( sortkeyarray ); } } #endif /* HAVE_LDAP */ diff --git a/dll/win32/wldap32/wldap32.rc b/dll/win32/wldap32/wldap32.rc index a9c00c02771..1af4e8218b1 100644 --- a/dll/win32/wldap32/wldap32.rc +++ b/dll/win32/wldap32/wldap32.rc @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "windef.h" /* UTF-8 */ #pragma code_page(65001) diff --git a/media/doc/README.WINE b/media/doc/README.WINE index b66f8a0f2b3..81a0f38d332 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -207,7 +207,7 @@ reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 reactos/dll/win32/winscard # Synced to WineStaging-3.3 reactos/dll/win32/wintrust # Synced to WineStaging-3.3 -reactos/dll/win32/wldap32 # Synced to Wine-3.0 +reactos/dll/win32/wldap32 # Synced to WineStaging-3.3 reactos/dll/win32/wmi # Synced to WineStaging-2.9 reactos/dll/win32/wmiutils # Synced to WineStaging-2.9 reactos/dll/win32/wmvcore # Synced to Wine-3.0