Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2021
- 70 participants
- 697 discussions
[PATCH 4/5] wldap32: Move support for option functions to the Unix library.
by Hans Leidekker 16 Apr '21
by Hans Leidekker 16 Apr '21
16 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/libldap.c | 20 ++++
dlls/wldap32/libldap.h | 23 +++++
dlls/wldap32/option.c | 170 ++++++++++++---------------------
dlls/wldap32/winldap_private.h | 7 ++
4 files changed, 112 insertions(+), 108 deletions(-)
diff --git a/dlls/wldap32/libldap.c b/dlls/wldap32/libldap.c
index e9353e2e3f4..662edb4d365 100644
--- a/dlls/wldap32/libldap.c
+++ b/dlls/wldap32/libldap.c
@@ -50,6 +50,8 @@ C_ASSERT( sizeof(LDAPModU) == sizeof(LDAPMod) );
C_ASSERT( sizeof(LDAPControlU) == sizeof(LDAPControl) );
C_ASSERT( sizeof(LDAPSortKeyU) == sizeof(LDAPSortKey) );
C_ASSERT( sizeof(LDAPVLVInfoU) == sizeof(LDAPVLVInfo) );
+C_ASSERT( sizeof(LDAPAPIInfoU) == sizeof(LDAPAPIInfo) );
+C_ASSERT( sizeof(LDAPAPIFeatureInfoU) == sizeof(LDAPAPIFeatureInfo) );
C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
static LDAPMod *nullmods[] = { NULL };
@@ -346,6 +348,11 @@ int CDECL wrap_ldap_count_references( void *ld, void *chain )
return ldap_count_references( ld, chain );
}
+int CDECL wrap_ldap_count_values_len( struct bervalU **values )
+{
+ return ldap_count_values_len( (struct berval **)values );
+}
+
int CDECL wrap_ldap_create_sort_control( void *ld, LDAPSortKeyU **keylist, int critical, LDAPControlU **control )
{
return ldap_create_sort_control( ld, (LDAPSortKey **)keylist, critical, (LDAPControl **)control );
@@ -414,6 +421,16 @@ void * CDECL wrap_ldap_first_reference( void *ld, void *chain )
return ldap_first_reference( ld, chain );
}
+int CDECL wrap_ldap_get_option( void *ld, int option, void *value )
+{
+ return ldap_get_option( ld, option, value );
+}
+
+struct bervalU ** CDECL wrap_ldap_get_values_len( void *ld, void *entry, const char *attr )
+{
+ return (struct bervalU **)ldap_get_values_len( ld, entry, attr );
+}
+
int CDECL wrap_ldap_initialize( void **ld, const char *url )
{
return ldap_initialize( (LDAP **)ld, url );
@@ -583,6 +600,7 @@ static const struct ldap_funcs funcs =
wrap_ldap_control_free,
wrap_ldap_count_entries,
wrap_ldap_count_references,
+ wrap_ldap_count_values_len,
wrap_ldap_create_sort_control,
wrap_ldap_create_vlv_control,
wrap_ldap_delete_ext,
@@ -592,6 +610,8 @@ static const struct ldap_funcs funcs =
wrap_ldap_extended_operation,
wrap_ldap_extended_operation_s,
wrap_ldap_get_dn,
+ wrap_ldap_get_option,
+ wrap_ldap_get_values_len,
wrap_ldap_initialize,
wrap_ldap_first_attribute,
wrap_ldap_first_entry,
diff --git a/dlls/wldap32/libldap.h b/dlls/wldap32/libldap.h
index 1b0a2be4ba1..8745eac3abc 100644
--- a/dlls/wldap32/libldap.h
+++ b/dlls/wldap32/libldap.h
@@ -60,6 +60,23 @@ typedef struct
void *ldvlv_extradata;
} LDAPVLVInfoU;
+typedef struct
+{
+ int ldapai_info_version;
+ int ldapai_api_version;
+ int ldapai_protocol_version;
+ char **ldapai_extensions;
+ char *ldapai_vendor_name;
+ int ldapai_vendor_version;
+} LDAPAPIInfoU;
+
+typedef struct
+{
+ int ldapaif_info_version;
+ char *ldapaif_name;
+ int ldapaif_version;
+} LDAPAPIFeatureInfoU;
+
typedef struct timevalU
{
unsigned long tv_sec;
@@ -108,6 +125,7 @@ extern int CDECL wrap_ldap_compare_ext_s(void *, const char *, const char *, str
extern void CDECL wrap_ldap_control_free(LDAPControlU *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_count_entries(void *, void *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_count_references(void *, void *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_count_values_len(struct bervalU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_create_sort_control(void *, LDAPSortKeyU **, int, LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_create_vlv_control(void *, LDAPVLVInfoU *, LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_delete_ext(void *, const char *, LDAPControlU **, LDAPControlU **, ULONG *) DECLSPEC_HIDDEN;
@@ -119,6 +137,8 @@ extern int CDECL wrap_ldap_extended_operation(void *, const char *, struct berva
extern int CDECL wrap_ldap_extended_operation_s(void *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **, char **, struct bervalU **) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_get_dn(void *, void *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_get_option(void *, int, void *) DECLSPEC_HIDDEN;
+extern struct bervalU ** CDECL wrap_ldap_get_values_len(void *, void *, const char *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_initialize(void **, const char *) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_first_attribute(void *, void *, void **) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_first_entry(void *, void *) DECLSPEC_HIDDEN;
@@ -181,6 +201,7 @@ struct ldap_funcs
void (CDECL *ldap_control_free)(LDAPControlU *);
int (CDECL *ldap_count_entries)(void *, void *);
int (CDECL *ldap_count_references)(void *, void *);
+ int (CDECL *ldap_count_values_len)(struct bervalU **);
int (CDECL *ldap_create_sort_control)(void *, LDAPSortKeyU **, int, LDAPControlU **);
int (CDECL *ldap_create_vlv_control)(void *, LDAPVLVInfoU *, LDAPControlU **);
int (CDECL *ldap_delete_ext)(void *, const char *, LDAPControlU **, LDAPControlU **, ULONG *);
@@ -192,6 +213,8 @@ struct ldap_funcs
int (CDECL *ldap_extended_operation_s)(void *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **, char **, struct bervalU **);
char * (CDECL *ldap_get_dn)(void *, void *);
+ int (CDECL *ldap_get_option)(void *, int, void *);
+ struct bervalU ** (CDECL *ldap_get_values_len)(void *, void *, const char *);
int (CDECL *ldap_initialize)(void **, const char *);
char * (CDECL *ldap_first_attribute)(void *, void *, void **);
void * (CDECL *ldap_first_entry)(void *, void *);
diff --git a/dlls/wldap32/option.c b/dlls/wldap32/option.c
index 8398dff67e4..49eac7d2e94 100644
--- a/dlls/wldap32/option.c
+++ b/dlls/wldap32/option.c
@@ -18,25 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "winldap_private.h"
-#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#endif
/***********************************************************************
* ldap_get_optionA (WLDAP32.@)
@@ -45,8 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
*/
ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
@@ -62,14 +51,12 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
if (!featureA->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
featureW.ldapaif_info_version = featureA->ldapaif_info_version;
- featureW.ldapaif_name = strAtoW( featureA->ldapaif_name );
+ if (!(featureW.ldapaif_name = strAtoW( featureA->ldapaif_name ))) return WLDAP32_LDAP_NO_MEMORY;
featureW.ldapaif_version = 0;
- if (!featureW.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
-
ret = ldap_get_optionW( ld, option, &featureW );
- featureA->ldapaif_version = featureW.ldapaif_version;
+ if (ret == WLDAP32_LDAP_SUCCESS) featureA->ldapaif_version = featureW.ldapaif_version;
strfreeW( featureW.ldapaif_name );
return ret;
}
@@ -78,32 +65,27 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
LDAPAPIInfoW infoW;
LDAPAPIInfoA *infoA = value;
- memset( &infoW, 0, sizeof(LDAPAPIInfoW) );
+ memset( &infoW, 0, sizeof(infoW) );
infoW.ldapai_info_version = infoA->ldapai_info_version;
ret = ldap_get_optionW( ld, option, &infoW );
-
- infoA->ldapai_api_version = infoW.ldapai_api_version;
- infoA->ldapai_protocol_version = infoW.ldapai_protocol_version;
-
- if (infoW.ldapai_extensions)
- {
- infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions );
- if (!infoA->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
- }
- if (infoW.ldapai_vendor_name)
+ if (ret == WLDAP32_LDAP_SUCCESS)
{
- infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name );
- if (!infoA->ldapai_vendor_name)
+ infoA->ldapai_api_version = infoW.ldapai_api_version;
+ infoA->ldapai_protocol_version = infoW.ldapai_protocol_version;
+
+ if (infoW.ldapai_extensions && !(infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions )))
+ return WLDAP32_LDAP_NO_MEMORY;
+ if (infoW.ldapai_vendor_name && !(infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name )))
{
ldap_value_freeW( infoW.ldapai_extensions );
return WLDAP32_LDAP_NO_MEMORY;
}
- }
- infoA->ldapai_vendor_version = infoW.ldapai_vendor_version;
+ infoA->ldapai_vendor_version = infoW.ldapai_vendor_version;
- ldap_value_freeW( infoW.ldapai_extensions );
- ldap_memfreeW( infoW.ldapai_vendor_name );
+ ldap_value_freeW( infoW.ldapai_extensions );
+ ldap_memfreeW( infoW.ldapai_vendor_name );
+ }
return ret;
}
@@ -124,7 +106,7 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REBIND_FN:
case WLDAP32_LDAP_OPT_RESTART:
case WLDAP32_LDAP_OPT_THREAD_FN_PTRS:
- return LDAP_LOCAL_ERROR;
+ return WLDAP32_LDAP_LOCAL_ERROR;
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
@@ -163,9 +145,6 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
FIXME( "Unknown option: 0x%02x\n", option );
return WLDAP32_LDAP_LOCAL_ERROR;
}
-
-#endif
- return ret;
}
/***********************************************************************
@@ -184,8 +163,7 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
*/
ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
@@ -195,54 +173,47 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
case WLDAP32_LDAP_OPT_API_FEATURE_INFO:
{
- LDAPAPIFeatureInfo featureU;
+ LDAPAPIFeatureInfoU featureU;
LDAPAPIFeatureInfoW *featureW = value;
if (!featureW->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
featureU.ldapaif_info_version = featureW->ldapaif_info_version;
- featureU.ldapaif_name = strWtoU( featureW->ldapaif_name );
+ if (!(featureU.ldapaif_name = strWtoU( featureW->ldapaif_name ))) return WLDAP32_LDAP_NO_MEMORY;
featureU.ldapaif_version = 0;
- if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
-
- ret = map_error( ldap_get_option( ld->ld, option, &featureU ));
+ ret = map_error( ldap_funcs->ldap_get_option( ld->ld, option, &featureU ) );
- featureW->ldapaif_version = featureU.ldapaif_version;
+ if (ret == WLDAP32_LDAP_SUCCESS) featureW->ldapaif_version = featureU.ldapaif_version;
strfreeU( featureU.ldapaif_name );
return ret;
}
case WLDAP32_LDAP_OPT_API_INFO:
{
- LDAPAPIInfo infoU;
+ LDAPAPIInfoU infoU;
LDAPAPIInfoW *infoW = value;
- memset( &infoU, 0, sizeof(LDAPAPIInfo) );
+ memset( &infoU, 0, sizeof(infoU) );
infoU.ldapai_info_version = infoW->ldapai_info_version;
- ret = map_error( ldap_get_option( ld->ld, option, &infoU ));
-
- infoW->ldapai_api_version = infoU.ldapai_api_version;
- infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
-
- if (infoU.ldapai_extensions)
- {
- infoW->ldapai_extensions = strarrayUtoW( infoU.ldapai_extensions );
- if (!infoW->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
- }
- if (infoU.ldapai_vendor_name)
+ ret = map_error( ldap_funcs->ldap_get_option( ld->ld, option, &infoU ) );
+ if (ret == WLDAP32_LDAP_SUCCESS)
{
- infoW->ldapai_vendor_name = strUtoW( infoU.ldapai_vendor_name );
- if (!infoW->ldapai_vendor_name)
+ infoW->ldapai_api_version = infoU.ldapai_api_version;
+ infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
+
+ if (infoU.ldapai_extensions && !(infoW->ldapai_extensions = strarrayUtoW( infoU.ldapai_extensions )))
+ return WLDAP32_LDAP_NO_MEMORY;
+ if (infoU.ldapai_vendor_name && !(infoW->ldapai_vendor_name = strUtoW( infoU.ldapai_vendor_name )))
{
- ldap_memvfree( (void **)infoU.ldapai_extensions );
+ ldap_funcs->ldap_memvfree( (void **)infoU.ldapai_extensions );
return WLDAP32_LDAP_NO_MEMORY;
}
- }
- infoW->ldapai_vendor_version = infoU.ldapai_vendor_version;
+ infoW->ldapai_vendor_version = infoU.ldapai_vendor_version;
- ldap_memvfree( (void **)infoU.ldapai_extensions );
- ldap_memfree( infoU.ldapai_vendor_name );
+ ldap_funcs->ldap_memvfree( (void **)infoU.ldapai_extensions );
+ ldap_funcs->ldap_memfree( infoU.ldapai_vendor_name );
+ }
return ret;
}
@@ -253,7 +224,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
- return map_error( ldap_get_option( ld->ld, option, value ));
+ return map_error( ldap_funcs->ldap_get_option( ld->ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
@@ -302,9 +273,6 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
FIXME( "Unknown option: 0x%02x\n", option );
return WLDAP32_LDAP_LOCAL_ERROR;
}
-
-#endif
- return ret;
}
/***********************************************************************
@@ -314,8 +282,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
*/
ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
@@ -326,10 +293,7 @@ ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
{
LDAPControlW **ctrlsW;
-
- ctrlsW = controlarrayAtoW( value );
- if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY;
-
+ if (!(ctrlsW = controlarrayAtoW( value ))) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_set_optionW( ld, option, ctrlsW );
controlarrayfreeW( ctrlsW );
return ret;
@@ -393,41 +357,37 @@ ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
FIXME( "Unknown option: 0x%02x\n", option );
return WLDAP32_LDAP_LOCAL_ERROR;
}
-
-#endif
- return ret;
}
-#ifdef HAVE_LDAP
-
static BOOL query_supported_server_ctrls( WLDAP32_LDAP *ld )
{
char *attrs[] = { (char *)"supportedControl", NULL };
- LDAPMessage *res, *entry;
+ void *res, *entry;
+ ULONG ret;
- if ( ld->ld_server_ctrls ) return TRUE;
+ if (ld->ld_server_ctrls) return TRUE;
- if (ldap_search_ext_s( ld->ld, (char *)"", LDAP_SCOPE_BASE, (char *)"(objectClass=*)", attrs, FALSE,
- NULL, NULL, NULL, 0, &res ) != LDAP_SUCCESS)
- return FALSE;
+ ret = map_error( ldap_funcs->ldap_search_ext_s( ld->ld, (char *)"", WLDAP32_LDAP_SCOPE_BASE,
+ (char *)"(objectClass=*)", attrs, FALSE, NULL, NULL, NULL, 0, &res ) );
+ if (ret != WLDAP32_LDAP_SUCCESS) return FALSE;
- entry = ldap_first_entry( ld->ld, res );
+ entry = ldap_funcs->ldap_first_entry( ld->ld, res );
if (entry)
{
ULONG count, i;
- ld->ld_server_ctrls = (struct bervalU **)ldap_get_values_len( ld->ld, entry, attrs[0] );
- count = ldap_count_values_len( (struct berval **)ld->ld_server_ctrls );
+ ld->ld_server_ctrls = ldap_funcs->ldap_get_values_len( ld->ld, entry, attrs[0] );
+ count = ldap_funcs->ldap_count_values_len( ld->ld_server_ctrls );
for (i = 0; i < count; i++)
TRACE("%u: %s\n", i, debugstr_an( ld->ld_server_ctrls[i]->bv_val, ld->ld_server_ctrls[i]->bv_len ));
}
- ldap_msgfree( res );
+ ldap_funcs->ldap_msgfree( res );
return ld->ld_server_ctrls != NULL;
}
-static BOOL is_supported_server_ctrls( WLDAP32_LDAP *ld, LDAPControl **ctrls )
+static BOOL is_supported_server_ctrls( WLDAP32_LDAP *ld, LDAPControlU **ctrls )
{
ULONG user_count, server_count, i, n, supported = 0;
@@ -435,7 +395,7 @@ static BOOL is_supported_server_ctrls( WLDAP32_LDAP *ld, LDAPControl **ctrls )
return TRUE; /* can't verify, let the server handle it on next query */
user_count = controlarraylenU( ctrls );
- server_count = ldap_count_values_len( (struct berval **)ld->ld_server_ctrls );
+ server_count = ldap_funcs->ldap_count_values_len( ld->ld_server_ctrls );
for (n = 0; n < user_count; n++)
{
@@ -453,7 +413,6 @@ static BOOL is_supported_server_ctrls( WLDAP32_LDAP *ld, LDAPControl **ctrls )
return supported == user_count;
}
-#endif
/***********************************************************************
* ldap_set_optionW (WLDAP32.@)
@@ -471,11 +430,10 @@ static BOOL is_supported_server_ctrls( WLDAP32_LDAP *ld, LDAPControl **ctrls )
*
* NOTES
* Set value to LDAP_OPT_ON or LDAP_OPT_OFF for on/off options.
- */
+ */
ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
@@ -485,26 +443,25 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
{
- LDAPControl **ctrlsU;
+ LDAPControlU **ctrlsU;
- ctrlsU = controlarrayWtoU( value );
- if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY;
+ if (!(ctrlsU = controlarrayWtoU( value ))) return WLDAP32_LDAP_NO_MEMORY;
if (!is_supported_server_ctrls( ld, ctrlsU ))
ret = WLDAP32_LDAP_PARAM_ERROR;
else
- ret = map_error( ldap_set_option( ld->ld, option, ctrlsU ));
+ ret = map_error( ldap_funcs->ldap_set_option( ld->ld, option, ctrlsU ) );
controlarrayfreeU( ctrlsU );
return ret;
}
case WLDAP32_LDAP_OPT_REFERRALS:
{
- void *openldap_referral = LDAP_OPT_ON;
- if (value == LDAP_OPT_OFF)
- openldap_referral = LDAP_OPT_OFF;
+ void *openldap_referral = WLDAP32_LDAP_OPT_ON;
+ if (value == WLDAP32_LDAP_OPT_OFF)
+ openldap_referral = WLDAP32_LDAP_OPT_OFF;
else
FIXME("upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)\n", value);
- return map_error( ldap_set_option( ld->ld, option, openldap_referral ));
+ return map_error( ldap_funcs->ldap_set_option( ld->ld, option, openldap_referral ) );
break;
}
case WLDAP32_LDAP_OPT_DEREF:
@@ -513,7 +470,7 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
case WLDAP32_LDAP_OPT_PROTOCOL_VERSION:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
- return map_error( ldap_set_option( ld->ld, option, value ));
+ return map_error( ldap_funcs->ldap_set_option( ld->ld, option, value ));
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
@@ -565,7 +522,4 @@ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
FIXME( "Unknown option: 0x%02x\n", option );
return WLDAP32_LDAP_LOCAL_ERROR;
}
-
-#endif
- return ret;
}
diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index 7ac7e5a3f41..32ed3f5a266 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -33,6 +33,13 @@
#define WLDAP32_LDAP_VERSION2 2
#define WLDAP32_LDAP_VERSION3 3
+#define WLDAP32_LDAP_OPT_ON ((void *)1)
+#define WLDAP32_LDAP_OPT_OFF ((void *)0)
+
+#define WLDAP32_LDAP_SCOPE_BASE 0x00
+#define WLDAP32_LDAP_SCOPE_ONELEVEL 0x01
+#define WLDAP32_LDAP_SCOPE_SUBTREE 0x02
+
typedef enum {
WLDAP32_LDAP_SUCCESS = 0x00,
WLDAP32_LDAP_UNWILLING_TO_PERFORM = 0x35,
--
2.30.2
1
0
[PATCH 3/5] wldap32: Move support for modrdn functions to the Unix library.
by Hans Leidekker 16 Apr '21
by Hans Leidekker 16 Apr '21
16 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/libldap.c | 16 ++++
dlls/wldap32/libldap.h | 7 ++
dlls/wldap32/modrdn.c | 199 ++++++++---------------------------------
3 files changed, 60 insertions(+), 162 deletions(-)
diff --git a/dlls/wldap32/libldap.c b/dlls/wldap32/libldap.c
index 333ecc741c2..e9353e2e3f4 100644
--- a/dlls/wldap32/libldap.c
+++ b/dlls/wldap32/libldap.c
@@ -470,6 +470,20 @@ int CDECL wrap_ldap_parse_result( void *ld, void *res, int *errcode, char **matc
return ldap_parse_result( ld, res, errcode, matcheddn, errmsg, referrals, (LDAPControl ***)serverctrls, free );
}
+int CDECL wrap_ldap_rename( void *ld, const char *dn, const char *newrdn, const char *newparent, int delete,
+ LDAPControlU **clientctrls, LDAPControlU **serverctrls, ULONG *msg )
+{
+ return ldap_rename( ld, dn ? dn : "", newrdn, newparent, delete, (LDAPControl **)clientctrls,
+ (LDAPControl **)serverctrls, (int *)msg );
+}
+
+int CDECL wrap_ldap_rename_s( void *ld, const char *dn, const char *newrdn, const char *newparent, int delete,
+ LDAPControlU **clientctrls, LDAPControlU **serverctrls )
+{
+ return ldap_rename_s( ld, dn ? dn : "", newrdn, newparent, delete, (LDAPControl **)clientctrls,
+ (LDAPControl **)serverctrls );
+}
+
int CDECL wrap_ldap_result( void *ld, int msgid, int all, struct timevalU *timeout, void **result )
{
return ldap_result( ld, msgid, all, (struct timeval *)timeout, (LDAPMessage **)result );
@@ -591,6 +605,8 @@ static const struct ldap_funcs funcs =
wrap_ldap_next_entry,
wrap_ldap_next_reference,
wrap_ldap_parse_result,
+ wrap_ldap_rename,
+ wrap_ldap_rename_s,
wrap_ldap_result,
wrap_ldap_sasl_bind,
wrap_ldap_sasl_bind_s,
diff --git a/dlls/wldap32/libldap.h b/dlls/wldap32/libldap.h
index b99855e9d34..1b0a2be4ba1 100644
--- a/dlls/wldap32/libldap.h
+++ b/dlls/wldap32/libldap.h
@@ -135,6 +135,10 @@ extern void * CDECL wrap_ldap_next_entry(void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_next_reference(void *, void *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_parse_result(void *, void *, int *, char **, char **, char ***, LDAPControlU ***,
int) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_rename(void *, const char *, const char *, const char *, int, LDAPControlU **,
+ LDAPControlU **, ULONG *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_rename_s(void *, const char *, const char *, const char *, int, LDAPControlU **,
+ LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_result(void *, int, int, struct timevalU *, void **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_sasl_bind(void *, const char *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **, int *) DECLSPEC_HIDDEN;
@@ -201,6 +205,9 @@ struct ldap_funcs
void * (CDECL *ldap_next_entry)(void *, void *);
void * (CDECL *ldap_next_reference)(void *, void *);
int (CDECL *ldap_parse_result)(void *, void *, int *, char **, char **, char ***, LDAPControlU ***, int);
+ int (CDECL *ldap_rename)(void *, const char *, const char *, const char *, int, LDAPControlU **, LDAPControlU **,
+ ULONG *);
+ int (CDECL *ldap_rename_s)(void *, const char *, const char *, const char *, int, LDAPControlU **, LDAPControlU **);
int (CDECL *ldap_result)(void *, int, int, struct timevalU *, void **);
int (CDECL *ldap_sasl_bind)(void *, const char *, const char *, struct bervalU *, LDAPControlU **, LDAPControlU **,
int *);
diff --git a/dlls/wldap32/modrdn.c b/dlls/wldap32/modrdn.c
index c9e232140ca..c297c7e90b6 100644
--- a/dlls/wldap32/modrdn.c
+++ b/dlls/wldap32/modrdn.c
@@ -18,58 +18,38 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "winldap_private.h"
-#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#endif
/***********************************************************************
* ldap_modrdnA (WLDAP32.@)
*
* See ldap_modrdnW.
*/
-ULONG CDECL ldap_modrdnA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
+ULONG CDECL ldap_modrdnA( WLDAP32_LDAP *ld, char *dn, char *newdn )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newdnW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) );
if (!ld || !newdn) return ~0u;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
-
- newdnW = strAtoW( newdn );
- if (!newdnW) goto exit;
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (!(newdnW = strAtoW( newdn ))) goto exit;
ret = ldap_modrdnW( ld, dnW, newdnW );
exit:
strfreeW( dnW );
strfreeW( newdnW );
-
-#endif
return ret;
}
@@ -81,7 +61,7 @@ exit:
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
- * newdn [I] New DN for the entry.
+ * newdn [I] New DN for the entry.
*
* RETURNS
* Success: Message ID of the modrdn operation.
@@ -92,40 +72,10 @@ exit:
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
-ULONG CDECL ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
+ULONG CDECL ldap_modrdnW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- char *dnU = NULL, *newdnU = NULL;
- int msg;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
-
- if (!ld || !newdn) return ~0u;
-
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
-
- newdnU = strWtoU( newdn );
- if (!newdnU) goto exit;
-
- ret = ldap_rename( ld->ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL, &msg );
-
- if (ret == LDAP_SUCCESS)
- ret = msg;
- else
- ret = ~0u;
-
-exit:
- strfreeU( dnU );
- strfreeU( newdnU );
-
-#endif
- return ret;
+ return ldap_modrdn2W( ld, dn, newdn, 1 );
}
/***********************************************************************
@@ -133,33 +83,23 @@ exit:
*
* See ldap_modrdn2W.
*/
-ULONG CDECL ldap_modrdn2A( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
+ULONG CDECL ldap_modrdn2A( WLDAP32_LDAP *ld, char *dn, char *newdn, int delete )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newdnW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
if (!ld || !newdn) return ~0u;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
-
- newdnW = strAtoW( newdn );
- if (!newdnW) goto exit;
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (!(newdnW = strAtoW( newdn ))) goto exit;
ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
exit:
strfreeW( dnW );
strfreeW( newdnW );
-
-#endif
return ret;
}
@@ -171,7 +111,7 @@ exit:
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
- * newdn [I] New DN for the entry.
+ * newdn [I] New DN for the entry.
* delete [I] Delete old DN?
*
* RETURNS
@@ -183,30 +123,21 @@ exit:
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
-ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
+ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
char *dnU = NULL, *newdnU = NULL;
- int msg;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
+ ULONG msg;
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
if (!ld || !newdn) return ~0u;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
-
- newdnU = strWtoU( newdn );
- if (!newdnU) goto exit;
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (!(newdnU = strWtoU( newdn ))) goto exit;
- ret = ldap_rename( ld->ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL, &msg );
-
- if (ret == LDAP_SUCCESS)
+ ret = ldap_funcs->ldap_rename( ld->ld, dnU, newdnU, NULL, delete, NULL, NULL, &msg );
+ if (ret == WLDAP32_LDAP_SUCCESS)
ret = msg;
else
ret = ~0u;
@@ -214,8 +145,6 @@ ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete
exit:
strfreeU( dnU );
strfreeU( newdnU );
-
-#endif
return ret;
}
@@ -224,33 +153,23 @@ exit:
*
* See ldap_modrdn2_sW.
*/
-ULONG CDECL ldap_modrdn2_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
+ULONG CDECL ldap_modrdn2_sA( WLDAP32_LDAP *ld, char *dn, char *newdn, int delete )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newdnW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
-
- newdnW = strAtoW( newdn );
- if (!newdnW) goto exit;
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (!(newdnW = strAtoW( newdn ))) goto exit;
ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
exit:
strfreeW( dnW );
strfreeW( newdnW );
-
-#endif
return ret;
}
@@ -262,40 +181,30 @@ exit:
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
- * newdn [I] New DN for the entry.
+ * newdn [I] New DN for the entry.
* delete [I] Delete old DN?
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
-ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
+ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
char *dnU = NULL, *newdnU = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
-
- newdnU = strWtoU( newdn );
- if (!newdnU) goto exit;
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (!(newdnU = strWtoU( newdn ))) goto exit;
- ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL ));
+ ret = map_error( ldap_funcs->ldap_rename_s( ld->ld, dnU, newdnU, NULL, delete, NULL, NULL ));
exit:
strfreeU( dnU );
strfreeU( newdnU );
-
-#endif
return ret;
}
@@ -304,33 +213,23 @@ exit:
*
* See ldap_modrdn_sW.
*/
-ULONG CDECL ldap_modrdn_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
+ULONG CDECL ldap_modrdn_sA( WLDAP32_LDAP *ld, char *dn, char *newdn )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newdnW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
-
- newdnW = strAtoW( newdn );
- if (!newdnW) goto exit;
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (!(newdnW = strAtoW( newdn ))) goto exit;
ret = ldap_modrdn_sW( ld, dnW, newdnW );
exit:
strfreeW( dnW );
strfreeW( newdnW );
-
-#endif
return ret;
}
@@ -342,38 +241,14 @@ exit:
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
- * newdn [I] New DN for the entry.
+ * newdn [I] New DN for the entry.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
-ULONG CDECL ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
+ULONG CDECL ldap_modrdn_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- char *dnU = NULL, *newdnU = NULL;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
-
- if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
-
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
-
- newdnU = strWtoU( newdn );
- if (!newdnU) goto exit;
-
- ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL ));
-
-exit:
- strfreeU( dnU );
- strfreeU( newdnU );
-
-#endif
- return ret;
+ return ldap_modrdn2_sW( ld, dn, newdn, 1 );
}
--
2.30.2
1
0
[PATCH 2/5] wldap32: Move support for modify functions to the Unix library.
by Hans Leidekker 16 Apr '21
by Hans Leidekker 16 Apr '21
16 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/libldap.c | 23 +++-
dlls/wldap32/libldap.h | 6 +
dlls/wldap32/modify.c | 275 +++++++++--------------------------------
3 files changed, 82 insertions(+), 222 deletions(-)
diff --git a/dlls/wldap32/libldap.c b/dlls/wldap32/libldap.c
index cf2c2b7e38c..333ecc741c2 100644
--- a/dlls/wldap32/libldap.c
+++ b/dlls/wldap32/libldap.c
@@ -52,7 +52,7 @@ C_ASSERT( sizeof(LDAPSortKeyU) == sizeof(LDAPSortKey) );
C_ASSERT( sizeof(LDAPVLVInfoU) == sizeof(LDAPVLVInfo) );
C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
-static LDAPMod *nullattrs[] = { NULL };
+static LDAPMod *nullmods[] = { NULL };
static const struct ldap_callbacks *callbacks;
@@ -305,14 +305,14 @@ int CDECL wrap_ldap_add_ext( void *ld, const char *dn, LDAPModU **attrs, LDAPCon
LDAPControlU **clientctrls, ULONG *msg )
{
int dummy;
- return ldap_add_ext( ld, dn ? dn : "", attrs ? (LDAPMod **)attrs : nullattrs, (LDAPControl **)serverctrls,
+ return ldap_add_ext( ld, dn ? dn : "", attrs ? (LDAPMod **)attrs : nullmods, (LDAPControl **)serverctrls,
(LDAPControl **)clientctrls, msg ? (int *)msg : &dummy );
}
int CDECL wrap_ldap_add_ext_s( void *ld, const char *dn, LDAPModU **attrs, LDAPControlU **serverctrls,
LDAPControlU **clientctrls )
{
- return ldap_add_ext_s( ld, dn ? dn : "", attrs ? (LDAPMod **)attrs : nullattrs, (LDAPControl **)serverctrls,
+ return ldap_add_ext_s( ld, dn ? dn : "", attrs ? (LDAPMod **)attrs : nullmods, (LDAPControl **)serverctrls,
(LDAPControl **)clientctrls );
}
@@ -429,6 +429,21 @@ void CDECL wrap_ldap_memvfree( void **ptr )
ldap_memvfree( ptr );
}
+int CDECL wrap_ldap_modify_ext( void *ld, const char *dn, LDAPModU **mods, LDAPControlU **serverctrls,
+ LDAPControlU **clientctrls, ULONG *msg )
+{
+ int dummy;
+ return ldap_modify_ext( ld, dn ? dn : "", mods ? (LDAPMod **)mods : nullmods, (LDAPControl **)serverctrls,
+ (LDAPControl **)clientctrls, msg ? (int *)msg : &dummy );
+}
+
+int CDECL wrap_ldap_modify_ext_s( void *ld, const char *dn, LDAPModU **mods, LDAPControlU **serverctrls,
+ LDAPControlU **clientctrls )
+{
+ return ldap_modify_ext_s( ld, dn ? dn : "", mods ? (LDAPMod **)mods : nullmods, (LDAPControl **)serverctrls,
+ (LDAPControl **)clientctrls );
+}
+
int CDECL wrap_ldap_msgfree( void *msg )
{
return ldap_msgfree( msg );
@@ -569,6 +584,8 @@ static const struct ldap_funcs funcs =
wrap_ldap_first_reference,
wrap_ldap_memfree,
wrap_ldap_memvfree,
+ wrap_ldap_modify_ext,
+ wrap_ldap_modify_ext_s,
wrap_ldap_msgfree,
wrap_ldap_next_attribute,
wrap_ldap_next_entry,
diff --git a/dlls/wldap32/libldap.h b/dlls/wldap32/libldap.h
index 9f26704d053..b99855e9d34 100644
--- a/dlls/wldap32/libldap.h
+++ b/dlls/wldap32/libldap.h
@@ -125,6 +125,10 @@ extern void * CDECL wrap_ldap_first_entry(void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_first_reference(void *, void *) DECLSPEC_HIDDEN;
extern void CDECL wrap_ldap_memfree(void *) DECLSPEC_HIDDEN;
extern void CDECL wrap_ldap_memvfree(void **) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_modify_ext(void *, const char *, LDAPModU **, LDAPControlU **, LDAPControlU **,
+ ULONG *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_modify_ext_s(void *, const char *, LDAPModU **, LDAPControlU **,
+ LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_msgfree(void *) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_next_attribute(void *, void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_next_entry(void *, void *) DECLSPEC_HIDDEN;
@@ -190,6 +194,8 @@ struct ldap_funcs
void * (CDECL *ldap_first_reference)(void *, void *);
void (CDECL *ldap_memfree)(void *);
void (CDECL *ldap_memvfree)(void **);
+ int (CDECL *ldap_modify_ext)(void *, const char *, LDAPModU **, LDAPControlU **, LDAPControlU **, ULONG *);
+ int (CDECL *ldap_modify_ext_s)(void *, const char *, LDAPModU **, LDAPControlU **, LDAPControlU **);
int (CDECL *ldap_msgfree)(void *);
char * (CDECL *ldap_next_attribute)(void *, void *, void *);
void * (CDECL *ldap_next_entry)(void *, void *);
diff --git a/dlls/wldap32/modify.c b/dlls/wldap32/modify.c
index 7269df9da9f..9655a0cf15e 100644
--- a/dlls/wldap32/modify.c
+++ b/dlls/wldap32/modify.c
@@ -18,62 +18,39 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "winldap_private.h"
-#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-static LDAPMod *nullmods[] = { NULL };
-#endif
-
/***********************************************************************
* ldap_modifyA (WLDAP32.@)
*
* See ldap_modifyW.
*/
-ULONG CDECL ldap_modifyA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
+ULONG CDECL ldap_modifyA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
if (!ld) return ~0u;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (mods) {
- modsW = modarrayAtoW( mods );
- if (!modsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
ret = ldap_modifyW( ld, dnW, modsW );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
-
-#endif
return ret;
}
@@ -97,43 +74,15 @@ exit:
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
-ULONG CDECL ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
+ULONG CDECL ldap_modifyW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- char *dnU = NULL;
- LDAPMod **modsU = NULL;
- int msg;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
+ ULONG ret, msg;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
- if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
-
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (mods) {
- modsU = modarrayWtoU( mods );
- if (!modsU) goto exit;
- }
-
- ret = ldap_modify_ext( ld->ld, dn ? dnU : "", mods ? modsU : nullmods,
- NULL, NULL, &msg );
-
- if (ret == LDAP_SUCCESS)
- ret = msg;
- else
- ret = ~0u;
-
-exit:
- strfreeU( dnU );
- modarrayfreeU( modsU );
-
-#endif
- return ret;
+ ret = ldap_modify_extW( ld, dn, mods, NULL, NULL, &msg );
+ if (ret == WLDAP32_LDAP_SUCCESS) return msg;
+ return ~0u;
}
/***********************************************************************
@@ -141,38 +90,22 @@ exit:
*
* See ldap_modify_extW.
*/
-ULONG CDECL ldap_modify_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
- PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message )
+ULONG CDECL ldap_modify_extA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods,
+ LDAPControlA **serverctrls, LDAPControlA **clientctrls, ULONG *message )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
- serverctrls, clientctrls, message );
+ TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls, message );
if (!ld) return ~0u;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (mods) {
- modsW = modarrayAtoW( mods );
- if (!modsW) goto exit;
- }
- if (serverctrls) {
- serverctrlsW = controlarrayAtoW( serverctrls );
- if (!serverctrlsW) goto exit;
- }
- if (clientctrls) {
- clientctrlsW = controlarrayAtoW( clientctrls );
- if (!clientctrlsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
+ if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
@@ -181,8 +114,6 @@ exit:
modarrayfreeW( modsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
-
-#endif
return ret;
}
@@ -209,50 +140,30 @@ exit:
* the operation. The serverctrls and clientctrls parameters are
* optional and should be set to NULL if not used.
*/
-ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
- PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message )
+ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods,
+ LDAPControlW **serverctrls, LDAPControlW **clientctrls, ULONG *message )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
char *dnU = NULL;
- LDAPMod **modsU = NULL;
- LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
- int dummy;
+ LDAPModU **modsU = NULL;
+ LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
- serverctrls, clientctrls, message );
+ TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls, message );
if (!ld) return ~0u;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (mods) {
- modsU = modarrayWtoU( mods );
- if (!modsU) goto exit;
- }
- if (serverctrls) {
- serverctrlsU = controlarrayWtoU( serverctrls );
- if (!serverctrlsU) goto exit;
- }
- if (clientctrls) {
- clientctrlsU = controlarrayWtoU( clientctrls );
- if (!clientctrlsU) goto exit;
- }
-
- ret = map_error( ldap_modify_ext( ld->ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
- clientctrlsU, message ? (int *)message : &dummy ));
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
+ if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
+
+ ret = map_error( ldap_funcs->ldap_modify_ext( ld->ld, dnU, modsU, serverctrlsU, clientctrlsU, message ) );
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
-
-#endif
return ret;
}
@@ -261,38 +172,22 @@ exit:
*
* See ldap_modify_ext_sW.
*/
-ULONG CDECL ldap_modify_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
- PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
+ULONG CDECL ldap_modify_ext_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods,
+ LDAPControlA **serverctrls, LDAPControlA **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
- serverctrls, clientctrls );
+ TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (mods) {
- modsW = modarrayAtoW( mods );
- if (!modsW) goto exit;
- }
- if (serverctrls) {
- serverctrlsW = controlarrayAtoW( serverctrls );
- if (!serverctrlsW) goto exit;
- }
- if (clientctrls) {
- clientctrlsW = controlarrayAtoW( clientctrls );
- if (!clientctrlsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
+ if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
@@ -301,8 +196,6 @@ exit:
modarrayfreeW( modsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
-
-#endif
return ret;
}
@@ -327,49 +220,30 @@ exit:
* The serverctrls and clientctrls parameters are optional and
* should be set to NULL if not used.
*/
-ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
- PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
+ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods,
+ LDAPControlW **serverctrls, LDAPControlW **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
char *dnU = NULL;
- LDAPMod **modsU = NULL;
- LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
+ LDAPModU **modsU = NULL;
+ LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
- serverctrls, clientctrls );
+ TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (mods) {
- modsU = modarrayWtoU( mods );
- if (!modsU) goto exit;
- }
- if (serverctrls) {
- serverctrlsU = controlarrayWtoU( serverctrls );
- if (!serverctrlsU) goto exit;
- }
- if (clientctrls) {
- clientctrlsU = controlarrayWtoU( clientctrls );
- if (!clientctrlsU) goto exit;
- }
-
- ret = map_error( ldap_modify_ext_s( ld->ld, dn ? dnU : "", mods ? modsU : nullmods,
- serverctrlsU, clientctrlsU ));
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
+ if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
+
+ ret = map_error( ldap_funcs->ldap_modify_ext_s( ld->ld, dnU, modsU, serverctrlsU, clientctrlsU ) );
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
-
-#endif
return ret;
}
@@ -378,35 +252,24 @@ exit:
*
* See ldap_modify_sW.
*/
-ULONG CDECL ldap_modify_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
+ULONG CDECL ldap_modify_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (mods) {
- modsW = modarrayAtoW( mods );
- if (!modsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
ret = ldap_modify_sW( ld, dnW, modsW );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
-
-#endif
return ret;
}
@@ -425,34 +288,8 @@ exit:
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
-ULONG CDECL ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
+ULONG CDECL ldap_modify_sW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- char *dnU = NULL;
- LDAPMod **modsU = NULL;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
-
- if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
-
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (mods) {
- modsU = modarrayWtoU( mods );
- if (!modsU) goto exit;
- }
-
- ret = map_error( ldap_modify_ext_s( ld->ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL ));
-
-exit:
- strfreeU( dnU );
- modarrayfreeU( modsU );
-
-#endif
- return ret;
+ return ldap_modify_ext_sW( ld, dn, mods, NULL, NULL );
}
--
2.30.2
1
0
[PATCH 1/5] wldap32: Move support for init functions to the Unix library.
by Hans Leidekker 16 Apr '21
by Hans Leidekker 16 Apr '21
16 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/init.c | 218 ++++++++-------------------------
dlls/wldap32/libldap.c | 18 +++
dlls/wldap32/libldap.h | 6 +
dlls/wldap32/winldap_private.h | 4 +
4 files changed, 78 insertions(+), 168 deletions(-)
diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c
index 6586caa0ef5..d65554afb3c 100644
--- a/dlls/wldap32/init.c
+++ b/dlls/wldap32/init.c
@@ -18,25 +18,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
-#include <stdio.h>
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "wine/heap.h"
+#include "winldap_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#ifdef HAVE_LDAP
/* Should eventually be determined by the algorithm documented on MSDN. */
static const WCHAR defaulthost[] = { 'l','o','c','a','l','h','o','s','t',0 };
@@ -200,55 +193,41 @@ static char *urlify_hostnames( const char *scheme, char *hostnames, ULONG port )
strarrayfreeU( strarray );
return url;
}
-#endif
-WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#ifdef HAVE_LDAP
static WLDAP32_LDAP *create_context( const char *url )
{
WLDAP32_LDAP *ld;
- int version = LDAP_VERSION3;
+ int version = WLDAP32_LDAP_VERSION3;
- ld = heap_alloc_zero( sizeof( *ld ));
- if (!ld) return NULL;
- if (ldap_initialize( (LDAP **)&ld->ld, url ) != LDAP_SUCCESS)
+ if (!(ld = heap_alloc_zero( sizeof( *ld )))) return NULL;
+ if (map_error( ldap_funcs->ldap_initialize( &ld->ld, url ) ) != WLDAP32_LDAP_SUCCESS)
{
heap_free( ld );
return NULL;
}
- ldap_set_option( ld->ld, LDAP_OPT_PROTOCOL_VERSION, &version );
+ ldap_funcs->ldap_set_option( ld->ld, WLDAP32_LDAP_OPT_PROTOCOL_VERSION, &version );
return ld;
}
-#endif
/***********************************************************************
* cldap_openA (WLDAP32.@)
*
* See cldap_openW.
*/
-WLDAP32_LDAP * CDECL cldap_openA( PCHAR hostname, ULONG portnumber )
+WLDAP32_LDAP * CDECL cldap_openA( char *hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
- WLDAP32_LDAP *ld = NULL;
+ WLDAP32_LDAP *ld;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
- if (hostname) {
- hostnameW = strAtoW( hostname );
- if (!hostnameW) goto exit;
- }
+ if (hostname && !(hostnameW = strAtoW( hostname ))) return NULL;
ld = cldap_openW( hostnameW, portnumber );
-exit:
strfreeW( hostnameW );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -272,25 +251,15 @@ exit:
* will take precedence over the port number supplied as a parameter
* to this function.
*/
-WLDAP32_LDAP * CDECL cldap_openW( PWCHAR hostname, ULONG portnumber )
+WLDAP32_LDAP * CDECL cldap_openW( WCHAR *hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
- char *hostnameU = NULL, *url = NULL;
+ char *hostnameU, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
- if (hostname) {
- hostnameU = strWtoU( hostname );
- if (!hostnameU) goto exit;
- }
- else {
- hostnameU = strWtoU( defaulthost );
- if (!hostnameU) goto exit;
- }
-
- url = urlify_hostnames( "cldap://", hostnameU, portnumber );
- if (!url) goto exit;
+ if (!(hostnameU = strWtoU( hostname ? hostname : defaulthost ))) return NULL;
+ if (!(url = urlify_hostnames( "cldap://", hostnameU, portnumber ))) goto exit;
ld = create_context( url );
@@ -298,10 +267,6 @@ exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -337,26 +302,17 @@ ULONG CDECL ldap_connect( WLDAP32_LDAP *ld, struct l_timeval *timeout )
*/
WLDAP32_LDAP * CDECL ldap_initA( const PCHAR hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
- WLDAP32_LDAP *ld = NULL;
+ WLDAP32_LDAP *ld;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
- if (hostname) {
- hostnameW = strAtoW( hostname );
- if (!hostnameW) goto exit;
- }
+ if (hostname && !(hostnameW = strAtoW( hostname ))) return NULL;
ld = ldap_initW( hostnameW, portnumber );
-exit:
strfreeW( hostnameW );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -383,23 +339,13 @@ exit:
*/
WLDAP32_LDAP * CDECL ldap_initW( const PWCHAR hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
- char *hostnameU = NULL, *url = NULL;
+ char *hostnameU, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
- if (hostname) {
- hostnameU = strWtoU( hostname );
- if (!hostnameU) goto exit;
- }
- else {
- hostnameU = strWtoU( defaulthost );
- if (!hostnameU) goto exit;
- }
-
- url = urlify_hostnames( "ldap://", hostnameU, portnumber );
- if (!url) goto exit;
+ if (!(hostnameU = strWtoU( hostname ? hostname : defaulthost ))) return NULL;
+ if (!(url = urlify_hostnames( "ldap://", hostnameU, portnumber ))) goto exit;
ld = create_context( url );
@@ -407,10 +353,6 @@ exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -418,28 +360,19 @@ exit:
*
* See ldap_openW.
*/
-WLDAP32_LDAP * CDECL ldap_openA( PCHAR hostname, ULONG portnumber )
+WLDAP32_LDAP * CDECL ldap_openA( char *hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
- WLDAP32_LDAP *ld = NULL;
+ WLDAP32_LDAP *ld;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
- if (hostname) {
- hostnameW = strAtoW( hostname );
- if (!hostnameW) goto exit;
- }
+ if (hostname && !(hostnameW = strAtoW( hostname ))) return NULL;
ld = ldap_openW( hostnameW, portnumber );
-exit:
strfreeW( hostnameW );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -463,25 +396,15 @@ exit:
* will take precedence over the port number supplied as a parameter
* to this function.
*/
-WLDAP32_LDAP * CDECL ldap_openW( PWCHAR hostname, ULONG portnumber )
+WLDAP32_LDAP * CDECL ldap_openW( WCHAR *hostname, ULONG portnumber )
{
-#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
- char *hostnameU = NULL, *url = NULL;
+ char *hostnameU, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
- if (hostname) {
- hostnameU = strWtoU( hostname );
- if (!hostnameU) goto exit;
- }
- else {
- hostnameU = strWtoU( defaulthost );
- if (!hostnameU) goto exit;
- }
-
- url = urlify_hostnames( "ldap://", hostnameU, portnumber );
- if (!url) goto exit;
+ if (!(hostnameU = strWtoU( hostname ? hostname : defaulthost ))) return NULL;
+ if (!(url = urlify_hostnames( "ldap://", hostnameU, portnumber ))) goto exit;
ld = create_context( url );
@@ -489,10 +412,6 @@ exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -500,27 +419,19 @@ exit:
*
* See ldap_sslinitW.
*/
-WLDAP32_LDAP * CDECL ldap_sslinitA( PCHAR hostname, ULONG portnumber, int secure )
+WLDAP32_LDAP * CDECL ldap_sslinitA( char *hostname, ULONG portnumber, int secure )
{
-#ifdef HAVE_LDAP
WLDAP32_LDAP *ld;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d, 0x%08x)\n", debugstr_a(hostname), portnumber, secure );
- if (hostname) {
- hostnameW = strAtoW( hostname );
- if (!hostnameW) return NULL;
- }
+ if (hostname && !(hostnameW = strAtoW( hostname ))) return NULL;
ld = ldap_sslinitW( hostnameW, portnumber, secure );
strfreeW( hostnameW );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -546,22 +457,14 @@ WLDAP32_LDAP * CDECL ldap_sslinitA( PCHAR hostname, ULONG portnumber, int secure
* to this function. The connection will not be made until the first
* LDAP function that needs it is called.
*/
-WLDAP32_LDAP * CDECL ldap_sslinitW( PWCHAR hostname, ULONG portnumber, int secure )
+WLDAP32_LDAP * CDECL ldap_sslinitW( WCHAR *hostname, ULONG portnumber, int secure )
{
-#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
- char *hostnameU = NULL, *url = NULL;
+ char *hostnameU, *url = NULL;
TRACE( "(%s, %d, 0x%08x)\n", debugstr_w(hostname), portnumber, secure );
- if (hostname) {
- hostnameU = strWtoU( hostname );
- if (!hostnameU) goto exit;
- }
- else {
- hostnameU = strWtoU( defaulthost );
- if (!hostnameU) goto exit;
- }
+ if (!(hostnameU = strWtoU( hostname ? hostname : defaulthost ))) return NULL;
if (secure)
url = urlify_hostnames( "ldaps://", hostnameU, portnumber );
@@ -575,10 +478,6 @@ exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -586,35 +485,24 @@ exit:
*
* See ldap_start_tls_sW.
*/
-ULONG CDECL ldap_start_tls_sA( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result,
- PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
+ULONG CDECL ldap_start_tls_sA( WLDAP32_LDAP *ld, ULONG *retval, WLDAP32_LDAPMessage **result,
+ LDAPControlA **serverctrls, LDAPControlA **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
if (!ld) return ~0u;
- if (serverctrls) {
- serverctrlsW = controlarrayAtoW( serverctrls );
- if (!serverctrlsW) goto exit;
- }
- if (clientctrls) {
- clientctrlsW = controlarrayAtoW( clientctrls );
- if (!clientctrlsW) goto exit;
- }
+ if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
ret = ldap_start_tls_sW( ld, retval, result, serverctrlsW, clientctrlsW );
exit:
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
-
-#endif
return ret;
}
@@ -637,42 +525,36 @@ exit:
* NOTES
* LDAP function that needs it is called.
*/
-ULONG CDECL ldap_start_tls_sW( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result,
- PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
+ULONG CDECL ldap_start_tls_sW( WLDAP32_LDAP *ld, ULONG *retval, WLDAP32_LDAPMessage **result,
+ LDAPControlW **serverctrls, LDAPControlW **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
-
- ret = WLDAP32_LDAP_NO_MEMORY;
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
+ LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
+ if (result)
+ {
+ FIXME( "result message not supported\n" );
+ *result = NULL;
+ }
if (!ld) return ~0u;
- if (serverctrls) {
- serverctrlsU = controlarrayWtoU( serverctrls );
- if (!serverctrlsU) goto exit;
- }
- if (clientctrls) {
- clientctrlsU = controlarrayWtoU( clientctrls );
- if (!clientctrlsU) goto exit;
- }
+ if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
- ret = map_error( ldap_start_tls_s( ld->ld, serverctrlsU, clientctrlsU ));
+ ret = map_error( ldap_funcs->ldap_start_tls_s( ld->ld, serverctrlsU, clientctrlsU ) );
exit:
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
-
-#endif
return ret;
}
/***********************************************************************
* ldap_startup (WLDAP32.@)
*/
-ULONG CDECL ldap_startup( PLDAP_VERSION_INFO version, HANDLE *instance )
+ULONG CDECL ldap_startup( LDAP_VERSION_INFO *version, HANDLE *instance )
{
TRACE( "(%p, %p)\n", version, instance );
return WLDAP32_LDAP_SUCCESS;
diff --git a/dlls/wldap32/libldap.c b/dlls/wldap32/libldap.c
index de6974570f6..cf2c2b7e38c 100644
--- a/dlls/wldap32/libldap.c
+++ b/dlls/wldap32/libldap.c
@@ -414,6 +414,11 @@ void * CDECL wrap_ldap_first_reference( void *ld, void *chain )
return ldap_first_reference( ld, chain );
}
+int CDECL wrap_ldap_initialize( void **ld, const char *url )
+{
+ return ldap_initialize( (LDAP **)ld, url );
+}
+
void CDECL wrap_ldap_memfree( void *ptr )
{
return ldap_memfree( ptr );
@@ -502,6 +507,16 @@ int CDECL wrap_ldap_search_ext_s( void *ld, const char *base, int scope, const c
(LDAPMessage **)result );
}
+int CDECL wrap_ldap_set_option( void *ld, int option, const void *value )
+{
+ return ldap_set_option( ld, option, value );
+}
+
+int CDECL wrap_ldap_start_tls_s( void *ld, LDAPControlU **serverctrls, LDAPControlU **clientctrls )
+{
+ return ldap_start_tls_s( ld, (LDAPControl **)serverctrls, (LDAPControl **)clientctrls );
+}
+
int CDECL wrap_ldap_unbind_ext( void *ld, LDAPControlU **serverctrls, LDAPControlU **clientctrls )
{
return ldap_unbind_ext( ld, (LDAPControl **)serverctrls, (LDAPControl **)clientctrls );
@@ -548,6 +563,7 @@ static const struct ldap_funcs funcs =
wrap_ldap_extended_operation,
wrap_ldap_extended_operation_s,
wrap_ldap_get_dn,
+ wrap_ldap_initialize,
wrap_ldap_first_attribute,
wrap_ldap_first_entry,
wrap_ldap_first_reference,
@@ -564,6 +580,8 @@ static const struct ldap_funcs funcs =
wrap_ldap_sasl_interactive_bind_s,
wrap_ldap_search_ext,
wrap_ldap_search_ext_s,
+ wrap_ldap_set_option,
+ wrap_ldap_start_tls_s,
wrap_ldap_unbind_ext,
wrap_ldap_unbind_ext_s,
wrap_ldap_value_free_len,
diff --git a/dlls/wldap32/libldap.h b/dlls/wldap32/libldap.h
index f3fc5796fdc..9f26704d053 100644
--- a/dlls/wldap32/libldap.h
+++ b/dlls/wldap32/libldap.h
@@ -119,6 +119,7 @@ extern int CDECL wrap_ldap_extended_operation(void *, const char *, struct berva
extern int CDECL wrap_ldap_extended_operation_s(void *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **, char **, struct bervalU **) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_get_dn(void *, void *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_initialize(void **, const char *) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_first_attribute(void *, void *, void **) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_first_entry(void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_first_reference(void *, void *) DECLSPEC_HIDDEN;
@@ -141,6 +142,8 @@ extern int CDECL wrap_ldap_search_ext(void *, const char *, int, const char *, c
LDAPControlU **, struct timevalU *, int, ULONG *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_search_ext_s(void *, const char *, int, const char *, char **, int, LDAPControlU **,
LDAPControlU **, struct timevalU *, int, void **) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_set_option(void *, int, const void *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_start_tls_s(void *, LDAPControlU **, LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_unbind_ext(void *, LDAPControlU **, LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_unbind_ext_s(void *, LDAPControlU **, LDAPControlU **) DECLSPEC_HIDDEN;
extern void CDECL wrap_ldap_value_free_len(struct bervalU **) DECLSPEC_HIDDEN;
@@ -181,6 +184,7 @@ struct ldap_funcs
int (CDECL *ldap_extended_operation_s)(void *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **, char **, struct bervalU **);
char * (CDECL *ldap_get_dn)(void *, void *);
+ int (CDECL *ldap_initialize)(void **, const char *);
char * (CDECL *ldap_first_attribute)(void *, void *, void **);
void * (CDECL *ldap_first_entry)(void *, void *);
void * (CDECL *ldap_first_reference)(void *, void *);
@@ -202,6 +206,8 @@ struct ldap_funcs
LDAPControlU **, struct timevalU *, int, ULONG *);
int (CDECL *ldap_search_ext_s)(void *, const char *, int, const char *, char **, int, LDAPControlU **,
LDAPControlU **, struct timevalU *, int, void **);
+ int (CDECL *ldap_set_option)(void *, int, const void *);
+ int (CDECL *ldap_start_tls_s)(void *, LDAPControlU **, LDAPControlU **);
int (CDECL *ldap_unbind_ext)(void *, LDAPControlU **, LDAPControlU **);
int (CDECL *ldap_unbind_ext_s)(void *, LDAPControlU **, LDAPControlU **);
void (CDECL *ldap_value_free_len)(struct bervalU **);
diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index 20fc676c7e2..7ac7e5a3f41 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -29,6 +29,10 @@
#define WLDAP32_LBER_ERROR (~0L)
+#define WLDAP32_LDAP_VERSION1 1
+#define WLDAP32_LDAP_VERSION2 2
+#define WLDAP32_LDAP_VERSION3 3
+
typedef enum {
WLDAP32_LDAP_SUCCESS = 0x00,
WLDAP32_LDAP_UNWILLING_TO_PERFORM = 0x35,
--
2.30.2
1
0
1
0
[PATCH v2 1/5] wined3d: Pass a wined3d_device_context to wined3d_device_get_blend_state().
by Zebediah Figura 16 Apr '21
by Zebediah Figura 16 Apr '21
16 Apr '21
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/d3d11/device.c | 4 ++--
dlls/wined3d/device.c | 9 +++++----
dlls/wined3d/wined3d.spec | 2 +-
include/wine/wined3d.h | 2 ++
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index d93256e77ad..70d14c7f2c5 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2137,7 +2137,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargetsAndUnord
static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11DeviceContext1 *iface,
ID3D11BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
{
- struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
+ struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
struct wined3d_blend_state *wined3d_state;
struct d3d_blend_state *blend_state_impl;
@@ -2145,7 +2145,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11Devi
iface, blend_state, blend_factor, sample_mask);
wined3d_mutex_lock();
- if ((wined3d_state = wined3d_device_get_blend_state(device->wined3d_device,
+ if ((wined3d_state = wined3d_device_context_get_blend_state(context->wined3d_context,
(struct wined3d_color *)blend_factor, sample_mask)))
{
blend_state_impl = wined3d_blend_state_get_parent(wined3d_state);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 974db90037d..39701886450 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1603,12 +1603,12 @@ void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
wined3d_device_context_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask);
}
-struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device,
+struct wined3d_blend_state * CDECL wined3d_device_context_get_blend_state(const struct wined3d_device_context *context,
struct wined3d_color *blend_factor, unsigned int *sample_mask)
{
- const struct wined3d_state *state = device->cs->c.state;
+ const struct wined3d_state *state = context->state;
- TRACE("device %p, blend_factor %p, sample_mask %p.\n", device, blend_factor, sample_mask);
+ TRACE("context %p, blend_factor %p, sample_mask %p.\n", context, blend_factor, sample_mask);
*blend_factor = state->blend_factor;
*sample_mask = state->sample_mask;
@@ -3921,6 +3921,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
const struct wined3d_saved_states *changed = &stateblock->changed;
const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
+ struct wined3d_device_context *context = &device->cs->c;
unsigned int i, j, start, idx;
struct wined3d_range range;
uint32_t map;
@@ -4153,7 +4154,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR))
wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]);
else
- wined3d_device_get_blend_state(device, &colour, &sample_mask);
+ wined3d_device_context_get_blend_state(context, &colour, &sample_mask);
if ((entry = wine_rb_get(&device->blend_states, &desc)))
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 406e511c0f6..35fbc44ee64 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -55,7 +55,6 @@
@ cdecl wined3d_device_end_scene(ptr)
@ cdecl wined3d_device_evict_managed_resources(ptr)
@ cdecl wined3d_device_get_available_texture_mem(ptr)
-@ cdecl wined3d_device_get_blend_state(ptr ptr)
@ cdecl wined3d_device_get_clip_status(ptr ptr)
@ cdecl wined3d_device_get_compute_shader(ptr)
@ cdecl wined3d_device_get_creation_parameters(ptr ptr)
@@ -170,6 +169,7 @@
@ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
@ cdecl wined3d_device_context_flush(ptr)
@ cdecl wined3d_device_context_generate_mipmaps(ptr ptr)
+@ cdecl wined3d_device_context_get_blend_state(ptr ptr ptr)
@ cdecl wined3d_device_context_get_constant_buffer(ptr long long)
@ cdecl wined3d_device_context_get_shader(ptr long)
@ cdecl wined3d_device_context_issue_query(ptr ptr long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 1a58c671934..5b936017191 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2565,6 +2565,8 @@ void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context
void __cdecl wined3d_device_context_flush(struct wined3d_device_context *context);
void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
struct wined3d_shader_resource_view *view);
+struct wined3d_blend_state * __cdecl wined3d_device_context_get_blend_state(
+ const struct wined3d_device_context *context, struct wined3d_color *blend_factor, unsigned int *sample_mask);
struct wined3d_buffer * __cdecl wined3d_device_context_get_constant_buffer(const struct wined3d_device_context *context,
enum wined3d_shader_type shader_type, unsigned int idx);
struct wined3d_shader * __cdecl wined3d_device_context_get_shader(const struct wined3d_device_context *context,
--
2.30.2
1
4
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/tests/documentmode.js | 2 ++
include/mshtmdid.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
2
1
[PATCH 1/4] amstream/tests: Test that streams call IMediaStreamFilter::EndOfStream.
by Anton Baskanov 15 Apr '21
by Anton Baskanov 15 Apr '21
15 Apr '21
Signed-off-by: Anton Baskanov <baskanov(a)gmail.com>
---
dlls/amstream/tests/amstream.c | 233 ++++++++++++++++++++++++++++++++-
1 file changed, 230 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 9cefec12442..2f7854606f4 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -1313,6 +1313,208 @@ static const IMediaSeekingVtbl testsource_seeking_vtbl =
testsource_seeking_GetPreroll,
};
+struct testmediastreamfilter
+{
+ IMediaStreamFilter IMediaStreamFilter_iface;
+ LONG refcount;
+ unsigned int got_end_of_stream;
+};
+
+static inline struct testmediastreamfilter *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
+{
+ return CONTAINING_RECORD(iface, struct testmediastreamfilter, IMediaStreamFilter_iface);
+}
+
+static HRESULT WINAPI testmediastreamfilter_QueryInterface(IMediaStreamFilter *iface, REFIID iid, void **out)
+{
+ if (IsEqualGUID(iid, &IID_IUnknown)
+ || IsEqualGUID(iid, &IID_IPersist)
+ || IsEqualGUID(iid, &IID_IMediaFilter)
+ || IsEqualGUID(iid, &IID_IBaseFilter)
+ || IsEqualGUID(iid, &IID_IMediaStreamFilter))
+ {
+ IMediaStreamFilter_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ ok(0, "Unexpected interface %s.\n", wine_dbgstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI testmediastreamfilter_AddRef(IMediaStreamFilter *iface)
+{
+ struct testmediastreamfilter *filter = impl_from_IMediaStreamFilter(iface);
+ return InterlockedIncrement(&filter->refcount);
+}
+
+static ULONG WINAPI testmediastreamfilter_Release(IMediaStreamFilter *iface)
+{
+ struct testmediastreamfilter *filter = impl_from_IMediaStreamFilter(iface);
+ return InterlockedDecrement(&filter->refcount);
+}
+
+static HRESULT WINAPI testmediastreamfilter_GetClassID(IMediaStreamFilter *iface, CLSID *clsid)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_Stop(IMediaStreamFilter *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_Pause(IMediaStreamFilter *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_Run(IMediaStreamFilter *iface, REFERENCE_TIME start)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_GetState(IMediaStreamFilter *iface, DWORD timeout, FILTER_STATE *state)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_SetSyncSource(IMediaStreamFilter *iface, IReferenceClock *clock)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_GetSyncSource(IMediaStreamFilter *iface, IReferenceClock **clock)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_EnumPins(IMediaStreamFilter *iface, IEnumPins **enum_pins)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_FindPin(IMediaStreamFilter *iface, const WCHAR *id, IPin **pin)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_QueryFilterInfo(IMediaStreamFilter *iface, FILTER_INFO *pInfo)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_JoinFilterGraph(IMediaStreamFilter *iface, IFilterGraph *graph, const WCHAR *name)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_QueryVendorInfo(IMediaStreamFilter *iface, WCHAR **vendor_info)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_AddMediaStream(IMediaStreamFilter *iface, IAMMediaStream *stream)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_GetMediaStream(IMediaStreamFilter *iface, const MSPID *purpose_id, IMediaStream **stream)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_EnumMediaStreams(IMediaStreamFilter *iface, LONG index, IMediaStream **stream)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_SupportSeeking(IMediaStreamFilter *iface, BOOL renderer)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_ReferenceTimeToStreamTime(IMediaStreamFilter *iface, REFERENCE_TIME *time)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_GetCurrentStreamTime(IMediaStreamFilter *iface, REFERENCE_TIME *time)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_WaitUntil(IMediaStreamFilter *iface, REFERENCE_TIME time)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_Flush(IMediaStreamFilter *iface, BOOL cancel_eos)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI testmediastreamfilter_EndOfStream(IMediaStreamFilter *iface)
+{
+ struct testmediastreamfilter *filter = impl_from_IMediaStreamFilter(iface);
+ ++filter->got_end_of_stream;
+ return S_OK;
+}
+
+static IMediaStreamFilterVtbl testmediastreamfilter_vtbl =
+{
+ testmediastreamfilter_QueryInterface,
+ testmediastreamfilter_AddRef,
+ testmediastreamfilter_Release,
+ testmediastreamfilter_GetClassID,
+ testmediastreamfilter_Stop,
+ testmediastreamfilter_Pause,
+ testmediastreamfilter_Run,
+ testmediastreamfilter_GetState,
+ testmediastreamfilter_SetSyncSource,
+ testmediastreamfilter_GetSyncSource,
+ testmediastreamfilter_EnumPins,
+ testmediastreamfilter_FindPin,
+ testmediastreamfilter_QueryFilterInfo,
+ testmediastreamfilter_JoinFilterGraph,
+ testmediastreamfilter_QueryVendorInfo,
+ testmediastreamfilter_AddMediaStream,
+ testmediastreamfilter_GetMediaStream,
+ testmediastreamfilter_EnumMediaStreams,
+ testmediastreamfilter_SupportSeeking,
+ testmediastreamfilter_ReferenceTimeToStreamTime,
+ testmediastreamfilter_GetCurrentStreamTime,
+ testmediastreamfilter_WaitUntil,
+ testmediastreamfilter_Flush,
+ testmediastreamfilter_EndOfStream,
+};
+
+static void testmediastreamfilter_init(struct testmediastreamfilter *filter)
+{
+ memset(filter, 0, sizeof(*filter));
+ filter->IMediaStreamFilter_iface.lpVtbl = &testmediastreamfilter_vtbl;
+}
+
#define check_get_stream(a,b,c,d) check_get_stream_(__LINE__,a,b,c,d)
static void check_get_stream_(int line, IAMMultiMediaStream *mmstream,
IMediaStreamFilter *filter, const GUID *mspid, IMediaStream *expect)
@@ -6065,9 +6267,11 @@ static void test_ammediastream_set_state(void)
check_ammediastream_set_state(&MSPID_PrimaryVideo);
}
-static void check_ammediastream_end_of_stream(const MSPID *id, const AM_MEDIA_TYPE *mt)
+static void check_ammediastream_end_of_stream(const CLSID *clsid, const MSPID *id, const AM_MEDIA_TYPE *mt)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
+ struct testmediastreamfilter filter;
+ IAMMediaStream *am_stream;
struct testfilter source;
IGraphBuilder *graph;
IMediaStream *stream;
@@ -6122,12 +6326,35 @@ static void check_ammediastream_end_of_stream(const MSPID *id, const AM_MEDIA_TY
IPin_Release(pin);
ref = IMediaStream_Release(stream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ testmediastreamfilter_init(&filter);
+
+ hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&am_stream);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_QueryInterface(am_stream, &IID_IPin, (void **)&pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_JoinFilter(am_stream, &filter.IMediaStreamFilter_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ filter.got_end_of_stream = 0;
+
+ hr = IPin_EndOfStream(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream);
+
+ hr = IPin_EndOfStream(pin);
+ ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream);
+
+ IPin_Release(pin);
+ ref = IAMMediaStream_Release(am_stream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_ammediastream_end_of_stream(void)
{
- check_ammediastream_end_of_stream(&MSPID_PrimaryAudio, &audio_mt);
- check_ammediastream_end_of_stream(&MSPID_PrimaryVideo, &rgb32_mt);
+ check_ammediastream_end_of_stream(&CLSID_AMAudioStream, &MSPID_PrimaryAudio, &audio_mt);
+ check_ammediastream_end_of_stream(&CLSID_AMDirectDrawStream, &MSPID_PrimaryVideo, &rgb32_mt);
}
void test_mediastreamfilter_get_state(void)
--
2.25.1
2
5
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 4 ++--
dlls/wined3d/adapter_vk.c | 4 ++--
dlls/wined3d/directx.c | 6 +++---
dlls/wined3d/glsl_shader.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index c3ce959a14f..990991e2e3d 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -4279,13 +4279,13 @@ static void adapter_gl_destroy_device(struct wined3d_device *device)
heap_free(device_gl);
}
-struct wined3d_context *adapter_gl_acquire_context(struct wined3d_device *device,
+static struct wined3d_context *adapter_gl_acquire_context(struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx)
{
return wined3d_context_gl_acquire(device, texture, sub_resource_idx);
}
-void adapter_gl_release_context(struct wined3d_context *context)
+static void adapter_gl_release_context(struct wined3d_context *context)
{
return wined3d_context_gl_release(wined3d_context_gl(context));
}
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index 7303c994eb4..0abae24fd1f 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -536,7 +536,7 @@ static void adapter_vk_destroy_device(struct wined3d_device *device)
heap_free(device_vk);
}
-struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device *device,
+static struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx)
{
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
@@ -549,7 +549,7 @@ struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device *device
return &wined3d_device_vk(device)->context_vk.c;
}
-void adapter_vk_release_context(struct wined3d_context *context)
+static void adapter_vk_release_context(struct wined3d_context *context)
{
TRACE("context %p.\n", context);
}
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 0a3c547e7a9..9883017f932 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2687,7 +2687,7 @@ static void adapter_no3d_destroy_device(struct wined3d_device *device)
heap_free(device);
}
-struct wined3d_context *adapter_no3d_acquire_context(struct wined3d_device *device,
+static struct wined3d_context *adapter_no3d_acquire_context(struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx)
{
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
@@ -2700,7 +2700,7 @@ struct wined3d_context *adapter_no3d_acquire_context(struct wined3d_device *devi
return &wined3d_device_no3d(device)->context_no3d;
}
-void adapter_no3d_release_context(struct wined3d_context *context)
+static void adapter_no3d_release_context(struct wined3d_context *context)
{
TRACE("context %p.\n", context);
}
@@ -3044,7 +3044,7 @@ static void adapter_no3d_dispatch_compute(struct wined3d_device *device,
ERR("device %p, state %p, parameters %p.\n", device, state, parameters);
}
-void adapter_no3d_clear_uav(struct wined3d_context *context,
+static void adapter_no3d_clear_uav(struct wined3d_context *context,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
{
ERR("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 8ca7afb2ec7..45e7ecd4850 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -419,7 +419,7 @@ static void shader_glsl_add_version_declaration(struct wined3d_string_buffer *bu
shader_addline(buffer, "#version %u\n", shader_glsl_get_version(gl_info));
}
-unsigned int shader_glsl_full_ffp_varyings(const struct wined3d_gl_info *gl_info)
+static unsigned int shader_glsl_full_ffp_varyings(const struct wined3d_gl_info *gl_info)
{
/* On core profile we have to also count diffuse and specular colours and
* the fog coordinate. */
--
2.20.1
1
0
15 Apr '21
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wined3d/device.c | 8 ++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 2 ++
3 files changed, 11 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e6406c7a04f..cf1e0e207de 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1901,6 +1901,14 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont
wined3d_shader_decref(prev);
}
+struct wined3d_shader * CDECL wined3d_device_context_get_shader(const struct wined3d_device_context *context,
+ enum wined3d_shader_type type)
+{
+ TRACE("context %p, type %#x, shader %p.\n", context, type, shader);
+
+ return context->state->shader[type];
+}
+
void CDECL wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer)
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 34eba025b8a..ada2c79fb77 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -171,6 +171,7 @@
@ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
@ cdecl wined3d_device_context_flush(ptr)
@ cdecl wined3d_device_context_generate_mipmaps(ptr ptr)
+@ cdecl wined3d_device_context_get_shader(ptr long)
@ cdecl wined3d_device_context_issue_query(ptr ptr long)
@ cdecl wined3d_device_context_map(ptr ptr long ptr ptr long)
@ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index db5f75d7aca..33844349968 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2567,6 +2567,8 @@ void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context
void __cdecl wined3d_device_context_flush(struct wined3d_device_context *context);
void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
struct wined3d_shader_resource_view *view);
+struct wined3d_shader * __cdecl wined3d_device_context_get_shader(const struct wined3d_device_context *context,
+ enum wined3d_shader_type type);
void __cdecl wined3d_device_context_issue_query(struct wined3d_device_context *context,
struct wined3d_query *query, unsigned int flags);
HRESULT __cdecl wined3d_device_context_map(struct wined3d_device_context *context,
--
2.30.2
3
9