[PATCH v2] uiautomationcore: Add stub UiaNodeFromFocus function.

Vijay Kiran Kamuju infyquest at gmail.com
Thu Jun 17 13:09:11 CDT 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50576

Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
 dlls/uiautomationcore/tests/uiautomation.c  | 17 ++++++++
 dlls/uiautomationcore/uia_main.c            | 12 ++++++
 dlls/uiautomationcore/uiautomationcore.spec |  2 +-
 include/uiautomationcoreapi.h               | 45 +++++++++++++++++++++
 4 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c
index cbcba1af294..1a1794b251b 100644
--- a/dlls/uiautomationcore/tests/uiautomation.c
+++ b/dlls/uiautomationcore/tests/uiautomation.c
@@ -86,7 +86,24 @@ if (hr == S_OK)
     UnregisterClassA("HostProviderFromHwnd class", NULL);
 }
 
+static void test_UiaNodeFromFocus(void)
+{
+    HRESULT hr;
+    UiaCacheRequest req;
+    SAFEARRAY *data;
+
+    hr = UiaNodeFromFocus(NULL, NULL, NULL);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
+    hr = UiaNodeFromFocus(&req, NULL, NULL);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
+    hr = UiaNodeFromFocus(&req, &data, NULL);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+}
+
 START_TEST(uiautomation)
 {
     test_UiaHostProviderFromHwnd();
+    test_UiaNodeFromFocus();
 }
diff --git a/dlls/uiautomationcore/uia_main.c b/dlls/uiautomationcore/uia_main.c
index 42014af6035..83ceca32954 100644
--- a/dlls/uiautomationcore/uia_main.c
+++ b/dlls/uiautomationcore/uia_main.c
@@ -89,3 +89,15 @@ HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **pr
     FIXME("(%p, %p): stub\n", hwnd, provider);
     return E_NOTIMPL;
 }
+
+HRESULT WINAPI UiaNodeFromFocus(UiaCacheRequest *request, SAFEARRAY **data, BSTR *tree)
+{
+    FIXME("(%p, %p, %p): stub\n", request, data, tree);
+
+    if (!request || !data || !tree)
+      return E_INVALIDARG;
+
+    *data = NULL;
+    *tree = NULL;
+    return S_OK;
+}
diff --git a/dlls/uiautomationcore/uiautomationcore.spec b/dlls/uiautomationcore/uiautomationcore.spec
index c9b96ab39ef..77596c360fb 100644
--- a/dlls/uiautomationcore/uiautomationcore.spec
+++ b/dlls/uiautomationcore/uiautomationcore.spec
@@ -76,7 +76,7 @@
 #@ stub UiaIAccessibleFromProvider
 @ stdcall UiaLookupId(long ptr)
 @ stub UiaNavigate
-@ stub UiaNodeFromFocus
+@ stdcall UiaNodeFromFocus(ptr ptr ptr)
 @ stub UiaNodeFromHandle
 @ stub UiaNodeFromPoint
 @ stub UiaNodeFromProvider
diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h
index de486710158..7eda5e5c3cd 100644
--- a/include/uiautomationcoreapi.h
+++ b/include/uiautomationcoreapi.h
@@ -39,6 +39,12 @@ DECLARE_HANDLE(HUIAPATTERNOBJECT);
 DECLARE_HANDLE(HUIATEXTRANGE);
 DECLARE_HANDLE(HUIAEVENT);
 
+enum AutomationElementMode
+{
+    AutomationElementMode_None,
+    AutomationElementMode_Full
+};
+
 enum AutomationIdentifierType
 {
     AutomationIdentifierType_Property,
@@ -52,6 +58,16 @@ enum AutomationIdentifierType
     AutomationIdentifierType_Style
 };
 
+enum ConditionType
+{
+    ConditionType_True = 0,
+    ConditionType_False = 1,
+    ConditionType_Property = 2,
+    ConditionType_And = 3,
+    ConditionType_Or = 4,
+    ConditionType_Not = 5
+};
+
 enum ProviderType
 {
     ProviderType_BaseHwnd,
@@ -59,11 +75,40 @@ enum ProviderType
     ProviderType_NonClientArea,
 };
 
+enum TreeScope
+{
+    TreeScope_None,
+    TreeScope_Element,
+    TreeScope_Children,
+    TreeScope_Descendents,
+    TreeScope_Parent,
+    TreeScope_Ancestors,
+    TreeScope_Subtree
+};
+
+typedef struct
+{
+    enum ConditionType ConditionType;
+} UiaCondition;
+
+typedef struct
+{
+    UiaCondition *pViewCondition;
+    enum TreeScope Scope;
+
+    PROPERTYID *pProperties;
+    int cProperties;
+    PATTERNID *pPatterns;
+    int cPatterns;
+    enum AutomationElementMode automationElementMode;
+} UiaCacheRequest;
+
 typedef SAFEARRAY * WINAPI UiaProviderCallback(HWND hwnd,enum ProviderType providerType);
 
 HRESULT WINAPI UiaGetReservedMixedAttributeValue(IUnknown **value);
 HRESULT WINAPI UiaGetReservedNotSupportedValue(IUnknown **value);
 int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid);
+HRESULT WINAPI UiaNodeFromFocus(UiaCacheRequest *pRequest, SAFEARRAY **ppRequestData, BSTR *ppTreeStructure);
 BOOL WINAPI UiaPatternRelease(HUIAPATTERNOBJECT hobj);
 HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *provider, EVENTID id);
 void WINAPI UiaRegisterProviderCallback(UiaProviderCallback *pCallback);
-- 
2.32.0




More information about the wine-devel mailing list