Commit 2cbd6a63 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msxml3: Added internal function for loading xml from IMoniker.

parent ecf31f2c
......@@ -242,12 +242,9 @@ static const struct IBindStatusCallbackVtbl bsc_vtbl =
bsc_OnObjectAvailable
};
HRESULT bind_url(LPCWSTR url, HRESULT (*onDataAvailable)(void*,char*,DWORD), void *obj, bsc_t **ret)
HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon)
{
WCHAR fileUrl[INTERNET_MAX_URL_LENGTH];
bsc_t *bsc;
IBindCtx *pbc;
HRESULT hr;
TRACE("%s\n", debugstr_w(url));
......@@ -270,6 +267,18 @@ HRESULT bind_url(LPCWSTR url, HRESULT (*onDataAvailable)(void*,char*,DWORD), voi
url = fileUrl;
}
return CreateURLMonikerEx(NULL, url, mon, 0);
}
HRESULT bind_url(IMoniker *mon, HRESULT (*onDataAvailable)(void*,char*,DWORD),
void *obj, bsc_t **ret)
{
bsc_t *bsc;
IBindCtx *pbc;
HRESULT hr;
TRACE("%p\n", mon);
hr = CreateBindCtx(0, &pbc);
if(FAILED(hr))
return hr;
......@@ -287,17 +296,10 @@ HRESULT bind_url(LPCWSTR url, HRESULT (*onDataAvailable)(void*,char*,DWORD), voi
hr = RegisterBindStatusCallback(pbc, &bsc->IBindStatusCallback_iface, NULL, 0);
if(SUCCEEDED(hr))
{
IMoniker *moniker;
hr = CreateURLMoniker(NULL, url, &moniker);
if(SUCCEEDED(hr))
{
IStream *stream;
hr = IMoniker_BindToStorage(moniker, pbc, NULL, &IID_IStream, (LPVOID*)&stream);
IMoniker_Release(moniker);
if(stream)
IStream_Release(stream);
}
IStream *stream;
hr = IMoniker_BindToStorage(mon, pbc, NULL, &IID_IStream, (LPVOID*)&stream);
if(stream)
IStream_Release(stream);
IBindCtx_Release(pbc);
}
......
......@@ -1996,12 +1996,13 @@ static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len)
return S_OK;
}
static HRESULT doread( domdoc *This, LPWSTR filename )
HRESULT domdoc_load_moniker(IXMLDOMDocument3 *iface, IMoniker *mon)
{
domdoc *This = impl_from_IXMLDOMDocument3(iface);
bsc_t *bsc;
HRESULT hr;
hr = bind_url(filename, domdoc_onDataAvailable, This, &bsc);
hr = bind_url(mon, domdoc_onDataAvailable, This, &bsc);
if(FAILED(hr))
return hr;
......@@ -2145,7 +2146,14 @@ static HRESULT WINAPI domdoc_load(
if ( filename )
{
hr = doread( This, filename );
IMoniker *mon;
hr = create_moniker_from_url( filename, &mon);
if ( SUCCEEDED(hr) )
{
hr = domdoc_load_moniker( iface, mon );
IMoniker_Release(mon);
}
if ( FAILED(hr) )
This->error = E_FAIL;
......
......@@ -487,8 +487,10 @@ static inline const CLSID* SchemaCache_version(MSXML_VERSION v)
typedef struct bsc_t bsc_t;
HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
HRESULT create_moniker_from_url(LPCWSTR, IMoniker**) DECLSPEC_HIDDEN;
HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
HRESULT domdoc_load_moniker(IXMLDOMDocument3*, IMoniker*) DECLSPEC_HIDDEN;
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
......
......@@ -2423,13 +2423,19 @@ static HRESULT internal_parseURL(
const WCHAR *url,
BOOL vbInterface)
{
IMoniker *mon;
bsc_t *bsc;
HRESULT hr;
TRACE("(%p)->(%s)\n", This, debugstr_w(url));
if(vbInterface) hr = bind_url(url, internal_vbonDataAvailable, This, &bsc);
else hr = bind_url(url, internal_onDataAvailable, This, &bsc);
hr = create_moniker_from_url(url, &mon);
if(FAILED(hr))
return hr;
if(vbInterface) hr = bind_url(mon, internal_vbonDataAvailable, This, &bsc);
else hr = bind_url(mon, internal_onDataAvailable, This, &bsc);
IMoniker_Release(mon);
if(FAILED(hr))
return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment