mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 19:26:05 +00:00
forgot to add these files
svn path=/trunk/; revision=36065
This commit is contained in:
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Copyright 2008 Piotr Caban
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
#include "wininet.h"
|
||||
#include "urlmon.h"
|
||||
#include "winreg.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
struct bsc_t {
|
||||
const struct IBindStatusCallbackVtbl *lpVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
void *obj;
|
||||
HRESULT (*onDataAvailable)(void*,char*,DWORD);
|
||||
|
||||
IBinding *binding;
|
||||
IStream *memstream;
|
||||
};
|
||||
|
||||
static inline bsc_t *impl_from_IBindStatusCallback( IBindStatusCallback *iface )
|
||||
{
|
||||
return (bsc_t *)((char*)iface - FIELD_OFFSET(bsc_t, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_QueryInterface(
|
||||
IBindStatusCallback *iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppobj )
|
||||
{
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IBindStatusCallback))
|
||||
{
|
||||
IBindStatusCallback_AddRef( iface );
|
||||
*ppobj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI bsc_AddRef(
|
||||
IBindStatusCallback *iface )
|
||||
{
|
||||
bsc_t *This = impl_from_IBindStatusCallback(iface);
|
||||
LONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI bsc_Release(
|
||||
IBindStatusCallback *iface )
|
||||
{
|
||||
bsc_t *This = impl_from_IBindStatusCallback(iface);
|
||||
LONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->binding)
|
||||
IBinding_Release(This->binding);
|
||||
if(This->memstream)
|
||||
IStream_Release(This->memstream);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnStartBinding(
|
||||
IBindStatusCallback* iface,
|
||||
DWORD dwReserved,
|
||||
IBinding* pib)
|
||||
{
|
||||
bsc_t *This = impl_from_IBindStatusCallback(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
|
||||
|
||||
This->binding = pib;
|
||||
IBindStatusCallback_AddRef(pib);
|
||||
|
||||
hr = CreateStreamOnHGlobal(NULL, TRUE, &This->memstream);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_GetPriority(
|
||||
IBindStatusCallback* iface,
|
||||
LONG* pnPriority)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnLowResource(
|
||||
IBindStatusCallback* iface,
|
||||
DWORD reserved)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnProgress(
|
||||
IBindStatusCallback* iface,
|
||||
ULONG ulProgress,
|
||||
ULONG ulProgressMax,
|
||||
ULONG ulStatusCode,
|
||||
LPCWSTR szStatusText)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnStopBinding(
|
||||
IBindStatusCallback* iface,
|
||||
HRESULT hresult,
|
||||
LPCWSTR szError)
|
||||
{
|
||||
bsc_t *This = impl_from_IBindStatusCallback(iface);
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
|
||||
|
||||
if(This->binding) {
|
||||
IBinding_Release(This->binding);
|
||||
This->binding = NULL;
|
||||
}
|
||||
|
||||
if(This->obj && SUCCEEDED(hresult)) {
|
||||
HGLOBAL hglobal;
|
||||
hr = GetHGlobalFromStream(This->memstream, &hglobal);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
DWORD len = GlobalSize(hglobal);
|
||||
char *ptr = GlobalLock(hglobal);
|
||||
|
||||
hr = This->onDataAvailable(This->obj, ptr, len);
|
||||
|
||||
GlobalUnlock(hglobal);
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_GetBindInfo(
|
||||
IBindStatusCallback* iface,
|
||||
DWORD* grfBINDF,
|
||||
BINDINFO* pbindinfo)
|
||||
{
|
||||
*grfBINDF = BINDF_GETNEWESTVERSION|BINDF_PULLDATA|BINDF_RESYNCHRONIZE|BINDF_PRAGMA_NO_CACHE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnDataAvailable(
|
||||
IBindStatusCallback* iface,
|
||||
DWORD grfBSCF,
|
||||
DWORD dwSize,
|
||||
FORMATETC* pformatetc,
|
||||
STGMEDIUM* pstgmed)
|
||||
{
|
||||
bsc_t *This = impl_from_IBindStatusCallback(iface);
|
||||
BYTE buf[4096];
|
||||
DWORD read, written;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
|
||||
|
||||
do
|
||||
{
|
||||
hr = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &read);
|
||||
if(FAILED(hr))
|
||||
break;
|
||||
|
||||
hr = IStream_Write(This->memstream, buf, read, &written);
|
||||
} while(SUCCEEDED(hr) && written != 0 && read != 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI bsc_OnObjectAvailable(
|
||||
IBindStatusCallback* iface,
|
||||
REFIID riid,
|
||||
IUnknown* punk)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IBindStatusCallbackVtbl bsc_vtbl =
|
||||
{
|
||||
bsc_QueryInterface,
|
||||
bsc_AddRef,
|
||||
bsc_Release,
|
||||
bsc_OnStartBinding,
|
||||
bsc_GetPriority,
|
||||
bsc_OnLowResource,
|
||||
bsc_OnProgress,
|
||||
bsc_OnStopBinding,
|
||||
bsc_GetBindInfo,
|
||||
bsc_OnDataAvailable,
|
||||
bsc_OnObjectAvailable
|
||||
};
|
||||
|
||||
HRESULT bind_url(LPCWSTR url, HRESULT (*onDataAvailable)(void*,char*,DWORD), void *obj, bsc_t **ret)
|
||||
{
|
||||
WCHAR fileUrl[INTERNET_MAX_URL_LENGTH];
|
||||
bsc_t *bsc;
|
||||
IBindCtx *pbc;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%s\n", debugstr_w(url));
|
||||
|
||||
if(!PathIsURLW(url))
|
||||
{
|
||||
WCHAR fullpath[MAX_PATH];
|
||||
DWORD needed = sizeof(fileUrl)/sizeof(WCHAR);
|
||||
|
||||
if(!PathSearchAndQualifyW(url, fullpath, sizeof(fullpath)/sizeof(WCHAR)))
|
||||
{
|
||||
WARN("can't find path\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(FAILED(UrlCreateFromPathW(url, fileUrl, &needed, 0)))
|
||||
{
|
||||
ERR("can't create url from path\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
url = fileUrl;
|
||||
}
|
||||
|
||||
hr = CreateBindCtx(0, &pbc);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
bsc = HeapAlloc(GetProcessHeap(), 0, sizeof(bsc_t));
|
||||
|
||||
bsc->lpVtbl = &bsc_vtbl;
|
||||
bsc->ref = 1;
|
||||
bsc->obj = obj;
|
||||
bsc->onDataAvailable = onDataAvailable;
|
||||
bsc->binding = NULL;
|
||||
bsc->memstream = NULL;
|
||||
|
||||
hr = RegisterBindStatusCallback(pbc, (IBindStatusCallback*)&bsc->lpVtbl, NULL, 0);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IMoniker *moniker;
|
||||
|
||||
hr = CreateURLMoniker(NULL, url, &moniker);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IStream *stream;
|
||||
hr = IMoniker_BindToStorage(moniker, pbc, NULL, &IID_IStream, (LPVOID*)&stream);
|
||||
IMoniker_Release(moniker);
|
||||
if(stream)
|
||||
IStream_Release(stream);
|
||||
}
|
||||
IBindCtx_Release(pbc);
|
||||
}
|
||||
|
||||
*ret = bsc;
|
||||
return hr;
|
||||
}
|
||||
|
||||
void detach_bsc(bsc_t *bsc)
|
||||
{
|
||||
if(bsc->binding)
|
||||
IBinding_Abort(bsc->binding);
|
||||
|
||||
bsc->obj = NULL;
|
||||
IBindStatusCallback_Release((IBindStatusCallback*)&bsc->lpVtbl);
|
||||
}
|
||||
@@ -0,0 +1,794 @@
|
||||
/*
|
||||
* DOM CDATA node implementation
|
||||
*
|
||||
* Copyright 2007 Alistair Leslie-Hughes
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
typedef struct _domcdata
|
||||
{
|
||||
const struct IXMLDOMCDATASectionVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IUnknown *element_unk;
|
||||
IXMLDOMCDATASection *element;
|
||||
} domcdata;
|
||||
|
||||
static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface )
|
||||
{
|
||||
return (domcdata *)((char*)iface - FIELD_OFFSET(domcdata, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_QueryInterface(
|
||||
IXMLDOMCDATASection *iface,
|
||||
REFIID riid,
|
||||
void** ppvObject )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) ||
|
||||
IsEqualGUID( riid, &IID_IDispatch ) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown ) )
|
||||
{
|
||||
*ppvObject = iface;
|
||||
}
|
||||
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
|
||||
IsEqualGUID( riid, &IID_IXMLDOMElement ) )
|
||||
{
|
||||
return IUnknown_QueryInterface(This->element_unk, riid, ppvObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IXMLDOMCDATASection_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI domcdata_AddRef(
|
||||
IXMLDOMCDATASection *iface )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return InterlockedIncrement( &This->ref );
|
||||
}
|
||||
|
||||
static ULONG WINAPI domcdata_Release(
|
||||
IXMLDOMCDATASection *iface )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
ULONG ref;
|
||||
|
||||
ref = InterlockedDecrement( &This->ref );
|
||||
if ( ref == 0 )
|
||||
{
|
||||
IUnknown_Release( This->element_unk );
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_GetTypeInfoCount(
|
||||
IXMLDOMCDATASection *iface,
|
||||
UINT* pctinfo )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
|
||||
*pctinfo = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_GetTypeInfo(
|
||||
IXMLDOMCDATASection *iface,
|
||||
UINT iTInfo, LCID lcid,
|
||||
ITypeInfo** ppTInfo )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
hr = get_typeinfo(IXMLDOMCDATASection_tid, ppTInfo);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_GetIDsOfNames(
|
||||
IXMLDOMCDATASection *iface,
|
||||
REFIID riid, LPOLESTR* rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID* rgDispId )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( 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(IXMLDOMCDATASection_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_Invoke(
|
||||
IXMLDOMCDATASection *iface,
|
||||
DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
||||
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( 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(IXMLDOMCDATASection_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nodeName(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nodeName( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nodeValue(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT* var1 )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nodeValue( This->element, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_put_nodeValue(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT var1 )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_put_nodeValue( This->element, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nodeType(
|
||||
IXMLDOMCDATASection *iface,
|
||||
DOMNodeType* domNodeType )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nodeType( This->element, domNodeType );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_parentNode(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** parent )
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_parentNode( This->element, parent );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_childNodes(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNodeList** outList)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_childNodes( This->element, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_firstChild(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_firstChild( This->element, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_lastChild(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_lastChild( This->element, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_previousSibling(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_previousSibling( This->element, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nextSibling(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nextSibling( This->element, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_attributes(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNamedNodeMap** attributeMap)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_attributes( This->element, attributeMap );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_insertBefore(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* newNode, VARIANT var1,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_replaceChild(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* newNode,
|
||||
IXMLDOMNode* oldNode,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_removeChild(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_removeChild( This->element, domNode, oldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_appendChild(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_appendChild( This->element, newNode, outNewNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_hasChildNodes(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_hasChildNodes( This->element, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_ownerDocument(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMDocument** domDocument)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_ownerDocument( This->element, domDocument );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_cloneNode(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_cloneNode( This->element, pbool, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nodeTypeString(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nodeTypeString( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_text(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_text( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_put_text(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_put_text( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_specified(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_specified( This->element, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_definition(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_definition( This->element, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_nodeTypedValue(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_nodeTypedValue( This->element, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_put_nodeTypedValue(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT var1)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_put_nodeTypedValue( This->element, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_dataType(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_dataType( This->element, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_put_dataType(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_put_dataType( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_xml(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_xml( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_transformNode(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* domNode, BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_transformNode( This->element, domNode, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_selectNodes(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR p, IXMLDOMNodeList** outList)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_selectNodes( This->element, p, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_selectSingleNode(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR p, IXMLDOMNode** outNode)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_selectSingleNode( This->element, p, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_parsed(
|
||||
IXMLDOMCDATASection *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_parsed( This->element, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_namespaceURI(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_namespaceURI( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_prefix(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_prefix( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_baseName(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_get_baseName( This->element, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_transformNodeToObject(
|
||||
IXMLDOMCDATASection *iface,
|
||||
IXMLDOMNode* domNode, VARIANT var1)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_data(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR *p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
HRESULT hr = E_FAIL;
|
||||
VARIANT vRet;
|
||||
|
||||
if(!p)
|
||||
return E_INVALIDARG;
|
||||
|
||||
hr = IXMLDOMNode_get_nodeValue( This->element, &vRet );
|
||||
if(hr == S_OK)
|
||||
{
|
||||
*p = V_BSTR(&vRet);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_put_data(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR data)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
HRESULT hr = E_FAIL;
|
||||
VARIANT val;
|
||||
|
||||
TRACE("%p %s\n", This, debugstr_w(data) );
|
||||
|
||||
V_VT(&val) = VT_BSTR;
|
||||
V_BSTR(&val) = data;
|
||||
|
||||
hr = IXMLDOMNode_put_nodeValue( This->element, val );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_length(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long *len)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
|
||||
xmlChar *pContent;
|
||||
long nLength = 0;
|
||||
|
||||
TRACE("%p\n", iface);
|
||||
|
||||
if(!len)
|
||||
return E_INVALIDARG;
|
||||
|
||||
pContent = xmlNodeGetContent(pDOMNode->node);
|
||||
if(pContent)
|
||||
{
|
||||
nLength = xmlStrlen(pContent);
|
||||
xmlFree(pContent);
|
||||
}
|
||||
|
||||
*len = nLength;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_substringData(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long offset, long count, BSTR *p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
|
||||
xmlChar *pContent;
|
||||
long nLength = 0;
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
TRACE("%p\n", iface);
|
||||
|
||||
if(!p)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*p = NULL;
|
||||
if(offset < 0 || count < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(count == 0)
|
||||
return hr;
|
||||
|
||||
pContent = xmlNodeGetContent(pDOMNode->node);
|
||||
if(pContent)
|
||||
{
|
||||
nLength = xmlStrlen(pContent);
|
||||
|
||||
if( offset < nLength)
|
||||
{
|
||||
BSTR sContent = bstr_from_xmlChar(pContent);
|
||||
if(offset + count > nLength)
|
||||
*p = SysAllocString(&sContent[offset]);
|
||||
else
|
||||
*p = SysAllocStringLen(&sContent[offset], count);
|
||||
|
||||
SysFreeString(sContent);
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
xmlFree(pContent);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_appendData(
|
||||
IXMLDOMCDATASection *iface,
|
||||
BSTR p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
|
||||
xmlChar *pContent;
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
TRACE("%p\n", iface);
|
||||
|
||||
/* Nothing to do if NULL or an Empty string passed in. */
|
||||
if(p == NULL || SysStringLen(p) == 0)
|
||||
return S_OK;
|
||||
|
||||
pContent = xmlChar_from_wchar( (WCHAR*)p );
|
||||
if(pContent)
|
||||
{
|
||||
if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
|
||||
hr = S_OK;
|
||||
else
|
||||
hr = E_FAIL;
|
||||
}
|
||||
else
|
||||
hr = E_FAIL;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_insertData(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long offset, BSTR p)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
|
||||
xmlChar *pXmlContent;
|
||||
BSTR sNewString;
|
||||
HRESULT hr = S_FALSE;
|
||||
long nLength = 0, nLengthP = 0;
|
||||
xmlChar *str = NULL;
|
||||
|
||||
TRACE("%p\n", This);
|
||||
|
||||
/* If have a NULL or empty string, don't do anything. */
|
||||
if(SysStringLen(p) == 0)
|
||||
return S_OK;
|
||||
|
||||
if(offset < 0)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pXmlContent = xmlNodeGetContent(pDOMNode->node);
|
||||
if(pXmlContent)
|
||||
{
|
||||
BSTR sContent = bstr_from_xmlChar( pXmlContent );
|
||||
nLength = SysStringLen(sContent);
|
||||
nLengthP = SysStringLen(p);
|
||||
|
||||
if(nLength < offset)
|
||||
{
|
||||
SysFreeString(sContent);
|
||||
xmlFree(pXmlContent);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
|
||||
if(sNewString)
|
||||
{
|
||||
if(offset > 0)
|
||||
memcpy(sNewString, sContent, offset * sizeof(WCHAR));
|
||||
|
||||
memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
|
||||
|
||||
if(offset+nLengthP < nLength)
|
||||
memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
|
||||
|
||||
sNewString[nLengthP + nLength] = 0;
|
||||
|
||||
str = xmlChar_from_wchar((WCHAR*)sNewString);
|
||||
if(str)
|
||||
{
|
||||
xmlNodeSetContent(pDOMNode->node, str);
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
SysFreeString(sNewString);
|
||||
}
|
||||
|
||||
SysFreeString(sContent);
|
||||
|
||||
xmlFree(pXmlContent);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_deleteData(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long offset, long count)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_replaceData(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long offset, long count, BSTR p)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_splitText(
|
||||
IXMLDOMCDATASection *iface,
|
||||
long offset, IXMLDOMText **txtNode)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
|
||||
{
|
||||
domcdata_QueryInterface,
|
||||
domcdata_AddRef,
|
||||
domcdata_Release,
|
||||
domcdata_GetTypeInfoCount,
|
||||
domcdata_GetTypeInfo,
|
||||
domcdata_GetIDsOfNames,
|
||||
domcdata_Invoke,
|
||||
domcdata_get_nodeName,
|
||||
domcdata_get_nodeValue,
|
||||
domcdata_put_nodeValue,
|
||||
domcdata_get_nodeType,
|
||||
domcdata_get_parentNode,
|
||||
domcdata_get_childNodes,
|
||||
domcdata_get_firstChild,
|
||||
domcdata_get_lastChild,
|
||||
domcdata_get_previousSibling,
|
||||
domcdata_get_nextSibling,
|
||||
domcdata_get_attributes,
|
||||
domcdata_insertBefore,
|
||||
domcdata_replaceChild,
|
||||
domcdata_removeChild,
|
||||
domcdata_appendChild,
|
||||
domcdata_hasChildNodes,
|
||||
domcdata_get_ownerDocument,
|
||||
domcdata_cloneNode,
|
||||
domcdata_get_nodeTypeString,
|
||||
domcdata_get_text,
|
||||
domcdata_put_text,
|
||||
domcdata_get_specified,
|
||||
domcdata_get_definition,
|
||||
domcdata_get_nodeTypedValue,
|
||||
domcdata_put_nodeTypedValue,
|
||||
domcdata_get_dataType,
|
||||
domcdata_put_dataType,
|
||||
domcdata_get_xml,
|
||||
domcdata_transformNode,
|
||||
domcdata_selectNodes,
|
||||
domcdata_selectSingleNode,
|
||||
domcdata_get_parsed,
|
||||
domcdata_get_namespaceURI,
|
||||
domcdata_get_prefix,
|
||||
domcdata_get_baseName,
|
||||
domcdata_transformNodeToObject,
|
||||
domcdata_get_data,
|
||||
domcdata_put_data,
|
||||
domcdata_get_length,
|
||||
domcdata_substringData,
|
||||
domcdata_appendData,
|
||||
domcdata_insertData,
|
||||
domcdata_deleteData,
|
||||
domcdata_replaceData,
|
||||
domcdata_splitText
|
||||
};
|
||||
|
||||
IUnknown* create_cdata( xmlNodePtr text )
|
||||
{
|
||||
domcdata *This;
|
||||
HRESULT hr;
|
||||
|
||||
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
|
||||
if ( !This )
|
||||
return NULL;
|
||||
|
||||
This->lpVtbl = &domcdata_vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl );
|
||||
if(!This->element_unk)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
IUnknown_Release(This->element_unk);
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return NULL;
|
||||
}
|
||||
/* The ref on This->element is actually looped back into this object, so release it */
|
||||
IXMLDOMNode_Release(This->element);
|
||||
|
||||
return (IUnknown*) &This->lpVtbl;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,630 @@
|
||||
/*
|
||||
* Copyright 2008 Jacek Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
#include "wininet.h"
|
||||
#include "urlmon.h"
|
||||
#include "winreg.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
#define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
|
||||
|
||||
typedef struct {
|
||||
DISPID id;
|
||||
BSTR name;
|
||||
enum tid_t tid;
|
||||
} func_info_t;
|
||||
|
||||
struct dispex_data_t {
|
||||
DWORD func_cnt;
|
||||
func_info_t *funcs;
|
||||
func_info_t **name_table;
|
||||
|
||||
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 ITypeLib *typelib;
|
||||
static ITypeInfo *typeinfos[LAST_tid];
|
||||
|
||||
static REFIID tid_ids[] = {
|
||||
&IID_IXMLDOMAttribute,
|
||||
&IID_IXMLDOMCDATASection,
|
||||
&IID_IXMLDOMComment,
|
||||
&IID_IXMLDOMDocument2,
|
||||
&IID_IXMLDOMDocumentFragment,
|
||||
&IID_IXMLDOMElement,
|
||||
&IID_IXMLDOMEntityReference,
|
||||
&IID_IXMLDOMImplementation,
|
||||
&IID_IXMLDOMNamedNodeMap,
|
||||
&IID_IXMLDOMNode,
|
||||
&IID_IXMLDOMNodeList,
|
||||
&IID_IXMLDOMParseError,
|
||||
&IID_IXMLDOMProcessingInstruction,
|
||||
&IID_IXMLDOMSchemaCollection,
|
||||
&IID_IXMLDOMText,
|
||||
&IID_IXMLElement,
|
||||
&IID_IXMLDOMDocument,
|
||||
&IID_IVBSAXAttributes,
|
||||
&IID_IVBSAXContentHandler,
|
||||
&IID_IVBSAXDeclHandler,
|
||||
&IID_IVBSAXDTDHandler,
|
||||
&IID_IVBSAXEntityResolver,
|
||||
&IID_IVBSAXErrorHandler,
|
||||
&IID_IVBSAXLexicalHandler,
|
||||
&IID_IVBSAXLocator,
|
||||
&IID_IVBSAXXMLFilter,
|
||||
&IID_IVBSAXXMLReader,
|
||||
&IID_IMXAttributes,
|
||||
&IID_IMXReaderControl,
|
||||
&IID_IMXWriter,
|
||||
};
|
||||
|
||||
HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
if(!typelib) {
|
||||
ITypeLib *tl;
|
||||
|
||||
hres = LoadRegTypeLib(&LIBID_MSXML2, 3, 0, LOCALE_SYSTEM_DEFAULT, &tl);
|
||||
if(FAILED(hres)) {
|
||||
ERR("LoadRegTypeLib failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
|
||||
ITypeLib_Release(tl);
|
||||
}
|
||||
|
||||
if(!typeinfos[tid]) {
|
||||
ITypeInfo *typeinfo;
|
||||
|
||||
hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &typeinfo);
|
||||
if(FAILED(hres)) {
|
||||
ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), typeinfo, NULL))
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
*typeinfo = typeinfos[tid];
|
||||
|
||||
ITypeInfo_AddRef(typeinfos[tid]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void release_typelib(void)
|
||||
{
|
||||
dispex_data_t *iter;
|
||||
unsigned i;
|
||||
|
||||
while(!list_empty(&dispex_data_list)) {
|
||||
iter = LIST_ENTRY(list_head(&dispex_data_list), dispex_data_t, entry);
|
||||
list_remove(&iter->entry);
|
||||
|
||||
for(i=0; i < iter->func_cnt; i++)
|
||||
SysFreeString(iter->funcs[i].name);
|
||||
|
||||
heap_free(iter->funcs);
|
||||
heap_free(iter->name_table);
|
||||
heap_free(iter);
|
||||
}
|
||||
|
||||
if(!typelib)
|
||||
return;
|
||||
|
||||
for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
|
||||
if(typeinfos[i])
|
||||
ITypeInfo_Release(typeinfos[i]);
|
||||
|
||||
ITypeLib_Release(typelib);
|
||||
}
|
||||
|
||||
static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, DISPID id, ITypeInfo *dti)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
if(data->func_cnt && data->funcs[data->func_cnt-1].id == id)
|
||||
return;
|
||||
|
||||
if(data->func_cnt == *size)
|
||||
data->funcs = heap_realloc(data->funcs, (*size <<= 1)*sizeof(func_info_t));
|
||||
|
||||
hres = ITypeInfo_GetDocumentation(dti, id, &data->funcs[data->func_cnt].name, NULL, NULL, NULL);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
data->funcs[data->func_cnt].id = id;
|
||||
data->funcs[data->func_cnt].tid = tid;
|
||||
|
||||
data->func_cnt++;
|
||||
}
|
||||
|
||||
static int dispid_cmp(const void *p1, const void *p2)
|
||||
{
|
||||
return ((func_info_t*)p1)->id - ((func_info_t*)p2)->id;
|
||||
}
|
||||
|
||||
static int func_name_cmp(const void *p1, const void *p2)
|
||||
{
|
||||
return strcmpiW((*(func_info_t**)p1)->name, (*(func_info_t**)p2)->name);
|
||||
}
|
||||
|
||||
static dispex_data_t *preprocess_dispex_data(DispatchEx *This)
|
||||
{
|
||||
const tid_t *tid = This->data->iface_tids;
|
||||
FUNCDESC *funcdesc;
|
||||
dispex_data_t *data;
|
||||
DWORD size = 16, i;
|
||||
ITypeInfo *ti, *dti;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
hres = get_typeinfo(This->data->disp_tid, &dti);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not get disp type info: %08x\n", hres);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = heap_alloc(sizeof(dispex_data_t));
|
||||
data->func_cnt = 0;
|
||||
data->funcs = heap_alloc(size*sizeof(func_info_t));
|
||||
list_add_tail(&dispex_data_list, &data->entry);
|
||||
|
||||
while(*tid) {
|
||||
hres = get_typeinfo(*tid, &ti);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
i=0;
|
||||
while(1) {
|
||||
hres = ITypeInfo_GetFuncDesc(ti, i++, &funcdesc);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
add_func_info(data, &size, *tid, funcdesc->memid, dti);
|
||||
ITypeInfo_ReleaseFuncDesc(ti, funcdesc);
|
||||
}
|
||||
|
||||
ITypeInfo_Release(ti);
|
||||
tid++;
|
||||
}
|
||||
|
||||
if(!data->func_cnt) {
|
||||
heap_free(data->funcs);
|
||||
data->funcs = NULL;
|
||||
}else if(data->func_cnt != size) {
|
||||
data->funcs = heap_realloc(data->funcs, data->func_cnt * sizeof(func_info_t));
|
||||
}
|
||||
|
||||
qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp);
|
||||
|
||||
if(data->funcs) {
|
||||
data->name_table = heap_alloc(data->func_cnt * sizeof(func_info_t*));
|
||||
for(i=0; i < data->func_cnt; i++)
|
||||
data->name_table[i] = data->funcs+i;
|
||||
qsort(data->name_table, data->func_cnt, sizeof(func_info_t*), func_name_cmp);
|
||||
}else {
|
||||
data->name_table = NULL;
|
||||
}
|
||||
|
||||
ITypeInfo_Release(dti);
|
||||
return data;
|
||||
}
|
||||
|
||||
static CRITICAL_SECTION cs_dispex_static_data;
|
||||
static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg =
|
||||
{
|
||||
0, 0, &cs_dispex_static_data,
|
||||
{ &cs_dispex_static_data_dbg.ProcessLocksList, &cs_dispex_static_data_dbg.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": dispex_static_data") }
|
||||
};
|
||||
static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
static dispex_data_t *get_dispex_data(DispatchEx *This)
|
||||
{
|
||||
if(This->data->data)
|
||||
return This->data->data;
|
||||
|
||||
EnterCriticalSection(&cs_dispex_static_data);
|
||||
|
||||
if(!This->data->data)
|
||||
This->data->data = preprocess_dispex_data(This);
|
||||
|
||||
LeaveCriticalSection(&cs_dispex_static_data);
|
||||
|
||||
return This->data->data;
|
||||
}
|
||||
|
||||
static inline BOOL is_custom_dispid(DISPID id)
|
||||
{
|
||||
return MSXML_DISPID_CUSTOM_MIN <= id && id <= MSXML_DISPID_CUSTOM_MAX;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return (DispatchEx*)((char*)iface - FIELD_OFFSET(DispatchEx, lpIDispatchExVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
return IUnknown_QueryInterface(This->outer, riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
return IUnknown_AddRef(This->outer);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
return IUnknown_Release(This->outer);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
|
||||
*pctinfo = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
return get_typeinfo(This->data->disp_tid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
UINT i;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
||||
lcid, rgDispId);
|
||||
|
||||
for(i=0; i < cNames; i++) {
|
||||
hres = IDispatchEx_GetDispID(DISPATCHEX(This), rgszNames[i], 0, rgDispId+i);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
|
||||
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
|
||||
return IDispatchEx_InvokeEx(DISPATCHEX(This), dispIdMember, lcid, wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, NULL);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
dispex_data_t *data;
|
||||
int min, max, n, c;
|
||||
|
||||
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
|
||||
|
||||
if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit))
|
||||
FIXME("Unsupported grfdex %x\n", grfdex);
|
||||
|
||||
data = get_dispex_data(This);
|
||||
if(!data)
|
||||
return E_FAIL;
|
||||
|
||||
min = 0;
|
||||
max = data->func_cnt-1;
|
||||
|
||||
while(min <= max) {
|
||||
n = (min+max)/2;
|
||||
|
||||
c = strcmpiW(data->name_table[n]->name, bstrName);
|
||||
if(!c) {
|
||||
if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, bstrName))
|
||||
break;
|
||||
|
||||
*pid = data->name_table[n]->id;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(c > 0)
|
||||
max = n-1;
|
||||
else
|
||||
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) {
|
||||
HRESULT hres;
|
||||
|
||||
hres = This->data->vtbl->get_dispid(This->outer, bstrName, grfdex, pid);
|
||||
if(hres != DISP_E_UNKNOWNNAME)
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(grfdex & fdexNameEnsure) {
|
||||
TRACE("creating dynamic prop %s\n", debugstr_w(bstrName));
|
||||
|
||||
if(!This->dynamic_data) {
|
||||
This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t));
|
||||
This->dynamic_data->props = heap_alloc(This->dynamic_data->buf_size = 4);
|
||||
}else if(This->dynamic_data->buf_size == This->dynamic_data->prop_cnt) {
|
||||
This->dynamic_data->props = heap_realloc(This->dynamic_data->props, This->dynamic_data->buf_size<<=1);
|
||||
}
|
||||
|
||||
This->dynamic_data->props[This->dynamic_data->prop_cnt].name = heap_strdupW(bstrName);
|
||||
VariantInit(&This->dynamic_data->props[This->dynamic_data->prop_cnt].var);
|
||||
*pid = DISPID_DYNPROP_0 + This->dynamic_data->prop_cnt++;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("not found %s\n", debugstr_w(bstrName));
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
IUnknown *unk;
|
||||
ITypeInfo *ti;
|
||||
dispex_data_t *data;
|
||||
UINT argerr=0;
|
||||
int min, max, n;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
|
||||
if(is_custom_dispid(id) && This->data->vtbl && This->data->vtbl->invoke)
|
||||
return This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei);
|
||||
|
||||
if(wFlags == DISPATCH_CONSTRUCT) {
|
||||
FIXME("DISPATCH_CONSTRUCT not implemented\n");
|
||||
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:
|
||||
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);
|
||||
if(!data)
|
||||
return E_FAIL;
|
||||
|
||||
min = 0;
|
||||
max = data->func_cnt-1;
|
||||
|
||||
while(min <= max) {
|
||||
n = (min+max)/2;
|
||||
|
||||
if(data->funcs[n].id == id)
|
||||
break;
|
||||
|
||||
if(data->funcs[n].id < id)
|
||||
min = n+1;
|
||||
else
|
||||
max = n-1;
|
||||
}
|
||||
|
||||
if(min > max) {
|
||||
WARN("invalid id %x\n", id);
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
}
|
||||
|
||||
hres = get_typeinfo(data->funcs[n].tid, &ti);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not get type info: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(This->outer, tid_ids[data->funcs[n].tid], (void**)&unk);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not get iface: %08x\n", hres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr);
|
||||
|
||||
ITypeInfo_Release(ti);
|
||||
IUnknown_Release(unk);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%x)\n", This, id);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
||||
{
|
||||
DispatchEx *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%p)\n", This, ppunk);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static IDispatchExVtbl DispatchExVtbl = {
|
||||
DispatchEx_QueryInterface,
|
||||
DispatchEx_AddRef,
|
||||
DispatchEx_Release,
|
||||
DispatchEx_GetTypeInfoCount,
|
||||
DispatchEx_GetTypeInfo,
|
||||
DispatchEx_GetIDsOfNames,
|
||||
DispatchEx_Invoke,
|
||||
DispatchEx_GetDispID,
|
||||
DispatchEx_InvokeEx,
|
||||
DispatchEx_DeleteMemberByName,
|
||||
DispatchEx_DeleteMemberByDispID,
|
||||
DispatchEx_GetMemberProperties,
|
||||
DispatchEx_GetMemberName,
|
||||
DispatchEx_GetNextDispID,
|
||||
DispatchEx_GetNameSpaceParent
|
||||
};
|
||||
|
||||
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
|
||||
{
|
||||
static const IID IID_UndocumentedScriptIface =
|
||||
{0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
|
||||
|
||||
if(IsEqualGUID(&IID_IDispatch, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
||||
*ppv = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
|
||||
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
|
||||
*ppv = DISPATCHEX(This);
|
||||
}else if(IsEqualGUID(&IID_UndocumentedScriptIface, riid)) {
|
||||
TRACE("(%p)->(IID_UndocumentedScriptIface %p) returning NULL\n", This, ppv);
|
||||
*ppv = NULL;
|
||||
}else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(*ppv)
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
|
||||
{
|
||||
dispex->lpIDispatchExVtbl = &DispatchExVtbl;
|
||||
dispex->outer = outer;
|
||||
dispex->data = data;
|
||||
}
|
||||
@@ -0,0 +1,552 @@
|
||||
/*
|
||||
* DOM Document Fragment implementation
|
||||
*
|
||||
* Copyright 2007 Alistair Leslie-Hughes
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
typedef struct _domfrag
|
||||
{
|
||||
const struct IXMLDOMDocumentFragmentVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IUnknown *node_unk;
|
||||
IXMLDOMNode *node;
|
||||
} domfrag;
|
||||
|
||||
static inline domfrag *impl_from_IXMLDOMDocumentFragment( IXMLDOMDocumentFragment *iface )
|
||||
{
|
||||
return (domfrag *)((char*)iface - FIELD_OFFSET(domfrag, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_QueryInterface(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
REFIID riid,
|
||||
void** ppvObject )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentFragment ) ||
|
||||
IsEqualGUID( riid, &IID_IDispatch ) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown ) )
|
||||
{
|
||||
*ppvObject = iface;
|
||||
}
|
||||
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
|
||||
{
|
||||
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IXMLDOMDocumentFragment_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI domfrag_AddRef(
|
||||
IXMLDOMDocumentFragment *iface )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return InterlockedIncrement( &This->ref );
|
||||
}
|
||||
|
||||
static ULONG WINAPI domfrag_Release(
|
||||
IXMLDOMDocumentFragment *iface )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
ULONG ref;
|
||||
|
||||
ref = InterlockedDecrement( &This->ref );
|
||||
if ( ref == 0 )
|
||||
{
|
||||
IUnknown_Release( This->node_unk );
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_GetTypeInfoCount(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
UINT* pctinfo )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
|
||||
*pctinfo = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_GetTypeInfo(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
UINT iTInfo, LCID lcid,
|
||||
ITypeInfo** ppTInfo )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
hr = get_typeinfo(IXMLDOMDocumentFragment_tid, ppTInfo);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_GetIDsOfNames(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
REFIID riid, LPOLESTR* rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID* rgDispId )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( 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(IXMLDOMDocumentFragment_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_Invoke(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
||||
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( 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(IXMLDOMDocumentFragment_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nodeName(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nodeName( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nodeValue(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT* var1 )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nodeValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_put_nodeValue(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT var1 )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_put_nodeValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nodeType(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
DOMNodeType* domNodeType )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nodeType( This->node, domNodeType );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_parentNode(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** parent )
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_parentNode( This->node, parent );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_childNodes(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNodeList** outList)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_childNodes( This->node, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_firstChild(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_firstChild( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_lastChild(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_lastChild( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_previousSibling(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_previousSibling( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nextSibling(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nextSibling( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_attributes(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNamedNodeMap** attributeMap)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_attributes( This->node, attributeMap );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_insertBefore(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* newNode, VARIANT var1,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_replaceChild(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* newNode,
|
||||
IXMLDOMNode* oldNode,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_removeChild(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_appendChild(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_hasChildNodes(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_hasChildNodes( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_ownerDocument(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMDocument** domDocument)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_cloneNode(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nodeTypeString(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nodeTypeString( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_text(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_text( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_put_text(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_put_text( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_specified(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_specified( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_definition(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_definition( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_nodeTypedValue(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_put_nodeTypedValue(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT var1)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_dataType(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_dataType( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_put_dataType(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_put_dataType( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_xml(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_xml( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_transformNode(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* domNode, BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_transformNode( This->node, domNode, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_selectNodes(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR p, IXMLDOMNodeList** outList)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_selectNodes( This->node, p, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_selectSingleNode(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR p, IXMLDOMNode** outNode)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_parsed(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_parsed( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_namespaceURI(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_namespaceURI( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_prefix(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_prefix( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_get_baseName(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_get_baseName( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domfrag_transformNodeToObject(
|
||||
IXMLDOMDocumentFragment *iface,
|
||||
IXMLDOMNode* domNode, VARIANT var1)
|
||||
{
|
||||
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
|
||||
return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
|
||||
}
|
||||
|
||||
static const struct IXMLDOMDocumentFragmentVtbl domfrag_vtbl =
|
||||
{
|
||||
domfrag_QueryInterface,
|
||||
domfrag_AddRef,
|
||||
domfrag_Release,
|
||||
domfrag_GetTypeInfoCount,
|
||||
domfrag_GetTypeInfo,
|
||||
domfrag_GetIDsOfNames,
|
||||
domfrag_Invoke,
|
||||
domfrag_get_nodeName,
|
||||
domfrag_get_nodeValue,
|
||||
domfrag_put_nodeValue,
|
||||
domfrag_get_nodeType,
|
||||
domfrag_get_parentNode,
|
||||
domfrag_get_childNodes,
|
||||
domfrag_get_firstChild,
|
||||
domfrag_get_lastChild,
|
||||
domfrag_get_previousSibling,
|
||||
domfrag_get_nextSibling,
|
||||
domfrag_get_attributes,
|
||||
domfrag_insertBefore,
|
||||
domfrag_replaceChild,
|
||||
domfrag_removeChild,
|
||||
domfrag_appendChild,
|
||||
domfrag_hasChildNodes,
|
||||
domfrag_get_ownerDocument,
|
||||
domfrag_cloneNode,
|
||||
domfrag_get_nodeTypeString,
|
||||
domfrag_get_text,
|
||||
domfrag_put_text,
|
||||
domfrag_get_specified,
|
||||
domfrag_get_definition,
|
||||
domfrag_get_nodeTypedValue,
|
||||
domfrag_put_nodeTypedValue,
|
||||
domfrag_get_dataType,
|
||||
domfrag_put_dataType,
|
||||
domfrag_get_xml,
|
||||
domfrag_transformNode,
|
||||
domfrag_selectNodes,
|
||||
domfrag_selectSingleNode,
|
||||
domfrag_get_parsed,
|
||||
domfrag_get_namespaceURI,
|
||||
domfrag_get_prefix,
|
||||
domfrag_get_baseName,
|
||||
domfrag_transformNodeToObject
|
||||
};
|
||||
|
||||
IUnknown* create_doc_fragment( xmlNodePtr fragment )
|
||||
{
|
||||
domfrag *This;
|
||||
HRESULT hr;
|
||||
|
||||
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
|
||||
if ( !This )
|
||||
return NULL;
|
||||
|
||||
This->lpVtbl = &domfrag_vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
This->node_unk = create_basic_node( fragment, (IUnknown*)&This->lpVtbl );
|
||||
if(!This->node_unk)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
IUnknown_Release(This->node_unk);
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return NULL;
|
||||
}
|
||||
/* The ref on This->node is actually looped back into this object, so release it */
|
||||
IXMLDOMNode_Release(This->node);
|
||||
|
||||
return (IUnknown*) &This->lpVtbl;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* DOM Document Implementation implementation
|
||||
*
|
||||
* Copyright 2007 Alistair Leslie-Hughes
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
typedef struct _domimpl
|
||||
{
|
||||
const struct IXMLDOMImplementationVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} domimpl;
|
||||
|
||||
static inline domimpl *impl_from_IXMLDOMImplementation( IXMLDOMImplementation *iface )
|
||||
{
|
||||
return (domimpl *)((char*)iface - FIELD_OFFSET(domimpl, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_QueryInterface(
|
||||
IXMLDOMImplementation *iface,
|
||||
REFIID riid,
|
||||
void** ppvObject )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( iface );
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IXMLDOMImplementation ) ||
|
||||
IsEqualGUID( riid, &IID_IDispatch ) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown ) )
|
||||
{
|
||||
*ppvObject = iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IXMLDOMImplementation_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI dimimpl_AddRef(
|
||||
IXMLDOMImplementation *iface )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( iface );
|
||||
return InterlockedIncrement( &This->ref );
|
||||
}
|
||||
|
||||
static ULONG WINAPI dimimpl_Release(
|
||||
IXMLDOMImplementation *iface )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( iface );
|
||||
ULONG ref;
|
||||
|
||||
ref = InterlockedDecrement( &This->ref );
|
||||
if ( ref == 0 )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_GetTypeInfoCount(
|
||||
IXMLDOMImplementation *iface,
|
||||
UINT* pctinfo )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( iface );
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
|
||||
*pctinfo = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_GetTypeInfo(
|
||||
IXMLDOMImplementation *iface,
|
||||
UINT iTInfo, LCID lcid,
|
||||
ITypeInfo** ppTInfo )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( iface );
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
hr = get_typeinfo(IXMLDOMImplementation_tid, ppTInfo);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_GetIDsOfNames(
|
||||
IXMLDOMImplementation *iface,
|
||||
REFIID riid, LPOLESTR* rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID* rgDispId )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( 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(IXMLDOMImplementation_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_Invoke(
|
||||
IXMLDOMImplementation *iface,
|
||||
DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
||||
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
||||
{
|
||||
domimpl *This = impl_from_IXMLDOMImplementation( 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(IXMLDOMImplementation_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature)
|
||||
{
|
||||
static const WCHAR bVersion[] = {'1','.','0',0};
|
||||
static const WCHAR bXML[] = {'X','M','L',0};
|
||||
static const WCHAR bDOM[] = {'D','O','M',0};
|
||||
static const WCHAR bMSDOM[] = {'M','S','-','D','O','M',0};
|
||||
BOOL bValidFeature = FALSE;
|
||||
BOOL bValidVersion = FALSE;
|
||||
|
||||
TRACE("feature(%s) version (%s)\n", debugstr_w(feature), debugstr_w(version));
|
||||
|
||||
if(!feature || !hasFeature)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*hasFeature = VARIANT_FALSE;
|
||||
|
||||
if(!version || lstrcmpiW(version, bVersion) == 0)
|
||||
bValidVersion = TRUE;
|
||||
|
||||
if(lstrcmpiW(feature, bXML) == 0 || lstrcmpiW(feature, bDOM) == 0 || lstrcmpiW(feature, bMSDOM) == 0)
|
||||
bValidFeature = TRUE;
|
||||
|
||||
if(bValidVersion && bValidFeature)
|
||||
*hasFeature = VARIANT_TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IXMLDOMImplementationVtbl dimimpl_vtbl =
|
||||
{
|
||||
dimimpl_QueryInterface,
|
||||
dimimpl_AddRef,
|
||||
dimimpl_Release,
|
||||
dimimpl_GetTypeInfoCount,
|
||||
dimimpl_GetTypeInfo,
|
||||
dimimpl_GetIDsOfNames,
|
||||
dimimpl_Invoke,
|
||||
dimimpl_hasFeature
|
||||
};
|
||||
|
||||
IUnknown* create_doc_Implementation(void)
|
||||
{
|
||||
domimpl *This;
|
||||
|
||||
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
|
||||
if ( !This )
|
||||
return NULL;
|
||||
|
||||
This->lpVtbl = &dimimpl_vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
return (IUnknown*) &This->lpVtbl;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,551 @@
|
||||
/*
|
||||
* DOM Entity Reference implementation
|
||||
*
|
||||
* Copyright 2007 Alistair Leslie-Hughes
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "msxml2.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
typedef struct _entityref
|
||||
{
|
||||
const struct IXMLDOMEntityReferenceVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IUnknown *node_unk;
|
||||
IXMLDOMNode *node;
|
||||
} entityref;
|
||||
|
||||
static inline entityref *impl_from_IXMLDOMEntityReference( IXMLDOMEntityReference *iface )
|
||||
{
|
||||
return (entityref *)((char*)iface - FIELD_OFFSET(entityref, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_QueryInterface(
|
||||
IXMLDOMEntityReference *iface,
|
||||
REFIID riid,
|
||||
void** ppvObject )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if ( IsEqualGUID( riid, &IID_IXMLDOMEntityReference ) ||
|
||||
IsEqualGUID( riid, &IID_IDispatch ) ||
|
||||
IsEqualGUID( riid, &IID_IUnknown ) )
|
||||
{
|
||||
*ppvObject = iface;
|
||||
}
|
||||
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
|
||||
{
|
||||
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IXMLDOMEntityReference_AddRef( iface );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI entityref_AddRef(
|
||||
IXMLDOMEntityReference *iface )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return InterlockedIncrement( &This->ref );
|
||||
}
|
||||
|
||||
static ULONG WINAPI entityref_Release(
|
||||
IXMLDOMEntityReference *iface )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
ULONG ref;
|
||||
|
||||
ref = InterlockedDecrement( &This->ref );
|
||||
if ( ref == 0 )
|
||||
{
|
||||
IUnknown_Release( This->node_unk );
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_GetTypeInfoCount(
|
||||
IXMLDOMEntityReference *iface,
|
||||
UINT* pctinfo )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
|
||||
*pctinfo = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_GetTypeInfo(
|
||||
IXMLDOMEntityReference *iface,
|
||||
UINT iTInfo, LCID lcid,
|
||||
ITypeInfo** ppTInfo )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
hr = get_typeinfo(IXMLDOMEntityReference_tid, ppTInfo);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_GetIDsOfNames(
|
||||
IXMLDOMEntityReference *iface,
|
||||
REFIID riid, LPOLESTR* rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID* rgDispId )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( 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(IXMLDOMEntityReference_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_Invoke(
|
||||
IXMLDOMEntityReference *iface,
|
||||
DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
||||
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( 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(IXMLDOMEntityReference_tid, &typeinfo);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr);
|
||||
ITypeInfo_Release(typeinfo);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nodeName(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nodeName( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nodeValue(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT* var1 )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nodeValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_put_nodeValue(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT var1 )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_put_nodeValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nodeType(
|
||||
IXMLDOMEntityReference *iface,
|
||||
DOMNodeType* domNodeType )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nodeType( This->node, domNodeType );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_parentNode(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** parent )
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_parentNode( This->node, parent );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_childNodes(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNodeList** outList)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_childNodes( This->node, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_firstChild(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_firstChild( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_lastChild(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_lastChild( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_previousSibling(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_previousSibling( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nextSibling(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nextSibling( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_attributes(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNamedNodeMap** attributeMap)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_attributes( This->node, attributeMap );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_insertBefore(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* newNode, VARIANT var1,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_replaceChild(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* newNode,
|
||||
IXMLDOMNode* oldNode,
|
||||
IXMLDOMNode** outOldNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_removeChild(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_appendChild(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_hasChildNodes(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_hasChildNodes( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_ownerDocument(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMDocument** domDocument)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_cloneNode(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nodeTypeString(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nodeTypeString( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_text(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_text( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_put_text(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_put_text( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_specified(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_specified( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_definition(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode** domNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_definition( This->node, domNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_nodeTypedValue(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_put_nodeTypedValue(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT var1)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_dataType(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT* var1)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_dataType( This->node, var1 );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_put_dataType(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_put_dataType( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_xml(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_xml( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_transformNode(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* domNode, BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_transformNode( This->node, domNode, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_selectNodes(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR p, IXMLDOMNodeList** outList)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_selectNodes( This->node, p, outList );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_selectSingleNode(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR p, IXMLDOMNode** outNode)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_parsed(
|
||||
IXMLDOMEntityReference *iface,
|
||||
VARIANT_BOOL* pbool)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_parsed( This->node, pbool );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_namespaceURI(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_namespaceURI( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_prefix(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_prefix( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_get_baseName(
|
||||
IXMLDOMEntityReference *iface,
|
||||
BSTR* p)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_get_baseName( This->node, p );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI entityref_transformNodeToObject(
|
||||
IXMLDOMEntityReference *iface,
|
||||
IXMLDOMNode* domNode, VARIANT var1)
|
||||
{
|
||||
entityref *This = impl_from_IXMLDOMEntityReference( iface );
|
||||
return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
|
||||
}
|
||||
|
||||
static const struct IXMLDOMEntityReferenceVtbl entityref_vtbl =
|
||||
{
|
||||
entityref_QueryInterface,
|
||||
entityref_AddRef,
|
||||
entityref_Release,
|
||||
entityref_GetTypeInfoCount,
|
||||
entityref_GetTypeInfo,
|
||||
entityref_GetIDsOfNames,
|
||||
entityref_Invoke,
|
||||
entityref_get_nodeName,
|
||||
entityref_get_nodeValue,
|
||||
entityref_put_nodeValue,
|
||||
entityref_get_nodeType,
|
||||
entityref_get_parentNode,
|
||||
entityref_get_childNodes,
|
||||
entityref_get_firstChild,
|
||||
entityref_get_lastChild,
|
||||
entityref_get_previousSibling,
|
||||
entityref_get_nextSibling,
|
||||
entityref_get_attributes,
|
||||
entityref_insertBefore,
|
||||
entityref_replaceChild,
|
||||
entityref_removeChild,
|
||||
entityref_appendChild,
|
||||
entityref_hasChildNodes,
|
||||
entityref_get_ownerDocument,
|
||||
entityref_cloneNode,
|
||||
entityref_get_nodeTypeString,
|
||||
entityref_get_text,
|
||||
entityref_put_text,
|
||||
entityref_get_specified,
|
||||
entityref_get_definition,
|
||||
entityref_get_nodeTypedValue,
|
||||
entityref_put_nodeTypedValue,
|
||||
entityref_get_dataType,
|
||||
entityref_put_dataType,
|
||||
entityref_get_xml,
|
||||
entityref_transformNode,
|
||||
entityref_selectNodes,
|
||||
entityref_selectSingleNode,
|
||||
entityref_get_parsed,
|
||||
entityref_get_namespaceURI,
|
||||
entityref_get_prefix,
|
||||
entityref_get_baseName,
|
||||
entityref_transformNodeToObject,
|
||||
};
|
||||
|
||||
IUnknown* create_doc_entity_ref( xmlNodePtr entity )
|
||||
{
|
||||
entityref *This;
|
||||
HRESULT hr;
|
||||
|
||||
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
|
||||
if ( !This )
|
||||
return NULL;
|
||||
|
||||
This->lpVtbl = &entityref_vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
This->node_unk = create_basic_node( entity, (IUnknown*)&This->lpVtbl );
|
||||
if(!This->node_unk)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
IUnknown_Release(This->node_unk);
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return NULL;
|
||||
}
|
||||
/* The ref on This->node is actually looped back into this object, so release it */
|
||||
IXMLDOMNode_Release(This->node);
|
||||
|
||||
return (IUnknown*) &This->lpVtbl;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2007 Alistair Leslie-Hughes
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "msxml2.idl"
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user