Commit ab4a0017 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement UiaNodeFromProvider.

parent 78406153
...@@ -5,6 +5,10 @@ IMPORTS = uuid ole32 oleaut32 user32 oleacc ...@@ -5,6 +5,10 @@ IMPORTS = uuid ole32 oleaut32 user32 oleacc
EXTRADLLFLAGS = -Wb,--prefer-native EXTRADLLFLAGS = -Wb,--prefer-native
C_SRCS = \ C_SRCS = \
uia_client.c \
uia_ids.c \ uia_ids.c \
uia_main.c \ uia_main.c \
uia_provider.c uia_provider.c
IDL_SRCS = \
uia_classes.idl
/*
* Copyright 2022 Connor McAdams for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep header
import "oaidl.idl";
[
object,
uuid(bccb6799-d831-4057-bd50-6425823ff1a3),
pointer_default(unique),
]
interface IWineUiaNode : IUnknown
{
}
/*
* Copyright 2022 Connor McAdams for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "uiautomation.h"
#include "initguid.h"
#include "uia_classes.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uiautomation);
/*
* IWineUiaNode interface.
*/
struct uia_node {
IWineUiaNode IWineUiaNode_iface;
LONG ref;
IRawElementProviderSimple *elprov;
};
static inline struct uia_node *impl_from_IWineUiaNode(IWineUiaNode *iface)
{
return CONTAINING_RECORD(iface, struct uia_node, IWineUiaNode_iface);
}
static HRESULT WINAPI uia_node_QueryInterface(IWineUiaNode *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IWineUiaNode) || IsEqualIID(riid, &IID_IUnknown))
*ppv = iface;
else
return E_NOINTERFACE;
IWineUiaNode_AddRef(iface);
return S_OK;
}
static ULONG WINAPI uia_node_AddRef(IWineUiaNode *iface)
{
struct uia_node *node = impl_from_IWineUiaNode(iface);
ULONG ref = InterlockedIncrement(&node->ref);
TRACE("%p, refcount %ld\n", node, ref);
return ref;
}
static ULONG WINAPI uia_node_Release(IWineUiaNode *iface)
{
struct uia_node *node = impl_from_IWineUiaNode(iface);
ULONG ref = InterlockedDecrement(&node->ref);
TRACE("%p, refcount %ld\n", node, ref);
if (!ref)
{
IRawElementProviderSimple_Release(node->elprov);
heap_free(node);
}
return ref;
}
static const IWineUiaNodeVtbl uia_node_vtbl = {
uia_node_QueryInterface,
uia_node_AddRef,
uia_node_Release,
};
/***********************************************************************
* UiaNodeFromProvider (uiautomationcore.@)
*/
HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *huianode)
{
static const int supported_prov_opts = ProviderOptions_ServerSideProvider;
enum ProviderOptions prov_opts;
struct uia_node *node;
HRESULT hr;
TRACE("(%p, %p)\n", elprov, huianode);
if (!elprov || !huianode)
return E_INVALIDARG;
*huianode = NULL;
node = heap_alloc_zero(sizeof(*node));
if (!node)
return E_OUTOFMEMORY;
hr = IRawElementProviderSimple_get_ProviderOptions(elprov, &prov_opts);
if (FAILED(hr))
{
heap_free(node);
return hr;
}
if (prov_opts & ~supported_prov_opts)
FIXME("Ignoring unsupported ProviderOption(s) %#x\n", prov_opts & ~supported_prov_opts);
node->IWineUiaNode_iface.lpVtbl = &uia_node_vtbl;
node->elprov = elprov;
IRawElementProviderSimple_AddRef(elprov);
node->ref = 1;
*huianode = (void *)&node->IWineUiaNode_iface;
return hr;
}
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
@ stub UiaNodeFromFocus @ stub UiaNodeFromFocus
@ stub UiaNodeFromHandle @ stub UiaNodeFromHandle
@ stub UiaNodeFromPoint @ stub UiaNodeFromPoint
@ stub UiaNodeFromProvider @ stdcall UiaNodeFromProvider(ptr ptr)
@ stub UiaNodeRelease @ stub UiaNodeRelease
@ stub UiaPatternRelease @ stub UiaPatternRelease
#@ stub UiaProviderForNonClient #@ stub UiaProviderForNonClient
......
...@@ -256,6 +256,7 @@ BOOL WINAPI UiaTextRangeRelease(HUIATEXTRANGE hobj); ...@@ -256,6 +256,7 @@ BOOL WINAPI UiaTextRangeRelease(HUIATEXTRANGE hobj);
HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **elprov);
HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, long child_id, DWORD flags, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, long child_id, DWORD flags, IRawElementProviderSimple **elprov);
HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val); HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val);
HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *huianode);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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