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 2023
----- 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
910 discussions
Start a n
N
ew thread
Connor McAdams : uiautomationcore: Implement IUIAutomation::CreateNotCondition.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 078a2c88317417307184aeaacdf58ae6ca822578 URL:
https://gitlab.winehq.org/wine/wine/-/commit/078a2c88317417307184aeaacdf58a…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Mon Mar 6 11:21:46 2023 -0500 uiautomationcore: Implement IUIAutomation::CreateNotCondition. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 78 +++++++++++++++- dlls/uiautomationcore/uia_com_client.c | 144 ++++++++++++++++++++++++++++- 2 files changed, 219 insertions(+), 3 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index ea2fda749a1..34b9df3a329 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10089,16 +10089,46 @@ static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface) SafeArrayDestroy(sa); } +static HRESULT WINAPI Object_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI Object_AddRef(IUnknown *iface) +{ + return 2; +} + +static ULONG WINAPI Object_Release(IUnknown *iface) +{ + return 1; +} + +static IUnknownVtbl ObjectVtbl = { + Object_QueryInterface, + Object_AddRef, + Object_Release +}; +static IUnknown Object = {&ObjectVtbl}; + static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface) { IUIAutomationPropertyCondition *prop_cond; enum PropertyConditionFlags prop_flags; IUIAutomationBoolCondition *bool_cond; + IUIAutomationNotCondition *not_cond; IUIAutomationCondition *cond; PROPERTYID prop_id; BOOL tmp_b; HRESULT hr; VARIANT v; + ULONG ref; hr = IUIAutomation_CreateTrueCondition(uia_iface, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); @@ -10202,7 +10232,53 @@ static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(prop_flags == PropertyConditionFlags_None, "Unexpected flags %#x.\n", prop_flags); - IUIAutomationPropertyCondition_Release(prop_cond); + /* + * IUIAutomationNotCondition tests. + */ + cond = (void *)0xdeadbeef; + + /* + * Passing in an interface that isn't a valid IUIAutomationCondition + * interface. + */ + hr = IUIAutomation_CreateNotCondition(uia_iface, (IUIAutomationCondition *)&Object, &cond); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + ok(!cond, "cond != NULL\n"); + + /* NULL input argument tests. */ + cond = (void *)0xdeadbeef; + hr = IUIAutomation_CreateNotCondition(uia_iface, NULL, &cond); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + ok(!cond, "cond != NULL\n"); + + hr = IUIAutomation_CreateNotCondition(uia_iface, (IUIAutomationCondition *)prop_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + /* Create the IUIAutomationNotCondition with our property condition. */ + cond = NULL; + hr = IUIAutomation_CreateNotCondition(uia_iface, (IUIAutomationCondition *)prop_cond, &cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!cond, "cond == NULL\n"); + + /* IUIAutomationNotCondition holds a reference to the passed in condition. */ + ref = IUIAutomationPropertyCondition_Release(prop_cond); + ok(ref == 1, "Unexpected ref %ld\n", ref); + + hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationNotCondition, (void **)¬_cond); + IUIAutomationCondition_Release(cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!not_cond, "not_cond == NULL\n"); + + hr = IUIAutomationNotCondition_GetChild(not_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + cond = NULL; + hr = IUIAutomationNotCondition_GetChild(not_cond, &cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(iface_cmp((IUnknown *)cond, (IUnknown *)prop_cond), "cond != prop_cond\n"); + IUIAutomationCondition_Release(cond); + + IUIAutomationNotCondition_Release(not_cond); } struct uia_com_classes { diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index c593b76e1d8..e4ea54a3aef 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -23,6 +23,112 @@ WINE_DEFAULT_DEBUG_CHANNEL(uiautomation); +static HRESULT get_uia_condition_struct_from_iface(IUIAutomationCondition *condition, struct UiaCondition **cond_struct); + +/* + * IUIAutomationNotCondition interface. + */ +struct uia_not_condition { + IUIAutomationNotCondition IUIAutomationNotCondition_iface; + LONG ref; + + IUIAutomationCondition *child_iface; + struct UiaNotCondition condition; +}; + +static inline struct uia_not_condition *impl_from_IUIAutomationNotCondition(IUIAutomationNotCondition *iface) +{ + return CONTAINING_RECORD(iface, struct uia_not_condition, IUIAutomationNotCondition_iface); +} + +static HRESULT WINAPI uia_not_condition_QueryInterface(IUIAutomationNotCondition *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUIAutomationNotCondition) || IsEqualIID(riid, &IID_IUIAutomationCondition) || + IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else + return E_NOINTERFACE; + + IUIAutomationNotCondition_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI uia_not_condition_AddRef(IUIAutomationNotCondition *iface) +{ + struct uia_not_condition *uia_not_condition = impl_from_IUIAutomationNotCondition(iface); + ULONG ref = InterlockedIncrement(&uia_not_condition->ref); + + TRACE("%p, refcount %ld\n", uia_not_condition, ref); + return ref; +} + +static ULONG WINAPI uia_not_condition_Release(IUIAutomationNotCondition *iface) +{ + struct uia_not_condition *uia_not_condition = impl_from_IUIAutomationNotCondition(iface); + ULONG ref = InterlockedDecrement(&uia_not_condition->ref); + + TRACE("%p, refcount %ld\n", uia_not_condition, ref); + if (!ref) + { + IUIAutomationCondition_Release(uia_not_condition->child_iface); + heap_free(uia_not_condition); + } + + return ref; +} + +static HRESULT WINAPI uia_not_condition_GetChild(IUIAutomationNotCondition *iface, IUIAutomationCondition **child) +{ + struct uia_not_condition *uia_not_condition = impl_from_IUIAutomationNotCondition(iface); + + TRACE("%p, %p\n", iface, child); + + if (!child) + return E_POINTER; + + IUIAutomationCondition_AddRef(uia_not_condition->child_iface); + *child = uia_not_condition->child_iface; + + return S_OK; +} + +static const IUIAutomationNotConditionVtbl uia_not_condition_vtbl = { + uia_not_condition_QueryInterface, + uia_not_condition_AddRef, + uia_not_condition_Release, + uia_not_condition_GetChild, +}; + +static HRESULT create_uia_not_condition_iface(IUIAutomationCondition **out_cond, IUIAutomationCondition *in_cond) +{ + struct uia_not_condition *uia_not_condition; + struct UiaCondition *cond_struct; + HRESULT hr; + + if (!out_cond) + return E_POINTER; + + *out_cond = NULL; + hr = get_uia_condition_struct_from_iface(in_cond, &cond_struct); + if (FAILED(hr)) + return hr; + + uia_not_condition = heap_alloc_zero(sizeof(*uia_not_condition)); + if (!uia_not_condition) + return E_OUTOFMEMORY; + + uia_not_condition->IUIAutomationNotCondition_iface.lpVtbl = &uia_not_condition_vtbl; + uia_not_condition->condition.ConditionType = ConditionType_Not; + uia_not_condition->condition.pConditions = cond_struct; + uia_not_condition->ref = 1; + uia_not_condition->child_iface = in_cond; + IUIAutomationCondition_AddRef(in_cond); + + *out_cond = (IUIAutomationCondition *)&uia_not_condition->IUIAutomationNotCondition_iface; + return S_OK; +} + /* * IUIAutomationPropertyCondition interface. */ @@ -265,6 +371,39 @@ static HRESULT create_uia_bool_condition_iface(IUIAutomationCondition **out_cond return S_OK; } +static HRESULT get_uia_condition_struct_from_iface(IUIAutomationCondition *condition, struct UiaCondition **cond_struct) +{ + *cond_struct = NULL; + if (!condition) + return E_POINTER; + + if (condition->lpVtbl == (IUIAutomationConditionVtbl *)&uia_bool_condition_vtbl) + { + struct uia_bool_condition *cond; + + cond = impl_from_IUIAutomationBoolCondition((IUIAutomationBoolCondition *)condition); + *cond_struct = &cond->condition; + } + else if (condition->lpVtbl == (IUIAutomationConditionVtbl *)&uia_property_condition_vtbl) + { + struct uia_property_condition *cond; + + cond = impl_from_IUIAutomationPropertyCondition((IUIAutomationPropertyCondition *)condition); + *cond_struct = (struct UiaCondition *)&cond->condition; + } + else if (condition->lpVtbl == (IUIAutomationConditionVtbl *)&uia_not_condition_vtbl) + { + struct uia_not_condition *cond; + + cond = impl_from_IUIAutomationNotCondition((IUIAutomationNotCondition *)condition); + *cond_struct = (struct UiaCondition *)&cond->condition; + } + else + return E_FAIL; + + return S_OK; +} + /* * IUIAutomationElement interface. */ @@ -1531,8 +1670,9 @@ static HRESULT WINAPI uia_iface_CreateOrConditionFromNativeArray(IUIAutomation6 static HRESULT WINAPI uia_iface_CreateNotCondition(IUIAutomation6 *iface, IUIAutomationCondition *cond, IUIAutomationCondition **out_condition) { - FIXME("%p, %p, %p: stub\n", iface, cond, out_condition); - return E_NOTIMPL; + TRACE("%p, %p, %p\n", iface, cond, out_condition); + + return create_uia_not_condition_iface(out_condition, cond); } static HRESULT WINAPI uia_iface_AddAutomationEventHandler(IUIAutomation6 *iface, EVENTID event_id,
1
0
0
0
Connor McAdams : uiautomationcore: Implement IUIAutomation::CreatePropertyCondition.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 6b4ad50c83f01d7ae3775828353c2ac97117f415 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6b4ad50c83f01d7ae3775828353c2a…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Mon Mar 6 10:53:44 2023 -0500 uiautomationcore: Implement IUIAutomation::CreatePropertyCondition. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 64 ++++++++++++ dlls/uiautomationcore/uia_com_client.c | 155 ++++++++++++++++++++++++++++- 2 files changed, 217 insertions(+), 2 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index cdff9c4b573..ea2fda749a1 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10091,10 +10091,14 @@ static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface) static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface) { + IUIAutomationPropertyCondition *prop_cond; + enum PropertyConditionFlags prop_flags; IUIAutomationBoolCondition *bool_cond; IUIAutomationCondition *cond; + PROPERTYID prop_id; BOOL tmp_b; HRESULT hr; + VARIANT v; hr = IUIAutomation_CreateTrueCondition(uia_iface, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); @@ -10139,6 +10143,66 @@ static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(tmp_b == FALSE, "tmp_b != FALSE\n"); IUIAutomationBoolCondition_Release(bool_cond); + + /* + * IUIAutomationPropertyCondition tests. + */ + cond = (void *)0xdeadbeef; + VariantInit(&v); + /* Invalid property ID. */ + hr = IUIAutomation_CreatePropertyCondition(uia_iface, 0, v, &cond); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + ok(!cond, "cond != NULL\n"); + + /* Invalid variant type for property ID. */ + cond = (void *)0xdeadbeef; + VariantInit(&v); + hr = IUIAutomation_CreatePropertyCondition(uia_iface, UIA_RuntimeIdPropertyId, v, &cond); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + ok(!cond, "cond != NULL\n"); + + /* NULL Condition argument. */ + V_VT(&v) = VT_I4 | VT_ARRAY; + V_ARRAY(&v) = create_i4_safearray(); + hr = IUIAutomation_CreatePropertyCondition(uia_iface, UIA_RuntimeIdPropertyId, v, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + /* Finally, create property condition interface. */ + cond = NULL; + hr = IUIAutomation_CreatePropertyCondition(uia_iface, UIA_RuntimeIdPropertyId, v, &cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!cond, "cond == NULL\n"); + + hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationPropertyCondition, (void **)&prop_cond); + IUIAutomationCondition_Release(cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!prop_cond, "prop_cond == NULL\n"); + + hr = IUIAutomationPropertyCondition_get_PropertyId(prop_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + hr = IUIAutomationPropertyCondition_get_PropertyId(prop_cond, &prop_id); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(prop_id == UIA_RuntimeIdPropertyId, "Unexpected prop_id %d.\n", prop_id); + + hr = IUIAutomationPropertyCondition_get_PropertyValue(prop_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + VariantClear(&v); + hr = IUIAutomationPropertyCondition_get_PropertyValue(prop_cond, &v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&v) == (VT_I4 | VT_ARRAY), "Unexpected vt %d.\n", V_VT(&v)); + ok(!!V_ARRAY(&v), "V_ARRAY(&v) == NULL\n"); + VariantClear(&v); + + hr = IUIAutomationPropertyCondition_get_PropertyConditionFlags(prop_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + hr = IUIAutomationPropertyCondition_get_PropertyConditionFlags(prop_cond, &prop_flags); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(prop_flags == PropertyConditionFlags_None, "Unexpected flags %#x.\n", prop_flags); + + IUIAutomationPropertyCondition_Release(prop_cond); } struct uia_com_classes { diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index 74f10b56f67..c593b76e1d8 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -23,6 +23,156 @@ WINE_DEFAULT_DEBUG_CHANNEL(uiautomation); +/* + * IUIAutomationPropertyCondition interface. + */ +struct uia_property_condition { + IUIAutomationPropertyCondition IUIAutomationPropertyCondition_iface; + LONG ref; + + struct UiaPropertyCondition condition; +}; + +static inline struct uia_property_condition *impl_from_IUIAutomationPropertyCondition(IUIAutomationPropertyCondition *iface) +{ + return CONTAINING_RECORD(iface, struct uia_property_condition, IUIAutomationPropertyCondition_iface); +} + +static HRESULT WINAPI uia_property_condition_QueryInterface(IUIAutomationPropertyCondition *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUIAutomationPropertyCondition) || IsEqualIID(riid, &IID_IUIAutomationCondition) || + IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else + return E_NOINTERFACE; + + IUIAutomationPropertyCondition_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI uia_property_condition_AddRef(IUIAutomationPropertyCondition *iface) +{ + struct uia_property_condition *uia_property_condition = impl_from_IUIAutomationPropertyCondition(iface); + ULONG ref = InterlockedIncrement(&uia_property_condition->ref); + + TRACE("%p, refcount %ld\n", uia_property_condition, ref); + return ref; +} + +static ULONG WINAPI uia_property_condition_Release(IUIAutomationPropertyCondition *iface) +{ + struct uia_property_condition *uia_property_condition = impl_from_IUIAutomationPropertyCondition(iface); + ULONG ref = InterlockedDecrement(&uia_property_condition->ref); + + TRACE("%p, refcount %ld\n", uia_property_condition, ref); + + if (!ref) + { + VariantClear(&uia_property_condition->condition.Value); + heap_free(uia_property_condition); + } + + return ref; +} + +static HRESULT WINAPI uia_property_condition_get_PropertyId(IUIAutomationPropertyCondition *iface, PROPERTYID *prop_id) +{ + struct uia_property_condition *uia_property_condition = impl_from_IUIAutomationPropertyCondition(iface); + + TRACE("%p, %p\n", iface, prop_id); + + if (!prop_id) + return E_POINTER; + + *prop_id = uia_property_condition->condition.PropertyId; + + return S_OK; +} + +static HRESULT WINAPI uia_property_condition_get_PropertyValue(IUIAutomationPropertyCondition *iface, VARIANT *val) +{ + struct uia_property_condition *uia_property_condition = impl_from_IUIAutomationPropertyCondition(iface); + + TRACE("%p, %p\n", iface, val); + + if (!val) + return E_POINTER; + + VariantCopy(val, &uia_property_condition->condition.Value); + + return S_OK; +} + +static HRESULT WINAPI uia_property_condition_get_PropertyConditionFlags(IUIAutomationPropertyCondition *iface, + enum PropertyConditionFlags *flags) +{ + struct uia_property_condition *uia_property_condition = impl_from_IUIAutomationPropertyCondition(iface); + + TRACE("%p, %p\n", iface, flags); + + if (!flags) + return E_POINTER; + + *flags = uia_property_condition->condition.Flags; + + return S_OK; +} + +static const IUIAutomationPropertyConditionVtbl uia_property_condition_vtbl = { + uia_property_condition_QueryInterface, + uia_property_condition_AddRef, + uia_property_condition_Release, + uia_property_condition_get_PropertyId, + uia_property_condition_get_PropertyValue, + uia_property_condition_get_PropertyConditionFlags, +}; + +static HRESULT create_uia_property_condition_iface(IUIAutomationCondition **out_cond, PROPERTYID prop_id, VARIANT val, + enum PropertyConditionFlags prop_flags) +{ + const struct uia_prop_info *prop_info = uia_prop_info_from_id(prop_id); + struct uia_property_condition *uia_property_condition; + + if (!out_cond) + return E_POINTER; + + *out_cond = NULL; + if (!prop_info) + return E_INVALIDARG; + + switch (prop_info->type) + { + case UIAutomationType_Bool: + if (V_VT(&val) != VT_BOOL) + return E_INVALIDARG; + break; + + case UIAutomationType_IntArray: + if (V_VT(&val) != (VT_I4 | VT_ARRAY)) + return E_INVALIDARG; + break; + + default: + FIXME("Property condition evaluation for property type %#x unimplemented\n", prop_info->type); + return E_NOTIMPL; + } + + uia_property_condition = heap_alloc_zero(sizeof(*uia_property_condition)); + if (!uia_property_condition) + return E_OUTOFMEMORY; + + uia_property_condition->IUIAutomationPropertyCondition_iface.lpVtbl = &uia_property_condition_vtbl; + uia_property_condition->condition.ConditionType = ConditionType_Property; + uia_property_condition->condition.PropertyId = prop_id; + VariantCopy(&uia_property_condition->condition.Value, &val); + uia_property_condition->condition.Flags = prop_flags; + uia_property_condition->ref = 1; + + *out_cond = (IUIAutomationCondition *)&uia_property_condition->IUIAutomationPropertyCondition_iface; + return S_OK; +} + /* * IUIAutomationBoolCondition interface. */ @@ -1324,8 +1474,9 @@ static HRESULT WINAPI uia_iface_CreateFalseCondition(IUIAutomation6 *iface, IUIA static HRESULT WINAPI uia_iface_CreatePropertyCondition(IUIAutomation6 *iface, PROPERTYID prop_id, VARIANT val, IUIAutomationCondition **out_condition) { - FIXME("%p, %d, %s, %p: stub\n", iface, prop_id, debugstr_variant(&val), out_condition); - return E_NOTIMPL; + TRACE("%p, %d, %s, %p\n", iface, prop_id, debugstr_variant(&val), out_condition); + + return create_uia_property_condition_iface(out_condition, prop_id, val, PropertyConditionFlags_None); } static HRESULT WINAPI uia_iface_CreatePropertyConditionEx(IUIAutomation6 *iface, PROPERTYID prop_id, VARIANT val,
1
0
0
0
Connor McAdams : uiautomationcore: Implement IUIAutomation::Create{True,False}Condition.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 6adae23d98efd33bd444e9bff7f690dbd25d7fea URL:
https://gitlab.winehq.org/wine/wine/-/commit/6adae23d98efd33bd444e9bff7f690…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Mon Mar 6 10:46:31 2023 -0500 uiautomationcore: Implement IUIAutomation::Create{True,False}Condition. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 53 +++++++++++++++ dlls/uiautomationcore/uia_com_client.c | 102 +++++++++++++++++++++++++++-- 2 files changed, 151 insertions(+), 4 deletions(-) diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index b33a09d4f11..cdff9c4b573 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -10089,6 +10089,58 @@ static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface) SafeArrayDestroy(sa); } +static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface) +{ + IUIAutomationBoolCondition *bool_cond; + IUIAutomationCondition *cond; + BOOL tmp_b; + HRESULT hr; + + hr = IUIAutomation_CreateTrueCondition(uia_iface, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + cond = NULL; + hr = IUIAutomation_CreateTrueCondition(uia_iface, &cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!cond, "cond == NULL\n"); + + hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationBoolCondition, (void **)&bool_cond); + IUIAutomationCondition_Release(cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!bool_cond, "bool_cond == NULL\n"); + + hr = IUIAutomationBoolCondition_get_BooleanValue(bool_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + tmp_b = FALSE; + hr = IUIAutomationBoolCondition_get_BooleanValue(bool_cond, &tmp_b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(tmp_b == TRUE, "tmp_b != TRUE\n"); + IUIAutomationBoolCondition_Release(bool_cond); + + hr = IUIAutomation_CreateFalseCondition(uia_iface, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + cond = NULL; + hr = IUIAutomation_CreateFalseCondition(uia_iface, &cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!cond, "cond == NULL\n"); + + hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationBoolCondition, (void **)&bool_cond); + IUIAutomationCondition_Release(cond); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!bool_cond, "bool_cond == NULL\n"); + + hr = IUIAutomationBoolCondition_get_BooleanValue(bool_cond, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + tmp_b = TRUE; + hr = IUIAutomationBoolCondition_get_BooleanValue(bool_cond, &tmp_b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(tmp_b == FALSE, "tmp_b != FALSE\n"); + IUIAutomationBoolCondition_Release(bool_cond); +} + struct uia_com_classes { const GUID *clsid; const GUID *iid; @@ -10187,6 +10239,7 @@ static void test_CUIAutomation(void) IUnknown_Release(unk1); IUnknown_Release(unk2); + test_CUIAutomation_condition_ifaces(uia_iface); test_CUIAutomation_value_conversion(uia_iface); test_ElementFromHandle(uia_iface, has_cui8); test_Element_GetPropertyValue(uia_iface); diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index f8fdfaa6505..74f10b56f67 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -23,6 +23,98 @@ WINE_DEFAULT_DEBUG_CHANNEL(uiautomation); +/* + * IUIAutomationBoolCondition interface. + */ +struct uia_bool_condition { + IUIAutomationBoolCondition IUIAutomationBoolCondition_iface; + LONG ref; + + struct UiaCondition condition; +}; + +static inline struct uia_bool_condition *impl_from_IUIAutomationBoolCondition(IUIAutomationBoolCondition *iface) +{ + return CONTAINING_RECORD(iface, struct uia_bool_condition, IUIAutomationBoolCondition_iface); +} + +static HRESULT WINAPI uia_bool_condition_QueryInterface(IUIAutomationBoolCondition *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUIAutomationBoolCondition) || IsEqualIID(riid, &IID_IUIAutomationCondition) || + IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else + return E_NOINTERFACE; + + IUIAutomationBoolCondition_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI uia_bool_condition_AddRef(IUIAutomationBoolCondition *iface) +{ + struct uia_bool_condition *uia_bool_condition = impl_from_IUIAutomationBoolCondition(iface); + ULONG ref = InterlockedIncrement(&uia_bool_condition->ref); + + TRACE("%p, refcount %ld\n", uia_bool_condition, ref); + return ref; +} + +static ULONG WINAPI uia_bool_condition_Release(IUIAutomationBoolCondition *iface) +{ + struct uia_bool_condition *uia_bool_condition = impl_from_IUIAutomationBoolCondition(iface); + ULONG ref = InterlockedDecrement(&uia_bool_condition->ref); + + TRACE("%p, refcount %ld\n", uia_bool_condition, ref); + if (!ref) + heap_free(uia_bool_condition); + + return ref; +} + +static HRESULT WINAPI uia_bool_condition_get_BooleanValue(IUIAutomationBoolCondition *iface, BOOL *ret_val) +{ + struct uia_bool_condition *uia_bool_condition = impl_from_IUIAutomationBoolCondition(iface); + + TRACE("%p, %p\n", iface, ret_val); + + if (!ret_val) + return E_POINTER; + + if (uia_bool_condition->condition.ConditionType == ConditionType_True) + *ret_val = TRUE; + else + *ret_val = FALSE; + + return S_OK; +} + +static const IUIAutomationBoolConditionVtbl uia_bool_condition_vtbl = { + uia_bool_condition_QueryInterface, + uia_bool_condition_AddRef, + uia_bool_condition_Release, + uia_bool_condition_get_BooleanValue, +}; + +static HRESULT create_uia_bool_condition_iface(IUIAutomationCondition **out_cond, enum ConditionType cond_type) +{ + struct uia_bool_condition *uia_bool_condition; + + if (!out_cond) + return E_POINTER; + + uia_bool_condition = heap_alloc_zero(sizeof(*uia_bool_condition)); + if (!uia_bool_condition) + return E_OUTOFMEMORY; + + uia_bool_condition->IUIAutomationBoolCondition_iface.lpVtbl = &uia_bool_condition_vtbl; + uia_bool_condition->condition.ConditionType = cond_type; + uia_bool_condition->ref = 1; + + *out_cond = (IUIAutomationCondition *)&uia_bool_condition->IUIAutomationBoolCondition_iface; + return S_OK; +} + /* * IUIAutomationElement interface. */ @@ -1217,14 +1309,16 @@ static HRESULT WINAPI uia_iface_CreateCacheRequest(IUIAutomation6 *iface, IUIAut static HRESULT WINAPI uia_iface_CreateTrueCondition(IUIAutomation6 *iface, IUIAutomationCondition **out_condition) { - FIXME("%p, %p: stub\n", iface, out_condition); - return E_NOTIMPL; + TRACE("%p, %p\n", iface, out_condition); + + return create_uia_bool_condition_iface(out_condition, ConditionType_True); } static HRESULT WINAPI uia_iface_CreateFalseCondition(IUIAutomation6 *iface, IUIAutomationCondition **out_condition) { - FIXME("%p, %p: stub\n", iface, out_condition); - return E_NOTIMPL; + TRACE("%p, %p\n", iface, out_condition); + + return create_uia_bool_condition_iface(out_condition, ConditionType_False); } static HRESULT WINAPI uia_iface_CreatePropertyCondition(IUIAutomation6 *iface, PROPERTYID prop_id, VARIANT val,
1
0
0
0
Anton Baskanov : ir50_32: Handle 24-bit output media type.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 0a1a5015d0b475d3208c21ea8bd9eb45bdf8c1bb URL:
https://gitlab.winehq.org/wine/wine/-/commit/0a1a5015d0b475d3208c21ea8bd9eb…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Mon Mar 6 15:35:02 2023 +0700 ir50_32: Handle 24-bit output media type. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47407
--- dlls/ir50_32/ir50.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 87807aba25f..ccd7f245772 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -95,7 +95,7 @@ IV50_DecompressQuery( LPBITMAPINFO in, LPBITMAPINFO out ) return ICERR_BADFORMAT; } - if ( out->bmiHeader.biBitCount != 32 && out->bmiHeader.biBitCount != 16 ) + if ( out->bmiHeader.biBitCount != 32 && out->bmiHeader.biBitCount != 24 && out->bmiHeader.biBitCount != 16 ) { TRACE("incompatible depth requested\n"); return ICERR_BADFORMAT; @@ -153,6 +153,8 @@ static LRESULT IV50_DecompressBegin( IMFTransform *decoder, LPBITMAPINFO in, LPB if ( out->bmiHeader.biBitCount == 32 ) output_subtype = &MFVideoFormat_RGB32; + else if ( out->bmiHeader.biBitCount == 24 ) + output_subtype = &MFVideoFormat_RGB24; else if ( out->bmiHeader.biBitCount == 16 ) output_subtype = &MFVideoFormat_RGB555; else
1
0
0
0
Davide Beatrici : mmdevapi: Move test_connect handling into mmdevapi.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: a20e1df90e2c78c7abfd2766cb1df0366da2ece3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/a20e1df90e2c78c7abfd2766cb1df0…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Mar 3 05:13:34 2023 +0100 mmdevapi: Move test_connect handling into mmdevapi. --- dlls/mmdevapi/main.c | 18 +++++++++++++++--- dlls/mmdevapi/mmdevapi.h | 5 ++--- dlls/winealsa.drv/mmdevdrv.c | 5 ----- dlls/winealsa.drv/winealsa.drv.spec | 1 - dlls/winecoreaudio.drv/mmdevdrv.c | 5 ----- dlls/winecoreaudio.drv/winecoreaudio.drv.spec | 1 - dlls/wineoss.drv/mmdevdrv.c | 11 ----------- dlls/wineoss.drv/wineoss.drv.spec | 1 - dlls/winepulse.drv/mmdevdrv.c | 11 ----------- dlls/winepulse.drv/winepulse.drv.spec | 1 - 10 files changed, 17 insertions(+), 42 deletions(-) diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index d71b7948428..179c18e422d 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -18,6 +18,7 @@ */ #include <stdarg.h> +#include <wchar.h> #include "ntstatus.h" #define COBJMACROS @@ -68,7 +69,8 @@ static const char *get_priority_string(int prio) static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) { NTSTATUS status; - WCHAR driver_module[264]; + WCHAR driver_module[264], path[MAX_PATH]; + struct test_connect_params params; lstrcpyW(driver_module, L"wine"); lstrcatW(driver_module, name); @@ -96,7 +98,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ if(!driver->p##n) { goto fail; } } while(0) - LDFC(GetPriority); LDFC(GetEndpointIDs); LDFC(GetAudioEndpoint); LDFC(GetAudioSessionManager); @@ -105,7 +106,18 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) /* optional - do not fail if not found */ driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue"); - driver->priority = driver->pGetPriority(); + GetModuleFileNameW(NULL, path, ARRAY_SIZE(path)); + params.name = wcsrchr(path, '\\'); + params.name = params.name ? params.name + 1 : path; + params.priority = Priority_Neutral; + + if ((status = __wine_unix_call(driver->module_unixlib, test_connect, ¶ms))) { + ERR("Unable to retrieve driver priority: %lx\n", status); + goto fail; + } + + driver->priority = params.priority; + lstrcpyW(driver->module_name, driver_module); TRACE("Successfully loaded %s with priority %s\n", diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h index 16eb3606fea..cd5b5a25a55 100644 --- a/dlls/mmdevapi/mmdevapi.h +++ b/dlls/mmdevapi/mmdevapi.h @@ -30,13 +30,12 @@ typedef struct _DriverFuncs { HMODULE module; unixlib_handle_t module_unixlib; WCHAR module_name[64]; - int priority; - /* Returns a "priority" value for the driver. Highest priority wins. + /* Highest priority wins. * If multiple drivers think they are valid, they will return a * priority value reflecting the likelihood that they are actually * valid. See enum _DriverPriority. */ - int (WINAPI *pGetPriority)(void); + int priority; /* ids gets an array of human-friendly endpoint names * keys gets an array of driver-specific stuff that is used diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index ea48143005b..fb81faf9d00 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -212,11 +212,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; } -int WINAPI AUDDRV_GetPriority(void) -{ - return Priority_Neutral; -} - static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread) { struct release_stream_params params; diff --git a/dlls/winealsa.drv/winealsa.drv.spec b/dlls/winealsa.drv/winealsa.drv.spec index bd83ea2e765..d846ade8ce2 100644 --- a/dlls/winealsa.drv/winealsa.drv.spec +++ b/dlls/winealsa.drv/winealsa.drv.spec @@ -4,7 +4,6 @@ @ stdcall -private modMessage(long long long long long) ALSA_modMessage # MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 367f7ba0ab8..877c1f7c3bc 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -213,11 +213,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; } -int WINAPI AUDDRV_GetPriority(void) -{ - return Priority_Neutral; -} - static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name, GUID *guid) { diff --git a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec index 9d9f781cf4e..1dfbfb79eb9 100644 --- a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec +++ b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec @@ -4,7 +4,6 @@ @ stdcall -private modMessage(long long long long long) CoreAudio_modMessage # MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 7411f87a4d7..6993fa88d0a 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -226,17 +226,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; } -int WINAPI AUDDRV_GetPriority(void) -{ - struct test_connect_params params; - - params.name = NULL; - - OSS_CALL(test_connect, ¶ms); - - return params.priority; -} - static HRESULT stream_release(stream_handle stream, HANDLE timer_thread) { struct release_stream_params params; diff --git a/dlls/wineoss.drv/wineoss.drv.spec b/dlls/wineoss.drv/wineoss.drv.spec index fe6cc518c33..a093649e982 100644 --- a/dlls/wineoss.drv/wineoss.drv.spec +++ b/dlls/wineoss.drv/wineoss.drv.spec @@ -5,7 +5,6 @@ @ stdcall -private modMessage(long long long long long) OSS_modMessage # MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 9a6939e959c..20fa08d3fa7 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -467,17 +467,6 @@ end: return params.result; } -int WINAPI AUDDRV_GetPriority(void) -{ - struct test_connect_params params; - WCHAR *name; - - params.name = name = get_application_name(FALSE); - pulse_call(test_connect, ¶ms); - free(name); - return params.priority; -} - static BOOL get_pulse_name_by_guid(const GUID *guid, char pulse_name[MAX_PULSE_NAME_LEN], EDataFlow *flow) { struct device_cache *device; diff --git a/dlls/winepulse.drv/winepulse.drv.spec b/dlls/winepulse.drv/winepulse.drv.spec index 7aeb1756ed1..b822fd08353 100644 --- a/dlls/winepulse.drv/winepulse.drv.spec +++ b/dlls/winepulse.drv/winepulse.drv.spec @@ -1,5 +1,4 @@ # MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
1
0
0
0
Davide Beatrici : mmdevapi: Use UTF-16 for client name in "test_connect_params" and "create_stream_params" structs.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: ec9aab2c467b0556f2ef679ef912055c6a77c2fc URL:
https://gitlab.winehq.org/wine/wine/-/commit/ec9aab2c467b0556f2ef679ef91205…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Mar 3 05:09:20 2023 +0100 mmdevapi: Use UTF-16 for client name in "test_connect_params" and "create_stream_params" structs. The conversion to another encoding is now up to the unixlib. --- dlls/mmdevapi/unixlib.h | 4 ++-- dlls/winepulse.drv/mmdevdrv.c | 23 ++++++----------------- dlls/winepulse.drv/pulse.c | 21 +++++++++++++++++++-- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/dlls/mmdevapi/unixlib.h b/dlls/mmdevapi/unixlib.h index ea0d2f9c4b9..37b4c53cb35 100644 --- a/dlls/mmdevapi/unixlib.h +++ b/dlls/mmdevapi/unixlib.h @@ -53,7 +53,7 @@ struct get_endpoint_ids_params struct create_stream_params { - const char *name; + const WCHAR *name; const char *device; EDataFlow flow; AUDCLNT_SHAREMODE share; @@ -219,7 +219,7 @@ struct set_event_handle_params struct test_connect_params { - const char *name; + const WCHAR *name; enum driver_priority priority; }; diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 99dbe24c82f..9a6939e959c 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -23,6 +23,7 @@ #include <stdarg.h> #include <assert.h> +#include <wchar.h> #include "windef.h" #include "winbase.h" @@ -247,11 +248,9 @@ static BOOL query_productname(void *data, LANGANDCODEPAGE *lang, LPVOID *buffer, return VerQueryValueW(data, pn, buffer, len) && *len; } -static char *get_application_name(BOOL query_app_name) +static WCHAR *get_application_name(BOOL query_app_name) { WCHAR path[MAX_PATH], *name; - char *str = NULL; - size_t len; GetModuleFileNameW(NULL, path, ARRAY_SIZE(path)); @@ -327,15 +326,9 @@ static char *get_application_name(BOOL query_app_name) } } - if (found) { - len = WideCharToMultiByte(CP_UTF8, 0, productname, -1, NULL, 0, NULL, NULL); - str = malloc(len); - if (str) WideCharToMultiByte(CP_UTF8, 0, productname, -1, str, len, NULL, NULL); - } - skip: free(data); - if (str) return str; + if (found) return wcsdup(productname); } name = wcsrchr(path, '\\'); @@ -343,11 +336,7 @@ static char *get_application_name(BOOL query_app_name) name = path; else name++; - len = WideCharToMultiByte(CP_UTF8, 0, name, -1, NULL, 0, NULL, NULL); - if (!(str = malloc(len))) - return NULL; - WideCharToMultiByte(CP_UNIXCP, 0, name, -1, str, len, NULL, NULL); - return str; + return wcsdup(name); } static DWORD WINAPI pulse_timer_cb(void *user) @@ -481,7 +470,7 @@ end: int WINAPI AUDDRV_GetPriority(void) { struct test_connect_params params; - char *name; + WCHAR *name; params.name = name = get_application_name(FALSE); pulse_call(test_connect, ¶ms); @@ -817,7 +806,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, struct create_stream_params params; unsigned int i, channel_count; stream_handle stream; - char *name; + WCHAR *name; HRESULT hr; TRACE("(%p)->(%x, %lx, %s, %s, %p, %s)\n", This, mode, flags, diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 900b77415a8..28afb5b788d 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -196,6 +196,14 @@ static int muldiv(int a, int b, int c) return ret; } +static char *wstr_to_str(const WCHAR *wstr) +{ + const int len = wcslen(wstr); + char *str = malloc(len * 3 + 1); + ntdll_wcstoumbs(wstr, len + 1, str, len * 3 + 1, FALSE); + return str; +} + /* Following pulseaudio design here, mainloop has the lock taken whenever * it is handling something for pulse, and the lock is required whenever * doing any pa_* call that can affect the state in any way @@ -765,13 +773,17 @@ static NTSTATUS pulse_test_connect(void *args) PhysDevice *dev; pa_operation *o; int ret; + char *name = wstr_to_str(params->name); pulse_lock(); pulse_ml = pa_mainloop_new(); pa_mainloop_set_poll_func(pulse_ml, pulse_poll_func, NULL); - pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), params->name); + pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), name); + + free(name); + if (!pulse_ctx) { ERR("Failed to create context\n"); pa_mainloop_free(pulse_ml); @@ -1104,10 +1116,15 @@ static NTSTATUS pulse_create_stream(void *args) struct pulse_stream *stream; unsigned int i, bufsize_bytes; HRESULT hr; + char *name = wstr_to_str(params->name); pulse_lock(); - if (FAILED(params->result = pulse_connect(params->name))) + params->result = pulse_connect(name); + + free(name); + + if (FAILED(params->result)) { pulse_unlock(); return STATUS_SUCCESS;
1
0
0
0
Davide Beatrici : winepulse: Move process_attach and process_detach handling into mmdevapi.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 3cc61002a830f57dcd9dc762099c3e87d4b37248 URL:
https://gitlab.winehq.org/wine/wine/-/commit/3cc61002a830f57dcd9dc762099c3e…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Mar 3 02:31:44 2023 +0100 winepulse: Move process_attach and process_detach handling into mmdevapi. --- dlls/mmdevapi/main.c | 18 +++++++++++++++--- dlls/winepulse.drv/mmdevdrv.c | 4 +--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index b019d2e427c..d71b7948428 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -19,7 +19,9 @@ #include <stdarg.h> +#include "ntstatus.h" #define COBJMACROS +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "wingdi.h" @@ -87,6 +89,11 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) goto fail; } + if ((status = __wine_unix_call(driver->module_unixlib, process_attach, NULL))) { + ERR("Unable to initialize library: %lx\n", status); + goto fail; + } + #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ if(!driver->p##n) { goto fail; } } while(0) LDFC(GetPriority); @@ -177,9 +184,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: - if(lpvReserved) - break; - MMDevEnum_Free(); + if (drvs.module_unixlib) { + const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, process_detach, NULL); + if (status) + WARN("Unable to deinitialize library: %lx\n", status); + } + + if (!lpvReserved) + MMDevEnum_Free(); break; } diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 5de9a941099..99dbe24c82f 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -87,14 +87,12 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) DisableThreadLibraryCalls(dll); if (__wine_init_unix_call()) return FALSE; - if (WINE_UNIX_CALL(process_attach, NULL)) - return FALSE; } else if (reason == DLL_PROCESS_DETACH) { struct device_cache *device, *device_next; LIST_FOR_EACH_ENTRY_SAFE(device, device_next, &g_devices_cache, struct device_cache, entry) free(device); - WINE_UNIX_CALL(process_detach, NULL); + if (pulse_thread) { WaitForSingleObject(pulse_thread, INFINITE); CloseHandle(pulse_thread);
1
0
0
0
Davide Beatrici : mmdevapi: Query MemoryWineUnixFuncs virtual memory and store the resulting handle.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 0888d2242df7a5fb310cd9473465fbfe3374a615 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0888d2242df7a5fb310cd9473465fb…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Sat Mar 4 02:31:53 2023 +0100 mmdevapi: Query MemoryWineUnixFuncs virtual memory and store the resulting handle. In preparation for calling the audio driver's UNIX functions directly. --- dlls/mmdevapi/main.c | 12 +++++++++++- dlls/mmdevapi/mmdevapi.h | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index c792661af33..b019d2e427c 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -65,6 +65,7 @@ static const char *get_priority_string(int prio) static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) { + NTSTATUS status; WCHAR driver_module[264]; lstrcpyW(driver_module, L"wine"); @@ -80,8 +81,14 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) return FALSE; } + if ((status = NtQueryVirtualMemory(GetCurrentProcess(), driver->module, MemoryWineUnixFuncs, + &driver->module_unixlib, sizeof(driver->module_unixlib), NULL))) { + ERR("Unable to load UNIX functions: %lx\n", status); + goto fail; + } + #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ - if(!driver->p##n) { FreeLibrary(driver->module); return FALSE; } } while(0) + if(!driver->p##n) { goto fail; } } while(0) LDFC(GetPriority); LDFC(GetEndpointIDs); LDFC(GetAudioEndpoint); @@ -98,6 +105,9 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) wine_dbgstr_w(driver_module), get_priority_string(driver->priority)); return TRUE; +fail: + FreeLibrary(driver->module); + return FALSE; } static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context) diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h index d694a3930aa..16eb3606fea 100644 --- a/dlls/mmdevapi/mmdevapi.h +++ b/dlls/mmdevapi/mmdevapi.h @@ -18,13 +18,17 @@ #include "unixlib.h" +#include <winternl.h> + #include <wine/list.h> +#include <wine/unixlib.h> extern HRESULT MMDevEnum_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN; extern void MMDevEnum_Free(void) DECLSPEC_HIDDEN; typedef struct _DriverFuncs { HMODULE module; + unixlib_handle_t module_unixlib; WCHAR module_name[64]; int priority;
1
0
0
0
Davide Beatrici : winepulse: Return STATUS_SUCCESS for unused unixlib functions.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: c24df1bb6c918cef355585cea16ef5f631efd01a URL:
https://gitlab.winehq.org/wine/wine/-/commit/c24df1bb6c918cef355585cea16ef5…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Mar 3 01:56:39 2023 +0100 winepulse: Return STATUS_SUCCESS for unused unixlib functions. --- dlls/winepulse.drv/pulse.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 9446feb452c..900b77415a8 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -119,6 +119,11 @@ static const REFERENCE_TIME DefaultPeriod = 100000; static pthread_mutex_t pulse_mutex; static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER; +static NTSTATUS pulse_not_implemented(void *args) +{ + return STATUS_SUCCESS; +} + static void pulse_lock(void) { pthread_mutex_lock(&pulse_mutex); @@ -2373,7 +2378,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_release_render_buffer, pulse_get_capture_buffer, pulse_release_capture_buffer, - NULL, + pulse_not_implemented, pulse_get_mix_format, pulse_get_device_period, pulse_get_buffer_size, @@ -2387,12 +2392,12 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_test_connect, pulse_is_started, pulse_get_prop_value, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, }; #ifdef _WIN64 @@ -2820,7 +2825,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_release_render_buffer, pulse_wow64_get_capture_buffer, pulse_release_capture_buffer, - NULL, + pulse_not_implemented, pulse_wow64_get_mix_format, pulse_wow64_get_device_period, pulse_wow64_get_buffer_size, @@ -2834,12 +2839,12 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_wow64_test_connect, pulse_is_started, pulse_wow64_get_prop_value, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, }; #endif /* _WIN64 */
1
0
0
0
Davide Beatrici : wineoss: Return STATUS_SUCCESS for unused unixlib functions.
by Alexandre Julliard
06 Mar '23
06 Mar '23
Module: wine Branch: master Commit: 09fd62b3d4f65b05cf1e14dafcadcdff91bb0557 URL:
https://gitlab.winehq.org/wine/wine/-/commit/09fd62b3d4f65b05cf1e14dafcadcd…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Mar 3 01:56:39 2023 +0100 wineoss: Return STATUS_SUCCESS for unused unixlib functions. --- dlls/wineoss.drv/oss.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 4bc8bc20666..65ca42c3182 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -69,6 +69,11 @@ struct oss_stream WINE_DEFAULT_DEBUG_CHANNEL(oss); +static NTSTATUS oss_not_implemented(void *args) +{ + return STATUS_SUCCESS; +} + /* copied from kernelbase */ static int muldiv( int a, int b, int c ) { @@ -1612,9 +1617,9 @@ static NTSTATUS oss_aux_message(void *args) unixlib_entry_t __wine_unix_call_funcs[] = { - NULL, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, + oss_not_implemented, oss_get_endpoint_ids, oss_create_stream, oss_release_stream, @@ -1628,7 +1633,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = oss_release_capture_buffer, oss_is_format_supported, oss_get_mix_format, - NULL, + oss_not_implemented, oss_get_buffer_size, oss_get_latency, oss_get_current_padding, @@ -1639,8 +1644,8 @@ unixlib_entry_t __wine_unix_call_funcs[] = oss_set_event_handle, oss_test_connect, oss_is_started, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, oss_midi_release, oss_midi_out_message, oss_midi_in_message, @@ -2016,9 +2021,9 @@ static NTSTATUS oss_wow64_aux_message(void *args) unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - NULL, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, + oss_not_implemented, oss_wow64_get_endpoint_ids, oss_wow64_create_stream, oss_wow64_release_stream, @@ -2032,7 +2037,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_release_capture_buffer, oss_wow64_is_format_supported, oss_wow64_get_mix_format, - NULL, + oss_not_implemented, oss_wow64_get_buffer_size, oss_wow64_get_latency, oss_wow64_get_current_padding, @@ -2043,8 +2048,8 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_wow64_set_event_handle, oss_wow64_test_connect, oss_is_started, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, oss_midi_release, oss_wow64_midi_out_message, oss_wow64_midi_in_message,
1
0
0
0
← Newer
1
...
81
82
83
84
85
86
87
...
91
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
Results per page:
10
25
50
100
200