mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
urlmon: Added support for IUri in IMoniker::Load implementation.
This commit is contained in:
parent
e6bc4cea2c
commit
649c1793c0
1 changed files with 33 additions and 15 deletions
|
@ -139,9 +139,12 @@ static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface)
|
||||||
static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
|
static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
|
||||||
{
|
{
|
||||||
URLMoniker *This = impl_from_IMoniker(iface);
|
URLMoniker *This = impl_from_IMoniker(iface);
|
||||||
HRESULT res;
|
WCHAR *new_uri_str;
|
||||||
|
IUri *new_uri;
|
||||||
|
BSTR new_url;
|
||||||
ULONG size;
|
ULONG size;
|
||||||
ULONG got;
|
ULONG got;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",This,pStm);
|
TRACE("(%p,%p)\n",This,pStm);
|
||||||
|
|
||||||
|
@ -153,22 +156,37 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
|
||||||
* Writes a ULONG containing length of unicode string, followed
|
* Writes a ULONG containing length of unicode string, followed
|
||||||
* by that many unicode characters
|
* by that many unicode characters
|
||||||
*/
|
*/
|
||||||
res = IStream_Read(pStm, &size, sizeof(ULONG), &got);
|
hres = IStream_Read(pStm, &size, sizeof(ULONG), &got);
|
||||||
if(SUCCEEDED(res)) {
|
if(FAILED(hres))
|
||||||
if(got == sizeof(ULONG)) {
|
return hres;
|
||||||
SysFreeString(This->URLName);
|
if(got != sizeof(ULONG))
|
||||||
This->URLName = SysAllocStringLen(NULL, size/sizeof(WCHAR));
|
return E_FAIL;
|
||||||
if(!This->URLName)
|
|
||||||
res = E_OUTOFMEMORY;
|
new_uri_str = heap_alloc(size+sizeof(WCHAR));
|
||||||
else {
|
if(!new_uri_str)
|
||||||
res = IStream_Read(pStm, This->URLName, size, NULL);
|
return E_OUTOFMEMORY;
|
||||||
}
|
|
||||||
}
|
hres = IStream_Read(pStm, new_uri_str, size, NULL);
|
||||||
else
|
new_uri_str[size/sizeof(WCHAR)] = 0;
|
||||||
res = E_FAIL;
|
if(SUCCEEDED(hres))
|
||||||
|
hres = CreateUri(new_uri_str, 0, 0, &new_uri);
|
||||||
|
heap_free(new_uri_str);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
hres = IUri_GetDisplayUri(new_uri, &new_url);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
IUri_Release(new_uri);
|
||||||
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
SysFreeString(This->URLName);
|
||||||
|
if(This->uri)
|
||||||
|
IUri_Release(This->uri);
|
||||||
|
|
||||||
|
This->uri = new_uri;
|
||||||
|
This->URLName = new_url;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
|
static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
|
||||||
|
|
Loading…
Reference in a new issue