Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/msxml3/domdoc.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 2a66fc9898..7aba8e4e5a 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -2158,16 +2158,38 @@ static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len) return E_FAIL; }
-static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon) +static HRESULT domdoc_load_file(domdoc *This, LPWSTR filename, IUri **uri) { + IMoniker *mon, *base_mon = NULL; bsc_t *bsc; HRESULT hr;
- hr = bind_url(mon, domdoc_onDataAvailable, This, &bsc); - if(FAILED(hr)) - return hr; + if (This->base_uri) + { + hr = CreateURLMonikerEx2(NULL, This->base_uri, &base_mon, 0); + if (hr != S_OK) return hr; + }
- return detach_bsc(bsc); + if (base_mon) /* look for file starting from base URL */ + hr = CreateUri(filename, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri); + else /* look for file in the PATH */ + hr = create_uri(filename, uri); + if (hr == S_OK) + { + hr = CreateURLMonikerEx2(base_mon, *uri, &mon, 0); + if (hr == S_OK) + { + hr = bind_url(mon, domdoc_onDataAvailable, This, &bsc); + if (hr == S_OK) + hr = detach_bsc(bsc); + IMoniker_Release(mon); + } + } + + if (base_mon) + IMoniker_Release(base_mon); + + return hr; }
static HRESULT WINAPI domdoc_load( @@ -2296,7 +2318,6 @@ static HRESULT WINAPI domdoc_load( if ( filename ) { IUri *uri = NULL; - IMoniker *mon;
if (This->properties->uri) { @@ -2304,15 +2325,7 @@ static HRESULT WINAPI domdoc_load( This->properties->uri = NULL; }
- hr = create_uri(filename, &uri); - if (SUCCEEDED(hr)) - hr = CreateURLMonikerEx2(NULL, uri, &mon, 0); - if ( SUCCEEDED(hr) ) - { - hr = domdoc_load_moniker( This, mon ); - IMoniker_Release(mon); - } - + hr = domdoc_load_file(This, filename, &uri); if (SUCCEEDED(hr)) { get_doc(This)->name = (char *)xmlchar_from_wcharn(filename, -1, TRUE);