From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/tests/uiautomation.c | 72 +++-- dlls/uiautomationcore/uia_classes.idl | 1 + dlls/uiautomationcore/uia_client.c | 334 +++++++++++++++++++-- dlls/uiautomationcore/uia_ids.c | 105 +++---- dlls/uiautomationcore/uia_private.h | 6 + 5 files changed, 406 insertions(+), 112 deletions(-)
diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index 8d8821fb946..9f60a874df0 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -4570,20 +4570,20 @@ static void test_UiaGetPropertyValue(void) }
static const struct prov_method_sequence get_runtime_id1[] = { - { &Provider_child, FRAG_GET_RUNTIME_ID, METHOD_TODO }, + { &Provider_child, FRAG_GET_RUNTIME_ID }, { 0 } };
static const struct prov_method_sequence get_runtime_id2[] = { - { &Provider_child, FRAG_GET_RUNTIME_ID, METHOD_TODO }, - { &Provider_child, FRAG_GET_FRAGMENT_ROOT, METHOD_TODO }, + { &Provider_child, FRAG_GET_RUNTIME_ID }, + { &Provider_child, FRAG_GET_FRAGMENT_ROOT }, { 0 } };
static const struct prov_method_sequence get_runtime_id3[] = { - { &Provider_child, FRAG_GET_RUNTIME_ID, METHOD_TODO }, - { &Provider_child, FRAG_GET_FRAGMENT_ROOT, METHOD_TODO }, - { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider_child, FRAG_GET_RUNTIME_ID }, + { &Provider_child, FRAG_GET_FRAGMENT_ROOT }, + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER }, /* Not called on Windows 7. */ { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ /* Only called on Win8+. */ @@ -4595,9 +4595,9 @@ static const struct prov_method_sequence get_runtime_id3[] = { };
static const struct prov_method_sequence get_runtime_id4[] = { - { &Provider_child, FRAG_GET_RUNTIME_ID, METHOD_TODO }, - { &Provider_child, FRAG_GET_FRAGMENT_ROOT, METHOD_TODO }, - { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider_child, FRAG_GET_RUNTIME_ID }, + { &Provider_child, FRAG_GET_FRAGMENT_ROOT }, + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER }, /* Not called on Windows 7. */ { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ /* These methods are only called on Win8+. */ @@ -4608,10 +4608,10 @@ static const struct prov_method_sequence get_runtime_id4[] = { };
static const struct prov_method_sequence get_runtime_id5[] = { - { &Provider_child, FRAG_GET_RUNTIME_ID, METHOD_TODO }, - { &Provider_child, FRAG_GET_FRAGMENT_ROOT, METHOD_TODO }, - { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, - { &Provider, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + { &Provider_child, FRAG_GET_RUNTIME_ID }, + { &Provider_child, FRAG_GET_FRAGMENT_ROOT }, + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER }, + { &Provider, PROV_GET_PROVIDER_OPTIONS }, { 0 } };
@@ -4620,6 +4620,7 @@ static void test_UiaGetRuntimeId(void) const int root_prov_opts[] = { ProviderOptions_ServerSideProvider, ProviderOptions_ServerSideProvider | ProviderOptions_OverrideProvider, ProviderOptions_ClientSideProvider | ProviderOptions_NonClientAreaProvider }; int rt_id[4], tmp, i; + IUnknown *unk_ns; SAFEARRAY *sa; WNDCLASSA cls; HUIANODE node; @@ -4644,6 +4645,9 @@ static void test_UiaGetRuntimeId(void) hwnd = CreateWindowA("UiaGetRuntimeId class", "Test window", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
+ hr = UiaGetReservedNotSupportedValue(&unk_ns); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + CoInitializeEx(NULL, COINIT_MULTITHREADED); Provider.prov_opts = Provider2.prov_opts = Provider_child.prov_opts = ProviderOptions_ServerSideProvider; Provider.hwnd = Provider2.hwnd = Provider_child.hwnd = NULL; @@ -4666,7 +4670,7 @@ static void test_UiaGetRuntimeId(void) Provider_child.runtime_id[0] = Provider_child.runtime_id[1] = 0; sa = (void *)0xdeadbeef; hr = UiaGetRuntimeId(node, &sa); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!sa, "sa != NULL\n"); ok_method_sequence(get_runtime_id1, "get_runtime_id1");
@@ -4675,10 +4679,9 @@ static void test_UiaGetRuntimeId(void) Provider_child.runtime_id[1] = rt_id[1] = 2; sa = (void *)0xdeadbeef; hr = UiaGetRuntimeId(node, &sa); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(!!sa, "sa == NULL\n"); - if (sa) - check_runtime_id(rt_id, 2, sa); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!sa, "sa == NULL\n"); + check_runtime_id(rt_id, 2, sa); SafeArrayDestroy(sa); ok_method_sequence(get_runtime_id1, "get_runtime_id1");
@@ -4702,10 +4705,21 @@ static void test_UiaGetRuntimeId(void) /* Provider_child has no fragment root for UiaAppendRuntimeId. */ hr = UiaGetRuntimeId(node, &sa); /* Windows 7 returns S_OK. */ - todo_wine ok(hr == E_FAIL || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr); + ok(hr == E_FAIL || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr); ok(!sa, "sa != NULL\n"); ok_method_sequence(get_runtime_id2, "get_runtime_id2");
+ /* + * UIA_RuntimeIdPropertyId won't return a failure code from + * UiaGetPropertyValue. + */ + hr = UiaGetPropertyValue(node, UIA_RuntimeIdPropertyId, &v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&v) == VT_UNKNOWN, "Unexpected vt %d\n", V_VT(&v)); + ok(V_UNKNOWN(&v) == unk_ns, "unexpected IUnknown %p\n", V_UNKNOWN(&v)); + VariantClear(&v); + ok_method_sequence(get_runtime_id2, "get_runtime_id2"); + /* * Provider_child returns a fragment root that doesn't expose an HWND. On * Win8+, fragment roots are navigated recursively until either a NULL @@ -4722,7 +4736,7 @@ static void test_UiaGetRuntimeId(void) sa = (void *)0xdeadbeef; hr = UiaGetRuntimeId(node, &sa); /* Windows 7 returns S_OK. */ - todo_wine ok(hr == E_FAIL || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr); + ok(hr == E_FAIL || broken(hr == S_OK), "Unexpected hr %#lx.\n", hr); ok(!sa, "sa != NULL\n"); ok_method_sequence(get_runtime_id3, "get_runtime_id3");
@@ -4735,9 +4749,9 @@ static void test_UiaGetRuntimeId(void) Provider_child.runtime_id[1] = rt_id[3] = 2; sa = NULL; hr = UiaGetRuntimeId(node, &sa); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); /* Windows 7 returns a NULL RuntimeId due to no fragment recursion. */ - todo_wine ok(!!sa || broken(!sa), "sa == NULL\n"); + ok(!!sa || broken(!sa), "sa == NULL\n"); SafeArrayDestroy(sa);
ok_method_sequence(get_runtime_id4, "get_runtime_id4"); @@ -4756,21 +4770,21 @@ static void test_UiaGetRuntimeId(void) Provider.prov_opts = root_prov_opts[i]; sa = NULL; hr = UiaGetRuntimeId(node, &sa); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(!!sa, "sa == NULL\n"); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!sa, "sa == NULL\n");
hr = SafeArrayGetLBound(sa, 1, &lbound); - todo_wine ok(hr == S_OK, "Failed to get LBound with hr %#lx\n", hr); + ok(hr == S_OK, "Failed to get LBound with hr %#lx\n", hr);
lbound = lbound + 2; hr = SafeArrayGetElement(sa, &lbound, &tmp); - todo_wine ok(hr == S_OK, "Failed to get element with hr %#lx\n", hr); - if (i && SUCCEEDED(hr)) + ok(hr == S_OK, "Failed to get element with hr %#lx\n", hr); + if (i) ok(rt_id[2] != tmp, "Expected different runtime id value from previous\n");
rt_id[2] = tmp; - if (sa) - check_runtime_id(rt_id, 4, sa); + check_runtime_id(rt_id, 4, sa); + SafeArrayDestroy(sa); ok_method_sequence(get_runtime_id5, "get_runtime_id5"); } diff --git a/dlls/uiautomationcore/uia_classes.idl b/dlls/uiautomationcore/uia_classes.idl index 8a627b92041..f7d3bb90c73 100644 --- a/dlls/uiautomationcore/uia_classes.idl +++ b/dlls/uiautomationcore/uia_classes.idl @@ -23,6 +23,7 @@ import "oaidl.idl"; struct uia_prop_info { const GUID *guid; int prop_id; + int prop_type; int type; };
diff --git a/dlls/uiautomationcore/uia_client.c b/dlls/uiautomationcore/uia_client.c index 8e672b048a5..0cbcc45761a 100644 --- a/dlls/uiautomationcore/uia_client.c +++ b/dlls/uiautomationcore/uia_client.c @@ -23,6 +23,32 @@
WINE_DEFAULT_DEBUG_CHANNEL(uiautomation);
+static HRESULT get_safearray_bounds(SAFEARRAY *sa, LONG *lbound, LONG *elems) +{ + LONG ubound; + HRESULT hr; + UINT dims; + + *lbound = *elems = 0; + dims = SafeArrayGetDim(sa); + if (!dims || (dims > 1)) + { + WARN("Invalid dimensions %d for safearray.\n", dims); + return E_FAIL; + } + + hr = SafeArrayGetLBound(sa, 1, lbound); + if (FAILED(hr)) + return hr; + + hr = SafeArrayGetUBound(sa, 1, &ubound); + if (FAILED(hr)) + return hr; + + *elems = (ubound - (*lbound)) + 1; + return S_OK; +} + static void clear_uia_node_ptr_safearray(SAFEARRAY *sa, LONG elems) { HUIANODE node; @@ -40,28 +66,14 @@ static void clear_uia_node_ptr_safearray(SAFEARRAY *sa, LONG elems)
static void create_uia_node_safearray(VARIANT *in, VARIANT *out) { - LONG i, idx, lbound, ubound, elems; + LONG i, idx, lbound, elems; HUIANODE node; SAFEARRAY *sa; HRESULT hr; - UINT dims; - - dims = SafeArrayGetDim(V_ARRAY(in)); - if (!dims || (dims > 1)) - { - WARN("Invalid dimensions %d for element safearray.\n", dims); - return; - }
- hr = SafeArrayGetLBound(V_ARRAY(in), 1, &lbound); - if (FAILED(hr)) + if (FAILED(get_safearray_bounds(V_ARRAY(in), &lbound, &elems))) return;
- hr = SafeArrayGetUBound(V_ARRAY(in), 1, &ubound); - if (FAILED(hr)) - return; - - elems = (ubound - lbound) + 1; if (!(sa = SafeArrayCreateVector(VT_UINT_PTR, 0, elems))) return;
@@ -191,6 +203,69 @@ static HWND get_hwnd_from_provider(IRawElementProviderSimple *elprov) return hwnd; }
+static IRawElementProviderSimple *get_provider_hwnd_fragment_root(IRawElementProviderSimple *elprov, HWND *hwnd) +{ + IRawElementProviderFragmentRoot *elroot, *elroot2; + IRawElementProviderSimple *elprov2, *ret; + IRawElementProviderFragment *elfrag; + HRESULT hr; + int depth; + + *hwnd = NULL; + + hr = IRawElementProviderSimple_QueryInterface(elprov, &IID_IRawElementProviderFragment, (void **)&elfrag); + if (FAILED(hr) || !elfrag) + return NULL; + + depth = 0; + ret = NULL; + elroot = elroot2 = NULL; + + /* + * Recursively walk up the fragment root chain until: + * We get a fragment root that has an HWND associated with it. + * We get a NULL fragment root. + * We get the same fragment root as the current fragment root. + * We've gone up the chain ten times. + */ + while (depth < 10) + { + hr = IRawElementProviderFragment_get_FragmentRoot(elfrag, &elroot); + IRawElementProviderFragment_Release(elfrag); + if (FAILED(hr) || !elroot || (elroot == elroot2)) + break; + + hr = IRawElementProviderFragmentRoot_QueryInterface(elroot, &IID_IRawElementProviderSimple, (void **)&elprov2); + if (FAILED(hr) || !elprov2) + break; + + *hwnd = get_hwnd_from_provider(elprov2); + if (IsWindow(*hwnd)) + { + ret = elprov2; + break; + } + + hr = IRawElementProviderSimple_QueryInterface(elprov2, &IID_IRawElementProviderFragment, (void **)&elfrag); + IRawElementProviderSimple_Release(elprov2); + if (FAILED(hr) || !elfrag) + break; + + if (elroot2) + IRawElementProviderFragmentRoot_Release(elroot2); + elroot2 = elroot; + elroot = NULL; + depth++; + } + + if (elroot) + IRawElementProviderFragmentRoot_Release(elroot); + if (elroot2) + IRawElementProviderFragmentRoot_Release(elroot2); + + return ret; +} + /* * IWineUiaNode interface. */ @@ -368,15 +443,12 @@ static void get_variant_for_node(HUIANODE node, VARIANT *v) #endif }
-static HRESULT WINAPI uia_provider_get_prop_val(IWineUiaProvider *iface, +static HRESULT uia_provider_get_elem_prop_val(struct uia_provider *prov, const struct uia_prop_info *prop_info, VARIANT *ret_val) { - struct uia_provider *prov = impl_from_IWineUiaProvider(iface); HRESULT hr; VARIANT v;
- TRACE("%p, %p, %p\n", iface, prop_info, ret_val); - VariantInit(&v); hr = IRawElementProviderSimple_GetPropertyValue(prov->elprov, prop_info->prop_id, &v); if (FAILED(hr)) @@ -486,6 +558,100 @@ exit: return S_OK; }
+static SAFEARRAY *append_uia_runtime_id(SAFEARRAY *sa, HWND hwnd, enum ProviderOptions root_opts); +static HRESULT uia_provider_get_special_prop_val(struct uia_provider *prov, + const struct uia_prop_info *prop_info, VARIANT *ret_val) +{ + HRESULT hr; + + switch (prop_info->prop_id) + { + case UIA_RuntimeIdPropertyId: + { + IRawElementProviderFragment *elfrag; + SAFEARRAY *sa; + LONG lbound; + int val; + + hr = IRawElementProviderSimple_QueryInterface(prov->elprov, &IID_IRawElementProviderFragment, (void **)&elfrag); + if (FAILED(hr) || !elfrag) + break; + + hr = IRawElementProviderFragment_GetRuntimeId(elfrag, &sa); + IRawElementProviderFragment_Release(elfrag); + if (FAILED(hr) || !sa) + break; + + hr = SafeArrayGetLBound(sa, 1, &lbound); + if (FAILED(hr)) + { + SafeArrayDestroy(sa); + break; + } + + hr = SafeArrayGetElement(sa, &lbound, &val); + if (FAILED(hr)) + { + SafeArrayDestroy(sa); + break; + } + + if (val == UiaAppendRuntimeId) + { + enum ProviderOptions prov_opts = 0; + IRawElementProviderSimple *elprov; + HWND hwnd; + + elprov = get_provider_hwnd_fragment_root(prov->elprov, &hwnd); + if (!elprov) + { + SafeArrayDestroy(sa); + return E_FAIL; + } + + hr = IRawElementProviderSimple_get_ProviderOptions(elprov, &prov_opts); + IRawElementProviderSimple_Release(elprov); + if (FAILED(hr)) + WARN("get_ProviderOptions for root provider failed with %#lx\n", hr); + + if (!(sa = append_uia_runtime_id(sa, hwnd, prov_opts))) + break; + } + + V_VT(ret_val) = VT_I4 | VT_ARRAY; + V_ARRAY(ret_val) = sa; + break; + } + + default: + break; + } + + return S_OK; +} + +static HRESULT WINAPI uia_provider_get_prop_val(IWineUiaProvider *iface, + const struct uia_prop_info *prop_info, VARIANT *ret_val) +{ + struct uia_provider *prov = impl_from_IWineUiaProvider(iface); + + TRACE("%p, %p, %p\n", iface, prop_info, ret_val); + + switch (prop_info->prop_type) + { + case PROP_TYPE_ELEM_PROP: + return uia_provider_get_elem_prop_val(prov, prop_info, ret_val); + + case PROP_TYPE_SPECIAL: + return uia_provider_get_special_prop_val(prov, prop_info, ret_val); + + default: + break; + } + + return S_OK; +} + static const IWineUiaProviderVtbl uia_provider_vtbl = { uia_provider_QueryInterface, uia_provider_AddRef, @@ -597,6 +763,23 @@ BOOL WINAPI UiaNodeRelease(HUIANODE huianode) return TRUE; }
+static HRESULT get_prop_val_from_node_provider(struct uia_node *node, + const struct uia_prop_info *prop_info, VARIANT *v) +{ + IWineUiaProvider *prov; + HRESULT hr; + + hr = IWineUiaNode_get_provider(&node->IWineUiaNode_iface, &prov); + if (FAILED(hr)) + return hr; + + VariantInit(v); + hr = IWineUiaProvider_get_prop_val(prov, prop_info, v); + IWineUiaProvider_Release(prov); + + return hr; +} + /*********************************************************************** * UiaGetPropertyValue (uiautomationcore.@) */ @@ -604,7 +787,6 @@ HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIAN { struct uia_node *node = unsafe_impl_from_IWineUiaNode((IWineUiaNode *)huianode); const struct uia_prop_info *prop_info; - IWineUiaProvider *prov; HRESULT hr; VARIANT v;
@@ -626,12 +808,26 @@ HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIAN return E_NOTIMPL; }
- hr = IWineUiaNode_get_provider(&node->IWineUiaNode_iface, &prov); - if (FAILED(hr)) - return hr; + switch (prop_id) + { + case UIA_RuntimeIdPropertyId: + { + SAFEARRAY *sa;
- VariantInit(&v); - hr = IWineUiaProvider_get_prop_val(prov, prop_info, &v); + hr = UiaGetRuntimeId(huianode, &sa); + if (SUCCEEDED(hr) && sa) + { + V_VT(out_val) = VT_I4 | VT_ARRAY; + V_ARRAY(out_val) = sa; + } + return S_OK; + } + + default: + break; + } + + hr = get_prop_val_from_node_provider(node, prop_info, &v); if (SUCCEEDED(hr) && V_VT(&v) != VT_EMPTY) { /* @@ -649,12 +845,17 @@ HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIAN *out_val = v; }
- IWineUiaProvider_Release(prov); - - return S_OK; + return hr; }
#define UIA_RUNTIME_ID_PREFIX 42 + +enum fragment_root_prov_type_ids { + FRAGMENT_ROOT_NONCLIENT_TYPE_ID = 0x03, + FRAGMENT_ROOT_MAIN_TYPE_ID = 0x04, + FRAGMENT_ROOT_OVERRIDE_TYPE_ID = 0x05, +}; + static HRESULT write_runtime_id_base(SAFEARRAY *sa, HWND hwnd) { const int rt_id[2] = { UIA_RUNTIME_ID_PREFIX, HandleToUlong(hwnd) }; @@ -671,15 +872,72 @@ static HRESULT write_runtime_id_base(SAFEARRAY *sa, HWND hwnd) return S_OK; }
+static SAFEARRAY *append_uia_runtime_id(SAFEARRAY *sa, HWND hwnd, enum ProviderOptions root_opts) +{ + LONG i, idx, lbound, elems; + SAFEARRAY *sa2, *ret; + HRESULT hr; + int val; + + ret = sa2 = NULL; + hr = get_safearray_bounds(sa, &lbound, &elems); + if (FAILED(hr)) + goto exit; + + /* elems includes the UiaAppendRuntimeId value, so we only add 2. */ + if (!(sa2 = SafeArrayCreateVector(VT_I4, 0, elems + 2))) + goto exit; + + hr = write_runtime_id_base(sa2, hwnd); + if (FAILED(hr)) + goto exit; + + if (root_opts & ProviderOptions_NonClientAreaProvider) + val = FRAGMENT_ROOT_NONCLIENT_TYPE_ID; + else if (root_opts & ProviderOptions_OverrideProvider) + val = FRAGMENT_ROOT_OVERRIDE_TYPE_ID; + else + val = FRAGMENT_ROOT_MAIN_TYPE_ID; + + idx = 2; + hr = SafeArrayPutElement(sa2, &idx, &val); + if (FAILED(hr)) + goto exit; + + for (i = 0; i < (elems - 1); i++) + { + idx = (lbound + 1) + i; + hr = SafeArrayGetElement(sa, &idx, &val); + if (FAILED(hr)) + goto exit; + + idx = (3 + i); + hr = SafeArrayPutElement(sa2, &idx, &val); + if (FAILED(hr)) + goto exit; + } + + ret = sa2; + +exit: + + if (!ret) + SafeArrayDestroy(sa2); + + SafeArrayDestroy(sa); + return ret; +} + /*********************************************************************** * UiaGetRuntimeId (uiautomationcore.@) */ HRESULT WINAPI UiaGetRuntimeId(HUIANODE huianode, SAFEARRAY **runtime_id) { + const struct uia_prop_info *prop_info = uia_prop_info_from_id(UIA_RuntimeIdPropertyId); struct uia_node *node = unsafe_impl_from_IWineUiaNode((IWineUiaNode *)huianode); HRESULT hr;
- FIXME("(%p, %p): partial stub\n", huianode, runtime_id); + TRACE("(%p, %p)\n", huianode, runtime_id);
if (!node || !runtime_id) return E_INVALIDARG; @@ -704,6 +962,20 @@ HRESULT WINAPI UiaGetRuntimeId(HUIANODE huianode, SAFEARRAY **runtime_id) *runtime_id = sa; return S_OK; } + else + { + VARIANT v; + + hr = get_prop_val_from_node_provider(node, prop_info, &v); + if (FAILED(hr)) + { + VariantClear(&v); + return hr; + } + + if (V_VT(&v) == (VT_I4 | VT_ARRAY)) + *runtime_id = V_ARRAY(&v); + }
- return E_NOTIMPL; + return S_OK; } diff --git a/dlls/uiautomationcore/uia_ids.c b/dlls/uiautomationcore/uia_ids.c index 7cfde7f4c29..a3a60c8aec9 100644 --- a/dlls/uiautomationcore/uia_ids.c +++ b/dlls/uiautomationcore/uia_ids.c @@ -33,9 +33,9 @@ static int __cdecl uia_property_guid_compare(const void *a, const void *b) /* Sorted by GUID. */ static const struct uia_prop_info default_uia_properties[] = { { &AutomationId_Property_GUID, UIA_AutomationIdPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &FrameworkId_Property_GUID, UIA_FrameworkIdPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &IsTransformPatternAvailable_Property_GUID, UIA_IsTransformPatternAvailablePropertyId, }, { &IsScrollItemPatternAvailable_Property_GUID, UIA_IsScrollItemPatternAvailablePropertyId, }, { &IsExpandCollapsePatternAvailable_Property_GUID, UIA_IsExpandCollapsePatternAvailablePropertyId, }, @@ -43,24 +43,24 @@ static const struct uia_prop_info default_uia_properties[] = { { &IsTableItemPatternAvailable_Property_GUID, UIA_IsTableItemPatternAvailablePropertyId, }, { &Scroll_HorizontalScrollPercent_Property_GUID, UIA_ScrollHorizontalScrollPercentPropertyId, }, { &AccessKey_Property_GUID, UIA_AccessKeyPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &RangeValue_Maximum_Property_GUID, UIA_RangeValueMaximumPropertyId, }, { &ClassName_Property_GUID, UIA_ClassNamePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Transform2_ZoomMinimum_Property_GUID, UIA_Transform2ZoomMinimumPropertyId, }, { &LegacyIAccessible_Description_Property_GUID, UIA_LegacyIAccessibleDescriptionPropertyId, }, { &Transform2_ZoomLevel_Property_GUID, UIA_Transform2ZoomLevelPropertyId, }, { &Name_Property_GUID, UIA_NamePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &GridItem_RowSpan_Property_GUID, UIA_GridItemRowSpanPropertyId, }, { &Size_Property_GUID, UIA_SizePropertyId, - UIAutomationType_DoubleArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_DoubleArray, }, { &IsTextPattern2Available_Property_GUID, UIA_IsTextPattern2AvailablePropertyId, }, { &Styles_FillPatternStyle_Property_GUID, UIA_StylesFillPatternStylePropertyId, }, { &FlowsTo_Property_GUID, UIA_FlowsToPropertyId, - UIAutomationType_ElementArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_ElementArray, }, { &ItemStatus_Property_GUID, UIA_ItemStatusPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Scroll_VerticalViewSize_Property_GUID, UIA_ScrollVerticalViewSizePropertyId, }, { &Selection_IsSelectionRequired_Property_GUID, UIA_SelectionIsSelectionRequiredPropertyId, }, { &IsGridItemPatternAvailable_Property_GUID, UIA_IsGridItemPatternAvailablePropertyId, }, @@ -68,12 +68,12 @@ static const struct uia_prop_info default_uia_properties[] = { { &RangeValue_LargeChange_Property_GUID, UIA_RangeValueLargeChangePropertyId, }, { &Selection2_CurrentSelectedItem_Property_GUID, UIA_Selection2CurrentSelectedItemPropertyId, }, { &Culture_Property_GUID, UIA_CulturePropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &LegacyIAccessible_DefaultAction_Property_GUID, UIA_LegacyIAccessibleDefaultActionPropertyId, }, { &Level_Property_GUID, UIA_LevelPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &IsKeyboardFocusable_Property_GUID, UIA_IsKeyboardFocusablePropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &GridItem_Row_Property_GUID, UIA_GridItemRowPropertyId, }, { &IsSpreadsheetItemPatternAvailable_Property_GUID, UIA_IsSpreadsheetItemPatternAvailablePropertyId, }, { &Table_ColumnHeaders_Property_GUID, UIA_TableColumnHeadersPropertyId, }, @@ -90,12 +90,12 @@ static const struct uia_prop_info default_uia_properties[] = { { &SpreadsheetItem_AnnotationObjects_Property_GUID, UIA_SpreadsheetItemAnnotationObjectsPropertyId, }, { &IsInvokePatternAvailable_Property_GUID, UIA_IsInvokePatternAvailablePropertyId, }, { &HasKeyboardFocus_Property_GUID, UIA_HasKeyboardFocusPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &ClickablePoint_Property_GUID, UIA_ClickablePointPropertyId, }, { &NewNativeWindowHandle_Property_GUID, UIA_NativeWindowHandlePropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &SizeOfSet_Property_GUID, UIA_SizeOfSetPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &LegacyIAccessible_Name_Property_GUID, UIA_LegacyIAccessibleNamePropertyId, }, { &Window_CanMaximize_Property_GUID, UIA_WindowCanMaximizePropertyId, }, { &Scroll_HorizontallyScrollable_Property_GUID, UIA_ScrollHorizontallyScrollablePropertyId, }, @@ -105,17 +105,17 @@ static const struct uia_prop_info default_uia_properties[] = { { &IsScrollPatternAvailable_Property_GUID, UIA_IsScrollPatternAvailablePropertyId, }, { &IsTransformPattern2Available_Property_GUID, UIA_IsTransformPattern2AvailablePropertyId, }, { &LabeledBy_Property_GUID, UIA_LabeledByPropertyId, - UIAutomationType_Element, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Element, }, { &ItemType_Property_GUID, UIA_ItemTypePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Transform_CanMove_Property_GUID, UIA_TransformCanMovePropertyId, }, { &LocalizedControlType_Property_GUID, UIA_LocalizedControlTypePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Annotation_AnnotationTypeId_Property_GUID, UIA_AnnotationAnnotationTypeIdPropertyId, }, { &FlowsFrom_Property_GUID, UIA_FlowsFromPropertyId, - UIAutomationType_ElementArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_ElementArray, }, { &OptimizeForVisualContent_Property_GUID, UIA_OptimizeForVisualContentPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &IsVirtualizedItemPatternAvailable_Property_GUID, UIA_IsVirtualizedItemPatternAvailablePropertyId, }, { &GridItem_Parent_Property_GUID, UIA_GridItemContainingGridPropertyId, }, { &LegacyIAccessible_Help_Property_GUID, UIA_LegacyIAccessibleHelpPropertyId, }, @@ -123,7 +123,7 @@ static const struct uia_prop_info default_uia_properties[] = { { &IsTogglePatternAvailable_Property_GUID, UIA_IsTogglePatternAvailablePropertyId, }, { &LegacyIAccessible_State_Property_GUID, UIA_LegacyIAccessibleStatePropertyId, }, { &PositionInSet_Property_GUID, UIA_PositionInSetPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &RangeValue_IsReadOnly_Property_GUID, UIA_RangeValueIsReadOnlyPropertyId, }, { &Drag_DropEffects_Property_GUID, UIA_DragDropEffectsPropertyId, }, { &RangeValue_SmallChange_Property_GUID, UIA_RangeValueSmallChangePropertyId, }, @@ -135,63 +135,63 @@ static const struct uia_prop_info default_uia_properties[] = { { &SelectionItem_IsSelected_Property_GUID, UIA_SelectionItemIsSelectedPropertyId, }, { &Window_WindowVisualState_Property_GUID, UIA_WindowWindowVisualStatePropertyId, }, { &IsOffscreen_Property_GUID, UIA_IsOffscreenPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &Annotation_Author_Property_GUID, UIA_AnnotationAuthorPropertyId, }, { &Orientation_Property_GUID, UIA_OrientationPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &Value_Value_Property_GUID, UIA_ValueValuePropertyId, }, { &VisualEffects_Property_GUID, UIA_VisualEffectsPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &Selection2_FirstSelectedItem_Property_GUID, UIA_Selection2FirstSelectedItemPropertyId, }, { &IsGridPatternAvailable_Property_GUID, UIA_IsGridPatternAvailablePropertyId, }, { &SelectionItem_SelectionContainer_Property_GUID, UIA_SelectionItemSelectionContainerPropertyId, }, { &HeadingLevel_Property_GUID, UIA_HeadingLevelPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &DropTarget_DropTargetEffect_Property_GUID, UIA_DropTargetDropTargetEffectPropertyId, }, { &Grid_ColumnCount_Property_GUID, UIA_GridColumnCountPropertyId, }, { &AnnotationTypes_Property_GUID, UIA_AnnotationTypesPropertyId, - UIAutomationType_IntArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_IntArray, }, { &IsPeripheral_Property_GUID, UIA_IsPeripheralPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &Transform2_ZoomMaximum_Property_GUID, UIA_Transform2ZoomMaximumPropertyId, }, { &Drag_DropEffect_Property_GUID, UIA_DragDropEffectPropertyId, }, { &MultipleView_CurrentView_Property_GUID, UIA_MultipleViewCurrentViewPropertyId, }, { &Styles_FillColor_Property_GUID, UIA_StylesFillColorPropertyId, }, { &Rotation_Property_GUID, UIA_RotationPropertyId, - UIAutomationType_Double, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Double, }, { &SpreadsheetItem_Formula_Property_GUID, UIA_SpreadsheetItemFormulaPropertyId, }, { &IsEnabled_Property_GUID, UIA_IsEnabledPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &LocalizedLandmarkType_Property_GUID, UIA_LocalizedLandmarkTypePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &IsDataValidForForm_Property_GUID, UIA_IsDataValidForFormPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &IsControlElement_Property_GUID, UIA_IsControlElementPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &HelpText_Property_GUID, UIA_HelpTextPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Table_RowHeaders_Property_GUID, UIA_TableRowHeadersPropertyId, }, { &ControllerFor_Property_GUID, UIA_ControllerForPropertyId, - UIAutomationType_ElementArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_ElementArray, }, { &ProviderDescription_Property_GUID, UIA_ProviderDescriptionPropertyId, }, { &AriaProperties_Property_GUID, UIA_AriaPropertiesPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &LiveSetting_Property_GUID, UIA_LiveSettingPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &Selection2_LastSelectedItem_Property_GUID, UIA_Selection2LastSelectedItemPropertyId, }, { &Transform2_CanZoom_Property_GUID, UIA_Transform2CanZoomPropertyId, }, { &Window_IsModal_Property_GUID, UIA_WindowIsModalPropertyId, }, { &Annotation_AnnotationTypeName_Property_GUID, UIA_AnnotationAnnotationTypeNamePropertyId, }, { &AriaRole_Property_GUID, UIA_AriaRolePropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &Scroll_VerticallyScrollable_Property_GUID, UIA_ScrollVerticallyScrollablePropertyId, }, { &RangeValue_Value_Property_GUID, UIA_RangeValueValuePropertyId, }, { &ProcessId_Property_GUID, UIA_ProcessIdPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &Scroll_VerticalScrollPercent_Property_GUID, UIA_ScrollVerticalScrollPercentPropertyId, }, { &IsObjectModelPatternAvailable_Property_GUID, UIA_IsObjectModelPatternAvailablePropertyId, }, { &IsDialog_Property_GUID, UIA_IsDialogPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &IsTextPatternAvailable_Property_GUID, UIA_IsTextPatternAvailablePropertyId, }, { &LegacyIAccessible_Role_Property_GUID, UIA_LegacyIAccessibleRolePropertyId, }, { &Selection2_ItemCount_Property_GUID, UIA_Selection2ItemCountPropertyId, }, @@ -205,59 +205,60 @@ static const struct uia_prop_info default_uia_properties[] = { { &IsValuePatternAvailable_Property_GUID, UIA_IsValuePatternAvailablePropertyId, }, { &IsItemContainerPatternAvailable_Property_GUID, UIA_IsItemContainerPatternAvailablePropertyId, }, { &IsContentElement_Property_GUID, UIA_IsContentElementPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &LegacyIAccessible_KeyboardShortcut_Property_GUID, UIA_LegacyIAccessibleKeyboardShortcutPropertyId, }, { &IsPassword_Property_GUID, UIA_IsPasswordPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &IsWindowPatternAvailable_Property_GUID, UIA_IsWindowPatternAvailablePropertyId, }, { &RangeValue_Minimum_Property_GUID, UIA_RangeValueMinimumPropertyId, }, { &BoundingRectangle_Property_GUID, UIA_BoundingRectanglePropertyId, }, { &LegacyIAccessible_Value_Property_GUID, UIA_LegacyIAccessibleValuePropertyId, }, { &IsDragPatternAvailable_Property_GUID, UIA_IsDragPatternAvailablePropertyId, }, { &DescribedBy_Property_GUID, UIA_DescribedByPropertyId, - UIAutomationType_ElementArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_ElementArray, }, { &IsSelectionPatternAvailable_Property_GUID, UIA_IsSelectionPatternAvailablePropertyId, }, { &Grid_RowCount_Property_GUID, UIA_GridRowCountPropertyId, }, { &OutlineColor_Property_GUID, UIA_OutlineColorPropertyId, - UIAutomationType_IntArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_IntArray, }, { &Table_RowOrColumnMajor_Property_GUID, UIA_TableRowOrColumnMajorPropertyId, }, { &IsDockPatternAvailable_Property_GUID, UIA_IsDockPatternAvailablePropertyId, }, { &IsSynchronizedInputPatternAvailable_Property_GUID,UIA_IsSynchronizedInputPatternAvailablePropertyId, }, { &OutlineThickness_Property_GUID, UIA_OutlineThicknessPropertyId, - UIAutomationType_DoubleArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_DoubleArray, }, { &IsLegacyIAccessiblePatternAvailable_Property_GUID,UIA_IsLegacyIAccessiblePatternAvailablePropertyId, }, { &AnnotationObjects_Property_GUID, UIA_AnnotationObjectsPropertyId, - UIAutomationType_ElementArray, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_ElementArray, }, { &IsRequiredForForm_Property_GUID, UIA_IsRequiredForFormPropertyId, - UIAutomationType_Bool, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &SpreadsheetItem_AnnotationTypes_Property_GUID, UIA_SpreadsheetItemAnnotationTypesPropertyId, }, { &FillColor_Property_GUID, UIA_FillColorPropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &IsStylesPatternAvailable_Property_GUID, UIA_IsStylesPatternAvailablePropertyId, }, { &Window_IsTopmost_Property_GUID, UIA_WindowIsTopmostPropertyId, }, { &IsCustomNavigationPatternAvailable_Property_GUID, UIA_IsCustomNavigationPatternAvailablePropertyId, }, { &Scroll_HorizontalViewSize_Property_GUID, UIA_ScrollHorizontalViewSizePropertyId, }, { &AcceleratorKey_Property_GUID, UIA_AcceleratorKeyPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, { &IsTextChildPatternAvailable_Property_GUID, UIA_IsTextChildPatternAvailablePropertyId, }, { &LegacyIAccessible_Selection_Property_GUID, UIA_LegacyIAccessibleSelectionPropertyId, }, { &FillType_Property_GUID, UIA_FillTypePropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &ControlType_Property_GUID, UIA_ControlTypePropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &IsMultipleViewPatternAvailable_Property_GUID, UIA_IsMultipleViewPatternAvailablePropertyId, }, { &DropTarget_DropTargetEffects_Property_GUID, UIA_DropTargetDropTargetEffectsPropertyId, }, { &LandmarkType_Property_GUID, UIA_LandmarkTypePropertyId, - UIAutomationType_Int, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_Int, }, { &Drag_IsGrabbed_Property_GUID, UIA_DragIsGrabbedPropertyId, }, { &GridItem_ColumnSpan_Property_GUID, UIA_GridItemColumnSpanPropertyId, }, { &Styles_Shape_Property_GUID, UIA_StylesShapePropertyId, }, - { &RuntimeId_Property_GUID, UIA_RuntimeIdPropertyId, }, + { &RuntimeId_Property_GUID, UIA_RuntimeIdPropertyId, + PROP_TYPE_SPECIAL, UIAutomationType_IntArray, }, { &IsSelectionPattern2Available_Property_GUID, UIA_IsSelectionPattern2AvailablePropertyId, }, { &MultipleView_SupportedViews_Property_GUID, UIA_MultipleViewSupportedViewsPropertyId, }, { &Styles_FillPatternColor_Property_GUID, UIA_StylesFillPatternColorPropertyId, }, { &FullDescription_Property_GUID, UIA_FullDescriptionPropertyId, - UIAutomationType_String, }, + PROP_TYPE_ELEM_PROP, UIAutomationType_String, }, };
static const int prop_id_idx[] = { diff --git a/dlls/uiautomationcore/uia_private.h b/dlls/uiautomationcore/uia_private.h index 40ea9db5cfc..ed53da58471 100644 --- a/dlls/uiautomationcore/uia_private.h +++ b/dlls/uiautomationcore/uia_private.h @@ -21,4 +21,10 @@ #include "uiautomation.h" #include "uia_classes.h"
+enum uia_prop_type { + PROP_TYPE_UNKNOWN, + PROP_TYPE_ELEM_PROP, + PROP_TYPE_SPECIAL, +}; + const struct uia_prop_info *uia_prop_info_from_id(PROPERTYID prop_id) DECLSPEC_HIDDEN;