winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
wine-commits
March 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
996 discussions
Start a n
N
ew thread
Dmitry Timoshkov : adsldp: Sort the attribute types array.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 5a6f56d3a2e23aebf02c01e547e334dc3fe59f97 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5a6f56d3a2e23aebf02c01e5…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 31 19:00:21 2020 +0800 adsldp: Sort the attribute types array. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/adsldp.c | 16 +++++----- dlls/adsldp/adsldp_private.h | 4 +-- dlls/adsldp/schema.c | 70 +++++++++++++++++++++++++++++++++++++++----- 3 files changed, 73 insertions(+), 17 deletions(-) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index 8621836afc..c4557667cc 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -391,7 +391,7 @@ typedef struct ULONG attrs_count, attrs_count_allocated; struct ldap_attribute *attrs; struct attribute_type *at; - ULONG at_count; + ULONG at_single_count, at_multiple_count; struct { ADS_SCOPEENUM scope; @@ -484,7 +484,7 @@ static ULONG WINAPI ldapns_Release(IADs *iface) SysFreeString(ldap->host); SysFreeString(ldap->object); free_attributes(ldap); - free_attribute_types(ldap->at, ldap->at_count); + free_attribute_types(ldap->at, ldap->at_single_count + ldap->at_multiple_count); heap_free(ldap); } @@ -943,7 +943,7 @@ static HRESULT WINAPI openobj_OpenDSObject(IADsOpenDSObject *iface, BSTR path, B IADs *ads; LDAP *ld = NULL; HRESULT hr; - ULONG err, at_count = 0; + ULONG err, at_single_count = 0, at_multiple_count = 0; struct attribute_type *at = NULL; TRACE("%p,%s,%s,%p,%08x,%p\n", iface, debugstr_w(path), debugstr_w(user), password, flags, obj); @@ -1043,7 +1043,7 @@ static HRESULT WINAPI openobj_OpenDSObject(IADsOpenDSObject *iface, BSTR path, B } } - at = load_schema(ld, &at_count); + at = load_schema(ld, &at_single_count, &at_multiple_count); } hr = LDAPNamespace_create(&IID_IADs, (void **)&ads); @@ -1055,7 +1055,8 @@ static HRESULT WINAPI openobj_OpenDSObject(IADsOpenDSObject *iface, BSTR path, B ldap->port = port; ldap->object = object; ldap->at = at; - ldap->at_count = at_count; + ldap->at_single_count = at_single_count; + ldap->at_multiple_count = at_multiple_count; hr = IADs_QueryInterface(ads, &IID_IDispatch, (void **)obj); IADs_Release(ads); return hr; @@ -1314,7 +1315,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex ADSTYPEENUM type; DWORD i, count; - type = get_schema_type(name, ldap->at, ldap->at_count); + type = get_schema_type(name, ldap->at, ldap->at_single_count, ldap->at_multiple_count); TRACE("%s => type %d\n", debugstr_w(name), type); switch (type) @@ -1577,7 +1578,8 @@ static HRESULT LDAPNamespace_create(REFIID riid, void **obj) ldap->attrs = NULL; ldap->search.scope = ADS_SCOPE_SUBTREE; ldap->at = NULL; - ldap->at_count = 0; + ldap->at_single_count = 0; + ldap->at_multiple_count = 0; hr = IADs_QueryInterface(&ldap->IADs_iface, riid, obj); IADs_Release(&ldap->IADs_iface); diff --git a/dlls/adsldp/adsldp_private.h b/dlls/adsldp/adsldp_private.h index a0d3a977a2..ea3d247dee 100644 --- a/dlls/adsldp/adsldp_private.h +++ b/dlls/adsldp/adsldp_private.h @@ -56,8 +56,8 @@ struct attribute_type }; DWORD map_ldap_error(DWORD) DECLSPEC_HIDDEN; -struct attribute_type *load_schema(LDAP *ld, ULONG *) DECLSPEC_HIDDEN; -ADSTYPEENUM get_schema_type(const WCHAR *, const struct attribute_type *, ULONG) DECLSPEC_HIDDEN; +struct attribute_type *load_schema(LDAP *ld, ULONG *, ULONG *) DECLSPEC_HIDDEN; +ADSTYPEENUM get_schema_type(const WCHAR *, const struct attribute_type *, ULONG, ULONG) DECLSPEC_HIDDEN; void free_attribute_types(struct attribute_type *, ULONG) DECLSPEC_HIDDEN; #endif diff --git a/dlls/adsldp/schema.c b/dlls/adsldp/schema.c index e91f817fc9..101a84c196 100644 --- a/dlls/adsldp/schema.c +++ b/dlls/adsldp/schema.c @@ -30,11 +30,41 @@ WINE_DEFAULT_DEBUG_CHANNEL(adsldp); -static const struct attribute_type *find_schema_type(const WCHAR *name, const struct attribute_type *at, ULONG count) +static const struct attribute_type *find_schema_type_sorted(const WCHAR *name, const struct attribute_type *at, ULONG count) { + int idx, min, max, res; + + if (!count) return NULL; + + min = 0; + max = count - 1; + + while (min <= max) + { + idx = (min + max) / 2; + res = wcsicmp(name, at[idx].name); + if (!res) return &at[idx]; + if (res > 0) min = idx + 1; + else max = idx - 1; + } + + return NULL; +} + + +static const struct attribute_type *find_schema_type(const WCHAR *name, const struct attribute_type *at, ULONG single, ULONG multiple) +{ + const struct attribute_type *found; ULONG i, n, off; - for (i = 0; i < count; i++) + /* Perform binary search within definitions with single name */ + found = find_schema_type_sorted(name, at, single); + if (found) return found; + + /* Perform linear search within definitions with multiple names */ + at += single; + + for (i = 0; i < multiple; i++) { off = 0; @@ -45,15 +75,16 @@ static const struct attribute_type *find_schema_type(const WCHAR *name, const st } } + FIXME("%s not found\n", debugstr_w(name)); return NULL; } /* RFC 4517 */ -ADSTYPEENUM get_schema_type(const WCHAR *name, const struct attribute_type *at, ULONG at_count) +ADSTYPEENUM get_schema_type(const WCHAR *name, const struct attribute_type *at, ULONG single, ULONG multiple) { const struct attribute_type *type; - type = find_schema_type(name, at, at_count); + type = find_schema_type(name, at, single, multiple); if (!type || !type->syntax) return ADSTYPE_CASE_IGNORE_STRING; if (!wcscmp(type->syntax, L"1.3.6.1.4.1.1466.115.121.1.7")) @@ -300,16 +331,29 @@ static BOOL parse_attribute_type(WCHAR *str, struct attribute_type *at) return FALSE; } -struct attribute_type *load_schema(LDAP *ld, ULONG *at_count) +static int __cdecl at_cmp(const void *a1, const void *a2) +{ + const struct attribute_type *at1 = a1; + const struct attribute_type *at2 = a2; + + if (at1->name_count == 1 && at2->name_count == 1) + return wcsicmp(at1->name, at2->name); + + /* put definitions with multiple names at the end */ + return at1->name_count - at2->name_count; +} + +struct attribute_type *load_schema(LDAP *ld, ULONG *at_single_count, ULONG *at_multiple_count) { WCHAR *subschema[] = { (WCHAR *)L"subschemaSubentry", NULL }; WCHAR *attribute_types[] = { (WCHAR *)L"attributeTypes", NULL }; - ULONG err, count; + ULONG err, count, multiple_count; LDAPMessage *res, *entry; WCHAR **schema = NULL; struct attribute_type *at = NULL; - *at_count = 0; + *at_single_count = 0; + *at_multiple_count = 0; err = ldap_search_sW(ld, NULL, LDAP_SCOPE_BASE, (WCHAR *)L"(objectClass=*)", subschema, FALSE, &res); if (err != LDAP_SUCCESS) @@ -334,6 +378,7 @@ struct attribute_type *load_schema(LDAP *ld, ULONG *at_count) } count = 0; + multiple_count = 0; entry = ldap_first_entry(ld, res); if (entry) @@ -367,6 +412,9 @@ struct attribute_type *load_schema(LDAP *ld, ULONG *at_count) TRACE("oid %s, name %s, name_count %u, syntax %s, single-value %d\n", debugstr_w(at[count].oid), debugstr_w(at[count].name), at[count].name_count, debugstr_w(at[count].syntax), at[count].single_value); + if (at[count].name_count > 1) + multiple_count++; + count++; } @@ -376,7 +424,13 @@ struct attribute_type *load_schema(LDAP *ld, ULONG *at_count) exit: ldap_msgfree(res); - if (at) *at_count = count; + if (at) + { + *at_single_count = count - multiple_count; + *at_multiple_count = multiple_count; + + qsort(at, count, sizeof(at[0]), at_cmp); + } return at; }
1
0
0
0
Dmitry Timoshkov : adsldp: Ignore attribute definitions without NAME.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 6591ddd58c9262bca5e4b619b36fb6a16e4c6718 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6591ddd58c9262bca5e4b619…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 31 19:00:15 2020 +0800 adsldp: Ignore attribute definitions without NAME. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/schema.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/adsldp/schema.c b/dlls/adsldp/schema.c index bff754be7a..e91f817fc9 100644 --- a/dlls/adsldp/schema.c +++ b/dlls/adsldp/schema.c @@ -36,8 +36,6 @@ static const struct attribute_type *find_schema_type(const WCHAR *name, const st for (i = 0; i < count; i++) { - if (!at[i].name) continue; - off = 0; for (n = 0; n < at[i].name_count; n++) @@ -360,6 +358,12 @@ struct attribute_type *load_schema(LDAP *ld, ULONG *at_count) continue; } + if (!at[count].name) + { + free_attribute_type(&at[count]); + continue; + } + TRACE("oid %s, name %s, name_count %u, syntax %s, single-value %d\n", debugstr_w(at[count].oid), debugstr_w(at[count].name), at[count].name_count, debugstr_w(at[count].syntax), at[count].single_value);
1
0
0
0
Dmitry Timoshkov : adsldp: Initialize also pADsValues->dwType field.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 4cdc333677ed123a02cf31b0fd3515ab7d14ece4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4cdc333677ed123a02cf31b0…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 31 19:00:00 2020 +0800 adsldp: Initialize also pADsValues->dwType field. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/adsldp.c | 5 +++++ dlls/adsldp/tests/ldap.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index f8e8adccf4..8621836afc 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -1345,6 +1345,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex for (i = 0; i < count; i++) { TRACE("=> %s\n", debugstr_w(values[i])); + col->pADsValues[i].dwType = type; col->pADsValues[i].u.CaseIgnoreString = values[i]; } @@ -1371,6 +1372,8 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex for (i = 0; i < count; i++) { + col->pADsValues[i].dwType = type; + if (wcsicmp(values[i], L"TRUE")) col->pADsValues[i].u.Boolean = 1; else if (wcsicmp(values[i], L"FALSE")) @@ -1436,6 +1439,7 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex for (i = 0; i < count; i++) { TRACE("=> %s\n", debugstr_an(values[i]->bv_val, values[i]->bv_len)); + col->pADsValues[i].dwType = type; col->pADsValues[i].u.OctetString.dwLength = values[i]->bv_len; col->pADsValues[i].u.OctetString.lpValue = (BYTE *)values[i]->bv_val; } @@ -1489,6 +1493,7 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL wcscat(col->pADsValues[0].u.CaseIgnoreString, ldap->host); wcscat(col->pADsValues[0].u.CaseIgnoreString, L"/"); if (dn) wcscat(col->pADsValues[0].u.CaseIgnoreString, dn); + col->pADsValues[0].dwType = ADSTYPE_CASE_IGNORE_STRING; col->dwADsType = ADSTYPE_CASE_IGNORE_STRING; col->dwNumValues = 1; col->pszAttrName = strdupW(name); diff --git a/dlls/adsldp/tests/ldap.c b/dlls/adsldp/tests/ldap.c index 3c1d47755d..120e77053a 100644 --- a/dlls/adsldp/tests/ldap.c +++ b/dlls/adsldp/tests/ldap.c @@ -271,6 +271,8 @@ static void do_search(const struct search *s) for (i = 0; i < col.dwNumValues; i++) { + ok(col.pADsValues[i].dwType == col.dwADsType, "%u: got %d for %s\n", i, col.pADsValues[i].dwType, wine_dbgstr_w(name)); + ok(res->values[i] != NULL, "expected to have more values for %s\n", wine_dbgstr_w(name)); if (!res->values[i]) break;
1
0
0
0
Dmitry Timoshkov : adsldp: Store original LDAP values pointer in hReserved.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: f0f24b4be4ee9a1dd0ebac6e40cb9277079c917b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f0f24b4be4ee9a1dd0ebac6e…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 31 18:59:51 2020 +0800 adsldp: Store original LDAP values pointer in hReserved. AD Explorer depends on this. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/adsldp.c | 169 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 120 insertions(+), 49 deletions(-) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index e0a14f2c70..f8e8adccf4 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -1308,65 +1308,141 @@ static HRESULT WINAPI search_GetNextColumnName(IDirectorySearch *iface, ADS_SEAR return S_ADS_NOMORE_COLUMNS; } -static HRESULT add_column_values(LDAP_namespace *ldap, ADS_SEARCH_COLUMN *col, - const WCHAR *name, struct berval **values, DWORD count) +static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_context *ldap_ctx, + LPWSTR name, ADS_SEARCH_COLUMN *col) { ADSTYPEENUM type; - DWORD i; + DWORD i, count; type = get_schema_type(name, ldap->at, ldap->at_count); + TRACE("%s => type %d\n", debugstr_w(name), type); - col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); - if (!col->pADsValues) - return E_OUTOFMEMORY; + switch (type) + { + default: + FIXME("no special handling for type %d\n", type); + /* fall through */ + case ADSTYPE_DN_STRING: + case ADSTYPE_CASE_EXACT_STRING: + case ADSTYPE_CASE_IGNORE_STRING: + case ADSTYPE_PRINTABLE_STRING: + { + WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); + if (!values) + { + memset(col, 0, sizeof(*col)); + return E_ADS_COLUMN_NOT_SET; + } + count = ldap_count_valuesW(values); - for (i = 0; i < count; i++) + col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + if (!col->pADsValues) + { + ldap_value_freeW(values); + return E_OUTOFMEMORY; + } + + for (i = 0; i < count; i++) + { + TRACE("=> %s\n", debugstr_w(values[i])); + col->pADsValues[i].u.CaseIgnoreString = values[i]; + } + + col->hReserved = values; + break; + } + + case ADSTYPE_BOOLEAN: { - switch (type) + WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); + if (!values) { - default: - FIXME("no special handling for type %d\n", type); - /* fall through */ - case ADSTYPE_DN_STRING: - case ADSTYPE_CASE_EXACT_STRING: - case ADSTYPE_CASE_IGNORE_STRING: - case ADSTYPE_PRINTABLE_STRING: + memset(col, 0, sizeof(*col)); + return E_ADS_COLUMN_NOT_SET; + } + count = ldap_count_valuesW(values); + + col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + if (!col->pADsValues) { - DWORD outlen; - TRACE("=> %s\n", debugstr_an(values[i]->bv_val, values[i]->bv_len)); - col->pADsValues[i].u.CaseIgnoreString = strnUtoW(values[i]->bv_val, values[i]->bv_len, &outlen); - if (!col->pADsValues[i].u.CaseIgnoreString) - { - heap_free(col->pADsValues); - return E_OUTOFMEMORY; - } - break; + ldap_value_freeW(values); + return E_OUTOFMEMORY; } - case ADSTYPE_BOOLEAN: - if (stricmp(values[i]->bv_val, "TRUE")) + for (i = 0; i < count; i++) + { + if (wcsicmp(values[i], L"TRUE")) col->pADsValues[i].u.Boolean = 1; - else if (stricmp(values[i]->bv_val, "FALSE")) + else if (wcsicmp(values[i], L"FALSE")) col->pADsValues[i].u.Boolean = 0; else { - FIXME("not recognized boolean value %s\n", debugstr_an(values[i]->bv_val, values[i]->bv_len)); + FIXME("not recognized boolean value %s\n", debugstr_w(values[i])); col->pADsValues[i].u.Boolean = 0; } TRACE("=> %d\n", col->pADsValues[i].u.Boolean); - break; + } - case ADSTYPE_INTEGER: - col->pADsValues[i].u.Integer = strtol(values[i]->bv_val, NULL, 10); - TRACE("%s => %d\n", debugstr_an(values[i]->bv_val, values[i]->bv_len), col->pADsValues[i].u.Integer); - break; + ldap_value_freeW(values); + col->hReserved = NULL; + break; + } + + case ADSTYPE_INTEGER: + { + WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); + if (!values) + { + memset(col, 0, sizeof(*col)); + return E_ADS_COLUMN_NOT_SET; + } + count = ldap_count_valuesW(values); + + col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + if (!col->pADsValues) + { + ldap_value_freeW(values); + return E_OUTOFMEMORY; + } + + for (i = 0; i < count; i++) + { + col->pADsValues[i].u.Integer = wcstol(values[i], NULL, 10); + TRACE("%s => %d\n", debugstr_w(values[i]), col->pADsValues[i].u.Integer); + } - case ADSTYPE_OCTET_STRING: + ldap_value_freeW(values); + col->hReserved = NULL; + break; + } + + case ADSTYPE_OCTET_STRING: + { + struct berval **values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name); + if (!values) + { + memset(col, 0, sizeof(*col)); + return E_ADS_COLUMN_NOT_SET; + } + count = ldap_count_values_len(values); + + col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + if (!col->pADsValues) + { + ldap_value_free_len(values); + return E_OUTOFMEMORY; + } + + for (i = 0; i < count; i++) + { TRACE("=> %s\n", debugstr_an(values[i]->bv_val, values[i]->bv_len)); col->pADsValues[i].u.OctetString.dwLength = values[i]->bv_len; col->pADsValues[i].u.OctetString.lpValue = (BYTE *)values[i]->bv_val; - break; } + + col->hReserved = values; + break; + } } col->dwADsType = type; @@ -1382,7 +1458,6 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL LDAP_namespace *ldap = impl_from_IDirectorySearch(iface); struct ldap_search_context *ldap_ctx = res; HRESULT hr; - struct berval **values; ULONG count; TRACE("%p,%p,%s,%p\n", iface, res, debugstr_w(name), col); @@ -1417,6 +1492,7 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL col->dwADsType = ADSTYPE_CASE_IGNORE_STRING; col->dwNumValues = 1; col->pszAttrName = strdupW(name); + col->hReserved = NULL; TRACE("=> %s\n", debugstr_w(col->pADsValues[0].u.CaseIgnoreString)); hr = S_OK; @@ -1425,19 +1501,7 @@ exit: return hr; } - values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name); - if (!values) - { - memset(col, 0, sizeof(*col)); - return E_ADS_COLUMN_NOT_SET; - } - - count = ldap_count_values_len(values); - - hr = add_column_values(ldap, col, name, values, count); - ldap_value_free_len(values); - - return hr; + return add_column_values(ldap, ldap_ctx, name, col); } static HRESULT WINAPI search_FreeColumn(IDirectorySearch *iface, PADS_SEARCH_COLUMN col) @@ -1447,6 +1511,13 @@ static HRESULT WINAPI search_FreeColumn(IDirectorySearch *iface, PADS_SEARCH_COL if (!col) return E_ADS_BAD_PARAMETER; heap_free(col->pADsValues); + if (col->hReserved) + { + if (col->dwADsType == ADSTYPE_OCTET_STRING) + ldap_value_free_len(col->hReserved); + else + ldap_value_freeW(col->hReserved); + } return S_OK; }
1
0
0
0
Dmitry Timoshkov : adsldp: Blacklist serverless and rootDSE connections in QueryInterface(&IID_IDirectorySearch).
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 6ae2d05fb7288f10e43987e566d9e3976e074812 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6ae2d05fb7288f10e43987e5…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Mar 31 18:59:41 2020 +0800 adsldp: Blacklist serverless and rootDSE connections in QueryInterface(&IID_IDirectorySearch). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/adsldp/adsldp.c | 14 +++----------- dlls/adsldp/tests/ldap.c | 6 ++++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index 5ab7948b1f..e0a14f2c70 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -437,6 +437,9 @@ static HRESULT WINAPI ldapns_QueryInterface(IADs *iface, REFIID riid, void **obj if (IsEqualGUID(riid, &IID_IDirectorySearch)) { + if (!ldap->ld || (ldap->object && !wcsicmp(ldap->object, L"rootDSE"))) + return E_NOINTERFACE; + IADs_AddRef(iface); *obj = &ldap->IDirectorySearch_iface; return S_OK; @@ -1167,8 +1170,6 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte TRACE("%p,%s,%p,%u,%p\n", iface, debugstr_w(filter), names, count, res); - if (!ldap->ld) return E_NOTIMPL; - if (!res) return E_ADS_BAD_PARAMETER; ldap_ctx = heap_alloc_zero(sizeof(*ldap_ctx)); @@ -1217,13 +1218,10 @@ static HRESULT WINAPI search_AbandonSearch(IDirectorySearch *iface, ADS_SEARCH_H static HRESULT WINAPI search_GetFirstRow(IDirectorySearch *iface, ADS_SEARCH_HANDLE res) { - LDAP_namespace *ldap = impl_from_IDirectorySearch(iface); struct ldap_search_context *ldap_ctx = res; TRACE("%p,%p\n", iface, res); - if (!ldap->ld) return E_NOTIMPL; - if (!res) return E_ADS_BAD_PARAMETER; ldap_ctx->entry = NULL; @@ -1238,8 +1236,6 @@ static HRESULT WINAPI search_GetNextRow(IDirectorySearch *iface, ADS_SEARCH_HAND TRACE("%p,%p\n", iface, res); - if (!ldap->ld) return E_NOTIMPL; - if (!res) return E_ADS_BAD_PARAMETER; if (!ldap_ctx->entry) @@ -1283,8 +1279,6 @@ static HRESULT WINAPI search_GetNextColumnName(IDirectorySearch *iface, ADS_SEAR TRACE("%p,%p,%p\n", iface, res, name); - if (!ldap->ld) return E_NOTIMPL; - if (!name || !ldap_ctx || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER; if (!ldap_ctx->ber) @@ -1393,8 +1387,6 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL TRACE("%p,%p,%s,%p\n", iface, res, debugstr_w(name), col); - if (!ldap->ld) return E_NOTIMPL; - if (!res || !name || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER; if (!wcsicmp(name, L"ADsPath")) diff --git a/dlls/adsldp/tests/ldap.c b/dlls/adsldp/tests/ldap.c index b3cb489d58..3c1d47755d 100644 --- a/dlls/adsldp/tests/ldap.c +++ b/dlls/adsldp/tests/ldap.c @@ -344,8 +344,10 @@ static void test_DirectorySearch(void) ADS_SEARCH_COLUMN col; LPWSTR name; + hr = ADsGetObject(L"LDAP:", &IID_IDirectorySearch, (void **)&ds); + ok(hr == E_NOINTERFACE, "got %#x\n", hr); + hr = ADsGetObject(L"
LDAP://ldap.forumsys.com/rootDSE
", &IID_IDirectorySearch, (void **)&ds); -todo_wine ok(hr == E_NOINTERFACE, "got %#x\n", hr); hr = ADsGetObject(L"
LDAP://ldap.forumsys.com
", &IID_IDirectorySearch, (void **)&ds); @@ -439,7 +441,7 @@ todo_wine memset(&col, 0x55, sizeof(col)); hr = IDirectorySearch_GetColumn(ds, sh, (WCHAR *)L"deadbeef", &col); ok(hr == E_ADS_COLUMN_NOT_SET, "got %#x\n", hr); - ok(!col.pszAttrName, "got %p\n", col.pszAttrName); + ok(!col.pszAttrName || broken(col.pszAttrName != NULL) /* XP */, "got %p\n", col.pszAttrName); ok(col.dwADsType == ADSTYPE_INVALID || broken(col.dwADsType != ADSTYPE_INVALID) /* XP */, "got %d\n", col.dwADsType); ok(!col.pADsValues, "got %p\n", col.pADsValues); ok(!col.dwNumValues, "got %u\n", col.dwNumValues);
1
0
0
0
Chip Davis : d3d8: Introduce a helper to convert d3d8 primitive types to wined3d types.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 3b5ae3c5fabc32858de68d9dbbecfcf281f6ec73 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b5ae3c5fabc32858de68d9d…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Tue Mar 31 19:57:20 2020 +0430 d3d8: Introduce a helper to convert d3d8 primitive types to wined3d types. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index ea1aec1f6b..cde7664515 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -449,6 +449,11 @@ static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYP return (enum wined3d_render_state)state; } +static enum wined3d_primitive_type wined3d_primitive_type_from_d3d(D3DPRIMITIVETYPE type) +{ + return (enum wined3d_primitive_type)type; +} + /* Handle table functions */ static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type) { @@ -2479,7 +2484,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface, vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count); wined3d_mutex_lock(); d3d8_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); wined3d_mutex_unlock(); @@ -2504,7 +2509,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, base_vertex_index = device->stateblock_state->base_vertex_index; d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count); d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count); wined3d_mutex_unlock(); @@ -2598,7 +2603,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, if (FAILED(hr)) goto done; - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); @@ -2726,7 +2731,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface wined3dformat_from_d3dformat(index_format)); wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
1
0
0
0
Chip Davis : d3d8: Introduce a helper to convert d3d8 render states to wined3d states.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 37e8cf5d451e2d166aacfba5e1826197cac489c5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=37e8cf5d451e2d166aacfba5…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Tue Mar 31 19:57:19 2020 +0430 d3d8: Introduce a helper to convert d3d8 render states to wined3d states. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/device.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 5f929ec0cc..ea1aec1f6b 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -442,6 +442,13 @@ static enum wined3d_transform_state wined3d_transform_state_from_d3d(D3DTRANSFOR return (enum wined3d_transform_state)state; } +static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYPE state) +{ + if (state == D3DRS_ZBIAS) + return WINED3D_RS_DEPTHBIAS; + return (enum wined3d_render_state)state; +} + /* Handle table functions */ static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type) { @@ -1910,9 +1917,7 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); wined3d_mutex_lock(); - if (state == D3DRS_ZBIAS) - state = WINED3D_RS_DEPTHBIAS; - wined3d_stateblock_set_render_state(device->update_state, state, value); + wined3d_stateblock_set_render_state(device->update_state, wined3d_render_state_from_d3d(state), value); if (state == D3DRS_POINTSIZE && value == D3D8_RESZ_CODE) resolve_depth_buffer(device); wined3d_mutex_unlock();
1
0
0
0
Chip Davis : d3d8: Introduce a helper to convert d3d8 transform states to wined3d states.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 20a7056db1f310cb19f9e1c6e12a2476ab87e3df URL:
https://source.winehq.org/git/wine.git/?a=commit;h=20a7056db1f310cb19f9e1c6…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Tue Mar 31 19:57:18 2020 +0430 d3d8: Introduce a helper to convert d3d8 transform states to wined3d states. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/device.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 6c81a41665..5f929ec0cc 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -437,6 +437,11 @@ void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst); } +static enum wined3d_transform_state wined3d_transform_state_from_d3d(D3DTRANSFORMSTATETYPE state) +{ + return (enum wined3d_transform_state)state; +} + /* Handle table functions */ static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type) { @@ -1649,7 +1654,8 @@ static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface, /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_set_transform(device->update_state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_set_transform(device->update_state, + wined3d_transform_state_from_d3d(state), (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); return D3D_OK; @@ -1679,7 +1685,8 @@ static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface, /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_multiply_transform(device->state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_multiply_transform(device->state, + wined3d_transform_state_from_d3d(state), (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); return D3D_OK;
1
0
0
0
Chip Davis : d3d8: Introduce a helper to convert d3d8 device types to wined3d types.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 9937a26b1aa776634ce24dc6554983e36fddd9d5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9937a26b1aa776634ce24dc6…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Tue Mar 31 19:57:17 2020 +0430 d3d8: Introduce a helper to convert d3d8 device types to wined3d types. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/d3d8_private.h | 5 +++++ dlls/d3d8/device.c | 4 ++-- dlls/d3d8/directx.c | 14 +++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 7e772c2b99..04bca7ddfa 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -374,4 +374,9 @@ static inline D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_ return (D3DMULTISAMPLE_TYPE)type; } +static inline enum wined3d_device_type wined3d_device_type_from_d3d(D3DDEVTYPE type) +{ + return (enum wined3d_device_type)type; +} + #endif /* __WINE_D3DX8_PRIVATE_H */ diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 85ceb8f4dc..6c81a41665 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -3722,7 +3722,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(parent->wined3d_outputs[output_idx]); - if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, device_type, + if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type), focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels), &device->device_parent, &device->wined3d_device))) { @@ -3732,7 +3732,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine return hr; } - wined3d_get_device_caps(wined3d_adapter, device_type, &caps); + wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst; diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 874f9ea047..0c0f2ecaad 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -232,8 +232,8 @@ static HRESULT WINAPI d3d8_CheckDeviceType(IDirect3D8 *iface, UINT adapter, D3DD return WINED3DERR_NOTAVAILABLE; wined3d_mutex_lock(); - hr = wined3d_check_device_type(d3d8->wined3d, d3d8->wined3d_outputs[output_idx], device_type, - wined3dformat_from_d3dformat(display_format), + hr = wined3d_check_device_type(d3d8->wined3d, d3d8->wined3d_outputs[output_idx], + wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(display_format), wined3dformat_from_d3dformat(backbuffer_format), windowed); wined3d_mutex_unlock(); @@ -298,13 +298,13 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3 { DWORD levels; - hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, + hr = wined3d_check_device_multisample_type(wined3d_adapter, wined3d_device_type_from_d3d(device_type), WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels); if (SUCCEEDED(hr) && !levels) hr = D3DERR_NOTAVAILABLE; } else - hr = wined3d_check_device_format(d3d8->wined3d, wined3d_adapter, device_type, + hr = wined3d_check_device_format(d3d8->wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(adapter_format), usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock(); @@ -332,7 +332,7 @@ static HRESULT WINAPI d3d8_CheckDeviceMultiSampleType(IDirect3D8 *iface, UINT ad wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, + hr = wined3d_check_device_multisample_type(wined3d_adapter, wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(format), windowed, (enum wined3d_multisample_type)multisample_type, NULL); wined3d_mutex_unlock(); @@ -357,7 +357,7 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type, + hr = wined3d_check_depth_stencil_match(wined3d_adapter, wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(ds_format)); wined3d_mutex_unlock(); @@ -384,7 +384,7 @@ static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEV wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); + hr = wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &wined3d_caps); wined3d_mutex_unlock(); d3dcaps_from_wined3dcaps(caps, &wined3d_caps, adapter);
1
0
0
0
Chip Davis : d3d8: Introduce helpers to convert between d3d8 and wined3d multisample types.
by Alexandre Julliard
31 Mar '20
31 Mar '20
Module: wine Branch: master Commit: 43104e37addab6f281cfc361b05185937a429b2d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=43104e37addab6f281cfc361…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Tue Mar 31 19:57:16 2020 +0430 d3d8: Introduce helpers to convert between d3d8 and wined3d multisample types. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/d3d8_private.h | 5 +++++ dlls/d3d8/device.c | 14 ++++++++++---- dlls/d3d8/surface.c | 2 +- dlls/d3d8/texture.c | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 9352641176..7e772c2b99 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -369,4 +369,9 @@ static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage) return bind_flags; } +static inline D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type) +{ + return (D3DMULTISAMPLE_TYPE)type; +} + #endif /* __WINE_D3DX8_PRIVATE_H */ diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 3b3153c6d4..85ceb8f4dc 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -204,7 +204,7 @@ static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height; present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format); present_parameters->BackBufferCount = swapchain_desc->backbuffer_count; - present_parameters->MultiSampleType = swapchain_desc->multisample_type; + present_parameters->MultiSampleType = d3dmultisample_type_from_wined3d(swapchain_desc->multisample_type); present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect); present_parameters->hDeviceWindow = swapchain_desc->device_window; present_parameters->Windowed = swapchain_desc->windowed; @@ -255,6 +255,11 @@ static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval) } } +static enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type) +{ + return (enum wined3d_multisample_type)type; +} + static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc, const D3DPRESENT_PARAMETERS *present_parameters) { @@ -291,7 +296,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat); swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount); swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET; - swapchain_desc->multisample_type = present_parameters->MultiSampleType; + swapchain_desc->multisample_type = wined3d_multisample_type_from_d3d(present_parameters->MultiSampleType); swapchain_desc->multisample_quality = 0; /* d3d9 only */ swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect); swapchain_desc->device_window = present_parameters->hDeviceWindow; @@ -1263,7 +1268,8 @@ static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UI access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format), - multisample_type, WINED3D_BIND_RENDER_TARGET, access, width, height, surface); + wined3d_multisample_type_from_d3d(multisample_type), + WINED3D_BIND_RENDER_TARGET, access, width, height, surface); } static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface, @@ -1281,7 +1287,7 @@ static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *if *surface = NULL; return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format), - multisample_type, WINED3D_BIND_DEPTH_STENCIL, + wined3d_multisample_type_from_d3d(multisample_type), WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, surface); } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index bbd7e38338..c3d28efba2 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -193,7 +193,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_ desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type); desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index c82a75d87a..f383b374bd 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -255,7 +255,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type); desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; } @@ -602,7 +602,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type); desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; }
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
100
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Results per page:
10
25
50
100
200