void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags) { IUriContainer *uri_container; IUri *uri = NULL; HRESULT hres; if(This->mon) { if(This->doc_obj && !(flags & (BINDING_REPLACE|BINDING_REFRESH))) { if(This == This->doc_obj->basedoc.window) notify_travellog_update(This->doc_obj); else TRACE("Skipping travellog update for frame navigation.\n"); } IMoniker_Release(This->mon); This->mon = NULL; } This->load_flags = flags; if(!mon) return; IMoniker_AddRef(mon); This->mon = mon; hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &uri); IUriContainer_Release(uri_container); if(hres != S_OK) { WARN("GetIUri failed: %08x\n", hres); uri = NULL; } } if(!uri) { WCHAR *url; hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); if(SUCCEEDED(hres)) { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { WARN("CrateUri failed: %08x\n", hres); set_current_uri(This, NULL); This->url = SysAllocString(url); CoTaskMemFree(url); return; } CoTaskMemFree(url); }else { WARN("GetDisplayName failed: %08x\n", hres); } } set_current_uri(This, uri); if(uri) IUri_Release(uri); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon) { IUriContainer *uri_container; IUri *uri = NULL; HRESULT hres; if(This->mon) { if(This->doc_obj) notify_travellog_update(This->doc_obj); IMoniker_Release(This->mon); This->mon = NULL; } if(!mon) return; IMoniker_AddRef(mon); This->mon = mon; hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &uri); IUriContainer_Release(uri_container); if(hres != S_OK) { WARN("GetIUri failed: %08x\n", hres); uri = NULL; } } if(!uri) { WCHAR *url; hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); if(SUCCEEDED(hres)) { hres = CreateUri(url, 0, 0, &uri); if(FAILED(hres)) { WARN("CrateUri failed: %08x\n", hres); set_current_uri(This, NULL); This->url = SysAllocString(url); CoTaskMemFree(url); return; } CoTaskMemFree(url); }else { WARN("GetDisplayName failed: %08x\n", hres); } } set_current_uri(This, uri); if(uri) IUri_Release(uri); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
/*********************************************************************** * CreateURLMonikerEx2 (URLMON.@) */ HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags) { IUri *context_uri = NULL, *uri; IUriContainer *uri_container; URLMoniker *ret; HRESULT hres; TRACE("(%p %p %p %x)\n", pmkContext, pUri, ppmk, dwFlags); if (ppmk) *ppmk = NULL; if (!pUri || !ppmk) return E_INVALIDARG; if(dwFlags >= ARRAY_SIZE(create_flags_map)) { FIXME("Unsupported flags %x\n", dwFlags); return E_INVALIDARG; } if(pmkContext) { hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &context_uri); if(FAILED(hres)) context_uri = NULL; IUriContainer_Release(uri_container); } } if(context_uri) { hres = CoInternetCombineIUri(context_uri, pUri, combine_flags_map[dwFlags], &uri, 0); IUri_Release(context_uri); if(FAILED(hres)) return hres; }else { uri = pUri; IUri_AddRef(uri); } hres = create_moniker(uri, &ret); IUri_Release(uri); if(FAILED(hres)) return hres; *ppmk = &ret->IMoniker_iface; return S_OK; }
/*********************************************************************** * CreateURLMonikerEx (URLMON.@) * * Create a url moniker. * * PARAMS * pmkContext [I] Context * szURL [I] Url to create the moniker for * ppmk [O] Destination for created moniker. * dwFlags [I] Flags. * * RETURNS * Success: S_OK. ppmk contains the created IMoniker object. * Failure: MK_E_SYNTAX if szURL is not a valid url, or * E_OUTOFMEMORY if memory allocation fails. */ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags) { IUri *uri, *base_uri = NULL; URLMoniker *obj; HRESULT hres; TRACE("(%p, %s, %p, %08x)\n", pmkContext, debugstr_w(szURL), ppmk, dwFlags); if (ppmk) *ppmk = NULL; if (!szURL || !ppmk) return E_INVALIDARG; if(dwFlags >= ARRAY_SIZE(create_flags_map)) { FIXME("Unsupported flags %x\n", dwFlags); return E_INVALIDARG; } if(pmkContext) { IUriContainer *uri_container; hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &base_uri); IUriContainer_Release(uri_container); if(FAILED(hres)) return hres; } } if(base_uri) { hres = CoInternetCombineUrlEx(base_uri, szURL, combine_flags_map[dwFlags], &uri, 0); IUri_Release(base_uri); }else { hres = CreateUri(szURL, Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|create_flags_map[dwFlags], 0, &uri); } if(FAILED(hres)) return hres; hres = create_moniker(uri, &obj); IUri_Release(uri); if(FAILED(hres)) return hres; *ppmk = &obj->IMoniker_iface; return S_OK; }