From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/uia_event.c | 5 ++++ dlls/uiautomationcore/uia_private.h | 3 +++ dlls/uiautomationcore/uia_utils.c | 42 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+)
diff --git a/dlls/uiautomationcore/uia_event.c b/dlls/uiautomationcore/uia_event.c index 417532fa7a6..4b55534c18a 100644 --- a/dlls/uiautomationcore/uia_event.c +++ b/dlls/uiautomationcore/uia_event.c @@ -180,6 +180,7 @@ static ULONG WINAPI uia_event_Release(IWineUiaEvent *iface) uia_event_map_entry_release(event->event_map_entry);
SafeArrayDestroy(event->runtime_id); + uia_cache_request_destroy(&event->cache_req); for (i = 0; i < event->event_advisers_count; i++) IWineUiaEventAdviser_Release(event->event_advisers[i]); heap_free(event->event_advisers); @@ -443,6 +444,10 @@ HRESULT WINAPI UiaAddEvent(HUIANODE huianode, EVENTID event_id, UiaEventCallback return hr; }
+ hr = uia_cache_request_clone(&event->cache_req, cache_req); + if (FAILED(hr)) + goto exit; + hr = attach_event_to_uia_node(huianode, event); if (FAILED(hr)) goto exit; diff --git a/dlls/uiautomationcore/uia_private.h b/dlls/uiautomationcore/uia_private.h index 67fa9febba7..26e70948c07 100644 --- a/dlls/uiautomationcore/uia_private.h +++ b/dlls/uiautomationcore/uia_private.h @@ -110,6 +110,7 @@ struct uia_event struct uia_event_map_entry *event_map_entry; LONG event_defunct;
+ struct UiaCacheRequest cache_req; UiaEventCallback *cback; };
@@ -186,6 +187,8 @@ HRESULT create_msaa_provider(IAccessible *acc, long child_id, HWND hwnd, BOOL kn HRESULT register_interface_in_git(IUnknown *iface, REFIID riid, DWORD *ret_cookie) DECLSPEC_HIDDEN; HRESULT unregister_interface_in_git(DWORD git_cookie) DECLSPEC_HIDDEN; HRESULT get_interface_in_git(REFIID riid, DWORD git_cookie, IUnknown **ret_iface) DECLSPEC_HIDDEN; +void uia_cache_request_destroy(struct UiaCacheRequest *cache_req) DECLSPEC_HIDDEN; +HRESULT uia_cache_request_clone(struct UiaCacheRequest *dst, struct UiaCacheRequest *src) DECLSPEC_HIDDEN; HRESULT get_safearray_dim_bounds(SAFEARRAY *sa, UINT dim, LONG *lbound, LONG *elems) DECLSPEC_HIDDEN; HRESULT get_safearray_bounds(SAFEARRAY *sa, LONG *lbound, LONG *elems) DECLSPEC_HIDDEN; int uia_compare_safearrays(SAFEARRAY *sa1, SAFEARRAY *sa2, int prop_type) DECLSPEC_HIDDEN; diff --git a/dlls/uiautomationcore/uia_utils.c b/dlls/uiautomationcore/uia_utils.c index ef7cf5ff9d2..03416418cce 100644 --- a/dlls/uiautomationcore/uia_utils.c +++ b/dlls/uiautomationcore/uia_utils.c @@ -98,6 +98,48 @@ HRESULT get_interface_in_git(REFIID riid, DWORD git_cookie, IUnknown **ret_iface return S_OK; }
+/* + * UiaCacheRequest cloning functions. + */ +void uia_cache_request_destroy(struct UiaCacheRequest *cache_req) +{ + heap_free(cache_req->pProperties); + heap_free(cache_req->pPatterns); +} + +HRESULT uia_cache_request_clone(struct UiaCacheRequest *dst, struct UiaCacheRequest *src) +{ + FIXME("Cache request condition cloning currently unimplemented\n"); + + dst->Scope = src->Scope; + dst->automationElementMode = src->automationElementMode; + if (src->cProperties) + { + if (!(dst->pProperties = heap_alloc_zero(sizeof(*dst->pProperties) * src->cProperties))) + { + uia_cache_request_destroy(dst); + return E_OUTOFMEMORY; + } + + dst->cProperties = src->cProperties; + memcpy(dst->pProperties, src->pProperties, sizeof(*dst->pProperties) * dst->cProperties); + } + + if (src->cPatterns) + { + if (!(dst->pPatterns = heap_alloc_zero(sizeof(*dst->pPatterns) * src->cPatterns))) + { + uia_cache_request_destroy(dst); + return E_OUTOFMEMORY; + } + + dst->cPatterns = src->cPatterns; + memcpy(dst->pPatterns, src->pPatterns, sizeof(*dst->pPatterns) * dst->cPatterns); + } + + return S_OK; +} + HRESULT get_safearray_dim_bounds(SAFEARRAY *sa, UINT dim, LONG *lbound, LONG *elems) { LONG ubound;