msxml3: Implement IXMLDOMDocument IDispatch interface
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Wed Feb 13 13:41:54 CST 2008
Hi,
Was there anything wrong with this patch?
Dont commit this patch if nothing is wrong. I will submit a series of
patches, that will include these changes.
Best Regards
Alistair Leslie-Hughes
"Alistair Leslie-Hughes" <leslie_alistair at hotmail.com> wrote in message
news:fnchqv$a5r$1 at ger.gmane.org...
> Hi,
>
> Fixes bug http://bugs.winehq.org/show_bug.cgi?id=11257
>
> Changelog:
> msxml3: Implement IXMLDOMDocument IDispatch interface
>
> Best Regards
> Alistair Leslie-Hughes
>
--------------------------------------------------------------------------------
> From 7cc5228684ed6d9aaace829cc1b8ebb43e5f4325 Mon Sep 17 00:00:00 2001
> From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> Date: Fri, 25 Jan 2008 22:34:36 +1100
> Subject: [PATCH] Implement IXMLDOMDocument IDispatch interface
> To: wine-patches <wine-patches at winehq.org>
>
> ---
> dlls/msxml3/domdoc.c | 53 +++++++++++++++++++++++++++++++++------
> dlls/msxml3/main.c | 58
> +++++++++++++++++++++++++++++++++++++++++++
> dlls/msxml3/msxml_private.h | 8 ++++++
> 3 files changed, 111 insertions(+), 8 deletions(-)
>
> diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
> index 06388c8..9d6b94b 100644
> --- a/dlls/msxml3/domdoc.c
> +++ b/dlls/msxml3/domdoc.c
> @@ -416,16 +416,29 @@ static ULONG WINAPI domdoc_Release(
>
> static HRESULT WINAPI domdoc_GetTypeInfoCount( IXMLDOMDocument2 *iface,
> UINT* pctinfo )
> {
> - FIXME("\n");
> - return E_NOTIMPL;
> + domdoc *This = impl_from_IXMLDOMDocument2( iface );
> +
> + TRACE("(%p)->(%p)\n", This, pctinfo);
> +
> + *pctinfo = 1;
> +
> + return S_OK;
> }
>
> static HRESULT WINAPI domdoc_GetTypeInfo(
> IXMLDOMDocument2 *iface,
> UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
> {
> - FIXME("\n");
> - return E_NOTIMPL;
> + domdoc *This = impl_from_IXMLDOMDocument2( iface );
> + HRESULT hr;
> +
> + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
> +
> + hr = get_typeinfo(IXMLDOMDocument2_tid, ppTInfo);
> + if(SUCCEEDED(hr))
> + ITypeInfo_AddRef(*ppTInfo);
> +
> + return hr;
> }
>
> static HRESULT WINAPI domdoc_GetIDsOfNames(
> @@ -436,8 +449,21 @@ static HRESULT WINAPI domdoc_GetIDsOfNames(
> LCID lcid,
> DISPID* rgDispId)
> {
> - FIXME("\n");
> - return E_NOTIMPL;
> + domdoc *This = impl_from_IXMLDOMDocument2( 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(IXMLDOMDocument2_tid, &typeinfo);
> + if(SUCCEEDED(hr))
> + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames,
> rgDispId);
> +
> + return hr;
> }
>
>
> @@ -452,8 +478,19 @@ static HRESULT WINAPI domdoc_Invoke(
> EXCEPINFO* pExcepInfo,
> UINT* puArgErr)
> {
> - FIXME("\n");
> - return E_NOTIMPL;
> + domdoc *This = impl_from_IXMLDOMDocument2( 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(IXMLDOMDocument2_tid, &typeinfo);
> + if(SUCCEEDED(hr))
> + hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember,
> wFlags, pDispParams,
> + pVarResult, pExcepInfo, puArgErr);
> +
> + return hr;
> }
>
>
> diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
> index 62bf2b5..41afbe6 100644
> --- a/dlls/msxml3/main.c
> +++ b/dlls/msxml3/main.c
> @@ -21,6 +21,8 @@
>
> #include "config.h"
>
> +#define COBJMACROS
> +
> #include <stdarg.h>
> #include "windef.h"
> #include "winbase.h"
> @@ -34,6 +36,61 @@
>
> WINE_DEFAULT_DEBUG_CHANNEL(msxml);
>
> +
> +static ITypeLib *typelib;
> +static ITypeInfo *typeinfos[LAST_tid];
> +
> +static REFIID tid_ids[] = {
> + &IID_IXMLDOMDocument2
> +};
> +
> +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];
> + return S_OK;
> +}
> +
> +static void process_detach(void)
> +{
> + if(typelib) {
> + unsigned i;
> +
> + for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
> + if(typeinfos[i])
> + ITypeInfo_Release(typeinfos[i]);
> +
> + ITypeLib_Release(typelib);
> + }
> +}
> +
> HRESULT WINAPI DllCanUnloadNow(void)
> {
> FIXME("\n");
> @@ -53,6 +110,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD
> fdwReason, LPVOID lpv)
> case DLL_PROCESS_DETACH:
> #ifdef HAVE_LIBXML2
> xmlCleanupParser();
> + process_detach();
> #endif
> break;
> }
> diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
> index 8d79d2e..c7d97a1 100644
> --- a/dlls/msxml3/msxml_private.h
> +++ b/dlls/msxml3/msxml_private.h
> @@ -91,4 +91,12 @@ extern HRESULT DOMDocument_create( IUnknown *pUnkOuter,
> LPVOID *ppObj );
> extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
> extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
>
> +/* typelibs */
> +enum tid_t {
> + IXMLDOMDocument2_tid,
> + LAST_tid
> +};
> +
> +extern HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo);
> +
> #endif /* __MSXML_PRIVATE__ */
> --
> 1.5.3.7
>
>
--------------------------------------------------------------------------------
>
>
More information about the wine-devel
mailing list