Commit 2d852543 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Add a helper function for retrieving a property value from an…

uiautomationcore: Add a helper function for retrieving a property value from an individual node provider. Signed-off-by: 's avatarConnor McAdams <cmcadams@codeweavers.com>
parent 45aca56e
...@@ -381,6 +381,23 @@ int get_node_provider_type_at_idx(struct uia_node *node, int idx) ...@@ -381,6 +381,23 @@ int get_node_provider_type_at_idx(struct uia_node *node, int idx)
return 0; return 0;
} }
static HRESULT get_prop_val_from_node_provider(IWineUiaNode *node, const struct uia_prop_info *prop_info, int idx,
VARIANT *out_val)
{
IWineUiaProvider *prov;
HRESULT hr;
VariantInit(out_val);
hr = IWineUiaNode_get_provider(node, idx, &prov);
if (FAILED(hr))
return hr;
hr = IWineUiaProvider_get_prop_val(prov, prop_info, out_val);
IWineUiaProvider_Release(prov);
return hr;
}
static HRESULT get_prov_opts_from_node_provider(IWineUiaNode *node, int idx, int *out_opts) static HRESULT get_prov_opts_from_node_provider(IWineUiaNode *node, int idx, int *out_opts)
{ {
IWineUiaProvider *prov; IWineUiaProvider *prov;
...@@ -2231,22 +2248,16 @@ BOOL WINAPI UiaNodeRelease(HUIANODE huianode) ...@@ -2231,22 +2248,16 @@ BOOL WINAPI UiaNodeRelease(HUIANODE huianode)
return TRUE; return TRUE;
} }
static HRESULT get_prop_val_from_node_provider(struct uia_node *node, static HRESULT get_prop_val_from_node(struct uia_node *node,
const struct uia_prop_info *prop_info, VARIANT *v) const struct uia_prop_info *prop_info, VARIANT *v)
{ {
IWineUiaProvider *prov;
HRESULT hr = S_OK; HRESULT hr = S_OK;
int i; int i;
VariantInit(v);
for (i = 0; i < node->prov_count; i++) for (i = 0; i < node->prov_count; i++)
{ {
hr = IWineUiaNode_get_provider(&node->IWineUiaNode_iface, i, &prov); hr = get_prop_val_from_node_provider(&node->IWineUiaNode_iface, prop_info, i, v);
if (FAILED(hr))
return hr;
VariantInit(v);
hr = IWineUiaProvider_get_prop_val(prov, prop_info, v);
IWineUiaProvider_Release(prov);
if (FAILED(hr) || V_VT(v) != VT_EMPTY) if (FAILED(hr) || V_VT(v) != VT_EMPTY)
break; break;
} }
...@@ -2301,7 +2312,7 @@ HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIAN ...@@ -2301,7 +2312,7 @@ HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIAN
break; break;
} }
hr = get_prop_val_from_node_provider(node, prop_info, &v); hr = get_prop_val_from_node(node, prop_info, &v);
if (SUCCEEDED(hr) && V_VT(&v) != VT_EMPTY) if (SUCCEEDED(hr) && V_VT(&v) != VT_EMPTY)
{ {
/* /*
...@@ -2440,7 +2451,7 @@ HRESULT WINAPI UiaGetRuntimeId(HUIANODE huianode, SAFEARRAY **runtime_id) ...@@ -2440,7 +2451,7 @@ HRESULT WINAPI UiaGetRuntimeId(HUIANODE huianode, SAFEARRAY **runtime_id)
{ {
VARIANT v; VARIANT v;
hr = get_prop_val_from_node_provider(node, prop_info, &v); hr = get_prop_val_from_node(node, prop_info, &v);
if (FAILED(hr)) if (FAILED(hr))
{ {
VariantClear(&v); VariantClear(&v);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment