Commit 5b43c42c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Remove dynamic properties support.

parent 86ee4e95
...@@ -86,20 +86,6 @@ struct dispex_data_t { ...@@ -86,20 +86,6 @@ struct dispex_data_t {
struct list entry; struct list entry;
}; };
typedef struct {
VARIANT var;
LPWSTR name;
} dynamic_prop_t;
struct dispex_dynamic_data_t {
DWORD buf_size;
DWORD prop_cnt;
dynamic_prop_t *props;
};
#define DISPID_DYNPROP_0 0x50000000
#define DISPID_DYNPROP_MAX 0x5fffffff
static struct list dispex_data_list = LIST_INIT(dispex_data_list); static struct list dispex_data_list = LIST_INIT(dispex_data_list);
static ITypeLib *typelib[LibXml_Last]; static ITypeLib *typelib[LibXml_Last];
static ITypeInfo *typeinfos[LAST_tid]; static ITypeInfo *typeinfos[LAST_tid];
...@@ -341,11 +327,6 @@ static dispex_data_t *get_dispex_data(DispatchEx *This) ...@@ -341,11 +327,6 @@ static dispex_data_t *get_dispex_data(DispatchEx *This)
return This->data->data; return This->data->data;
} }
static inline BOOL is_dynamic_dispid(DISPID id)
{
return DISPID_DYNPROP_0 <= id && id <= DISPID_DYNPROP_MAX;
}
static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface)
{ {
return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface);
...@@ -461,17 +442,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW ...@@ -461,17 +442,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
min = n+1; min = n+1;
} }
if(This->dynamic_data) {
unsigned i;
for(i=0; i < This->dynamic_data->prop_cnt; i++) {
if(!strcmpW(This->dynamic_data->props[i].name, bstrName)) {
*pid = DISPID_DYNPROP_0 + i;
return S_OK;
}
}
}
if(This->data->vtbl && This->data->vtbl->get_dispid) { if(This->data->vtbl && This->data->vtbl->get_dispid) {
HRESULT hres; HRESULT hres;
...@@ -480,42 +450,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW ...@@ -480,42 +450,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
return hres; return hres;
} }
if(grfdex & fdexNameEnsure) {
dispex_dynamic_data_t *dynamic_data;
TRACE("creating dynamic prop %s\n", debugstr_w(bstrName));
if(This->dynamic_data) {
dynamic_data = This->dynamic_data;
}else {
dynamic_data = This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t));
if(!dynamic_data)
return E_OUTOFMEMORY;
}
if(!dynamic_data->buf_size) {
dynamic_data->props = heap_alloc(sizeof(dynamic_prop_t)*4);
if(!dynamic_data->props)
return E_OUTOFMEMORY;
dynamic_data->buf_size = 4;
}else if(dynamic_data->buf_size == dynamic_data->prop_cnt) {
dynamic_prop_t *new_props;
new_props = heap_realloc(dynamic_data->props, sizeof(dynamic_prop_t)*(dynamic_data->buf_size<<1));
if(!new_props)
return E_OUTOFMEMORY;
dynamic_data->props = new_props;
dynamic_data->buf_size <<= 1;
}
dynamic_data->props[dynamic_data->prop_cnt].name = heap_strdupW(bstrName);
VariantInit(&dynamic_data->props[dynamic_data->prop_cnt].var);
*pid = DISPID_DYNPROP_0 + dynamic_data->prop_cnt++;
return S_OK;
}
TRACE("not found %s\n", debugstr_w(bstrName)); TRACE("not found %s\n", debugstr_w(bstrName));
return DISP_E_UNKNOWNNAME; return DISP_E_UNKNOWNNAME;
} }
...@@ -567,28 +501,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc ...@@ -567,28 +501,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return E_NOTIMPL; return E_NOTIMPL;
} }
if(is_dynamic_dispid(id)) {
DWORD idx = id - DISPID_DYNPROP_0;
VARIANT *var;
if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx)
return DISP_E_UNKNOWNNAME;
var = &This->dynamic_data->props[idx].var;
switch(wFlags) {
case INVOKE_PROPERTYGET:
V_VT(pvarRes) = VT_EMPTY;
return VariantCopy(pvarRes, var);
case INVOKE_PROPERTYPUT:
VariantClear(var);
return VariantCopy(var, pdp->rgvarg);
default:
FIXME("unhandled wFlags %x\n", wFlags);
return E_NOTIMPL;
}
}
data = get_dispex_data(This); data = get_dispex_data(This);
if(!data) if(!data)
return E_FAIL; return E_FAIL;
...@@ -726,26 +638,9 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) ...@@ -726,26 +638,9 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
return TRUE; return TRUE;
} }
void release_dispex(DispatchEx *This)
{
dynamic_prop_t *prop;
if(!This->dynamic_data)
return;
for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
VariantClear(&prop->var);
heap_free(prop->name);
}
heap_free(This->dynamic_data->props);
heap_free(This->dynamic_data);
}
void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data) void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
{ {
dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
dispex->outer = outer; dispex->outer = outer;
dispex->data = data; dispex->data = data;
dispex->dynamic_data = NULL;
} }
...@@ -101,10 +101,7 @@ static ULONG WINAPI dimimpl_Release( ...@@ -101,10 +101,7 @@ static ULONG WINAPI dimimpl_Release(
TRACE("(%p)->(%d)\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 ) if ( ref == 0 )
{
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
}
return ref; return ref;
} }
......
...@@ -134,7 +134,6 @@ extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN; ...@@ -134,7 +134,6 @@ extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
extern void release_typelib(void) DECLSPEC_HIDDEN; extern void release_typelib(void) DECLSPEC_HIDDEN;
typedef struct dispex_data_t dispex_data_t; typedef struct dispex_data_t dispex_data_t;
typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
typedef struct { typedef struct {
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*); HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
...@@ -154,7 +153,6 @@ typedef struct { ...@@ -154,7 +153,6 @@ typedef struct {
IUnknown *outer; IUnknown *outer;
dispex_static_data_t *data; dispex_static_data_t *data;
dispex_dynamic_data_t *dynamic_data;
} DispatchEx; } DispatchEx;
extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN; extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN;
......
...@@ -460,7 +460,6 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface) ...@@ -460,7 +460,6 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface)
free_ns_context(ctxt); free_ns_context(ctxt);
} }
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
......
...@@ -779,7 +779,6 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface) ...@@ -779,7 +779,6 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface)
SysFreeString(This->encoding); SysFreeString(This->encoding);
SysFreeString(This->element); SysFreeString(This->element);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }
...@@ -2605,7 +2604,6 @@ static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface) ...@@ -2605,7 +2604,6 @@ static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface)
SysFreeString(This->attr[i].value); SysFreeString(This->attr[i].value);
} }
release_dispex(&This->dispex);
heap_free(This->attr); heap_free(This->attr);
heap_free(This); heap_free(This);
} }
......
...@@ -1198,7 +1198,6 @@ void destroy_xmlnode(xmlnode *This) ...@@ -1198,7 +1198,6 @@ void destroy_xmlnode(xmlnode *This)
xmlnode_release(This->node); xmlnode_release(This->node);
xmldoc_release(This->node->doc); xmldoc_release(This->node->doc);
} }
release_dispex(&This->dispex);
} }
void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispex_static_data_t *dispex_data) void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispex_static_data_t *dispex_data)
......
...@@ -142,7 +142,6 @@ static ULONG WINAPI xmlnodemap_Release( ...@@ -142,7 +142,6 @@ static ULONG WINAPI xmlnodemap_Release(
{ {
xmldoc_release( This->node->doc ); xmldoc_release( This->node->doc );
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
......
...@@ -109,7 +109,6 @@ static ULONG WINAPI parseError_Release( ...@@ -109,7 +109,6 @@ static ULONG WINAPI parseError_Release(
SysFreeString(This->url); SysFreeString(This->url);
SysFreeString(This->reason); SysFreeString(This->reason);
SysFreeString(This->srcText); SysFreeString(This->srcText);
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
......
...@@ -2934,7 +2934,6 @@ static ULONG WINAPI saxxmlreader_Release( ...@@ -2934,7 +2934,6 @@ static ULONG WINAPI saxxmlreader_Release(
SysFreeString(This->xmldecl_version); SysFreeString(This->xmldecl_version);
free_bstr_pool(&This->pool); free_bstr_pool(&This->pool);
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
......
...@@ -1149,7 +1149,6 @@ static ULONG WINAPI schema_cache_Release(IXMLDOMSchemaCollection2* iface) ...@@ -1149,7 +1149,6 @@ static ULONG WINAPI schema_cache_Release(IXMLDOMSchemaCollection2* iface)
heap_free(This->uris[i]); heap_free(This->uris[i]);
heap_free(This->uris); heap_free(This->uris);
xmlHashFree(This->cache, cache_free); xmlHashFree(This->cache, cache_free);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }
......
...@@ -177,7 +177,6 @@ static ULONG WINAPI domselection_Release( ...@@ -177,7 +177,6 @@ static ULONG WINAPI domselection_Release(
xmlXPathFreeObject(This->result); xmlXPathFreeObject(This->result);
xmldoc_release(This->node->doc); xmldoc_release(This->node->doc);
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }
......
...@@ -138,7 +138,6 @@ static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface ) ...@@ -138,7 +138,6 @@ static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface )
if ( ref == 0 ) if ( ref == 0 )
{ {
if (This->node) IXMLDOMNode_Release( This->node ); if (This->node) IXMLDOMNode_Release( This->node );
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
...@@ -326,7 +325,6 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface ) ...@@ -326,7 +325,6 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
xslprocessor_par_free(&This->params, par); xslprocessor_par_free(&This->params, par);
IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface); IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface);
release_dispex(&This->dispex);
heap_free( This ); heap_free( This );
} }
......
...@@ -9734,6 +9734,7 @@ static void test_load(void) ...@@ -9734,6 +9734,7 @@ static void test_load(void)
static void test_domobj_dispex(IUnknown *obj) static void test_domobj_dispex(IUnknown *obj)
{ {
static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
DISPID dispid = DISPID_XMLDOM_NODELIST_RESET; DISPID dispid = DISPID_XMLDOM_NODELIST_RESET;
IDispatchEx *dispex; IDispatchEx *dispex;
IUnknown *unk; IUnknown *unk;
...@@ -9771,9 +9772,15 @@ static void test_domobj_dispex(IUnknown *obj) ...@@ -9771,9 +9772,15 @@ static void test_domobj_dispex(IUnknown *obj)
hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_NODELIST_RESET, &dispid); hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_NODELIST_RESET, &dispid);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
unk = (IUnknown*)0xdeadbeef;
hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
if (hr == S_OK && unk) IUnknown_Release(unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(testW);
hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid);
ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
SysFreeString(name);
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
} }
...@@ -10670,6 +10677,13 @@ todo_wine { ...@@ -10670,6 +10677,13 @@ todo_wine {
IXSLProcessor_Release(processor); IXSLProcessor_Release(processor);
IXSLTemplate_Release(template); IXSLTemplate_Release(template);
if (is_clsid_supported(&CLSID_DOMDocument60, &IID_IXMLDOMDocument))
{
doc = create_document_version(60, &IID_IXMLDOMDocument);
test_domobj_dispex((IUnknown*)doc);
IXMLDOMDocument_Release(doc);
}
free_bstrs(); free_bstrs();
} }
......
...@@ -4387,6 +4387,7 @@ static void test_mxwriter_encoding(void) ...@@ -4387,6 +4387,7 @@ static void test_mxwriter_encoding(void)
static void test_obj_dispex(IUnknown *obj) static void test_obj_dispex(IUnknown *obj)
{ {
static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
static const WCHAR starW[] = {'*',0}; static const WCHAR starW[] = {'*',0};
DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE;
IDispatchEx *dispex; IDispatchEx *dispex;
...@@ -4395,6 +4396,7 @@ static void test_obj_dispex(IUnknown *obj) ...@@ -4395,6 +4396,7 @@ static void test_obj_dispex(IUnknown *obj)
UINT ticnt; UINT ticnt;
HRESULT hr; HRESULT hr;
BSTR name; BSTR name;
DISPID did;
hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex); hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
...@@ -4425,9 +4427,15 @@ static void test_obj_dispex(IUnknown *obj) ...@@ -4425,9 +4427,15 @@ static void test_obj_dispex(IUnknown *obj)
hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_SAX_XMLREADER_GETFEATURE, &dispid); hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_SAX_XMLREADER_GETFEATURE, &dispid);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
unk = (IUnknown*)0xdeadbeef;
hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
if (hr == S_OK && unk) IUnknown_Release(unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(testW);
hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &did);
ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
SysFreeString(name);
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
} }
...@@ -4491,8 +4499,15 @@ static void test_saxreader_dispex(void) ...@@ -4491,8 +4499,15 @@ static void test_saxreader_dispex(void)
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
IVBSAXXMLReader_Release(vbreader); IVBSAXXMLReader_Release(vbreader);
ISAXXMLReader_Release(reader); ISAXXMLReader_Release(reader);
if (is_clsid_supported(&CLSID_SAXXMLReader60, reader_support_data))
{
hr = CoCreateInstance(&CLSID_SAXXMLReader60, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "got 0x%08x\n", hr);
test_obj_dispex(unk);
IUnknown_Release(unk);
}
} }
static void test_mxwriter_dispex(void) static void test_mxwriter_dispex(void)
...@@ -4512,8 +4527,15 @@ static void test_mxwriter_dispex(void) ...@@ -4512,8 +4527,15 @@ static void test_mxwriter_dispex(void)
test_obj_dispex(unk); test_obj_dispex(unk);
IUnknown_Release(unk); IUnknown_Release(unk);
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
IMXWriter_Release(writer); IMXWriter_Release(writer);
if (is_clsid_supported(&CLSID_MXXMLWriter60, mxwriter_support_data))
{
hr = CoCreateInstance(&CLSID_MXXMLWriter60, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "got 0x%08x\n", hr);
test_obj_dispex(unk);
IUnknown_Release(unk);
}
} }
static void test_mxwriter_comment(void) static void test_mxwriter_comment(void)
......
...@@ -1416,6 +1416,7 @@ static void test_validate_on_load(void) ...@@ -1416,6 +1416,7 @@ static void test_validate_on_load(void)
static void test_obj_dispex(IUnknown *obj) static void test_obj_dispex(IUnknown *obj)
{ {
static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
static const WCHAR starW[] = {'*',0}; static const WCHAR starW[] = {'*',0};
DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE;
IDispatchEx *dispex; IDispatchEx *dispex;
...@@ -1454,9 +1455,15 @@ static void test_obj_dispex(IUnknown *obj) ...@@ -1454,9 +1455,15 @@ static void test_obj_dispex(IUnknown *obj)
hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid); hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
unk = (IUnknown*)0xdeadbeef;
hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
EXPECT_HR(hr, E_NOTIMPL); EXPECT_HR(hr, E_NOTIMPL);
if (hr == S_OK && unk) IUnknown_Release(unk); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
name = SysAllocString(testW);
hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid);
ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
SysFreeString(name);
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
} }
...@@ -1496,8 +1503,14 @@ static void test_dispex(void) ...@@ -1496,8 +1503,14 @@ static void test_dispex(void)
ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
IDispatchEx_Release(dispex); IDispatchEx_Release(dispex);
IXMLDOMSchemaCollection_Release(cache); IXMLDOMSchemaCollection_Release(cache);
cache = create_cache_version(60, &IID_IXMLDOMSchemaCollection);
if (cache)
{
test_obj_dispex((IUnknown*)cache);
IXMLDOMSchemaCollection_Release(cache);
}
} }
static void test_get(void) static void test_get(void)
......
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