* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62946
This commit is contained in:
Amine Khaldi 2014-04-24 15:40:52 +00:00
parent 87ad295d8e
commit d81af057a8
29 changed files with 2057 additions and 597 deletions

View file

@ -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;

View file

@ -18,6 +18,8 @@
#include "precomp.h"
#include <msxml6did.h>
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;
}

View file

@ -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");

View file

@ -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;
}

View file

@ -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;

View file

@ -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");

View file

@ -31,7 +31,9 @@
# ifdef HAVE_LIBXSLT_TRANSFORM_H
# include <libxslt/transform.h>
# endif
# include <libxslt/imports.h>
# include <libxslt/xsltutils.h>
# include <libxslt/variables.h>
# include <libxslt/xsltInternals.h>
# 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();

View file

@ -16,4 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep regtypelib
#include "msxml2.idl"

View file

@ -24,6 +24,7 @@
#include <dispex.h>
#include <wine/unicode.h>
#include <wine/list.h>
#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)
{

View file

@ -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 )

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,8 @@
# ifdef HAVE_LIBXSLT_TRANSFORM_H
# include <libxslt/transform.h>
# endif
# include <libxslt/imports.h>
# include <libxslt/variables.h>
# include <libxslt/xsltutils.h>
# include <libxslt/xsltInternals.h>
# 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, "<?xml version=");
if (result->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, &params->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)

View file

@ -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 ) ||

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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; index<This->nb_attributes; index++)
for(index=0; index<This->attributesSize; 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");

View file

@ -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");

View file

@ -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);
}

View file

@ -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);

View file

@ -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));

View file

@ -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");

View file

@ -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;

View file

@ -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)

View file

@ -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";

View file

@ -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");

View file

@ -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);
}
[

View file

@ -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);
}
[

View file

@ -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 *);

View file

@ -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