diff --git a/reactos/dll/win32/msxml3/bsc.c b/reactos/dll/win32/msxml3/bsc.c index b660d5bfa19..9e148cb4051 100644 --- a/reactos/dll/win32/msxml3/bsc.c +++ b/reactos/dll/win32/msxml3/bsc.c @@ -149,7 +149,7 @@ static HRESULT WINAPI bsc_OnStopBinding( DWORD len = GlobalSize(hglobal); char *ptr = GlobalLock(hglobal); - This->hres = hr = This->onDataAvailable(This->obj, ptr, len); + This->hres = This->onDataAvailable(This->obj, ptr, len); GlobalUnlock(hglobal); } @@ -234,7 +234,7 @@ HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon) return E_FAIL; } - if(FAILED(UrlCreateFromPathW(url, fileUrl, &needed, 0))) + if(FAILED(UrlCreateFromPathW(fullpath, fileUrl, &needed, 0))) { ERR("can't create url from path\n"); return E_FAIL; diff --git a/reactos/dll/win32/msxml3/dispex.c b/reactos/dll/win32/msxml3/dispex.c index 578d052f5b4..e425084fc6c 100644 --- a/reactos/dll/win32/msxml3/dispex.c +++ b/reactos/dll/win32/msxml3/dispex.c @@ -18,6 +18,8 @@ #include "precomp.h" +#include + static CRITICAL_SECTION cs_dispex_static_data; static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg = { @@ -59,20 +61,6 @@ struct dispex_data_t { 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[LibXml_Last]; static ITypeInfo *typeinfos[LAST_tid]; @@ -314,11 +302,6 @@ static dispex_data_t *get_dispex_data(DispatchEx *This) return This->data->data; } -static inline BOOL is_dynamic_dispid(DISPID id) -{ - return DISPID_DYNPROP_0 <= id && id <= DISPID_DYNPROP_MAX; -} - static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); @@ -391,7 +374,7 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, { DispatchEx *This = impl_from_IDispatchEx(iface); - TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, @@ -434,17 +417,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW 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; @@ -453,46 +425,34 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW return hres; } - if(grfdex & fdexNameEnsure) { - dispex_dynamic_data_t *dynamic_data; - - TRACE("creating dynamic prop %s\n", debugstr_w(bstrName)); - - if(This->dynamic_data) { - dynamic_data = This->dynamic_data; - }else { - dynamic_data = This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)); - if(!dynamic_data) - return E_OUTOFMEMORY; - } - - if(!dynamic_data->buf_size) { - dynamic_data->props = heap_alloc(sizeof(dynamic_prop_t)*4); - if(!dynamic_data->props) - return E_OUTOFMEMORY; - dynamic_data->buf_size = 4; - }else if(dynamic_data->buf_size == dynamic_data->prop_cnt) { - dynamic_prop_t *new_props; - - new_props = heap_realloc(dynamic_data->props, sizeof(dynamic_prop_t)*(dynamic_data->buf_size<<1)); - if(!new_props) - return E_OUTOFMEMORY; - - dynamic_data->props = new_props; - dynamic_data->buf_size <<= 1; - } - - dynamic_data->props[dynamic_data->prop_cnt].name = heap_strdupW(bstrName); - VariantInit(&dynamic_data->props[dynamic_data->prop_cnt].var); - *pid = DISPID_DYNPROP_0 + dynamic_data->prop_cnt++; - - return S_OK; - } - TRACE("not found %s\n", debugstr_w(bstrName)); return DISP_E_UNKNOWNNAME; } +static BOOL is_propputref_id(DISPID id) +{ + switch (id) + { + case DISPID_DOM_DOCUMENT_DOCUMENTELEMENT: + case DISPID_XMLDOM_DOCUMENT2_SCHEMAS: + case DISPID_XMLDOM_SELECTION_CONTEXT: + case DISPID_XMLDOM_TEMPLATE_STYLESHEET: + case DISPID_SAX_CONTENTHANDLER_DOCUMENTLOCATOR: + case DISPID_SAX_XMLFILTER_PARENT: + case DISPID_SAX_XMLREADER_ENTITYRESOLVER: + case DISPID_SAX_XMLREADER_CONTENTHANDLER: + case DISPID_SAX_XMLREADER_DTDHANDLER: + case DISPID_SAX_XMLREADER_ERRORHANDLER: + case DISPID_MXXML_FILTER_ENTITYRESOLVER: + case DISPID_MXXML_FILTER_CONTENTHANDLER: + case DISPID_MXXML_FILTER_DTDHANDLER: + case DISPID_MXXML_FILTER_ERRORHANDLER: + return TRUE; + default: + return FALSE; + } +} + static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -516,28 +476,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return E_NOTIMPL; } - if(is_dynamic_dispid(id)) { - DWORD idx = id - DISPID_DYNPROP_0; - VARIANT *var; - - if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx) - return DISP_E_UNKNOWNNAME; - - var = &This->dynamic_data->props[idx].var; - - switch(wFlags) { - case INVOKE_PROPERTYGET: - V_VT(pvarRes) = VT_EMPTY; - return VariantCopy(pvarRes, var); - case INVOKE_PROPERTYPUT: - VariantClear(var); - return VariantCopy(var, pdp->rgvarg); - default: - FIXME("unhandled wFlags %x\n", wFlags); - return E_NOTIMPL; - } - } - data = get_dispex_data(This); if(!data) return E_FAIL; @@ -575,6 +513,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return E_FAIL; } + if (is_propputref_id(id) && wFlags == DISPATCH_PROPERTYPUT) + wFlags = DISPATCH_PROPERTYPUTREF; hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr); ITypeInfo_Release(ti); @@ -673,26 +613,9 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) return TRUE; } -void release_dispex(DispatchEx *This) -{ - dynamic_prop_t *prop; - - if(!This->dynamic_data) - return; - - for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { - VariantClear(&prop->var); - heap_free(prop->name); - } - - heap_free(This->dynamic_data->props); - heap_free(This->dynamic_data); -} - void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data) { dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->outer = outer; dispex->data = data; - dispex->dynamic_data = NULL; } diff --git a/reactos/dll/win32/msxml3/domdoc.c b/reactos/dll/win32/msxml3/domdoc.c index db25d5c558b..0fca3e0a499 100644 --- a/reactos/dll/win32/msxml3/domdoc.c +++ b/reactos/dll/win32/msxml3/domdoc.c @@ -64,6 +64,7 @@ typedef struct { xmlChar const* selectNsStr; LONG selectNsStr_len; BOOL XPath; + WCHAR *url; } domdoc_properties; typedef struct ConnectionPoint ConnectionPoint; @@ -107,10 +108,9 @@ struct domdoc VARIANT_BOOL validating; VARIANT_BOOL resolving; domdoc_properties* properties; - bsc_t *bsc; HRESULT error; - /* IObjectWithSite*/ + /* IObjectWithSite */ IUnknown *site; /* IObjectSafety */ @@ -276,6 +276,9 @@ static domdoc_properties *create_properties(MSXML_VERSION version) properties->version = version; properties->XPath = (version == MSXML4 || version == MSXML6); + /* document url */ + properties->url = NULL; + return properties; } @@ -310,6 +313,16 @@ static domdoc_properties* copy_properties(domdoc_properties const* properties) list_add_tail(&pcopy->selectNsList, &new_ns->entry); } + if (properties->url) + { + int len = strlenW(properties->url); + + pcopy->url = CoTaskMemAlloc((len+1)*sizeof(WCHAR)); + memcpy(pcopy->url, properties->url, len*sizeof(WCHAR)); + pcopy->url[len] = 0; + } + else + pcopy->url = NULL; } return pcopy; @@ -323,6 +336,7 @@ static void free_properties(domdoc_properties* properties) IXMLDOMSchemaCollection2_Release(properties->schemaCache); clear_selectNsList(&properties->selectNsList); heap_free((xmlChar*)properties->selectNsStr); + CoTaskMemFree(properties->url); heap_free(properties); } } @@ -918,9 +932,6 @@ static ULONG WINAPI domdoc_Release( IXMLDOMDocument3 *iface ) { int eid; - if(This->bsc) - detach_bsc(This->bsc); - if (This->site) IUnknown_Release( This->site ); destroy_xmlnode(&This->node); @@ -2045,7 +2056,7 @@ static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len) return attach_xmldoc(This, xmldoc); } - return S_OK; + return E_FAIL; } static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon) @@ -2057,14 +2068,7 @@ static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon) if(FAILED(hr)) return hr; - if(This->bsc) { - hr = detach_bsc(This->bsc); - if(FAILED(hr)) - return hr; - } - - This->bsc = bsc; - return S_OK; + return detach_bsc(bsc); } static HRESULT WINAPI domdoc_load( @@ -2188,10 +2192,15 @@ static HRESULT WINAPI domdoc_load( { IMoniker *mon; + CoTaskMemFree(This->properties->url); + This->properties->url = NULL; + hr = create_moniker_from_url( filename, &mon); if ( SUCCEEDED(hr) ) { hr = domdoc_load_moniker( This, mon ); + if (hr == S_OK) + IMoniker_GetDisplayName(mon, NULL, NULL, &This->properties->url); IMoniker_Release(mon); } @@ -2254,11 +2263,25 @@ static HRESULT WINAPI domdoc_get_parseError( static HRESULT WINAPI domdoc_get_url( IXMLDOMDocument3 *iface, - BSTR* urlString ) + BSTR* url ) { domdoc *This = impl_from_IXMLDOMDocument3(iface); - FIXME("(%p)->(%p)\n", This, urlString); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, url); + + if (!url) + return E_INVALIDARG; + + if (This->properties->url) + { + *url = SysAllocString(This->properties->url); + if (!*url) + return E_OUTOFMEMORY; + + return S_OK; + } + else + return return_null_bstr(url); } @@ -2581,7 +2604,7 @@ static HRESULT WINAPI domdoc_get_namespaces( if (!This->namespaces) { - hr = SchemaCache_create(This->properties->version, NULL, (void**)&This->namespaces); + hr = SchemaCache_create(This->properties->version, (void**)&This->namespaces); if (hr != S_OK) return hr; hr = cache_from_doc_ns(This->namespaces, &This->node); @@ -3533,7 +3556,6 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) doc->error = S_OK; doc->site = NULL; doc->safeopt = 0; - doc->bsc = NULL; doc->cp_list = NULL; doc->namespaces = NULL; memset(doc->events, 0, sizeof(doc->events)); @@ -3552,12 +3574,12 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) return S_OK; } -HRESULT DOMDocument_create(MSXML_VERSION version, IUnknown *pUnkOuter, void **ppObj) +HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj) { xmlDocPtr xmldoc; HRESULT hr; - TRACE("(%d, %p, %p)\n", version, pUnkOuter, ppObj); + TRACE("(%d, %p)\n", version, ppObj); xmldoc = xmlNewDoc(NULL); if(!xmldoc) @@ -3593,7 +3615,7 @@ IUnknown* create_domdoc( xmlNodePtr document ) #else -HRESULT DOMDocument_create(MSXML_VERSION version, IUnknown *pUnkOuter, void **ppObj) +HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj) { MESSAGE("This program tried to use a DOMDocument object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/dll/win32/msxml3/domimpl.c b/reactos/dll/win32/msxml3/domimpl.c index 5cb8df72a91..a18070a7590 100644 --- a/reactos/dll/win32/msxml3/domimpl.c +++ b/reactos/dll/win32/msxml3/domimpl.c @@ -81,10 +81,7 @@ static ULONG WINAPI dimimpl_Release( TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) - { - release_dispex(&This->dispex); heap_free( This ); - } return ref; } diff --git a/reactos/dll/win32/msxml3/factory.c b/reactos/dll/win32/msxml3/factory.c index cb9ac32d3ca..3a01490ebe3 100644 --- a/reactos/dll/win32/msxml3/factory.c +++ b/reactos/dll/win32/msxml3/factory.c @@ -47,8 +47,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); -typedef HRESULT (*ClassFactoryCreateInstanceFunc)(IUnknown*, void**); -typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, IUnknown*, void**); +typedef HRESULT (*ClassFactoryCreateInstanceFunc)(void**); +typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, void**); struct clsid_version_t { @@ -175,7 +175,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance( if (pOuter) return CLASS_E_NOAGGREGATION; - r = This->pCreateInstance( pOuter, (void**) &punk ); + r = This->pCreateInstance( (void**) &punk ); if (FAILED(r)) return r; @@ -233,7 +233,7 @@ static HRESULT WINAPI DOMClassFactory_CreateInstance( if (pOuter) return CLASS_E_NOAGGREGATION; - r = This->pCreateInstance( This->version, pOuter, (void**) &punk ); + r = This->pCreateInstance( This->version, (void**) &punk ); if (FAILED(r)) return r; diff --git a/reactos/dll/win32/msxml3/httprequest.c b/reactos/dll/win32/msxml3/httprequest.c index 8f8e64495f7..ea22ebf2a12 100644 --- a/reactos/dll/win32/msxml3/httprequest.c +++ b/reactos/dll/win32/msxml3/httprequest.c @@ -433,9 +433,11 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac { static const WCHAR content_type_utf8W[] = {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ', 't','e','x','t','/','p','l','a','i','n',';','c','h','a','r','s','e','t','=','u','t','f','-','8','\r','\n',0}; + static const WCHAR refererW[] = {'R','e','f','e','r','e','r',':',' ',0}; BindStatusCallback *This = impl_from_IHttpNegotiate(iface); const struct httpheader *entry; + BSTR base_uri = NULL; WCHAR *buff, *ptr; int size = 0; @@ -449,10 +451,24 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac if (!list_empty(&This->request->reqheaders)) size += This->request->reqheader_size*sizeof(WCHAR); - if (!size) return S_OK; + if (This->request->base_uri) + { + IUri_GetRawUri(This->request->base_uri, &base_uri); + size += SysStringLen(base_uri)*sizeof(WCHAR) + sizeof(refererW) + sizeof(crlfW); + } + + if (!size) + { + SysFreeString(base_uri); + return S_OK; + } buff = CoTaskMemAlloc(size); - if (!buff) return E_OUTOFMEMORY; + if (!buff) + { + SysFreeString(base_uri); + return E_OUTOFMEMORY; + } ptr = buff; if (This->request->use_utf8_content) @@ -461,6 +477,15 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac ptr += sizeof(content_type_utf8W)/sizeof(WCHAR)-1; } + if (base_uri) + { + strcpyW(ptr, refererW); + strcatW(ptr, base_uri); + strcatW(ptr, crlfW); + ptr += strlenW(refererW) + SysStringLen(base_uri) + strlenW(crlfW); + SysFreeString(base_uri); + } + /* user headers */ LIST_FOR_EACH_ENTRY(entry, &This->request->reqheaders, struct httpheader, entry) { @@ -1116,7 +1141,7 @@ static HRESULT httprequest_get_responseXML(httprequest *This, IDispatch **body) if (!body) return E_INVALIDARG; if (This->state != READYSTATE_COMPLETE) return E_FAIL; - hr = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&doc); + hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc); if (hr != S_OK) return hr; hr = httprequest_get_responseText(This, &str); @@ -1546,6 +1571,8 @@ static void get_base_uri(httprequest *This) return; hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc); + if(FAILED(hr)) + hr = IServiceProvider_QueryService(provider, &SID_SInternetHostSecurityManager, &IID_IHTMLDocument2, (void**)&doc); IServiceProvider_Release(provider); if(FAILED(hr)) return; @@ -1955,11 +1982,11 @@ static void init_httprequest(httprequest *req) req->safeopt = 0; } -HRESULT XMLHTTPRequest_create(IUnknown *outer, void **obj) +HRESULT XMLHTTPRequest_create(void **obj) { httprequest *req; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); req = heap_alloc( sizeof (*req) ); if( !req ) @@ -1973,11 +2000,11 @@ HRESULT XMLHTTPRequest_create(IUnknown *outer, void **obj) return S_OK; } -HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) +HRESULT ServerXMLHTTP_create(void **obj) { serverhttp *req; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); req = heap_alloc( sizeof (*req) ); if( !req ) @@ -1996,14 +2023,14 @@ HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) #else -HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, void **ppObj) +HRESULT XMLHTTPRequest_create(void **ppObj) { MESSAGE("This program tried to use a XMLHTTPRequest object, but\n" "libxml2 support was not present at compile time.\n"); return E_NOTIMPL; } -HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) +HRESULT ServerXMLHTTP_create(void **obj) { MESSAGE("This program tried to use a ServerXMLHTTP object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/dll/win32/msxml3/main.c b/reactos/dll/win32/msxml3/main.c index 939743f744e..e3247c33977 100644 --- a/reactos/dll/win32/msxml3/main.c +++ b/reactos/dll/win32/msxml3/main.c @@ -31,7 +31,9 @@ # ifdef HAVE_LIBXSLT_TRANSFORM_H # include # endif +# include # include +# include # include # endif #endif @@ -48,7 +50,7 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, { enum __wine_debug_class dbcl; char buff[200]; - static const int max_size = sizeof(buff) / sizeof(buff[0]); + const int max_size = sizeof(buff) / sizeof(buff[0]); int len; switch (lvl) @@ -145,22 +147,19 @@ static int wineXmlFileCloseCallback (void * context) return CloseHandle(context) ? 0 : -1; } -#endif - - -HRESULT WINAPI DllCanUnloadNow(void) -{ - return S_FALSE; -} - - void* libxslt_handle = NULL; #ifdef SONAME_LIBXSLT # define DECL_FUNCPTR(f) typeof(f) * p##f = NULL DECL_FUNCPTR(xsltApplyStylesheet); +DECL_FUNCPTR(xsltApplyStylesheetUser); DECL_FUNCPTR(xsltCleanupGlobals); DECL_FUNCPTR(xsltFreeStylesheet); +DECL_FUNCPTR(xsltFreeTransformContext); +DECL_FUNCPTR(xsltNewTransformContext); +DECL_FUNCPTR(xsltNextImport); DECL_FUNCPTR(xsltParseStylesheetDoc); +DECL_FUNCPTR(xsltQuoteUserParams); +DECL_FUNCPTR(xsltSaveResultTo); # undef DECL_FUNCPTR #endif @@ -178,9 +177,15 @@ static void init_libxslt(void) if (needed) { WARN("Can't find symbol %s\n", #f); goto sym_not_found; } LOAD_FUNCPTR(xsltInit, 0); LOAD_FUNCPTR(xsltApplyStylesheet, 1); + LOAD_FUNCPTR(xsltApplyStylesheetUser, 1); LOAD_FUNCPTR(xsltCleanupGlobals, 1); LOAD_FUNCPTR(xsltFreeStylesheet, 1); + LOAD_FUNCPTR(xsltFreeTransformContext, 1); + LOAD_FUNCPTR(xsltNewTransformContext, 1); + LOAD_FUNCPTR(xsltNextImport, 1); LOAD_FUNCPTR(xsltParseStylesheetDoc, 1); + LOAD_FUNCPTR(xsltQuoteUserParams, 1); + LOAD_FUNCPTR(xsltSaveResultTo, 1); #undef LOAD_FUNCPTR if (pxsltInit) @@ -193,6 +198,15 @@ static void init_libxslt(void) #endif } +#endif /* HAVE_LIBXML2 */ + + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_FALSE; +} + + BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) { MSXML_hInstance = hInstDLL; @@ -214,11 +228,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) WARN("Failed to register callbacks\n"); schemasInit(); -#endif init_libxslt(); +#endif DisableThreadLibraryCalls(hInstDLL); break; case DLL_PROCESS_DETACH: + if (reserved) break; +#ifdef HAVE_LIBXML2 #ifdef SONAME_LIBXSLT if (libxslt_handle) { @@ -226,7 +242,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) wine_dlclose(libxslt_handle, NULL, 0); } #endif -#ifdef HAVE_LIBXML2 /* Restore default Callbacks */ xmlCleanupInputCallbacks(); xmlRegisterDefaultInputCallbacks(); diff --git a/reactos/dll/win32/msxml3/msxml3_v1.idl b/reactos/dll/win32/msxml3/msxml3_v1.idl index d80833fafb6..9987e545b4c 100644 --- a/reactos/dll/win32/msxml3/msxml3_v1.idl +++ b/reactos/dll/win32/msxml3/msxml3_v1.idl @@ -16,4 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "msxml2.idl" diff --git a/reactos/dll/win32/msxml3/msxml_private.h b/reactos/dll/win32/msxml3/msxml_private.h index 9f11add0b04..ee457691000 100644 --- a/reactos/dll/win32/msxml3/msxml_private.h +++ b/reactos/dll/win32/msxml3/msxml_private.h @@ -24,6 +24,7 @@ #include #include +#include #ifndef __WINE_CONFIG_H # error You must include config.h to use this header @@ -133,7 +134,6 @@ extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN; extern void release_typelib(void) DECLSPEC_HIDDEN; typedef struct dispex_data_t dispex_data_t; -typedef struct dispex_dynamic_data_t dispex_dynamic_data_t; typedef struct { HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*); @@ -153,7 +153,6 @@ typedef struct { IUnknown *outer; dispex_static_data_t *data; - dispex_dynamic_data_t *dynamic_data; } DispatchEx; extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN; @@ -180,6 +179,11 @@ static inline void *heap_realloc(void *mem, size_t len) return HeapReAlloc(GetProcessHeap(), 0, mem, len); } +static inline void *heap_realloc_zero(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); +} + static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem); @@ -217,6 +221,20 @@ static inline LPSTR heap_strdupWtoA(LPCWSTR str) return ret; } +/* XSLProcessor parameter list */ +struct xslprocessor_par +{ + struct list entry; + BSTR name; + BSTR value; +}; + +struct xslprocessor_params +{ + struct list list; + unsigned int count; +}; + #ifdef HAVE_LIBXML2 extern void schemasInit(void) DECLSPEC_HIDDEN; @@ -300,7 +318,7 @@ extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_H extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN; extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN; -extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN; +extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN; extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN; extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN; @@ -354,6 +372,7 @@ extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN; extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN; extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN; extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN; +extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,IStream*,const struct xslprocessor_params*) DECLSPEC_HIDDEN; extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN; extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN; @@ -441,6 +460,18 @@ static inline HRESULT return_bstr(const WCHAR *value, BSTR *p) return S_OK; } +static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p) +{ + if(value) { + *p = SysAllocStringLen(value, len); + if(!*p) + return E_OUTOFMEMORY; + }else + *p = NULL; + + return S_OK; +} + static inline HRESULT return_null_node(IXMLDOMNode **p) { if(!p) @@ -486,18 +517,18 @@ static inline HRESULT return_var_false(VARIANT_BOOL *p) extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText, LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN; -extern HRESULT DOMDocument_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SchemaCache_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT XMLDocument_create(IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SAXXMLReader_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SAXAttributes_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT XMLHTTPRequest_create(IUnknown*, void **) DECLSPEC_HIDDEN; -extern HRESULT ServerXMLHTTP_create(IUnknown*, void **) DECLSPEC_HIDDEN; -extern HRESULT XSLTemplate_create(IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT MXWriter_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT MXNamespaceManager_create(IUnknown*,void**) DECLSPEC_HIDDEN; -extern HRESULT XMLParser_create(IUnknown*,void**) DECLSPEC_HIDDEN; -extern HRESULT XMLView_create(IUnknown*,void**) DECLSPEC_HIDDEN; +extern HRESULT DOMDocument_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT SchemaCache_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT XMLDocument_create(void**) DECLSPEC_HIDDEN; +extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT SAXAttributes_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT XMLHTTPRequest_create(void **) DECLSPEC_HIDDEN; +extern HRESULT ServerXMLHTTP_create(void **) DECLSPEC_HIDDEN; +extern HRESULT XSLTemplate_create(void**) DECLSPEC_HIDDEN; +extern HRESULT MXWriter_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT MXNamespaceManager_create(void**) DECLSPEC_HIDDEN; +extern HRESULT XMLParser_create(void**) DECLSPEC_HIDDEN; +extern HRESULT XMLView_create(void**) DECLSPEC_HIDDEN; static inline const CLSID* DOMDocument_version(MSXML_VERSION v) { diff --git a/reactos/dll/win32/msxml3/mxnamespace.c b/reactos/dll/win32/msxml3/mxnamespace.c index 69a7cbea0a6..e41d1a45e69 100644 --- a/reactos/dll/win32/msxml3/mxnamespace.c +++ b/reactos/dll/win32/msxml3/mxnamespace.c @@ -438,7 +438,6 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface) free_ns_context(ctxt); } - release_dispex(&This->dispex); heap_free( This ); } @@ -622,12 +621,12 @@ static dispex_static_data_t namespacemanager_dispex = { namespacemanager_iface_tids }; -HRESULT MXNamespaceManager_create(IUnknown *outer, void **obj) +HRESULT MXNamespaceManager_create(void **obj) { namespacemanager *This; struct nscontext *ctxt; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); This = heap_alloc( sizeof (*This) ); if( !This ) diff --git a/reactos/dll/win32/msxml3/mxwriter.c b/reactos/dll/win32/msxml3/mxwriter.c index 6aad6c6c9d0..511f45fdde1 100644 --- a/reactos/dll/win32/msxml3/mxwriter.c +++ b/reactos/dll/win32/msxml3/mxwriter.c @@ -1,7 +1,7 @@ /* * MXWriter implementation * - * Copyright 2011-2013 Nikolay Sivov for CodeWeavers + * Copyright 2011-2014 Nikolay Sivov for CodeWeavers * Copyright 2011 Thomas Mullaly * * This library is free software; you can redistribute it and/or @@ -122,6 +122,13 @@ typedef struct ISAXContentHandler ISAXContentHandler_iface; ISAXLexicalHandler ISAXLexicalHandler_iface; ISAXDeclHandler ISAXDeclHandler_iface; + ISAXDTDHandler ISAXDTDHandler_iface; + ISAXErrorHandler ISAXErrorHandler_iface; + IVBSAXDeclHandler IVBSAXDeclHandler_iface; + IVBSAXLexicalHandler IVBSAXLexicalHandler_iface; + IVBSAXContentHandler IVBSAXContentHandler_iface; + IVBSAXDTDHandler IVBSAXDTDHandler_iface; + IVBSAXErrorHandler IVBSAXErrorHandler_iface; LONG ref; MSXML_VERSION class_version; @@ -373,11 +380,14 @@ static void close_output_buffer(mxwriter *This) get_code_page(This->xml_enc, &This->buffer->code_page); } -/* escapes special characters like: +/* Escapes special characters like: '<' -> "<" '&' -> "&" '"' -> """ '>' -> ">" + + On call 'len' contains a length of 'str' in chars or -1 if it's null terminated. + After a call it's updated with actual new length if it wasn't -1 initially. */ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len) { @@ -609,16 +619,51 @@ static inline mxwriter *impl_from_ISAXContentHandler(ISAXContentHandler *iface) return CONTAINING_RECORD(iface, mxwriter, ISAXContentHandler_iface); } +static inline mxwriter *impl_from_IVBSAXContentHandler(IVBSAXContentHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXContentHandler_iface); +} + static inline mxwriter *impl_from_ISAXLexicalHandler(ISAXLexicalHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXLexicalHandler_iface); } +static inline mxwriter *impl_from_IVBSAXLexicalHandler(IVBSAXLexicalHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXLexicalHandler_iface); +} + static inline mxwriter *impl_from_ISAXDeclHandler(ISAXDeclHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXDeclHandler_iface); } +static inline mxwriter *impl_from_IVBSAXDeclHandler(IVBSAXDeclHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDeclHandler_iface); +} + +static inline mxwriter *impl_from_ISAXDTDHandler(ISAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXDTDHandler(IVBSAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_ISAXErrorHandler(ISAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXErrorHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXErrorHandler(IVBSAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXErrorHandler_iface); +} + static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj) { mxwriter *This = impl_from_IMXWriter( iface ); @@ -645,6 +690,34 @@ static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, voi { *obj = &This->ISAXDeclHandler_iface; } + else if ( IsEqualGUID( riid, &IID_ISAXDTDHandler ) ) + { + *obj = &This->ISAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_ISAXErrorHandler ) ) + { + *obj = &This->ISAXErrorHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDeclHandler ) ) + { + *obj = &This->IVBSAXDeclHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXLexicalHandler ) ) + { + *obj = &This->IVBSAXLexicalHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXContentHandler ) ) + { + *obj = &This->IVBSAXContentHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDTDHandler ) ) + { + *obj = &This->IVBSAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXErrorHandler ) ) + { + *obj = &This->IVBSAXErrorHandler_iface; + } else if (dispex_query_interface(&This->dispex, riid, obj)) { return *obj ? S_OK : E_NOINTERFACE; @@ -688,7 +761,6 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface) SysFreeString(This->encoding); SysFreeString(This->element); - release_dispex(&This->dispex); heap_free(This); } @@ -1067,8 +1139,8 @@ static HRESULT WINAPI SAXContentHandler_startPrefixMapping( int nuri) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); - return E_NOTIMPL; + TRACE("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); + return S_OK; } static HRESULT WINAPI SAXContentHandler_endPrefixMapping( @@ -1077,8 +1149,42 @@ static HRESULT WINAPI SAXContentHandler_endPrefixMapping( int nprefix) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); + return S_OK; +} + +static void mxwriter_write_attribute(mxwriter *writer, const WCHAR *qname, int qname_len, + const WCHAR *value, int value_len, BOOL escape) +{ + static const WCHAR eqW[] = {'='}; + + /* space separator in front of every attribute */ + write_output_buffer(writer->buffer, spaceW, 1); + write_output_buffer(writer->buffer, qname, qname_len); + write_output_buffer(writer->buffer, eqW, 1); + + if (escape) + { + WCHAR *escaped = get_escaped_string(value, EscapeValue, &value_len); + write_output_buffer_quoted(writer->buffer, escaped, value_len); + heap_free(escaped); + } + else + write_output_buffer_quoted(writer->buffer, value, value_len); +} + +static void mxwriter_write_starttag(mxwriter *writer, const WCHAR *qname, int len) +{ + static const WCHAR ltW[] = {'<'}; + + close_element_starttag(writer); + set_element_name(writer, qname ? qname : emptyW, qname ? len : 0); + + write_node_indent(writer); + + write_output_buffer(writer->buffer, ltW, 1); + write_output_buffer(writer->buffer, qname ? qname : emptyW, qname ? len : 0); + writer_inc_indent(writer); } static HRESULT WINAPI SAXContentHandler_startElement( @@ -1092,7 +1198,6 @@ static HRESULT WINAPI SAXContentHandler_startElement( ISAXAttributes *attr) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - static const WCHAR ltW[] = {'<'}; TRACE("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri), debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName), attr); @@ -1101,15 +1206,7 @@ static HRESULT WINAPI SAXContentHandler_startElement( (nQName == -1 && This->class_version == MSXML6)) return E_INVALIDARG; - close_element_starttag(This); - set_element_name(This, QName ? QName : emptyW, - QName ? nQName : 0); - - write_node_indent(This); - - write_output_buffer(This->buffer, ltW, 1); - write_output_buffer(This->buffer, QName, nQName); - writer_inc_indent(This); + mxwriter_write_starttag(This, QName, nQName); if (attr) { @@ -1124,31 +1221,16 @@ static HRESULT WINAPI SAXContentHandler_startElement( for (i = 0; i < length; i++) { - static const WCHAR eqW[] = {'='}; - const WCHAR *str; - int len = 0; + int qname_len = 0, value_len = 0; + const WCHAR *qname, *value; - hr = ISAXAttributes_getQName(attr, i, &str, &len); + hr = ISAXAttributes_getQName(attr, i, &qname, &qname_len); if (FAILED(hr)) return hr; - /* space separator in front of every attribute */ - write_output_buffer(This->buffer, spaceW, 1); - write_output_buffer(This->buffer, str, len); - - write_output_buffer(This->buffer, eqW, 1); - - len = 0; - hr = ISAXAttributes_getValue(attr, i, &str, &len); + hr = ISAXAttributes_getValue(attr, i, &value, &value_len); if (FAILED(hr)) return hr; - if (escape) - { - WCHAR *escaped = get_escaped_string(str, EscapeValue, &len); - write_output_buffer_quoted(This->buffer, escaped, len); - heap_free(escaped); - } - else - write_output_buffer_quoted(This->buffer, str, len); + mxwriter_write_attribute(This, qname, qname_len, value, value_len, escape); } } @@ -1628,6 +1710,743 @@ static const ISAXDeclHandlerVtbl SAXDeclHandlerVtbl = { SAXDeclHandler_externalEntityDecl }; +/*** IVBSAXDeclHandler ***/ +static HRESULT WINAPI VBSAXDeclHandler_QueryInterface(IVBSAXDeclHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDeclHandler_AddRef(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDeclHandler_Release(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfoCount(IVBSAXDeclHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfo(IVBSAXDeclHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetIDsOfNames(IVBSAXDeclHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDeclHandler_Invoke(IVBSAXDeclHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDeclHandler_elementDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *model) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, model); + + if (!name || !model) + return E_POINTER; + + return ISAXDeclHandler_elementDecl(&This->ISAXDeclHandler_iface, *name, -1, *model, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_attributeDecl(IVBSAXDeclHandler *iface, + BSTR *element, BSTR *attr, BSTR *type, BSTR *default_value, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p %p %p)\n", This, element, attr, type, default_value, value); + + if (!element || !attr || !type || !default_value || !value) + return E_POINTER; + + return ISAXDeclHandler_attributeDecl(&This->ISAXDeclHandler_iface, *element, -1, *attr, -1, *type, -1, + *default_value, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_internalEntityDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, value); + + if (!name || !value) + return E_POINTER; + + return ISAXDeclHandler_internalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_externalEntityDecl(IVBSAXDeclHandler *iface, + BSTR *name, BSTR *publicid, BSTR *systemid) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicid, systemid); + + if (!name || !publicid || !systemid) + return E_POINTER; + + return ISAXDeclHandler_externalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *publicid, -1, *systemid, -1); +} + +static const IVBSAXDeclHandlerVtbl VBSAXDeclHandlerVtbl = { + VBSAXDeclHandler_QueryInterface, + VBSAXDeclHandler_AddRef, + VBSAXDeclHandler_Release, + VBSAXDeclHandler_GetTypeInfoCount, + VBSAXDeclHandler_GetTypeInfo, + VBSAXDeclHandler_GetIDsOfNames, + VBSAXDeclHandler_Invoke, + VBSAXDeclHandler_elementDecl, + VBSAXDeclHandler_attributeDecl, + VBSAXDeclHandler_internalEntityDecl, + VBSAXDeclHandler_externalEntityDecl +}; + +/*** IVBSAXLexicalHandler ***/ +static HRESULT WINAPI VBSAXLexicalHandler_QueryInterface(IVBSAXLexicalHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXLexicalHandler_AddRef(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXLexicalHandler_Release(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfoCount(IVBSAXLexicalHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfo(IVBSAXLexicalHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetIDsOfNames(IVBSAXLexicalHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXLexicalHandler_Invoke(IVBSAXLexicalHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startDTD(IVBSAXLexicalHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXLexicalHandler_startDTD(&This->ISAXLexicalHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endDTD(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endDTD(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_startEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_endEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_startCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_comment(IVBSAXLexicalHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXLexicalHandler_comment(&This->ISAXLexicalHandler_iface, *chars, -1); +} + +static const IVBSAXLexicalHandlerVtbl VBSAXLexicalHandlerVtbl = { + VBSAXLexicalHandler_QueryInterface, + VBSAXLexicalHandler_AddRef, + VBSAXLexicalHandler_Release, + VBSAXLexicalHandler_GetTypeInfoCount, + VBSAXLexicalHandler_GetTypeInfo, + VBSAXLexicalHandler_GetIDsOfNames, + VBSAXLexicalHandler_Invoke, + VBSAXLexicalHandler_startDTD, + VBSAXLexicalHandler_endDTD, + VBSAXLexicalHandler_startEntity, + VBSAXLexicalHandler_endEntity, + VBSAXLexicalHandler_startCDATA, + VBSAXLexicalHandler_endCDATA, + VBSAXLexicalHandler_comment +}; + +/*** IVBSAXContentHandler ***/ +static HRESULT WINAPI VBSAXContentHandler_QueryInterface(IVBSAXContentHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXContentHandler_AddRef(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXContentHandler_Release(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfoCount(IVBSAXContentHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfo(IVBSAXContentHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetIDsOfNames(IVBSAXContentHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXContentHandler_Invoke(IVBSAXContentHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXContentHandler_putref_documentLocator(IVBSAXContentHandler *iface, IVBSAXLocator *locator) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + TRACE("(%p)->(%p)\n", This, locator); + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_startDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_startDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_endDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_endDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_startPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix, BSTR *uri) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, prefix, uri); + + if (!prefix || !uri) + return E_POINTER; + + return ISAXContentHandler_startPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1, *uri, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_endPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, prefix); + + if (!prefix) + return E_POINTER; + + return ISAXContentHandler_endPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_startElement(IVBSAXContentHandler *iface, + BSTR *namespaceURI, BSTR *localName, BSTR *QName, IVBSAXAttributes *attrs) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, namespaceURI, localName, QName, attrs); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + TRACE("(%s %s %s)\n", debugstr_w(*namespaceURI), debugstr_w(*localName), debugstr_w(*QName)); + + mxwriter_write_starttag(This, *QName, SysStringLen(*QName)); + + if (attrs) + { + int length, i, escape; + HRESULT hr; + + hr = IVBSAXAttributes_get_length(attrs, &length); + if (FAILED(hr)) return hr; + + escape = This->props[MXWriter_DisableEscaping] == VARIANT_FALSE || + (This->class_version == MSXML4 || This->class_version == MSXML6); + + for (i = 0; i < length; i++) + { + BSTR qname, value; + + hr = IVBSAXAttributes_getQName(attrs, i, &qname); + if (FAILED(hr)) return hr; + + hr = IVBSAXAttributes_getValue(attrs, i, &value); + if (FAILED(hr)) + { + SysFreeString(qname); + return hr; + } + + mxwriter_write_attribute(This, qname, SysStringLen(qname), value, SysStringLen(value), escape); + SysFreeString(qname); + SysFreeString(value); + } + } + + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_endElement(IVBSAXContentHandler *iface, BSTR *namespaceURI, + BSTR *localName, BSTR *QName) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, namespaceURI, localName, QName); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + return ISAXContentHandler_endElement(&This->ISAXContentHandler_iface, + *namespaceURI, SysStringLen(*namespaceURI), + *localName, SysStringLen(*localName), + *QName, SysStringLen(*QName)); +} + +static HRESULT WINAPI VBSAXContentHandler_characters(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_characters(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_ignorableWhitespace(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_ignorableWhitespace(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_processingInstruction(IVBSAXContentHandler *iface, + BSTR *target, BSTR *data) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, target, data); + + if (!target || !data) + return E_POINTER; + + return ISAXContentHandler_processingInstruction(&This->ISAXContentHandler_iface, *target, -1, *data, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_skippedEntity(IVBSAXContentHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXContentHandler_skippedEntity(&This->ISAXContentHandler_iface, *name, -1); +} + +static const IVBSAXContentHandlerVtbl VBSAXContentHandlerVtbl = { + VBSAXContentHandler_QueryInterface, + VBSAXContentHandler_AddRef, + VBSAXContentHandler_Release, + VBSAXContentHandler_GetTypeInfoCount, + VBSAXContentHandler_GetTypeInfo, + VBSAXContentHandler_GetIDsOfNames, + VBSAXContentHandler_Invoke, + VBSAXContentHandler_putref_documentLocator, + VBSAXContentHandler_startDocument, + VBSAXContentHandler_endDocument, + VBSAXContentHandler_startPrefixMapping, + VBSAXContentHandler_endPrefixMapping, + VBSAXContentHandler_startElement, + VBSAXContentHandler_endElement, + VBSAXContentHandler_characters, + VBSAXContentHandler_ignorableWhitespace, + VBSAXContentHandler_processingInstruction, + VBSAXContentHandler_skippedEntity +}; + +static HRESULT WINAPI SAXDTDHandler_QueryInterface(ISAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXDTDHandler_AddRef(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXDTDHandler_Release(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXDTDHandler_notationDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXDTDHandler_unparsedEntityDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid, + const WCHAR *notation, INT nnotation) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid, + debugstr_wn(notation, nnotation), nnotation); + return E_NOTIMPL; +} + +static const ISAXDTDHandlerVtbl SAXDTDHandlerVtbl = { + SAXDTDHandler_QueryInterface, + SAXDTDHandler_AddRef, + SAXDTDHandler_Release, + SAXDTDHandler_notationDecl, + SAXDTDHandler_unparsedEntityDecl +}; + +/*** IVBSAXDTDHandler ***/ +static HRESULT WINAPI VBSAXDTDHandler_QueryInterface(IVBSAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDTDHandler_AddRef(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDTDHandler_Release(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfoCount(IVBSAXDTDHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfo(IVBSAXDTDHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetIDsOfNames(IVBSAXDTDHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDTDHandler_Invoke(IVBSAXDTDHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDTDHandler_notationDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXDTDHandler_notationDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXDTDHandler_unparsedEntityDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, + BSTR *systemId, BSTR *notation) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, name, publicId, systemId, notation); + + if (!name || !publicId || !systemId || !notation) + return E_POINTER; + + return ISAXDTDHandler_unparsedEntityDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, + *systemId, -1, *notation, -1); +} + +static const IVBSAXDTDHandlerVtbl VBSAXDTDHandlerVtbl = { + VBSAXDTDHandler_QueryInterface, + VBSAXDTDHandler_AddRef, + VBSAXDTDHandler_Release, + VBSAXDTDHandler_GetTypeInfoCount, + VBSAXDTDHandler_GetTypeInfo, + VBSAXDTDHandler_GetIDsOfNames, + VBSAXDTDHandler_Invoke, + VBSAXDTDHandler_notationDecl, + VBSAXDTDHandler_unparsedEntityDecl +}; + +/* ISAXErrorHandler */ +static HRESULT WINAPI SAXErrorHandler_QueryInterface(ISAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXErrorHandler_AddRef(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXErrorHandler_Release(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXErrorHandler_error(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_fatalError(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_ignorableWarning(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static const ISAXErrorHandlerVtbl SAXErrorHandlerVtbl = { + SAXErrorHandler_QueryInterface, + SAXErrorHandler_AddRef, + SAXErrorHandler_Release, + SAXErrorHandler_error, + SAXErrorHandler_fatalError, + SAXErrorHandler_ignorableWarning +}; + +/*** IVBSAXErrorHandler ***/ +static HRESULT WINAPI VBSAXErrorHandler_QueryInterface(IVBSAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXErrorHandler_AddRef(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXErrorHandler_Release(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfoCount(IVBSAXErrorHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfo(IVBSAXErrorHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetIDsOfNames(IVBSAXErrorHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXErrorHandler_Invoke(IVBSAXErrorHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXErrorHandler_error(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_fatalError(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_ignorableWarning(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static const IVBSAXErrorHandlerVtbl VBSAXErrorHandlerVtbl = { + VBSAXErrorHandler_QueryInterface, + VBSAXErrorHandler_AddRef, + VBSAXErrorHandler_Release, + VBSAXErrorHandler_GetTypeInfoCount, + VBSAXErrorHandler_GetTypeInfo, + VBSAXErrorHandler_GetIDsOfNames, + VBSAXErrorHandler_Invoke, + VBSAXErrorHandler_error, + VBSAXErrorHandler_fatalError, + VBSAXErrorHandler_ignorableWarning +}; + static const tid_t mxwriter_iface_tids[] = { IMXWriter_tid, 0 @@ -1640,15 +2459,13 @@ static dispex_static_data_t mxwriter_dispex = { mxwriter_iface_tids }; -HRESULT MXWriter_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) +HRESULT MXWriter_create(MSXML_VERSION version, void **ppObj) { static const WCHAR version10W[] = {'1','.','0',0}; mxwriter *This; HRESULT hr; - TRACE("(%p, %p)\n", outer, ppObj); - - if (outer) FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if(!This) @@ -1658,6 +2475,13 @@ HRESULT MXWriter_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) This->ISAXContentHandler_iface.lpVtbl = &SAXContentHandlerVtbl; This->ISAXLexicalHandler_iface.lpVtbl = &SAXLexicalHandlerVtbl; This->ISAXDeclHandler_iface.lpVtbl = &SAXDeclHandlerVtbl; + This->ISAXDTDHandler_iface.lpVtbl = &SAXDTDHandlerVtbl; + This->ISAXErrorHandler_iface.lpVtbl = &SAXErrorHandlerVtbl; + This->IVBSAXDeclHandler_iface.lpVtbl = &VBSAXDeclHandlerVtbl; + This->IVBSAXLexicalHandler_iface.lpVtbl = &VBSAXLexicalHandlerVtbl; + This->IVBSAXContentHandler_iface.lpVtbl = &VBSAXContentHandlerVtbl; + This->IVBSAXDTDHandler_iface.lpVtbl = &VBSAXDTDHandlerVtbl; + This->IVBSAXErrorHandler_iface.lpVtbl = &VBSAXErrorHandlerVtbl; This->ref = 1; This->class_version = version; @@ -1762,7 +2586,6 @@ static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface) SysFreeString(This->attr[i].value); } - release_dispex(&This->dispex); heap_free(This->attr); heap_free(This); } @@ -2373,25 +3196,61 @@ static HRESULT WINAPI VBSAXAttributes_get_length(IVBSAXAttributes* iface, int *l static HRESULT WINAPI VBSAXAttributes_getURI(IVBSAXAttributes* iface, int index, BSTR *uri) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *uriW; + HRESULT hr; int len; - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, (const WCHAR**)uri, &len); + TRACE("(%p)->(%d %p)\n", This, index, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI VBSAXAttributes_getLocalName(IVBSAXAttributes* iface, int index, BSTR *name) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *nameW; + HRESULT hr; int len; - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, (const WCHAR**)name, &len); + TRACE("(%p)->(%d %p)\n", This, index, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI VBSAXAttributes_getQName(IVBSAXAttributes* iface, int index, BSTR *qname) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *qnameW; + HRESULT hr; int len; - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, (const WCHAR**)qname, &len); + TRACE("(%p)->(%d %p)\n", This, index, qname); + + if (!qname) + return E_POINTER; + + *qname = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, &qnameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(qnameW, len, qname); } static HRESULT WINAPI VBSAXAttributes_getIndexFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, int *index) @@ -2408,58 +3267,130 @@ static HRESULT WINAPI VBSAXAttributes_getIndexFromQName(IVBSAXAttributes* iface, SysStringLen(qname), index); } -static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index,BSTR *type) +static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getType(&This->ISAXAttributes_iface, index, (const WCHAR**)type, &len); + TRACE("(%p)->(%d %p)\n", This, index, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, index, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)type, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)type, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getValue(IVBSAXAttributes* iface, int index, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, (const WCHAR**)value, &len); + TRACE("(%p)->(%d %p)\n", This, index, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)value, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)value, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl VBSAXAttributesVtbl = @@ -2497,12 +3428,12 @@ static dispex_static_data_t mxattrs_dispex = { mxattrs_iface_tids }; -HRESULT SAXAttributes_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) +HRESULT SAXAttributes_create(MSXML_VERSION version, void **ppObj) { static const int default_count = 10; mxattributes *This; - TRACE("(%p, %p)\n", outer, ppObj); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if( !This ) diff --git a/reactos/dll/win32/msxml3/node.c b/reactos/dll/win32/msxml3/node.c index b9f79dbc0af..cf15f8585a5 100644 --- a/reactos/dll/win32/msxml3/node.c +++ b/reactos/dll/win32/msxml3/node.c @@ -29,6 +29,8 @@ # ifdef HAVE_LIBXSLT_TRANSFORM_H # include # endif +# include +# include # include # include # endif @@ -40,9 +42,15 @@ extern void* libxslt_handle; # define MAKE_FUNCPTR(f) extern typeof(f) * p##f MAKE_FUNCPTR(xsltApplyStylesheet); +MAKE_FUNCPTR(xsltApplyStylesheetUser); MAKE_FUNCPTR(xsltCleanupGlobals); MAKE_FUNCPTR(xsltFreeStylesheet); +MAKE_FUNCPTR(xsltFreeTransformContext); +MAKE_FUNCPTR(xsltNewTransformContext); +MAKE_FUNCPTR(xsltNextImport); MAKE_FUNCPTR(xsltParseStylesheetDoc); +MAKE_FUNCPTR(xsltQuoteUserParams); +MAKE_FUNCPTR(xsltSaveResultTo); # undef MAKE_FUNCPTR #endif @@ -600,6 +608,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh VARIANT var; HRESULT hr; + if (!child) + return E_INVALIDARG; + hr = IXMLDOMNode_get_nodeType(child, &type); if(FAILED(hr) || type == NODE_ATTRIBUTE) { if (outChild) *outChild = NULL; @@ -877,6 +888,8 @@ HRESULT node_get_xml(xmlnode *This, BOOL ensure_eol, BSTR *ret) return *ret ? S_OK : E_OUTOFMEMORY; } +#ifdef SONAME_LIBXSLT + /* duplicates xmlBufferWriteQuotedString() logic */ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string) { @@ -886,7 +899,7 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string { if (xmlStrchr(string, '\'')) { - xmlOutputBufferWrite(buf, 1, "\""); + xmlOutputBufferWrite(buf, 1, "\""); base = cur = string; while (*cur) @@ -904,13 +917,13 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string } if (base != cur) xmlOutputBufferWrite(buf, cur-base, (const char*)base); - xmlOutputBufferWrite(buf, 1, "\""); - } + xmlOutputBufferWrite(buf, 1, "\""); + } else { - xmlOutputBufferWrite(buf, 1, "\'"); + xmlOutputBufferWrite(buf, 1, "\'"); xmlOutputBufferWriteString(buf, (const char*)string); - xmlOutputBufferWrite(buf, 1, "\'"); + xmlOutputBufferWrite(buf, 1, "\'"); } } else @@ -921,6 +934,112 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string } } +static int XMLCALL transform_to_stream_write(void *context, const char *buffer, int len) +{ + DWORD written; + HRESULT hr = IStream_Write((IStream*)context, buffer, len, &written); + return hr == S_OK ? written : -1; +} + +/* Output for method "text" */ +static void transform_write_text(xmlDocPtr result, xsltStylesheetPtr style, xmlOutputBufferPtr output) +{ + xmlNodePtr cur = result->children; + while (cur) + { + if (cur->type == XML_TEXT_NODE) + xmlOutputBufferWriteString(output, (const char*)cur->content); + + /* skip to next node */ + if (cur->children) + { + if ((cur->children->type != XML_ENTITY_DECL) && + (cur->children->type != XML_ENTITY_REF_NODE) && + (cur->children->type != XML_ENTITY_NODE)) + { + cur = cur->children; + continue; + } + } + + if (cur->next) { + cur = cur->next; + continue; + } + + do + { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) style->doc) { + cur = NULL; + break; + } + if (cur->next) { + cur = cur->next; + break; + } + } while (cur); + } +} + +#undef XSLT_GET_IMPORT_PTR +#define XSLT_GET_IMPORT_PTR(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = NULL; \ + while (st != NULL) { \ + if (st->name != NULL) { res = st->name; break; } \ + st = pxsltNextImport(st); \ + }} + +#undef XSLT_GET_IMPORT_INT +#define XSLT_GET_IMPORT_INT(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = -1; \ + while (st != NULL) { \ + if (st->name != -1) { res = st->name; break; } \ + st = pxsltNextImport(st); \ + }} + +static void transform_write_xmldecl(xmlDocPtr result, xsltStylesheetPtr style, BOOL omit_encoding, xmlOutputBufferPtr output) +{ + int omit_xmldecl, standalone; + + XSLT_GET_IMPORT_INT(omit_xmldecl, style, omitXmlDeclaration); + if (omit_xmldecl == 1) return; + + XSLT_GET_IMPORT_INT(standalone, style, standalone); + + xmlOutputBufferWriteString(output, "version) + { + xmlOutputBufferWriteString(output, "\""); + xmlOutputBufferWriteString(output, (const char *)result->version); + xmlOutputBufferWriteString(output, "\""); + } + else + xmlOutputBufferWriteString(output, "\"1.0\""); + + if (!omit_encoding) + { + const xmlChar *encoding; + + /* default encoding is UTF-16 */ + XSLT_GET_IMPORT_PTR(encoding, style, encoding); + xmlOutputBufferWriteString(output, " encoding="); + xmlOutputBufferWriteString(output, "\""); + xmlOutputBufferWriteString(output, encoding ? (const char *)encoding : "UTF-16"); + xmlOutputBufferWriteString(output, "\""); + } + + /* standalone attribute */ + if (standalone != -1) + xmlOutputBufferWriteString(output, standalone == 0 ? " standalone=\"no\"" : " standalone=\"yes\""); + + xmlOutputBufferWriteString(output, "?>"); +} + static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) { xmlDtdPtr cur = doc->intSubset; @@ -935,7 +1054,7 @@ static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) { xmlOutputBufferWriteString(buf, " "); xml_write_quotedstring(buf, cur->SystemID); - } + } } else if (cur->SystemID) { @@ -945,7 +1064,8 @@ static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) xmlOutputBufferWriteString(buf, ">\n"); } -static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) +/* Duplicates htmlDocContentDumpFormatOutput() the way we need it - doesn't add trailing newline. */ +static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding, int format) { xmlElementType type; @@ -954,33 +1074,155 @@ static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) doc->type = XML_HTML_DOCUMENT_NODE; if (doc->intSubset) htmldtd_dumpcontent(buf, doc); - if (doc->children) - { + if (doc->children) { xmlNodePtr cur = doc->children; - - while (cur) - { - htmlNodeDumpFormatOutput(buf, doc, cur, NULL, 1); + while (cur) { + htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); cur = cur->next; } - } doc->type = type; } -static const xmlChar *get_output_buffer_content(xmlOutputBufferPtr output) +static inline BOOL transform_is_empty_resultdoc(xmlDocPtr result) { -#ifdef LIBXML2_NEW_BUFFER - return xmlOutputBufferGetContent(output); -#else - return xmlBufferContent(output->buffer); -#endif + return !result->children || ((result->children->type == XML_DTD_NODE) && !result->children->next); } -HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR *p) +static inline BOOL transform_is_valid_method(xsltStylesheetPtr style) +{ + return !style->methodURI || !(style->method && xmlStrEqual(style->method, (const xmlChar *)"xhtml")); +} + +/* Helper to write transformation result to specified output buffer. */ +static HRESULT node_transform_write(xsltStylesheetPtr style, xmlDocPtr result, BOOL omit_encoding, const char *encoding, xmlOutputBufferPtr output) +{ + const xmlChar *method; + int indent; + + if (!transform_is_valid_method(style)) + { + ERR("unknown output method\n"); + return E_FAIL; + } + + XSLT_GET_IMPORT_PTR(method, style, method) + XSLT_GET_IMPORT_INT(indent, style, indent); + + if (!method && (result->type == XML_HTML_DOCUMENT_NODE)) + method = (const xmlChar *) "html"; + + if (method && xmlStrEqual(method, (const xmlChar *)"html")) + { + htmlSetMetaEncoding(result, (const xmlChar *)encoding); + if (indent == -1) + indent = 1; + htmldoc_dumpcontent(output, result, (const char*)encoding, indent); + } + else if (method && xmlStrEqual(method, (const xmlChar *)"xhtml")) + { + htmlSetMetaEncoding(result, (const xmlChar *) encoding); + htmlDocContentDumpOutput(output, result, encoding); + } + else if (method && xmlStrEqual(method, (const xmlChar *)"text")) + transform_write_text(result, style, output); + else + { + transform_write_xmldecl(result, style, omit_encoding, output); + + if (result->children) + { + xmlNodePtr child = result->children; + + while (child) + { + xmlNodeDumpOutput(output, result, child, 0, indent == 1, encoding); + if (indent && ((child->type == XML_DTD_NODE) || ((child->type == XML_COMMENT_NODE) && child->next))) + xmlOutputBufferWriteString(output, "\r\n"); + child = child->next; + } + } + } + + xmlOutputBufferFlush(output); + return S_OK; +} + +/* For BSTR output is always UTF-16, without 'encoding' attribute */ +static HRESULT node_transform_write_to_bstr(xsltStylesheetPtr style, xmlDocPtr result, BSTR *str) +{ + HRESULT hr = S_OK; + + if (transform_is_empty_resultdoc(result)) + *str = SysAllocStringLen(NULL, 0); + else + { + xmlOutputBufferPtr output = xmlAllocOutputBuffer(xmlFindCharEncodingHandler("UTF-16")); + const xmlChar *content; + size_t len; + + *str = NULL; + if (!output) + return E_OUTOFMEMORY; + + hr = node_transform_write(style, result, TRUE, "UTF-16", output); +#ifdef LIBXML2_NEW_BUFFER + content = xmlBufContent(output->conv); + len = xmlBufUse(output->conv); +#else + content = xmlBufferContent(output->conv); + len = xmlBufferLength(output->conv); +#endif + /* UTF-16 encoder places UTF-16 bom, we don't need it for BSTR */ + content += sizeof(WCHAR); + *str = SysAllocStringLen((WCHAR*)content, len/sizeof(WCHAR) - 1); + xmlOutputBufferClose(output); + } + + return *str ? hr : E_OUTOFMEMORY; +} + +static HRESULT node_transform_write_to_stream(xsltStylesheetPtr style, xmlDocPtr result, IStream *stream) +{ + static const xmlChar *utf16 = (const xmlChar*)"UTF-16"; + xmlOutputBufferPtr output; + const xmlChar *encoding; + HRESULT hr; + + if (transform_is_empty_resultdoc(result)) + { + WARN("empty result document\n"); + return S_OK; + } + + if (style->methodURI && (!style->method || !xmlStrEqual(style->method, (const xmlChar *) "xhtml"))) + { + ERR("unknown output method\n"); + return E_FAIL; + } + + /* default encoding is UTF-16 */ + XSLT_GET_IMPORT_PTR(encoding, style, encoding); + if (!encoding) + encoding = utf16; + + output = xmlOutputBufferCreateIO(transform_to_stream_write, NULL, stream, xmlFindCharEncodingHandler((const char*)encoding)); + if (!output) + return E_OUTOFMEMORY; + + hr = node_transform_write(style, result, FALSE, (const char*)encoding, output); + xmlOutputBufferClose(output); + return hr; +} + +#endif + +HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR *p, + IStream *stream, const struct xslprocessor_params *params) { #ifdef SONAME_LIBXSLT xsltStylesheetPtr xsltSS; + HRESULT hr = S_OK; xmlnode *sheet; if (!libxslt_handle) return E_NOTIMPL; @@ -994,36 +1236,47 @@ HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR * xsltSS = pxsltParseStylesheetDoc(sheet->node->doc); if(xsltSS) { - xmlDocPtr result = pxsltApplyStylesheet(xsltSS, This->node->doc, NULL); - if(result) - { - const xmlChar *content; + const char **xslparams = NULL; + xmlDocPtr result; + unsigned int i; - if(result->type == XML_HTML_DOCUMENT_NODE) + /* convert our parameter list to libxml2 format */ + if (params && params->count) + { + struct xslprocessor_par *par; + + i = 0; + xslparams = heap_alloc((params->count*2 + 1)*sizeof(char*)); + LIST_FOR_EACH_ENTRY(par, ¶ms->list, struct xslprocessor_par, entry) { - xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL); - if (output) - { - htmldoc_dumpcontent(output, result->doc); - content = get_output_buffer_content(output); - *p = bstr_from_xmlChar(content); - xmlOutputBufferClose(output); - } + xslparams[i++] = (char*)xmlchar_from_wchar(par->name); + xslparams[i++] = (char*)xmlchar_from_wchar(par->value); } + xslparams[i] = NULL; + } + + if (xslparams) + { + xsltTransformContextPtr ctxt = pxsltNewTransformContext(xsltSS, This->node->doc); + + /* push parameters to user context */ + pxsltQuoteUserParams(ctxt, xslparams); + result = pxsltApplyStylesheetUser(xsltSS, This->node->doc, NULL, NULL, NULL, ctxt); + pxsltFreeTransformContext(ctxt); + + for (i = 0; i < params->count*2; i++) + heap_free((char*)xslparams[i]); + heap_free(xslparams); + } + else + result = pxsltApplyStylesheet(xsltSS, This->node->doc, NULL); + + if (result) + { + if (stream) + hr = node_transform_write_to_stream(xsltSS, result, stream); else - { - xmlBufferPtr buf = xmlBufferCreate(); - if (buf) - { - int size = xmlNodeDump(buf, NULL, (xmlNodePtr)result, 0, 0); - if(size > 0) - { - content = xmlBufferContent(buf); - *p = bstr_from_xmlChar(content); - } - xmlBufferFree(buf); - } - } + hr = node_transform_write_to_bstr(xsltSS, result, p); xmlFreeDoc(result); } /* libxslt "helpfully" frees the XML document the stylesheet was @@ -1034,13 +1287,18 @@ HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR * if(!*p) *p = SysAllocStringLen(NULL, 0); - return S_OK; + return hr; #else FIXME("libxslt headers were not found at compile time\n"); return E_NOTIMPL; #endif } +HRESULT node_transform_node(const xmlnode *node, IXMLDOMNode *stylesheet, BSTR *p) +{ + return node_transform_node_params(node, stylesheet, p, NULL, NULL); +} + HRESULT node_select_nodes(const xmlnode *This, BSTR query, IXMLDOMNodeList **nodes) { xmlChar* str; @@ -1134,7 +1392,6 @@ void destroy_xmlnode(xmlnode *This) xmlnode_release(This->node); xmldoc_release(This->node->doc); } - release_dispex(&This->dispex); } void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispex_static_data_t *dispex_data) diff --git a/reactos/dll/win32/msxml3/nodelist.c b/reactos/dll/win32/msxml3/nodelist.c index 171d2a37a0d..f52357019de 100644 --- a/reactos/dll/win32/msxml3/nodelist.c +++ b/reactos/dll/win32/msxml3/nodelist.c @@ -68,6 +68,7 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); +#ifdef __REACTOS__ if (!ppvObject) { /* NOTE: Interface documentation for IUnknown explicitly states @@ -76,6 +77,7 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( */ return E_INVALIDARG; } +#endif if ( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || diff --git a/reactos/dll/win32/msxml3/nodemap.c b/reactos/dll/win32/msxml3/nodemap.c index 9924d8c5342..bdb1942caa7 100644 --- a/reactos/dll/win32/msxml3/nodemap.c +++ b/reactos/dll/win32/msxml3/nodemap.c @@ -122,7 +122,6 @@ static ULONG WINAPI xmlnodemap_Release( { xmldoc_release( This->node->doc ); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free( This ); } diff --git a/reactos/dll/win32/msxml3/parseerror.c b/reactos/dll/win32/msxml3/parseerror.c index 100c86a0d86..13fcb97402e 100644 --- a/reactos/dll/win32/msxml3/parseerror.c +++ b/reactos/dll/win32/msxml3/parseerror.c @@ -87,7 +87,6 @@ static ULONG WINAPI parseError_Release( SysFreeString(This->url); SysFreeString(This->reason); SysFreeString(This->srcText); - release_dispex(&This->dispex); heap_free( This ); } diff --git a/reactos/dll/win32/msxml3/saxreader.c b/reactos/dll/win32/msxml3/saxreader.c index 4ba8c18eee0..dc38cb90b97 100644 --- a/reactos/dll/win32/msxml3/saxreader.c +++ b/reactos/dll/win32/msxml3/saxreader.c @@ -320,7 +320,7 @@ static inline saxlocator *impl_from_ISAXAttributes( ISAXAttributes *iface ) return CONTAINING_RECORD(iface, saxlocator, ISAXAttributes_iface); } -static inline int saxreader_has_handler(const saxlocator *locator, enum saxhandler_type type) +static inline BOOL saxreader_has_handler(const saxlocator *locator, enum saxhandler_type type) { struct saxanyhandler_iface *iface = &locator->saxreader->saxhandlers[type].u.anyhandler; return (locator->vbInterface && iface->vbhandler) || (!locator->vbInterface && iface->handler); @@ -468,6 +468,7 @@ static void free_element_entry(element_entry *element) SysFreeString(element->prefix); SysFreeString(element->local); + SysFreeString(element->qname); heap_free(element->ns); heap_free(element); @@ -682,7 +683,6 @@ static void update_position(saxlocator *This, BOOL fix_column) } /*** IVBSAXAttributes interface ***/ -/*** IUnknown methods ***/ static HRESULT WINAPI ivbsaxattributes_QueryInterface( IVBSAXAttributes* iface, REFIID riid, @@ -696,16 +696,15 @@ static HRESULT WINAPI ivbsaxattributes_QueryInterface( static ULONG WINAPI ivbsaxattributes_AddRef(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_AddRef(&This->ISAXLocator_iface); + return IVBSAXLocator_AddRef(&This->IVBSAXLocator_iface); } static ULONG WINAPI ivbsaxattributes_Release(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_Release(&This->ISAXLocator_iface); + return IVBSAXLocator_Release(&This->IVBSAXLocator_iface); } -/*** IDispatch methods ***/ static HRESULT WINAPI ivbsaxattributes_GetTypeInfoCount( IVBSAXAttributes *iface, UINT* pctinfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); @@ -722,13 +721,10 @@ static HRESULT WINAPI ivbsaxattributes_GetTypeInfo( UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXAttributes_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXAttributes_tid, ppTInfo); } static HRESULT WINAPI ivbsaxattributes_GetIDsOfNames( @@ -802,20 +798,45 @@ static HRESULT WINAPI ivbsaxattributes_getURI( int nIndex, BSTR *uri) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)uri, &len); + const WCHAR *uriW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI ivbsaxattributes_getLocalName( IVBSAXAttributes* iface, int nIndex, - BSTR *localName) + BSTR *name) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, - (const WCHAR**)localName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI ivbsaxattributes_getQName( @@ -823,9 +844,22 @@ static HRESULT WINAPI ivbsaxattributes_getQName( int nIndex, BSTR *QName) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)QName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, QName); + + if (!QName) + return E_POINTER; + + *QName = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, QName); } static HRESULT WINAPI ivbsaxattributes_getIndexFromName( @@ -854,9 +888,22 @@ static HRESULT WINAPI ivbsaxattributes_getType( int nIndex, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromName( @@ -865,10 +912,23 @@ static HRESULT WINAPI ivbsaxattributes_getTypeFromName( BSTR localName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromQName( @@ -876,10 +936,23 @@ static HRESULT WINAPI ivbsaxattributes_getTypeFromQName( BSTR QName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), - (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getValue( @@ -887,9 +960,22 @@ static HRESULT WINAPI ivbsaxattributes_getValue( int nIndex, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromName( @@ -898,10 +984,23 @@ static HRESULT WINAPI ivbsaxattributes_getValueFromName( BSTR localName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromQName( @@ -909,10 +1008,23 @@ static HRESULT WINAPI ivbsaxattributes_getValueFromQName( BSTR QName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, - SysStringLen(QName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, + SysStringLen(QName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl ivbsaxattributes_vtbl = @@ -1285,6 +1397,23 @@ static BSTR saxreader_get_unescaped_value(const xmlChar *buf, int len) return bstr; } +static void free_attribute_values(saxlocator *locator) +{ + int i; + + for (i = 0; i < locator->nb_attributes; i++) + { + SysFreeString(locator->attributes[i].szLocalname); + locator->attributes[i].szLocalname = NULL; + + SysFreeString(locator->attributes[i].szValue); + locator->attributes[i].szValue = NULL; + + SysFreeString(locator->attributes[i].szQName); + locator->attributes[i].szQName = NULL; + } +} + static HRESULT SAXAttributes_populate(saxlocator *locator, int nb_namespaces, const xmlChar **xmlNamespaces, int nb_attributes, const xmlChar **xmlAttributes) @@ -1302,13 +1431,16 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, locator->nb_attributes = nb_namespaces + nb_attributes; if(locator->nb_attributes > locator->attributesSize) { - attrs = heap_realloc(locator->attributes, sizeof(struct _attributes)*locator->nb_attributes*2); + int new_size = locator->attributesSize * 2; + attrs = heap_realloc_zero(locator->attributes, new_size * sizeof(struct _attributes)); if(!attrs) { + free_attribute_values(locator); locator->nb_attributes = 0; return E_OUTOFMEMORY; } locator->attributes = attrs; + locator->attributesSize = new_size; } else { @@ -1317,9 +1449,15 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, for (i = 0; i < nb_namespaces; i++) { + SysFreeString(attrs[nb_attributes+i].szLocalname); attrs[nb_attributes+i].szLocalname = SysAllocStringLen(NULL, 0); + attrs[nb_attributes+i].szURI = locator->namespaceUri; + + SysFreeString(attrs[nb_attributes+i].szValue); attrs[nb_attributes+i].szValue = bstr_from_xmlChar(xmlNamespaces[2*i+1]); + + SysFreeString(attrs[nb_attributes+i].szQName); if(!xmlNamespaces[2*i]) attrs[nb_attributes+i].szQName = SysAllocString(xmlnsW); else @@ -1336,10 +1474,14 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, /* that's an important feature to keep same uri pointer for every reported attribute */ attrs[i].szURI = find_element_uri(locator, xmlAttributes[i*5+2]); + SysFreeString(attrs[i].szLocalname); attrs[i].szLocalname = bstr_from_xmlChar(xmlAttributes[i*5]); + + SysFreeString(attrs[i].szValue); attrs[i].szValue = saxreader_get_unescaped_value(xmlAttributes[i*5+3], xmlAttributes[i*5+4]-xmlAttributes[i*5+3]); - attrs[i].szQName = QName_from_xmlChar(xmlAttributes[i*5+1], - xmlAttributes[i*5]); + + SysFreeString(attrs[i].szQName); + attrs[i].szQName = QName_from_xmlChar(xmlAttributes[i*5+1], xmlAttributes[i*5]); } return S_OK; @@ -1541,6 +1683,7 @@ static void libxmlEndElementNS( if (!saxreader_has_handler(This, SAXContentHandler)) { + free_attribute_values(This); This->nb_attributes = 0; free_element_entry(element); return; @@ -1562,6 +1705,7 @@ static void libxmlEndElementNS( local, SysStringLen(local), element->qname, SysStringLen(element->qname)); + free_attribute_values(This); This->nb_attributes = 0; if (sax_callback_failed(This, hr)) @@ -1946,14 +2090,13 @@ static ULONG WINAPI ivbsaxlocator_AddRef(IVBSAXLocator* iface) { saxlocator *This = impl_from_IVBSAXLocator( iface ); TRACE("%p\n", This ); - return InterlockedIncrement( &This->ref ); + return ISAXLocator_AddRef(&This->ISAXLocator_iface); } -static ULONG WINAPI ivbsaxlocator_Release( - IVBSAXLocator* iface) +static ULONG WINAPI ivbsaxlocator_Release(IVBSAXLocator* iface) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_Release((ISAXLocator*)&This->IVBSAXLocator_iface); + return ISAXLocator_Release(&This->ISAXLocator_iface); } /*** IDispatch methods ***/ @@ -1973,13 +2116,10 @@ static HRESULT WINAPI ivbsaxlocator_GetTypeInfo( UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXLocator_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXLocator_tid, ppTInfo); } static HRESULT WINAPI ivbsaxlocator_GetIDsOfNames( @@ -2045,7 +2185,7 @@ static HRESULT WINAPI ivbsaxlocator_get_columnNumber( int *pnColumn) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getColumnNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnColumn); + return ISAXLocator_getColumnNumber(&This->ISAXLocator_iface, pnColumn); } static HRESULT WINAPI ivbsaxlocator_get_lineNumber( @@ -2053,25 +2193,45 @@ static HRESULT WINAPI ivbsaxlocator_get_lineNumber( int *pnLine) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getLineNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnLine); + return ISAXLocator_getLineNumber(&This->ISAXLocator_iface, pnLine); } -static HRESULT WINAPI ivbsaxlocator_get_publicId( - IVBSAXLocator* iface, - BSTR* publicId) +static HRESULT WINAPI ivbsaxlocator_get_publicId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getPublicId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)publicId); + const WCHAR *publicidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getPublicId(&This->ISAXLocator_iface, &publicidW); + if (FAILED(hr)) + return hr; + + return return_bstr(publicidW, ret); } -static HRESULT WINAPI ivbsaxlocator_get_systemId( - IVBSAXLocator* iface, - BSTR* systemId) +static HRESULT WINAPI ivbsaxlocator_get_systemId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getSystemId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)systemId); + const WCHAR *systemidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getSystemId(&This->ISAXLocator_iface, &systemidW); + if (FAILED(hr)) + return hr; + + return return_bstr(systemidW, ret); } static const struct IVBSAXLocatorVtbl VBSAXLocatorVtbl = @@ -2144,7 +2304,7 @@ static ULONG WINAPI isaxlocator_Release( SysFreeString(This->systemId); SysFreeString(This->namespaceUri); - for(index=0; indexnb_attributes; index++) + for(index=0; indexattributesSize; index++) { SysFreeString(This->attributes[index].szLocalname); SysFreeString(This->attributes[index].szValue); @@ -2282,7 +2442,7 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B locator->attributesSize = 8; locator->nb_attributes = 0; - locator->attributes = heap_alloc(sizeof(struct _attributes)*locator->attributesSize); + locator->attributes = heap_alloc_zero(sizeof(struct _attributes)*locator->attributesSize); if(!locator->attributes) { ISAXXMLReader_Release(&reader->ISAXXMLReader_iface); @@ -2389,7 +2549,7 @@ static HRESULT internal_parseStream(saxreader *This, ISequentialStream *stream, saxlocator *locator; HRESULT hr; ULONG dataRead; - char data[1024]; + char data[2048]; int ret; dataRead = 0; @@ -2410,32 +2570,21 @@ static HRESULT internal_parseStream(saxreader *This, ISequentialStream *stream, This->isParsing = TRUE; - if(dataRead != sizeof(data)) + do { + dataRead = 0; + hr = ISequentialStream_Read(stream, data, sizeof(data), &dataRead); + if (FAILED(hr) || !dataRead) break; + + ret = xmlParseChunk(locator->pParserCtxt, data, dataRead, 0); + hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; + }while(hr == S_OK); + + if(SUCCEEDED(hr)) { ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1); hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; } - else - { - while(1) - { - dataRead = 0; - hr = ISequentialStream_Read(stream, data, sizeof(data), &dataRead); - if (FAILED(hr)) break; - ret = xmlParseChunk(locator->pParserCtxt, data, dataRead, 0); - hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; - - if (hr != S_OK) break; - - if (dataRead != sizeof(data)) - { - ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1); - hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; - break; - } - } - } This->isParsing = FALSE; @@ -2460,9 +2609,12 @@ static HRESULT internal_parse( switch(V_VT(&varInput)) { case VT_BSTR: - hr = internal_parseBuffer(This, (const char*)V_BSTR(&varInput), - strlenW(V_BSTR(&varInput))*sizeof(WCHAR), vbInterface); + case VT_BSTR|VT_BYREF: + { + BSTR str = V_ISBYREF(&varInput) ? *V_BSTRREF(&varInput) : V_BSTR(&varInput); + hr = internal_parseBuffer(This, (const char*)str, strlenW(str)*sizeof(WCHAR), vbInterface); break; + } case VT_ARRAY|VT_UI1: { void *pSAData; LONG lBound, uBound; @@ -2587,99 +2739,85 @@ static HRESULT internal_parseURL( return detach_bsc(bsc); } +static HRESULT saxreader_put_handler_from_variant(saxreader *This, enum saxhandler_type type, const VARIANT *v, BOOL vb) +{ + const IID *riid; + + if (V_VT(v) == VT_EMPTY) + return saxreader_put_handler(This, type, NULL, vb); + + switch (type) + { + case SAXDeclHandler: + riid = vb ? &IID_IVBSAXDeclHandler : &IID_ISAXDeclHandler; + break; + case SAXLexicalHandler: + riid = vb ? &IID_IVBSAXLexicalHandler : &IID_ISAXLexicalHandler; + break; + default: + ERR("wrong handler type %d\n", type); + return E_FAIL; + } + + switch (V_VT(v)) + { + case VT_DISPATCH: + case VT_UNKNOWN: + { + IUnknown *handler = NULL; + + if (V_UNKNOWN(v)) + { + HRESULT hr = IUnknown_QueryInterface(V_UNKNOWN(v), riid, (void**)&handler); + if (FAILED(hr)) return hr; + } + + saxreader_put_handler(This, type, handler, vb); + if (handler) IUnknown_Release(handler); + break; + } + default: + ERR("value type %d not supported\n", V_VT(v)); + return E_INVALIDARG; + } + + return S_OK; +} + static HRESULT internal_putProperty( saxreader* This, const WCHAR *prop, VARIANT value, BOOL vbInterface) { + VARIANT *v; + TRACE("(%p)->(%s %s)\n", This, debugstr_w(prop), debugstr_variant(&value)); + if (This->isParsing) return E_FAIL; + + v = V_VT(&value) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(&value) : &value; if(!memcmp(prop, PropertyDeclHandlerW, sizeof(PropertyDeclHandlerW))) - { - if(This->isParsing) return E_FAIL; - - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXDeclHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; - - if (V_UNKNOWN(&value)) - { - HRESULT hr; - - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXDeclHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXDeclHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } - - saxreader_put_handler(This, SAXDeclHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; - } - - return S_OK; - } + return saxreader_put_handler_from_variant(This, SAXDeclHandler, v, vbInterface); if(!memcmp(prop, PropertyLexicalHandlerW, sizeof(PropertyLexicalHandlerW))) - { - if(This->isParsing) return E_FAIL; - - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXLexicalHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; - - if (V_UNKNOWN(&value)) - { - HRESULT hr; - - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXLexicalHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXLexicalHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } - - saxreader_put_handler(This, SAXLexicalHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; - } - - return S_OK; - } + return saxreader_put_handler_from_variant(This, SAXLexicalHandler, v, vbInterface); if(!memcmp(prop, PropertyMaxXMLSizeW, sizeof(PropertyMaxXMLSizeW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } if(!memcmp(prop, PropertyMaxElementDepthW, sizeof(PropertyMaxElementDepthW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } - FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(&value)); + FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(v)); if(!memcmp(prop, PropertyCharsetW, sizeof(PropertyCharsetW))) return E_NOTIMPL; @@ -2794,19 +2932,18 @@ static ULONG WINAPI saxxmlreader_Release( for (i = 0; i < SAXHandler_Last; i++) { - struct saxanyhandler_iface *iface = &This->saxhandlers[i].u.anyhandler; + struct saxanyhandler_iface *saxiface = &This->saxhandlers[i].u.anyhandler; - if (iface->handler) - IUnknown_Release(iface->handler); + if (saxiface->handler) + IUnknown_Release(saxiface->handler); - if (iface->vbhandler) - IUnknown_Release(iface->vbhandler); + if (saxiface->vbhandler) + IUnknown_Release(saxiface->vbhandler); } SysFreeString(This->xmldecl_version); free_bstr_pool(&This->pool); - release_dispex(&This->dispex); heap_free( This ); } @@ -2860,56 +2997,25 @@ static HRESULT WINAPI saxxmlreader_Invoke( /*** IVBSAXXMLReader methods ***/ static HRESULT WINAPI saxxmlreader_getFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - if (feature == Namespaces || feature == NamespacePrefixes) - return get_feature_value(This, feature, value); - - FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_getFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_putFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - - /* accepted cases */ - if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || - (feature == ExternalParameterEntities && value == VARIANT_FALSE) || - feature == Namespaces || - feature == NamespacePrefixes) - { - return set_feature_value(This, feature, value); - } - - if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) - { - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return set_feature_value(This, feature, value); - } - - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_putFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_getProperty( IVBSAXXMLReader* iface, - const WCHAR *prop, + BSTR prop, VARIANT *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -2918,7 +3024,7 @@ static HRESULT WINAPI saxxmlreader_getProperty( static HRESULT WINAPI saxxmlreader_putProperty( IVBSAXXMLReader* iface, - const WCHAR *pProp, + BSTR pProp, VARIANT value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -2991,7 +3097,7 @@ static HRESULT WINAPI saxxmlreader_put_errorHandler( static HRESULT WINAPI saxxmlreader_get_baseURL( IVBSAXXMLReader* iface, - const WCHAR **pBaseUrl) + BSTR *pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3001,17 +3107,15 @@ static HRESULT WINAPI saxxmlreader_get_baseURL( static HRESULT WINAPI saxxmlreader_put_baseURL( IVBSAXXMLReader* iface, - const WCHAR *pBaseUrl) + BSTR pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putBaseURL(&This->ISAXXMLReader_iface, pBaseUrl); } static HRESULT WINAPI saxxmlreader_get_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR **pSecureBaseUrl) + BSTR *pSecureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3019,15 +3123,12 @@ static HRESULT WINAPI saxxmlreader_get_secureBaseURL( return E_NOTIMPL; } - static HRESULT WINAPI saxxmlreader_put_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR *secureBaseUrl) + BSTR secureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putSecureBaseURL(&This->ISAXXMLReader_iface, secureBaseUrl); } static HRESULT WINAPI saxxmlreader_parse( @@ -3040,7 +3141,7 @@ static HRESULT WINAPI saxxmlreader_parse( static HRESULT WINAPI saxxmlreader_parseURL( IVBSAXXMLReader* iface, - const WCHAR *url) + BSTR url) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); return internal_parseURL(This, url, TRUE); @@ -3080,38 +3181,69 @@ static const struct IVBSAXXMLReaderVtbl VBSAXXMLReaderVtbl = static HRESULT WINAPI isaxxmlreader_QueryInterface(ISAXXMLReader* iface, REFIID riid, void **ppvObject) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); + return IVBSAXXMLReader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); } static ULONG WINAPI isaxxmlreader_AddRef(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_AddRef(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_AddRef(&This->IVBSAXXMLReader_iface); } static ULONG WINAPI isaxxmlreader_Release(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_Release(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_Release(&This->IVBSAXXMLReader_iface); } /*** ISAXXMLReader methods ***/ static HRESULT WINAPI isaxxmlreader_getFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL *pValue) + const WCHAR *feature_name, + VARIANT_BOOL *value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_getFeature(&This->IVBSAXXMLReader_iface, pFeature, pValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + if (feature == Namespaces || feature == NamespacePrefixes) + return get_feature_value(This, feature, value); + + FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL vfValue) + const WCHAR *feature_name, + VARIANT_BOOL value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_putFeature(&This->IVBSAXXMLReader_iface, pFeature, vfValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + + /* accepted cases */ + if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || + (feature == ExternalParameterEntities && value == VARIANT_FALSE) || + feature == Namespaces || + feature == NamespacePrefixes) + { + return set_feature_value(This, feature, value); + } + + if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) + { + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return set_feature_value(This, feature, value); + } + + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getProperty( @@ -3196,10 +3328,12 @@ static HRESULT WINAPI isaxxmlreader_putErrorHandler(ISAXXMLReader* iface, ISAXEr static HRESULT WINAPI isaxxmlreader_getBaseURL( ISAXXMLReader* iface, - const WCHAR **pBaseUrl) + const WCHAR **base_url) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%p) stub\n", This, base_url); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putBaseURL( @@ -3207,7 +3341,9 @@ static HRESULT WINAPI isaxxmlreader_putBaseURL( const WCHAR *pBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getSecureBaseURL( @@ -3215,7 +3351,8 @@ static HRESULT WINAPI isaxxmlreader_getSecureBaseURL( const WCHAR **pSecureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_secureBaseURL(&This->IVBSAXXMLReader_iface, pSecureBaseUrl); + FIXME("(%p)->(%p) stub\n", This, pSecureBaseUrl); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putSecureBaseURL( @@ -3223,7 +3360,9 @@ static HRESULT WINAPI isaxxmlreader_putSecureBaseURL( const WCHAR *secureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_secureBaseURL(&This->IVBSAXXMLReader_iface, secureBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_parse( @@ -3278,11 +3417,11 @@ static dispex_static_data_t saxreader_dispex = { saxreader_iface_tids }; -HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppObj) +HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj) { saxreader *reader; - TRACE("(%p, %p)\n", outer, ppObj); + TRACE("(%p)\n", ppObj); reader = heap_alloc( sizeof (*reader) ); if( !reader ) @@ -3325,7 +3464,7 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppOb #else -HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj) { MESSAGE("This program tried to use a SAX XML Reader object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/dll/win32/msxml3/schema.c b/reactos/dll/win32/msxml3/schema.c index b491890c8f4..8bd78ff0061 100644 --- a/reactos/dll/win32/msxml3/schema.c +++ b/reactos/dll/win32/msxml3/schema.c @@ -96,6 +96,12 @@ typedef struct LONG ref; } cache_entry; +static const tid_t schema_cache_se_tids[] = { + IXMLDOMSchemaCollection_tid, + IXMLDOMSchemaCollection2_tid, + NULL_tid +}; + /* datatypes lookup stuff * generated with help from gperf */ #define DT_MIN_STR_LEN 2 @@ -910,7 +916,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM cache_entry* entry; IXMLDOMDocument3* domdoc = NULL; xmlDocPtr doc = NULL; - HRESULT hr = DOMDocument_create(version, NULL, (void**)&domdoc); + HRESULT hr = DOMDocument_create(version, (void**)&domdoc); VARIANT_BOOL b = VARIANT_FALSE; CacheEntryType type = CacheEntryType_Invalid; @@ -1085,6 +1091,10 @@ static HRESULT WINAPI schema_cache_QueryInterface(IXMLDOMSchemaCollection2* ifac { return *ppvObject ? S_OK : E_NOINTERFACE; } + else if(IsEqualGUID( riid, &IID_ISupportErrorInfo )) + { + return node_create_supporterrorinfo(schema_cache_se_tids, ppvObject); + } else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); @@ -1119,7 +1129,6 @@ static ULONG WINAPI schema_cache_Release(IXMLDOMSchemaCollection2* iface) heap_free(This->uris[i]); heap_free(This->uris); xmlHashFree(This->cache, cache_free); - release_dispex(&This->dispex); heap_free(This); } @@ -1263,11 +1272,17 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri TRACE("(%p)->(%s %p)\n", This, debugstr_w(uri), node); - if (This->version == MSXML6) return E_NOTIMPL; + if (This->version == MSXML6) + { + if (node) *node = NULL; + return E_NOTIMPL; + } if (!node) return E_POINTER; + *node = NULL; + name = uri ? xmlchar_from_wchar(uri) : xmlchar_from_wchar(emptyW); entry = (cache_entry*) xmlHashLookup(This->cache, name); heap_free(name); @@ -1276,7 +1291,6 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri if (entry && entry->doc) return get_domdoc_from_xmldoc(entry->doc, (IXMLDOMDocument3**)node); - *node = NULL; return S_OK; } @@ -1315,6 +1329,9 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection2* if if (!uri) return E_POINTER; + if (This->version == MSXML6) + *uri = NULL; + if (index >= This->count) return E_FAIL; @@ -1538,13 +1555,13 @@ static dispex_static_data_t schemacache_dispex = { schemacache_iface_tids }; -HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) +HRESULT SchemaCache_create(MSXML_VERSION version, void** obj) { schema_cache* This = heap_alloc(sizeof(schema_cache)); if (!This) return E_OUTOFMEMORY; - TRACE("(%d %p %p)\n", version, outer, obj); + TRACE("(%d %p)\n", version, obj); This->IXMLDOMSchemaCollection2_iface.lpVtbl = &XMLDOMSchemaCollection2Vtbl; This->cache = xmlHashCreate(DEFAULT_HASHTABLE_SIZE); @@ -1563,7 +1580,7 @@ HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) #else -HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) +HRESULT SchemaCache_create(MSXML_VERSION version, void** obj) { MESSAGE("This program tried to use a SchemaCache object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/dll/win32/msxml3/selection.c b/reactos/dll/win32/msxml3/selection.c index 01fc8476ca9..b0fccb381da 100644 --- a/reactos/dll/win32/msxml3/selection.c +++ b/reactos/dll/win32/msxml3/selection.c @@ -160,7 +160,6 @@ static ULONG WINAPI domselection_Release( xmlXPathFreeObject(This->result); xmldoc_release(This->node->doc); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free(This); } diff --git a/reactos/dll/win32/msxml3/stylesheet.c b/reactos/dll/win32/msxml3/stylesheet.c index d9543a90c2d..2417968fee8 100644 --- a/reactos/dll/win32/msxml3/stylesheet.c +++ b/reactos/dll/win32/msxml3/stylesheet.c @@ -40,6 +40,8 @@ typedef struct IStream *output; BSTR outstr; + + struct xslprocessor_params params; } xslprocessor; static HRESULT XSLProcessor_create(xsltemplate*, IXSLProcessor**); @@ -54,6 +56,15 @@ static inline xslprocessor *impl_from_IXSLProcessor( IXSLProcessor *iface ) return CONTAINING_RECORD(iface, xslprocessor, IXSLProcessor_iface); } +static void xslprocessor_par_free(struct xslprocessor_params *params, struct xslprocessor_par *par) +{ + params->count--; + list_remove(&par->entry); + SysFreeString(par->name); + SysFreeString(par->value); + heap_free(par); +} + static void xsltemplate_set_node( xsltemplate *This, IXMLDOMNode *node ) { if (This->node) IXMLDOMNode_Release(This->node); @@ -107,7 +118,6 @@ static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface ) if ( ref == 0 ) { if (This->node) IXMLDOMNode_Release( This->node ); - release_dispex(&This->dispex); heap_free( This ); } @@ -217,13 +227,11 @@ static dispex_static_data_t xsltemplate_dispex = { xsltemplate_iface_tids }; -HRESULT XSLTemplate_create(IUnknown *outer, void **ppObj) +HRESULT XSLTemplate_create(void **ppObj) { xsltemplate *This; - TRACE("(%p, %p)\n", outer, ppObj); - - if(outer) FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if(!This) @@ -287,11 +295,16 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface ) TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) { + struct xslprocessor_par *par, *par2; + if (This->input) IXMLDOMNode_Release(This->input); if (This->output) IStream_Release(This->output); SysFreeString(This->outstr); + + LIST_FOR_EACH_ENTRY_SAFE(par, par2, &This->params.list, struct xslprocessor_par, entry) + xslprocessor_par_free(&This->params, par); + IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface); - release_dispex(&This->dispex); heap_free( This ); } @@ -352,7 +365,7 @@ static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT inpu { IXMLDOMDocument *doc; - hr = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&doc); + hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc); if (hr == S_OK) { VARIANT_BOOL b; @@ -430,7 +443,7 @@ static HRESULT WINAPI xslprocessor_put_output( IStream *stream; HRESULT hr; - FIXME("(%p)->(%s): semi-stub\n", This, debugstr_variant(&output)); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&output)); switch (V_VT(&output)) { @@ -440,8 +453,11 @@ static HRESULT WINAPI xslprocessor_put_output( break; case VT_UNKNOWN: hr = IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IStream, (void**)&stream); + if (FAILED(hr)) + WARN("failed to get IStream from output, 0x%08x\n", hr); break; default: + FIXME("output type %d not handled\n", V_VT(&output)); hr = E_FAIL; } @@ -485,6 +501,7 @@ static HRESULT WINAPI xslprocessor_transform( IXSLProcessor *iface, VARIANT_BOOL *ret) { +#ifdef HAVE_LIBXML2 xslprocessor *This = impl_from_IXSLProcessor( iface ); HRESULT hr; @@ -493,22 +510,13 @@ static HRESULT WINAPI xslprocessor_transform( if (!ret) return E_INVALIDARG; SysFreeString(This->outstr); - hr = IXMLDOMNode_transformNode(This->input, This->stylesheet->node, &This->outstr); - if (hr == S_OK) - { - if (This->output) - { - ULONG len = 0; - - /* output to stream */ - hr = IStream_Write(This->output, This->outstr, SysStringByteLen(This->outstr), &len); - *ret = len == SysStringByteLen(This->outstr) ? VARIANT_TRUE : VARIANT_FALSE; - } - } - else - *ret = VARIANT_FALSE; - + hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, This->output, &This->params); + *ret = hr == S_OK ? VARIANT_TRUE : VARIANT_FALSE; return hr; +#else + FIXME("libxml2 is required but wasn't present at compile time\n"); + return E_NOTIMPL; +#endif } static HRESULT WINAPI xslprocessor_reset( IXSLProcessor *iface ) @@ -529,6 +537,26 @@ static HRESULT WINAPI xslprocessor_get_readyState( return E_NOTIMPL; } +static HRESULT xslprocessor_set_parvalue(const VARIANT *var, struct xslprocessor_par *par) +{ + HRESULT hr = S_OK; + + switch (V_VT(var)) + { + case VT_BSTR: + { + par->value = SysAllocString(V_BSTR(var)); + if (!par->value) hr = E_OUTOFMEMORY; + break; + } + default: + FIXME("value type %d not handled\n", V_VT(var)); + hr = E_NOTIMPL; + } + + return hr; +} + static HRESULT WINAPI xslprocessor_addParameter( IXSLProcessor *iface, BSTR p, @@ -536,10 +564,58 @@ static HRESULT WINAPI xslprocessor_addParameter( BSTR uri) { xslprocessor *This = impl_from_IXSLProcessor( iface ); + struct xslprocessor_par *cur, *par = NULL; + HRESULT hr; - FIXME("(%p)->(%s %s %s): stub\n", This, debugstr_w(p), debugstr_variant(&var), + TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(p), debugstr_variant(&var), debugstr_w(uri)); - return E_NOTIMPL; + + if (uri && *uri) + FIXME("namespace uri is not supported\n"); + + /* search for existing parameter first */ + LIST_FOR_EACH_ENTRY(cur, &This->params.list, struct xslprocessor_par, entry) + { + if (!strcmpW(cur->name, p)) + { + par = cur; + break; + } + } + + /* override with new value or add new parameter */ + if (par) + { + if (V_VT(&var) == VT_NULL || V_VT(&var) == VT_EMPTY) + { + /* remove parameter */ + xslprocessor_par_free(&This->params, par); + return S_OK; + } + SysFreeString(par->value); + par->value = NULL; + } + else + { + /* new parameter */ + par = heap_alloc(sizeof(struct xslprocessor_par)); + if (!par) return E_OUTOFMEMORY; + + par->name = SysAllocString(p); + if (!par->name) + { + heap_free(par); + return E_OUTOFMEMORY; + } + list_add_tail(&This->params.list, &par->entry); + This->params.count++; + } + + hr = xslprocessor_set_parvalue(&var, par); + if (FAILED(hr)) + xslprocessor_par_free(&This->params, par); + + return hr; } static HRESULT WINAPI xslprocessor_addObject( @@ -615,6 +691,8 @@ HRESULT XSLProcessor_create(xsltemplate *template, IXSLProcessor **ppObj) This->input = NULL; This->output = NULL; This->outstr = NULL; + list_init(&This->params.list); + This->params.count = 0; This->stylesheet = template; IXSLTemplate_AddRef(&template->IXSLTemplate_iface); init_dispex(&This->dispex, (IUnknown*)&This->IXSLProcessor_iface, &xslprocessor_dispex); diff --git a/reactos/dll/win32/msxml3/text.c b/reactos/dll/win32/msxml3/text.c index b412ff4c25c..41f80614353 100644 --- a/reactos/dll/win32/msxml3/text.c +++ b/reactos/dll/win32/msxml3/text.c @@ -599,7 +599,7 @@ static HRESULT WINAPI domtext_put_data( BSTR data) { domtext *This = impl_from_IXMLDOMText( iface ); - static WCHAR rnW[] = {'\r','\n',0}; + static const WCHAR rnW[] = {'\r','\n',0}; TRACE("(%p)->(%s)\n", This, debugstr_w(data)); diff --git a/reactos/dll/win32/msxml3/xmldoc.c b/reactos/dll/win32/msxml3/xmldoc.c index bb12bca2bb4..34aa8dae3de 100644 --- a/reactos/dll/win32/msxml3/xmldoc.c +++ b/reactos/dll/win32/msxml3/xmldoc.c @@ -188,7 +188,7 @@ static HRESULT WINAPI xmldoc_get_root(IXMLDocument *iface, IXMLElement **p) if (!(root = xmlDocGetRootElement(This->xmldoc))) return E_FAIL; - return XMLElement_create((IUnknown *)This, root, (LPVOID *)p, FALSE); + return XMLElement_create(root, (LPVOID *)p, FALSE); } static HRESULT WINAPI xmldoc_get_fileSize(IXMLDocument *iface, BSTR *p) @@ -500,7 +500,7 @@ static HRESULT WINAPI xmldoc_createElement(IXMLDocument *iface, VARIANT vType, node->type = type_msxml_to_libxml(V_I4(&vType)); /* FIXME: create xmlNodePtr based on vType and var1 */ - return XMLElement_create((IUnknown *)iface, node, (LPVOID *)ppElem, TRUE); + return XMLElement_create(node, (LPVOID *)ppElem, TRUE); } static const struct IXMLDocumentVtbl xmldoc_vtbl = @@ -672,11 +672,11 @@ static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable = xmldoc_IPersistStreamInit_InitNew }; -HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT XMLDocument_create(LPVOID *ppObj) { xmldoc *doc; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); doc = heap_alloc(sizeof (*doc)); if(!doc) @@ -697,7 +697,7 @@ HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) #else -HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT XMLDocument_create(LPVOID *ppObj) { MESSAGE("This program tried to use an XMLDocument object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/dll/win32/msxml3/xmlelem.c b/reactos/dll/win32/msxml3/xmlelem.c index dd9f8e648aa..f356c249068 100644 --- a/reactos/dll/win32/msxml3/xmlelem.c +++ b/reactos/dll/win32/msxml3/xmlelem.c @@ -22,7 +22,7 @@ #ifdef HAVE_LIBXML2 -static HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj ); +static HRESULT XMLElementCollection_create( xmlNodePtr node, LPVOID *ppObj ); /********************************************************************** * IXMLElement @@ -168,8 +168,12 @@ static HRESULT WINAPI xmlelem_get_tagName(IXMLElement *iface, BSTR *p) if (!p) return E_INVALIDARG; - *p = bstr_from_xmlChar(This->node->name); - CharUpperBuffW(*p, SysStringLen(*p)); + if (*This->node->name) { + *p = bstr_from_xmlChar(This->node->name); + CharUpperBuffW(*p, SysStringLen(*p)); + }else { + *p = NULL; + } TRACE("returning %s\n", debugstr_w(*p)); @@ -202,7 +206,7 @@ static HRESULT WINAPI xmlelem_get_parent(IXMLElement *iface, IXMLElement **paren if (!This->node->parent) return S_FALSE; - return XMLElement_create((IUnknown *)iface, This->node->parent, (LPVOID *)parent, FALSE); + return XMLElement_create(This->node->parent, (LPVOID *)parent, FALSE); } static HRESULT WINAPI xmlelem_setAttribute(IXMLElement *iface, BSTR strPropertyName, @@ -325,7 +329,7 @@ static HRESULT WINAPI xmlelem_get_children(IXMLElement *iface, IXMLElementCollec if (!p) return E_INVALIDARG; - return XMLElementCollection_create((IUnknown *)iface, This->node, (LPVOID *)p); + return XMLElementCollection_create(This->node, (LPVOID *)p); } static LONG type_libxml_to_msxml(xmlElementType type) @@ -466,11 +470,11 @@ static const struct IXMLElementVtbl xmlelem_vtbl = xmlelem_removeChild }; -HRESULT XMLElement_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own) +HRESULT XMLElement_create(xmlNodePtr node, LPVOID *ppObj, BOOL own) { xmlelem *elem; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); if (!ppObj) return E_INVALIDARG; @@ -548,6 +552,7 @@ static HRESULT WINAPI xmlelem_collection_QueryInterface(IXMLElementCollection *i else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObject = NULL; return E_NOINTERFACE; } @@ -638,8 +643,8 @@ static HRESULT WINAPI xmlelem_collection_get__newEnum(IXMLElementCollection *ifa if (!ppUnk) return E_INVALIDARG; - *ppUnk = (IUnknown *)This; - IUnknown_AddRef(*ppUnk); + IXMLElementCollection_AddRef(iface); + *ppUnk = (IUnknown *)&This->IEnumVARIANT_iface; return S_OK; } @@ -668,7 +673,7 @@ static HRESULT WINAPI xmlelem_collection_item(IXMLElementCollection *iface, VARI for (i = 0; i < index; i++) ptr = ptr->next; - return XMLElement_create((IUnknown *)iface, ptr, (LPVOID *)ppDisp, FALSE); + return XMLElement_create(ptr, (LPVOID *)ppDisp, FALSE); } static const struct IXMLElementCollectionVtbl xmlelem_collection_vtbl = @@ -693,21 +698,34 @@ static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_QueryInterface( IEnumVARIANT *iface, REFIID riid, LPVOID *ppvObj) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_QueryInterface((IXMLDocument *)this, riid, ppvObj); + + TRACE("(%p)->(%s %p)\n", this, debugstr_guid(riid), ppvObj); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IEnumVARIANT)) + { + *ppvObj = iface; + IEnumVARIANT_AddRef(iface); + return S_OK; + } + + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObj = NULL; + return E_NOINTERFACE; } static ULONG WINAPI xmlelem_collection_IEnumVARIANT_AddRef( IEnumVARIANT *iface) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_AddRef((IXMLDocument *)this); + return IXMLElementCollection_AddRef(&this->IXMLElementCollection_iface); } static ULONG WINAPI xmlelem_collection_IEnumVARIANT_Release( IEnumVARIANT *iface) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_Release((IXMLDocument *)this); + return IXMLElementCollection_Release(&this->IXMLElementCollection_iface); } static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next( @@ -735,7 +753,7 @@ static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next( } V_VT(rgVar) = VT_DISPATCH; - return XMLElement_create((IUnknown *)iface, ptr, (LPVOID *)&V_DISPATCH(rgVar), FALSE); + return XMLElement_create(ptr, (LPVOID *)&V_DISPATCH(rgVar), FALSE); } static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip( @@ -774,11 +792,11 @@ static const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl = xmlelem_collection_IEnumVARIANT_Clone }; -static HRESULT XMLElementCollection_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj) +static HRESULT XMLElementCollection_create(xmlNodePtr node, LPVOID *ppObj) { xmlelem_collection *collection; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); *ppObj = NULL; diff --git a/reactos/dll/win32/msxml3/xmlparser.c b/reactos/dll/win32/msxml3/xmlparser.c index 1d116125eba..0f515bb81eb 100644 --- a/reactos/dll/win32/msxml3/xmlparser.c +++ b/reactos/dll/win32/msxml3/xmlparser.c @@ -413,14 +413,11 @@ static const struct IXMLParserVtbl xmlparser_vtbl = xmlparser_GetSecureBaseURL }; -HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj) +HRESULT XMLParser_create(void **ppObj) { xmlparser *This; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); - - if (pUnkOuter) - FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof(xmlparser) ); if(!This) diff --git a/reactos/dll/win32/msxml3/xmlparser.idl b/reactos/dll/win32/msxml3/xmlparser.idl index a0ce97efd7a..7f02b149b24 100644 --- a/reactos/dll/win32/msxml3/xmlparser.idl +++ b/reactos/dll/win32/msxml3/xmlparser.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + import "unknwn.idl"; import "objidl.idl"; import "oaidl.idl"; diff --git a/reactos/dll/win32/msxml3/xmlview.c b/reactos/dll/win32/msxml3/xmlview.c index ce5467af190..c2aaaaa0b39 100644 --- a/reactos/dll/win32/msxml3/xmlview.c +++ b/reactos/dll/win32/msxml3/xmlview.c @@ -380,7 +380,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This) if(FAILED(hres)) return display_error_page(This); - hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xml); + hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xml); if(FAILED(hres)) return display_error_page(This); @@ -456,7 +456,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This) return display_error_page(This); } - hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xsl); + hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xsl); if(FAILED(hres)) { VariantClear(&var); IXMLDOMDocument3_Release(xml); @@ -1405,15 +1405,12 @@ static IOleObjectVtbl XMLView_OleObjectVtbl = { XMLView_OleObject_SetColorScheme }; -HRESULT XMLView_create(IUnknown *outer, void **ppObj) +HRESULT XMLView_create(void **ppObj) { XMLView *This; HRESULT hres; - TRACE("(%p %p)\n", outer, ppObj); - - if(outer) - return E_FAIL; + TRACE("(%p)\n", ppObj); This = heap_alloc_zero(sizeof(*This)); if(!This) @@ -1438,7 +1435,7 @@ HRESULT XMLView_create(IUnknown *outer, void **ppObj) #else -HRESULT XMLView_create(IUnknown *outer, void **ppObj) +HRESULT XMLView_create(void **ppObj) { MESSAGE("This program tried to use a XMLView object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/reactos/include/psdk/msxml2.idl b/reactos/include/psdk/msxml2.idl index b5275232583..7ce929ffd72 100644 --- a/reactos/include/psdk/msxml2.idl +++ b/reactos/include/psdk/msxml2.idl @@ -2453,17 +2453,17 @@ interface IVBSAXXMLFilter : IDispatch interface IVBSAXXMLReader : IDispatch { [id(DISPID_SAX_XMLREADER_GETFEATURE)] - HRESULT getFeature( [in] const WCHAR * pFeature, + HRESULT getFeature( [in] BSTR pFeature, [out, retval] VARIANT_BOOL * pValue); [id(DISPID_SAX_XMLREADER_PUTFEATURE)] - HRESULT putFeature( [in] const WCHAR * pFeature, + HRESULT putFeature( [in] BSTR pFeature, [in] VARIANT_BOOL vfValue); [id(DISPID_SAX_XMLREADER_GETPROPERTY)] - HRESULT getProperty( [in] const WCHAR * pProp, + HRESULT getProperty( [in] BSTR pProp, [out, retval] VARIANT * pValue); [id(DISPID_SAX_XMLREADER_PUTPROPERTY)] - HRESULT putProperty( [in] const WCHAR * pProp, [in] VARIANT value); + HRESULT putProperty( [in] BSTR pProp, [in] VARIANT value); [propget, id(DISPID_SAX_XMLREADER_ENTITYRESOLVER)] HRESULT entityResolver( @@ -2488,19 +2488,19 @@ interface IVBSAXXMLReader : IDispatch HRESULT errorHandler([in] IVBSAXErrorHandler * errorHandler); [propget, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([out, retval] const WCHAR ** pBaseUrl); + HRESULT baseURL([out, retval] BSTR *pBaseUrl); [propput, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([in] const WCHAR * pBaseUrl); + HRESULT baseURL([in] BSTR pBaseUrl); [propget, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([out, retval] const WCHAR ** pSecureBaseUrl); + HRESULT secureBaseURL([out, retval] BSTR *pSecureBaseUrl); [propput, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([in] const WCHAR * secureBaseUrl); + HRESULT secureBaseURL([in] BSTR secureBaseUrl); [id(DISPID_SAX_XMLREADER_PARSE)] HRESULT parse( [in] VARIANT varInput); [id(DISPID_SAX_XMLREADER_PARSEURL)] - HRESULT parseURL([in] const WCHAR * url); + HRESULT parseURL([in] BSTR url); } [ diff --git a/reactos/include/psdk/msxml6.idl b/reactos/include/psdk/msxml6.idl index d811b760015..df6d93d3def 100644 --- a/reactos/include/psdk/msxml6.idl +++ b/reactos/include/psdk/msxml6.idl @@ -2317,17 +2317,17 @@ interface IVBSAXXMLFilter : IDispatch interface IVBSAXXMLReader : IDispatch { [id(DISPID_SAX_XMLREADER_GETFEATURE)] - HRESULT getFeature( [in] const WCHAR * pFeature, + HRESULT getFeature( [in] BSTR pFeature, [out, retval] VARIANT_BOOL * pValue); [id(DISPID_SAX_XMLREADER_PUTFEATURE)] - HRESULT putFeature( [in] const WCHAR * pFeature, + HRESULT putFeature( [in] BSTR pFeature, [in] VARIANT_BOOL vfValue); [id(DISPID_SAX_XMLREADER_GETPROPERTY)] - HRESULT getProperty( [in] const WCHAR * pProp, + HRESULT getProperty( [in] BSTR pProp, [out, retval] VARIANT * pValue); [id(DISPID_SAX_XMLREADER_PUTPROPERTY)] - HRESULT putProperty( [in] const WCHAR * pProp, [in] VARIANT value); + HRESULT putProperty( [in] BSTR pProp, [in] VARIANT value); [propget, id(DISPID_SAX_XMLREADER_ENTITYRESOLVER)] HRESULT entityResolver( @@ -2352,19 +2352,19 @@ interface IVBSAXXMLReader : IDispatch HRESULT errorHandler([in] IVBSAXErrorHandler * errorHandler); [propget, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([out, retval] const WCHAR ** pBaseUrl); + HRESULT baseURL([out, retval] BSTR *pBaseUrl); [propput, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([in] const WCHAR * pBaseUrl); + HRESULT baseURL([in] BSTR pBaseUrl); [propget, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([out, retval] const WCHAR ** pSecureBaseUrl); + HRESULT secureBaseURL([out, retval] BSTR *pSecureBaseUrl); [propput, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([in] const WCHAR * secureBaseUrl); + HRESULT secureBaseURL([in] BSTR secureBaseUrl); [id(DISPID_SAX_XMLREADER_PARSE)] HRESULT parse( [in] VARIANT varInput); [id(DISPID_SAX_XMLREADER_PARSEURL)] - HRESULT parseURL([in] const WCHAR * url); + HRESULT parseURL([in] BSTR url); } [ diff --git a/reactos/include/reactos/wine/typeof.h b/reactos/include/reactos/wine/typeof.h index daefcc185af..b7ab75590b1 100644 --- a/reactos/include/reactos/wine/typeof.h +++ b/reactos/include/reactos/wine/typeof.h @@ -23,6 +23,9 @@ struct tagCANDIDATELIST; struct tagIMEMENUITEMINFOW; struct _xsltStylesheet; struct jpeg_decompress_struct; +struct _iobuf; +struct _xsltTransformContext; +struct _xmlOutputBuffer; typedef struct IWineD3D * (__stdcall typeof(WineDirect3DCreate))(unsigned int, struct IUnknown *); typedef struct IWineD3DClipper * (__stdcall typeof(WineDirect3DCreateClipper))(struct IUnknown *); @@ -44,6 +47,12 @@ typedef int (__stdcall typeof(ImeProcessKey))(void *, unsigned int, __typeof_lon typedef unsigned int (__stdcall typeof(ImeGetRegisterWordStyle))(unsigned int, struct tagSTYLEBUFW *); typedef unsigned int (__stdcall typeof(ImeGetImeMenuItems))(void *, unsigned int, unsigned int, struct tagIMEMENUITEMINFOW *, struct tagIMEMENUITEMINFOW *, unsigned int); typedef struct _xmlDoc * (__cdecl typeof(xsltApplyStylesheet))(struct _xsltStylesheet *, struct _xmlDoc *, const char **); +typedef struct _xmlDoc * (__cdecl typeof(xsltApplyStylesheetUser))(struct _xsltStylesheet *, struct _xmlDoc *, const char **, const char *, struct _iobuf *, struct _xsltTransformContext *); +typedef struct _xsltTransformContext * (__cdecl typeof(xsltNewTransformContext))(struct _xsltStylesheet *, struct _xmlDoc *); +typedef void (__cdecl typeof(xsltFreeTransformContext))(struct _xsltTransformContext *); +typedef int (__cdecl typeof(xsltQuoteUserParams))(struct _xsltTransformContext *, const char **); +typedef int (__cdecl typeof(xsltSaveResultTo))(struct _xmlOutputBuffer *, struct _xmlDoc *, struct _xsltStylesheet *); +typedef struct _xsltStylesheet * (__cdecl typeof(xsltNextImport))(struct _xsltStylesheet *); typedef void (__cdecl typeof(xsltCleanupGlobals))(void); typedef void (__cdecl typeof(xsltFreeStylesheet))(struct _xsltStylesheet *); typedef struct _xsltStylesheet * (__cdecl typeof(xsltParseStylesheetDoc))(struct _xmlDoc *); diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index a6e7d4bad8b..ce2f979b80c 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -135,7 +135,7 @@ reactos/dll/win32/msvfw32 # Synced to Wine-1.7.1 reactos/dll/win32/msvidc32 # Synced to Wine-1.7.17 reactos/dll/win32/msxml # Synced to Wine-1.7.1 reactos/dll/win32/msxml2 # Synced to Wine-1.7.1 -reactos/dll/win32/msxml3 # Synced to Wine-1.7.1 +reactos/dll/win32/msxml3 # Synced to Wine-1.7.17 reactos/dll/win32/msxml4 # Synced to Wine-1.7.1 reactos/dll/win32/msxml6 # Synced to Wine-1.7.1 reactos/dll/win32/nddeapi # Synced to Wine-1.7.1