msxml3/mxnamespace: Stub IVBMXNamespaceManager and added some tests.
This commit is contained in:
parent
9253967295
commit
7f47d97e12
|
@ -114,6 +114,7 @@ static REFIID tid_ids[] = {
|
|||
&IID_IMXAttributes,
|
||||
&IID_IMXReaderControl,
|
||||
&IID_IMXWriter,
|
||||
&IID_IVBMXNamespaceManager
|
||||
};
|
||||
|
||||
HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
|
||||
|
|
|
@ -74,6 +74,7 @@ typedef enum tid_t {
|
|||
IMXAttributes_tid,
|
||||
IMXReaderControl_tid,
|
||||
IMXWriter_tid,
|
||||
IVBMXNamespaceManager_tid,
|
||||
LAST_tid
|
||||
} tid_t;
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|||
|
||||
typedef struct
|
||||
{
|
||||
IMXNamespaceManager IMXNamespaceManager_iface;
|
||||
IMXNamespaceManager IMXNamespaceManager_iface;
|
||||
IVBMXNamespaceManager IVBMXNamespaceManager_iface;
|
||||
LONG ref;
|
||||
} namespacemanager;
|
||||
|
||||
|
@ -53,92 +54,66 @@ static inline namespacemanager *impl_from_IMXNamespaceManager( IMXNamespaceManag
|
|||
return CONTAINING_RECORD(iface, namespacemanager, IMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static inline namespacemanager *impl_from_IVBMXNamespaceManager( IVBMXNamespaceManager *iface )
|
||||
{
|
||||
return CONTAINING_RECORD(iface, namespacemanager, IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_QueryInterface(IMXNamespaceManager *iface, REFIID riid, void **ppvObject)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IMXNamespaceManager) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown) )
|
||||
{
|
||||
*ppvObject = iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
*ppvObject = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IMXNamespaceManager_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
return IVBMXNamespaceManager_QueryInterface(&This->IVBMXNamespaceManager_iface, riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI namespacemanager_AddRef(IMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
ULONG ref = InterlockedIncrement( &This->ref );
|
||||
TRACE("(%p)->(%u)\n", This, ref );
|
||||
return ref;
|
||||
return IVBMXNamespaceManager_AddRef(&This->IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI namespacemanager_Release(IMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
ULONG ref = InterlockedDecrement( &This->ref );
|
||||
|
||||
TRACE("(%p)->(%u)\n", This, ref );
|
||||
|
||||
if ( ref == 0 )
|
||||
heap_free( This );
|
||||
|
||||
return ref;
|
||||
return IVBMXNamespaceManager_Release(&This->IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_putAllowOverride(IMXNamespaceManager *iface,
|
||||
VARIANT_BOOL override)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%d): stub\n", This, override );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_put_allowOverride(&This->IVBMXNamespaceManager_iface, override);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_getAllowOverride(IMXNamespaceManager *iface,
|
||||
VARIANT_BOOL *override)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%p): stub\n", This, override );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_get_allowOverride(&This->IVBMXNamespaceManager_iface, override);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_reset(IMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_reset(&This->IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_pushContext(IMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_pushContext(&This->IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_pushNodeContext(IMXNamespaceManager *iface,
|
||||
IXMLDOMNode *node, VARIANT_BOOL deep)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%p %d): stub\n", This, node, deep );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_pushNodeContext(&This->IVBMXNamespaceManager_iface, node, deep);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_popContext(IMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This );
|
||||
return E_NOTIMPL;
|
||||
return IVBMXNamespaceManager_popContext(&This->IVBMXNamespaceManager_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI namespacemanager_declarePrefix(IMXNamespaceManager *iface,
|
||||
|
@ -190,6 +165,226 @@ static const struct IMXNamespaceManagerVtbl MXNamespaceManagerVtbl =
|
|||
namespacemanager_getURI
|
||||
};
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_QueryInterface(IVBMXNamespaceManager *iface, REFIID riid, void **ppvObject)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IMXNamespaceManager) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown) )
|
||||
{
|
||||
*ppvObject = &This->IMXNamespaceManager_iface;
|
||||
}
|
||||
else if ( IsEqualGUID( riid, &IID_IVBMXNamespaceManager) ||
|
||||
IsEqualGUID( riid, &IID_IDispatch) )
|
||||
{
|
||||
*ppvObject = &This->IVBMXNamespaceManager_iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
*ppvObject = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IVBMXNamespaceManager_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI vbnamespacemanager_AddRef(IVBMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
ULONG ref = InterlockedIncrement( &This->ref );
|
||||
TRACE("(%p)->(%u)\n", This, ref );
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
ULONG ref = InterlockedDecrement( &This->ref );
|
||||
|
||||
TRACE("(%p)->(%u)\n", This, ref );
|
||||
|
||||
if ( ref == 0 )
|
||||
heap_free( This );
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_GetTypeInfoCount(IVBMXNamespaceManager *iface, UINT *pctinfo)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
*pctinfo = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_GetTypeInfo(IVBMXNamespaceManager *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
return get_typeinfo(IVBMXNamespaceManager_tid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_GetIDsOfNames(IVBMXNamespaceManager *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
ITypeInfo *typeinfo;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
||||
lcid, rgDispId);
|
||||
|
||||
if(!rgszNames || cNames == 0 || !rgDispId)
|
||||
return E_INVALIDARG;
|
||||
|
||||
hr = get_typeinfo(IVBMXNamespaceManager_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_Invoke(IVBMXNamespaceManager *iface, DISPID dispIdMember, REFIID riid,
|
||||
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
||||
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
ITypeInfo *typeinfo;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
|
||||
hr = get_typeinfo(IVBMXNamespaceManager_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_Invoke(typeinfo, &This->IVBMXNamespaceManager_iface, dispIdMember, wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_put_allowOverride(IVBMXNamespaceManager *iface,
|
||||
VARIANT_BOOL override)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%d): stub\n", This, override);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_get_allowOverride(IVBMXNamespaceManager *iface,
|
||||
VARIANT_BOOL *override)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%p): stub\n", This, override);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_reset(IVBMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_pushContext(IVBMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_pushNodeContext(IVBMXNamespaceManager *iface,
|
||||
IXMLDOMNode *node, VARIANT_BOOL deep)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%p %d): stub\n", This, node, deep);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_popContext(IVBMXNamespaceManager *iface)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p): stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_declarePrefix(IVBMXNamespaceManager *iface,
|
||||
BSTR prefix, BSTR namespaceURI)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%s %s): stub\n", This, debugstr_w(prefix), debugstr_w(namespaceURI));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_getDeclaredPrefixes(IVBMXNamespaceManager *iface,
|
||||
IMXNamespacePrefixes** prefixes)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%p): stub\n", This, prefixes);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_getPrefixes(IVBMXNamespaceManager *iface,
|
||||
BSTR namespaceURI, IMXNamespacePrefixes** prefixes)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(namespaceURI), prefixes);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_getURI(IVBMXNamespaceManager *iface,
|
||||
BSTR prefix, VARIANT* uri)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(prefix), uri);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI vbnamespacemanager_getURIFromNode(IVBMXNamespaceManager *iface,
|
||||
BSTR prefix, IXMLDOMNode *node, VARIANT *uri)
|
||||
{
|
||||
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
|
||||
FIXME("(%p)->(%s %p %p): stub\n", This, debugstr_w(prefix), node, uri);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const struct IVBMXNamespaceManagerVtbl VBMXNamespaceManagerVtbl =
|
||||
{
|
||||
vbnamespacemanager_QueryInterface,
|
||||
vbnamespacemanager_AddRef,
|
||||
vbnamespacemanager_Release,
|
||||
vbnamespacemanager_GetTypeInfoCount,
|
||||
vbnamespacemanager_GetTypeInfo,
|
||||
vbnamespacemanager_GetIDsOfNames,
|
||||
vbnamespacemanager_Invoke,
|
||||
vbnamespacemanager_put_allowOverride,
|
||||
vbnamespacemanager_get_allowOverride,
|
||||
vbnamespacemanager_reset,
|
||||
vbnamespacemanager_pushContext,
|
||||
vbnamespacemanager_pushNodeContext,
|
||||
vbnamespacemanager_popContext,
|
||||
vbnamespacemanager_declarePrefix,
|
||||
vbnamespacemanager_getDeclaredPrefixes,
|
||||
vbnamespacemanager_getPrefixes,
|
||||
vbnamespacemanager_getURI,
|
||||
vbnamespacemanager_getURIFromNode
|
||||
};
|
||||
|
||||
HRESULT MXNamespaceManager_create(IUnknown *outer, void **obj)
|
||||
{
|
||||
namespacemanager *ns;
|
||||
|
@ -201,6 +396,7 @@ HRESULT MXNamespaceManager_create(IUnknown *outer, void **obj)
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
ns->IMXNamespaceManager_iface.lpVtbl = &MXNamespaceManagerVtbl;
|
||||
ns->IVBMXNamespaceManager_iface.lpVtbl = &VBMXNamespaceManagerVtbl;
|
||||
ns->ref = 1;
|
||||
|
||||
*obj = &ns->IMXNamespaceManager_iface;
|
||||
|
|
|
@ -10115,6 +10115,82 @@ static void test_load(void)
|
|||
free_bstrs();
|
||||
}
|
||||
|
||||
static void test_nsnamespacemanager(void)
|
||||
{
|
||||
IMXNamespaceManager *nsmgr;
|
||||
IVBMXNamespaceManager *mgr2;
|
||||
IDispatch *disp;
|
||||
HRESULT hr;
|
||||
WCHAR buffW[250];
|
||||
INT len;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_MXNamespaceManager40, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IMXNamespaceManager, (void**)&nsmgr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("MXNamespaceManager is not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* IMXNamespaceManager inherits from IUnknown */
|
||||
hr = IMXNamespaceManager_QueryInterface(nsmgr, &IID_IDispatch, (void**)&disp);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
IDispatch_Release(disp);
|
||||
|
||||
hr = IMXNamespaceManager_QueryInterface(nsmgr, &IID_IVBMXNamespaceManager, (void**)&mgr2);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
IVBMXNamespaceManager_Release(mgr2);
|
||||
|
||||
todo_wine {
|
||||
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, NULL);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
||||
/* prefix already added */
|
||||
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri"));
|
||||
EXPECT_HR(hr, S_FALSE);
|
||||
|
||||
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns0"), NULL);
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
|
||||
/* "xml" and "xmlns" are not allowed here */
|
||||
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("xml"), _bstr_("uri1"));
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
|
||||
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("xmlns"), _bstr_("uri1"));
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
|
||||
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, -1, NULL, NULL);
|
||||
EXPECT_HR(hr, E_FAIL);
|
||||
|
||||
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, NULL, NULL);
|
||||
EXPECT_HR(hr, E_POINTER);
|
||||
|
||||
len = -1;
|
||||
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, NULL, &len);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
ok(len == 3, "got %d\n", len);
|
||||
}
|
||||
|
||||
len = -1;
|
||||
buffW[0] = 0x1;
|
||||
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
|
||||
todo_wine EXPECT_HR(hr, E_XML_BUFFERTOOSMALL);
|
||||
ok(len == -1, "got %d\n", len);
|
||||
ok(buffW[0] == 0x1, "got %x\n", buffW[0]);
|
||||
|
||||
len = 10;
|
||||
buffW[0] = 0x1;
|
||||
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
|
||||
todo_wine {
|
||||
EXPECT_HR(hr, S_OK);
|
||||
ok(len == 3, "got %d\n", len);
|
||||
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n", wine_dbgstr_w(buffW));
|
||||
}
|
||||
IMXNamespaceManager_Release(nsmgr);
|
||||
|
||||
free_bstrs();
|
||||
}
|
||||
|
||||
START_TEST(domdoc)
|
||||
{
|
||||
IXMLDOMDocument *doc;
|
||||
|
@ -10189,5 +10265,7 @@ START_TEST(domdoc)
|
|||
|
||||
test_xsltemplate();
|
||||
|
||||
test_nsnamespacemanager();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue