Commit 46a2f3e4 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

oleacc: Add IServiceProvider interface to default accessible objects.

parent e75ceba1
......@@ -32,6 +32,7 @@ typedef struct {
IAccessible IAccessible_iface;
IOleWindow IOleWindow_iface;
IEnumVARIANT IEnumVARIANT_iface;
IServiceProvider IServiceProvider_iface;
LONG ref;
......@@ -114,6 +115,8 @@ static HRESULT WINAPI Client_QueryInterface(IAccessible *iface, REFIID riid, voi
*ppv = &This->IOleWindow_iface;
}else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
*ppv = &This->IEnumVARIANT_iface;
}else if(IsEqualIID(riid, &IID_IServiceProvider)) {
*ppv = &This->IServiceProvider_iface;
}else {
WARN("no interface: %s\n", debugstr_guid(riid));
*ppv = NULL;
......@@ -703,6 +706,50 @@ static const IEnumVARIANTVtbl ClientEnumVARIANTVtbl = {
Client_EnumVARIANT_Clone
};
static inline Client* impl_from_Client_ServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, Client, IServiceProvider_iface);
}
static HRESULT WINAPI Client_ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
}
static ULONG WINAPI Client_ServiceProvider_AddRef(IServiceProvider *iface)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_AddRef(&This->IAccessible_iface);
}
static ULONG WINAPI Client_ServiceProvider_Release(IServiceProvider *iface)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_Release(&This->IAccessible_iface);
}
static HRESULT WINAPI Client_ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guid_service,
REFIID riid, void **ppv)
{
Client *This = impl_from_Client_ServiceProvider(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guid_service), debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(guid_service, &IIS_IsOleaccProxy))
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
return E_INVALIDARG;
}
static const IServiceProviderVtbl ClientServiceProviderVtbl = {
Client_ServiceProvider_QueryInterface,
Client_ServiceProvider_AddRef,
Client_ServiceProvider_Release,
Client_ServiceProvider_QueryService
};
static void edit_init(Client *client)
{
client->role = ROLE_SYSTEM_TEXT;
......@@ -872,6 +919,7 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj)
client->IAccessible_iface.lpVtbl = &ClientVtbl;
client->IOleWindow_iface.lpVtbl = &ClientOleWindowVtbl;
client->IEnumVARIANT_iface.lpVtbl = &ClientEnumVARIANTVtbl;
client->IServiceProvider_iface.lpVtbl = &ClientServiceProviderVtbl;
client->ref = 1;
client->hwnd = hwnd;
client->enum_pos = 0;
......
......@@ -17,6 +17,7 @@
*/
#include "oleacc_classes.h"
#include "servprov.h"
struct win_class_data {
const WCHAR *name;
......
......@@ -1419,21 +1419,19 @@ static void check_acc_proxy_service_(IAccessible *acc, int line)
HRESULT hr;
hr = IAccessible_QueryInterface(acc, &IID_IServiceProvider, (void **)&service);
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IServiceProvider_QueryService(service, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "got %#lx\n", hr);
ok(!!unk, "unk == NULL\n");
ok(iface_cmp(unk, (IUnknown*)acc), "unk != acc\n");
IUnknown_Release(unk);
ok(hr == S_OK, "got %#lx\n", hr);
unk = (IUnknown*)0xdeadbeef;
hr = IServiceProvider_QueryService(service, &IID_IUnknown, &IID_IUnknown, (void **)&unk);
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
ok(!unk, "unk != NULL\n");
IServiceProvider_Release(service);
}
hr = IServiceProvider_QueryService(service, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "got %#lx\n", hr);
ok(!!unk, "unk == NULL\n");
ok(iface_cmp(unk, (IUnknown*)acc), "unk != acc\n");
IUnknown_Release(unk);
unk = (IUnknown*)0xdeadbeef;
hr = IServiceProvider_QueryService(service, &IID_IUnknown, &IID_IUnknown, (void **)&unk);
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
ok(!unk, "unk != NULL\n");
IServiceProvider_Release(service);
}
static void test_CreateStdAccessibleObject_classes(void)
......
......@@ -30,6 +30,7 @@ typedef struct {
IAccessible IAccessible_iface;
IOleWindow IOleWindow_iface;
IEnumVARIANT IEnumVARIANT_iface;
IServiceProvider IServiceProvider_iface;
LONG ref;
......@@ -55,6 +56,8 @@ static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, voi
*ppv = &This->IOleWindow_iface;
}else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
*ppv = &This->IEnumVARIANT_iface;
}else if(IsEqualIID(riid, &IID_IServiceProvider)) {
*ppv = &This->IServiceProvider_iface;
}else {
WARN("no interface: %s\n", debugstr_guid(riid));
*ppv = NULL;
......@@ -444,6 +447,50 @@ static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl = {
Window_EnumVARIANT_Clone
};
static inline Window* impl_from_Window_ServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, Window, IServiceProvider_iface);
}
static HRESULT WINAPI Window_ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
}
static ULONG WINAPI Window_ServiceProvider_AddRef(IServiceProvider *iface)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_AddRef(&This->IAccessible_iface);
}
static ULONG WINAPI Window_ServiceProvider_Release(IServiceProvider *iface)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_Release(&This->IAccessible_iface);
}
static HRESULT WINAPI Window_ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guid_service,
REFIID riid, void **ppv)
{
Window *This = impl_from_Window_ServiceProvider(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guid_service), debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(guid_service, &IIS_IsOleaccProxy))
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
return E_INVALIDARG;
}
static const IServiceProviderVtbl WindowServiceProviderVtbl = {
Window_ServiceProvider_QueryInterface,
Window_ServiceProvider_AddRef,
Window_ServiceProvider_Release,
Window_ServiceProvider_QueryService
};
static const struct win_class_data classes[] = {
{WC_LISTBOXW, 0x10000, TRUE},
{L"#32768", 0x10001, TRUE}, /* menu */
......@@ -467,6 +514,7 @@ HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj)
window->IAccessible_iface.lpVtbl = &WindowVtbl;
window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl;
window->IServiceProvider_iface.lpVtbl = &WindowServiceProviderVtbl;
window->ref = 1;
window->hwnd = hwnd;
......
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