mshtml: Use callback to register additional IDispatch interfaces.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-07-05 22:48:20 +02:00 committed by Alexandre Julliard
parent 87f7aea1ca
commit f6a00dbd25
3 changed files with 20 additions and 5 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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,