From f6a00dbd25d009aebc0f300b9039537ecc255ca7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 5 Jul 2016 22:48:20 +0200 Subject: [PATCH] mshtml: Use callback to register additional IDispatch interfaces. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/dispex.c | 15 ++++++++++++--- dlls/mshtml/htmlwindow.c | 7 ++++++- dlls/mshtml/mshtml_private.h | 3 ++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 9a2cebd70b9..791f361e0bf 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -343,6 +343,15 @@ static HRESULT process_interface(dispex_data_t *data, tid_t tid, ITypeInfo *disp return S_OK; } +void dispex_info_add_interface(dispex_data_t *info, tid_t tid) +{ + HRESULT hres; + + hres = process_interface(info, tid, NULL); + if(FAILED(hres)) + ERR("process_interface failed: %08x\n", hres); +} + static int dispid_cmp(const void *p1, const void *p2) { return ((const func_info_t*)p1)->id - ((const func_info_t*)p2)->id; @@ -386,15 +395,15 @@ static dispex_data_t *preprocess_dispex_data(const dispex_static_data_t *desc) } list_add_tail(&dispex_data_list, &data->entry); + if(desc->init_info) + desc->init_info(data); + for(tid = desc->iface_tids; *tid; tid++) { hres = process_interface(data, *tid, dti); if(FAILED(hres)) break; } - if(desc->additional_tid) - process_interface(data, desc->additional_tid, NULL); - if(!data->func_cnt) { heap_free(data->funcs); data->name_table = NULL; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index b75c9bad6ff..54cd0782994 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -2936,6 +2936,11 @@ static void HTMLWindow_bind_event(DispatchEx *dispex, int eid) dispex_get_vtbl(&This->doc->node.event_target.dispex)->bind_event(&This->doc->node.event_target.dispex, eid); } +static void HTMLWindow_init_dispex_info(dispex_data_t *info) +{ + dispex_info_add_interface(info, IHTMLWindow5_tid); +} + static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl = { NULL, NULL, @@ -2957,7 +2962,7 @@ static dispex_static_data_t HTMLWindow_dispex = { &HTMLWindow_dispex_vtbl, DispHTMLWindow2_tid, HTMLWindow_iface_tids, - IHTMLWindow5_tid + HTMLWindow_init_dispex_info }; static void *alloc_window(size_t size) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 04a1ccf49d2..412db241ee5 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -265,7 +265,7 @@ typedef struct { const dispex_static_data_vtbl_t *vtbl; const tid_t disp_tid; const tid_t* const iface_tids; - const tid_t additional_tid; + void (*init_info)(dispex_data_t*); dispex_data_t *data; } dispex_static_data_t; @@ -317,6 +317,7 @@ void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN; void release_typelib(void) DECLSPEC_HIDDEN; HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN; const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN; +void dispex_info_add_interface(dispex_data_t*,tid_t) DECLSPEC_HIDDEN; typedef enum { DISPEXPROP_CUSTOM,