2 * Copyright 2006-2007 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define NONAMELESSUNION
20 #define NONAMELESSSTRUCT
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
36 static const WCHAR emptyW[] = {0};
39 IBindStatusCallback IBindStatusCallback_iface;
40 IHttpNegotiate IHttpNegotiate_iface;
41 IHttpSecurity IHttpSecurity_iface;
54 static void dump_BINDINFO(BINDINFO *bi)
56 static const char * const BINDINFOF_str[] = {
58 "BINDINFOF_URLENCODESTGMEDDATA",
59 "BINDINFOF_URLENCODEDEXTRAINFO"
62 static const char * const BINDVERB_str[] = {
82 bi->cbSize, debugstr_w(bi->szExtraInfo),
83 bi->stgmedData.tymed, bi->stgmedData.u.hGlobal, bi->stgmedData.pUnkForRelease,
84 bi->grfBindInfoF > BINDINFOF_URLENCODEDEXTRAINFO
85 ? "unknown" : BINDINFOF_str[bi->grfBindInfoF],
86 bi->dwBindVerb > BINDVERB_CUSTOM
87 ? "unknown" : BINDVERB_str[bi->dwBindVerb],
88 debugstr_w(bi->szCustomVerb),
89 bi->cbstgmedData, bi->dwOptions, bi->dwOptionsFlags, bi->dwCodePage,
90 bi->securityAttributes.nLength,
91 bi->securityAttributes.lpSecurityDescriptor,
92 bi->securityAttributes.bInheritHandle,
93 debugstr_guid(&bi->iid),
94 bi->pUnk, bi->dwReserved
98 static void set_status_text(BindStatusCallback *This, ULONG statuscode, LPCWSTR str)
101 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
102 WCHAR fmt[IDS_STATUSFMT_MAXLEN];
103 WCHAR buffer[IDS_STATUSFMT_MAXLEN + INTERNET_MAX_URL_LENGTH];
108 TRACE("(%p, %d, %s)\n", This, statuscode, debugstr_w(str));
110 if (statuscode && str && *str) {
112 /* the format string must have one "%s" for the str */
113 LoadStringW(ieframe_instance, IDS_STATUSFMT_FIRST + statuscode, fmt, IDS_STATUSFMT_MAXLEN);
114 snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), fmt, str);
117 V_VT(&arg) = VT_BSTR;
118 V_BSTR(&arg) = str ? SysAllocString(buffer) : NULL;
119 TRACE("=> %s\n", debugstr_w(V_BSTR(&arg)));
121 call_sink(This->doc_host->cps.wbe2, DISPID_STATUSTEXTCHANGE, &dispparams);
123 if(This->doc_host->frame)
124 IOleInPlaceFrame_SetStatusText(This->doc_host->frame, buffer);
130 HRESULT set_dochost_url(DocHost *This, const WCHAR *url)
135 new_url = heap_strdupW(url);
137 return E_OUTOFMEMORY;
142 heap_free(This->url);
145 This->container_vtbl->SetURL(This, This->url);
149 static inline BindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCallback *iface)
151 return CONTAINING_RECORD(iface, BindStatusCallback, IBindStatusCallback_iface);
154 static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
155 REFIID riid, void **ppv)
157 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
159 if(IsEqualGUID(&IID_IUnknown, riid)) {
160 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
161 *ppv = &This->IBindStatusCallback_iface;
162 }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
163 TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
164 *ppv = &This->IBindStatusCallback_iface;
165 }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
166 TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
167 *ppv = &This->IHttpNegotiate_iface;
168 }else if(IsEqualGUID(&IID_IWindowForBindingUI, riid)) {
169 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This, ppv);
170 *ppv = &This->IHttpSecurity_iface;
171 }else if(IsEqualGUID(&IID_IHttpSecurity, riid)) {
172 TRACE("(%p)->(IID_IHttpSecurity %p)\n", This, ppv);
173 *ppv = &This->IHttpSecurity_iface;
176 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
177 return E_NOINTERFACE;
180 IUnknown_AddRef((IUnknown*)*ppv);
184 static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
186 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
187 LONG ref = InterlockedIncrement(&This->ref);
189 TRACE("(%p) ref=%d\n", This, ref);
194 static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
196 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
197 LONG ref = InterlockedDecrement(&This->ref);
199 TRACE("(%p) ref=%d\n", This, ref);
203 IOleClientSite_Release(&This->doc_host->IOleClientSite_iface);
205 IBinding_Release(This->binding);
207 GlobalFree(This->post_data);
208 SysFreeString(This->headers);
209 heap_free(This->url);
216 static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
217 DWORD dwReserved, IBinding *pbind)
219 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
221 TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
223 This->binding = pbind;
224 IBinding_AddRef(This->binding);
229 static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
232 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
233 FIXME("(%p)->(%p)\n", This, pnPriority);
237 static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface,
240 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
241 FIXME("(%p)->(%d)\n", This, reserved);
245 static DWORD get_http_status_code(IBinding *binding)
247 IWinInetHttpInfo *http_info;
248 DWORD status, size = sizeof(DWORD);
251 hres = IBinding_QueryInterface(binding, &IID_IWinInetHttpInfo, (void**)&http_info);
253 return HTTP_STATUS_OK;
255 hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,
256 &status, &size, NULL, NULL);
257 IWinInetHttpInfo_Release(http_info);
260 return HTTP_STATUS_OK;
264 static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
265 ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
267 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
270 TRACE("(%p)->(%d %d %d %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
271 debugstr_w(szStatusText));
273 switch(ulStatusCode) {
274 case BINDSTATUS_REDIRECTING:
275 return set_dochost_url(This->doc_host, szStatusText);
276 case BINDSTATUS_BEGINDOWNLOADDATA:
277 set_status_text(This, ulStatusCode, szStatusText);
278 status_code = get_http_status_code(This->binding);
279 if(status_code != HTTP_STATUS_OK)
280 handle_navigation_error(This->doc_host, status_code, This->url, NULL);
283 case BINDSTATUS_FINDINGRESOURCE:
284 case BINDSTATUS_ENDDOWNLOADDATA:
285 case BINDSTATUS_SENDINGREQUEST:
286 set_status_text(This, ulStatusCode, szStatusText);
289 case BINDSTATUS_CONNECTING:
290 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
291 case BINDSTATUS_CLASSIDAVAILABLE:
292 case BINDSTATUS_MIMETYPEAVAILABLE:
293 case BINDSTATUS_BEGINSYNCOPERATION:
294 case BINDSTATUS_ENDSYNCOPERATION:
297 FIXME("status code %u\n", ulStatusCode);
303 void handle_navigation_error(DocHost* doc_host, HRESULT hres, BSTR url, IHTMLWindow2 *win2)
305 VARIANT var_status_code, var_frame_name, var_url;
306 DISPPARAMS dispparams;
307 VARIANTARG params[5];
308 VARIANT_BOOL cancel = VARIANT_FALSE;
310 dispparams.cArgs = 5;
311 dispparams.cNamedArgs = 0;
312 dispparams.rgdispidNamedArgs = NULL;
313 dispparams.rgvarg = params;
315 V_VT(params) = VT_BOOL|VT_BYREF;
316 V_BOOLREF(params) = &cancel;
318 V_VT(params+1) = VT_VARIANT|VT_BYREF;
319 V_VARIANTREF(params+1) = &var_status_code;
320 V_VT(&var_status_code) = VT_I4;
321 V_I4(&var_status_code) = hres;
323 V_VT(params+2) = VT_VARIANT|VT_BYREF;
324 V_VARIANTREF(params+2) = &var_frame_name;
325 V_VT(&var_frame_name) = VT_BSTR;
327 hres = IHTMLWindow2_get_name(win2, &V_BSTR(&var_frame_name));
329 V_BSTR(&var_frame_name) = NULL;
331 V_BSTR(&var_frame_name) = NULL;
333 V_VT(params+3) = VT_VARIANT|VT_BYREF;
334 V_VARIANTREF(params+3) = &var_url;
335 V_VT(&var_url) = VT_BSTR;
336 V_BSTR(&var_url) = url;
338 V_VT(params+4) = VT_DISPATCH;
339 V_DISPATCH(params+4) = (IDispatch*)doc_host->wb;
341 call_sink(doc_host->cps.wbe2, DISPID_NAVIGATEERROR, &dispparams);
342 SysFreeString(V_BSTR(&var_frame_name));
345 FIXME("Navigate to error page\n");
348 static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
349 HRESULT hresult, LPCWSTR szError)
351 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
353 TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
355 set_status_text(This, 0, emptyW);
361 handle_navigation_error(This->doc_host, hresult, This->url, NULL);
363 IOleClientSite_Release(&This->doc_host->IOleClientSite_iface);
364 This->doc_host = NULL;
366 IBinding_Release(This->binding);
367 This->binding = NULL;
372 static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
373 DWORD *grfBINDF, BINDINFO *pbindinfo)
375 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
377 TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
379 *grfBINDF = BINDF_ASYNCHRONOUS;
381 if(This->post_data) {
382 pbindinfo->dwBindVerb = BINDVERB_POST;
384 pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
385 pbindinfo->stgmedData.u.hGlobal = This->post_data;
386 pbindinfo->cbstgmedData = This->post_data_len;
387 pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)&This->IBindStatusCallback_iface;
388 IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
394 static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
395 DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
397 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
398 FIXME("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
402 static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
403 REFIID riid, IUnknown *punk)
405 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
407 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
409 return dochost_object_available(This->doc_host, punk);
412 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
413 BindStatusCallback_QueryInterface,
414 BindStatusCallback_AddRef,
415 BindStatusCallback_Release,
416 BindStatusCallback_OnStartBinding,
417 BindStatusCallback_GetPriority,
418 BindStatusCallback_OnLowResource,
419 BindStatusCallback_OnProgress,
420 BindStatusCallback_OnStopBinding,
421 BindStatusCallback_GetBindInfo,
422 BindStatusCallback_OnDataAvailable,
423 BindStatusCallback_OnObjectAvailable
426 static inline BindStatusCallback *impl_from_IHttpNegotiate(IHttpNegotiate *iface)
428 return CONTAINING_RECORD(iface, BindStatusCallback, IHttpNegotiate_iface);
431 static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface,
432 REFIID riid, void **ppv)
434 BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
435 return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
438 static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
440 BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
441 return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
444 static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
446 BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
447 return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
450 static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
451 LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
453 BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
455 TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
456 dwReserved, pszAdditionalHeaders);
459 int size = (strlenW(This->headers)+1)*sizeof(WCHAR);
460 *pszAdditionalHeaders = CoTaskMemAlloc(size);
461 memcpy(*pszAdditionalHeaders, This->headers, size);
467 static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface,
468 DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders,
469 LPWSTR *pszAdditionalRequestHeaders)
471 BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
472 TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
473 debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
477 static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
478 HttpNegotiate_QueryInterface,
479 HttpNegotiate_AddRef,
480 HttpNegotiate_Release,
481 HttpNegotiate_BeginningTransaction,
482 HttpNegotiate_OnResponse
485 static inline BindStatusCallback *impl_from_IHttpSecurity(IHttpSecurity *iface)
487 return CONTAINING_RECORD(iface, BindStatusCallback, IHttpSecurity_iface);
490 static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
492 BindStatusCallback *This = impl_from_IHttpSecurity(iface);
493 return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
496 static ULONG WINAPI HttpSecurity_AddRef(IHttpSecurity *iface)
498 BindStatusCallback *This = impl_from_IHttpSecurity(iface);
499 return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
502 static ULONG WINAPI HttpSecurity_Release(IHttpSecurity *iface)
504 BindStatusCallback *This = impl_from_IHttpSecurity(iface);
505 return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
508 static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguidReason, HWND *phwnd)
510 BindStatusCallback *This = impl_from_IHttpSecurity(iface);
512 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(rguidReason), phwnd);
517 *phwnd = This->doc_host->frame_hwnd;
521 static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem)
523 BindStatusCallback *This = impl_from_IHttpSecurity(iface);
524 FIXME("(%p)->(%u)\n", This, dwProblem);
528 static const IHttpSecurityVtbl HttpSecurityVtbl = {
529 HttpSecurity_QueryInterface,
531 HttpSecurity_Release,
532 HttpSecurity_GetWindow,
533 HttpSecurity_OnSecurityProblem
536 static BindStatusCallback *create_callback(DocHost *doc_host, LPCWSTR url, PBYTE post_data,
537 ULONG post_data_len, LPCWSTR headers)
539 BindStatusCallback *ret = heap_alloc(sizeof(BindStatusCallback));
541 ret->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
542 ret->IHttpNegotiate_iface.lpVtbl = &HttpNegotiateVtbl;
543 ret->IHttpSecurity_iface.lpVtbl = &HttpSecurityVtbl;
546 ret->url = heap_strdupW(url);
547 ret->post_data = NULL;
548 ret->post_data_len = post_data_len;
549 ret->headers = headers ? SysAllocString(headers) : NULL;
551 ret->doc_host = doc_host;
552 IOleClientSite_AddRef(&doc_host->IOleClientSite_iface);
557 ret->post_data = GlobalAlloc(0, post_data_len);
558 memcpy(ret->post_data, post_data, post_data_len);
564 static void on_before_navigate2(DocHost *This, LPCWSTR url, SAFEARRAY *post_data, LPWSTR headers, VARIANT_BOOL *cancel)
566 VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
567 DISPPARAMS dispparams;
568 VARIANTARG params[7];
569 WCHAR file_path[MAX_PATH];
570 DWORD file_path_len = sizeof(file_path) / sizeof(*file_path);
572 dispparams.cArgs = 7;
573 dispparams.cNamedArgs = 0;
574 dispparams.rgdispidNamedArgs = NULL;
575 dispparams.rgvarg = params;
577 This->busy = VARIANT_TRUE;
579 V_VT(params) = VT_BOOL|VT_BYREF;
580 V_BOOLREF(params) = cancel;
582 V_VT(params+1) = (VT_BYREF|VT_VARIANT);
583 V_VARIANTREF(params+1) = &var_headers;
584 V_VT(&var_headers) = VT_BSTR;
585 V_BSTR(&var_headers) = headers;
587 V_VT(params+2) = (VT_BYREF|VT_VARIANT);
588 V_VARIANTREF(params+2) = &var_post_data2;
589 V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
590 V_VARIANTREF(&var_post_data2) = &var_post_data;
593 V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
594 V_ARRAY(&var_post_data) = post_data;
596 V_VT(&var_post_data) = VT_EMPTY;
599 V_VT(params+3) = (VT_BYREF|VT_VARIANT);
600 V_VARIANTREF(params+3) = &var_frame_name;
601 V_VT(&var_frame_name) = VT_BSTR;
602 V_BSTR(&var_frame_name) = NULL;
604 V_VT(params+4) = (VT_BYREF|VT_VARIANT);
605 V_VARIANTREF(params+4) = &var_flags;
606 V_VT(&var_flags) = VT_I4;
607 V_I4(&var_flags) = 0;
609 V_VT(params+5) = (VT_BYREF|VT_VARIANT);
610 V_VARIANTREF(params+5) = &var_url;
611 V_VT(&var_url) = VT_BSTR;
612 if(PathCreateFromUrlW(url, file_path, &file_path_len, 0) == S_OK)
613 V_BSTR(&var_url) = SysAllocString(file_path);
615 V_BSTR(&var_url) = SysAllocString(url);
617 V_VT(params+6) = (VT_DISPATCH);
618 V_DISPATCH(params+6) = (IDispatch*)This->wb;
620 call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
622 SysFreeString(V_BSTR(&var_url));
625 /* FIXME: urlmon should handle it */
626 static BOOL try_application_url(LPCWSTR url)
628 SHELLEXECUTEINFOW exec_info;
634 static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
636 hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
640 res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
641 if(res != ERROR_SUCCESS)
644 res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
646 if(res != ERROR_SUCCESS || type != REG_SZ)
649 TRACE("opening application %s\n", debugstr_w(app));
651 memset(&exec_info, 0, sizeof(exec_info));
652 exec_info.cbSize = sizeof(exec_info);
653 exec_info.lpFile = url;
654 exec_info.nShow = SW_SHOW;
656 return ShellExecuteExW(&exec_info);
659 static HRESULT create_moniker(LPCWSTR url, IMoniker **mon)
661 WCHAR new_url[INTERNET_MAX_URL_LENGTH];
666 return CreateURLMoniker(NULL, url, mon);
668 size = sizeof(new_url)/sizeof(WCHAR);
669 hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE);
670 TRACE("was %s got %s\n", debugstr_w(url), debugstr_w(new_url));
672 WARN("UrlApplyScheme failed: %08x\n", hres);
676 return CreateURLMoniker(NULL, new_url, mon);
679 static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
680 IBindStatusCallback *callback)
682 IUnknown *unk = NULL;
687 IMoniker_AddRef(mon);
689 hres = create_moniker(url, &mon);
694 hres = IMoniker_GetDisplayName(mon, 0, NULL, &display_name);
696 FIXME("GetDisplayName failed: %08x\n", hres);
700 hres = set_dochost_url(This, display_name);
701 CoTaskMemFree(display_name);
705 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
706 (IUnknown*)&This->IOleClientSite_iface);
708 hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
709 if(SUCCEEDED(hres)) {
712 IUnknown_Release(unk);
713 }else if(try_application_url(url)) {
716 FIXME("BindToObject failed: %08x\n", hres);
719 IMoniker_Release(mon);
723 static void html_window_navigate(DocHost *This, IHTMLPrivateWindow *window, BSTR url, BSTR headers, SAFEARRAY *post_data)
725 VARIANT headers_var, post_data_var;
729 hres = set_dochost_url(This, url);
733 empty_str = SysAllocStringLen(NULL, 0);
736 V_VT(&headers_var) = VT_BSTR;
737 V_BSTR(&headers_var) = headers;
739 V_VT(&headers_var) = VT_EMPTY;
743 V_VT(&post_data_var) = VT_UI1|VT_ARRAY;
744 V_ARRAY(&post_data_var) = post_data;
746 V_VT(&post_data_var) = VT_EMPTY;
749 set_doc_state(This, READYSTATE_LOADING);
750 hres = IHTMLPrivateWindow_SuperNavigate(window, url, empty_str, NULL, NULL, &post_data_var, &headers_var, 0);
751 SysFreeString(empty_str);
753 WARN("SuprtNavigate failed: %08x\n", hres);
757 task_header_t header;
760 SAFEARRAY *post_data;
762 } task_doc_navigate_t;
764 static void doc_navigate_task_destr(task_header_t *t)
766 task_doc_navigate_t *task = (task_doc_navigate_t*)t;
768 SysFreeString(task->url);
769 SysFreeString(task->headers);
771 SafeArrayDestroy(task->post_data);
775 static void doc_navigate_proc(DocHost *This, task_header_t *t)
777 task_doc_navigate_t *task = (task_doc_navigate_t*)t;
778 IHTMLPrivateWindow *priv_window;
781 if(!This->doc_navigate) {
786 if(task->async_notif) {
787 VARIANT_BOOL cancel = VARIANT_FALSE;
788 on_before_navigate2(This, task->url, task->post_data, task->headers, &cancel);
790 TRACE("Navigation canceled\n");
795 hres = IUnknown_QueryInterface(This->doc_navigate, &IID_IHTMLPrivateWindow, (void**)&priv_window);
796 if(SUCCEEDED(hres)) {
797 html_window_navigate(This, priv_window, task->url, task->headers, task->post_data);
798 IHTMLPrivateWindow_Release(priv_window);
800 WARN("Could not get IHTMLPrivateWindow iface: %08x\n", hres);
804 static HRESULT async_doc_navigate(DocHost *This, LPCWSTR url, LPCWSTR headers, PBYTE post_data, ULONG post_data_size,
807 task_doc_navigate_t *task;
809 TRACE("%s\n", debugstr_w(url));
811 task = heap_alloc_zero(sizeof(*task));
813 return E_OUTOFMEMORY;
815 task->url = SysAllocString(url);
817 doc_navigate_task_destr(&task->header);
818 return E_OUTOFMEMORY;
822 task->headers = SysAllocString(headers);
824 doc_navigate_task_destr(&task->header);
825 return E_OUTOFMEMORY;
830 task->post_data = SafeArrayCreateVector(VT_UI1, 0, post_data_size);
831 if(!task->post_data) {
832 doc_navigate_task_destr(&task->header);
833 return E_OUTOFMEMORY;
836 memcpy(task->post_data->pvData, post_data, post_data_size);
840 VARIANT_BOOL cancel = VARIANT_FALSE;
842 on_before_navigate2(This, task->url, task->post_data, task->headers, &cancel);
844 TRACE("Navigation canceled\n");
845 doc_navigate_task_destr(&task->header);
850 task->async_notif = async_notif;
851 abort_dochost_tasks(This, doc_navigate_proc);
852 push_dochost_task(This, &task->header, doc_navigate_proc, doc_navigate_task_destr, FALSE);
856 static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
858 VARIANT_BOOL cancel = VARIANT_FALSE;
859 SAFEARRAY *post_data = NULL;
863 set_doc_state(This, READYSTATE_LOADING);
866 post_data = SafeArrayCreateVector(VT_UI1, 0, bsc->post_data_len);
867 memcpy(post_data->pvData, post_data, bsc->post_data_len);
870 on_before_navigate2(This, bsc->url, post_data, bsc->headers, &cancel);
872 SafeArrayDestroy(post_data);
874 FIXME("Navigation canceled\n");
879 deactivate_document(This);
881 CreateAsyncBindCtx(0, &bsc->IBindStatusCallback_iface, 0, &bindctx);
884 IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
886 hres = bind_to_object(This, mon, bsc->url, bindctx, &bsc->IBindStatusCallback_iface);
889 IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
891 IBindCtx_Release(bindctx);
897 task_header_t header;
898 BindStatusCallback *bsc;
899 } task_navigate_bsc_t;
901 static void navigate_bsc_task_destr(task_header_t *t)
903 task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
905 IBindStatusCallback_Release(&task->bsc->IBindStatusCallback_iface);
909 static void navigate_bsc_proc(DocHost *This, task_header_t *t)
911 task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
914 create_doc_view_hwnd(This);
916 navigate_bsc(This, task->bsc, NULL);
920 HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
921 const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
923 PBYTE post_data = NULL;
924 ULONG post_data_len = 0;
925 LPWSTR headers = NULL;
928 TRACE("navigating to %s\n", debugstr_w(url));
930 if((Flags && V_VT(Flags) != VT_EMPTY)
931 || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
932 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
933 Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
934 TargetFrameName ? V_VT(TargetFrameName) : -1);
936 if(PostData && V_VT(PostData) == (VT_ARRAY | VT_UI1) && V_ARRAY(PostData)) {
937 SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
938 post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
941 if(Headers && V_VT(Headers) == VT_BSTR) {
942 headers = V_BSTR(Headers);
943 TRACE("Headers: %s\n", debugstr_w(headers));
946 set_doc_state(This, READYSTATE_LOADING);
947 This->ready_state = READYSTATE_LOADING;
949 if(This->doc_navigate) {
950 WCHAR new_url[INTERNET_MAX_URL_LENGTH];
952 if(PathIsURLW(url)) {
957 size = sizeof(new_url)/sizeof(WCHAR);
958 hres = UrlApplySchemeW(url, new_url, &size,
959 URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE | URL_APPLY_DEFAULT);
961 WARN("UrlApplyScheme failed: %08x\n", hres);
966 hres = async_doc_navigate(This, *new_url ? new_url : url, headers, post_data,
967 post_data_len, TRUE);
969 task_navigate_bsc_t *task;
971 task = heap_alloc(sizeof(*task));
972 task->bsc = create_callback(This, url, post_data, post_data_len, headers);
973 push_dochost_task(This, &task->header, navigate_bsc_proc, navigate_bsc_task_destr, This->url == NULL);
977 SafeArrayUnaccessData(V_ARRAY(PostData));
982 static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
983 IBindStatusCallback *callback)
985 IHttpNegotiate *http_negotiate;
986 BindStatusCallback *bsc;
987 PBYTE post_data = NULL;
988 ULONG post_data_len = 0;
989 LPWSTR headers = NULL, url;
996 hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
998 FIXME("GetDisplayName failed: %08x\n", hres);
1000 hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
1001 (void**)&http_negotiate);
1002 if(SUCCEEDED(hres)) {
1003 static const WCHAR null_string[] = {0};
1005 IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
1007 IHttpNegotiate_Release(http_negotiate);
1010 memset(&bindinfo, 0, sizeof(bindinfo));
1011 bindinfo.cbSize = sizeof(bindinfo);
1013 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1014 dump_BINDINFO(&bindinfo);
1015 if(bindinfo.dwBindVerb == BINDVERB_POST) {
1016 post_data_len = bindinfo.cbstgmedData;
1018 post_data = bindinfo.stgmedData.u.hGlobal;
1021 if(This->doc_navigate) {
1022 hres = async_doc_navigate(This, url, headers, post_data, post_data_len, FALSE);
1024 bsc = create_callback(This, url, post_data, post_data_len, headers);
1025 hres = navigate_bsc(This, bsc, mon);
1026 IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);
1030 CoTaskMemFree(headers);
1031 ReleaseBindInfo(&bindinfo);
1036 HRESULT go_home(DocHost *This)
1039 DWORD res, type, size;
1040 WCHAR wszPageName[MAX_PATH];
1041 static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
1042 static const WCHAR wszStartPage[] = {'S','t','a','r','t',' ','P','a','g','e',0};
1043 static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
1044 'M','i','c','r','o','s','o','f','t','\\',
1045 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
1048 res = RegOpenKeyW(HKEY_CURRENT_USER, wszSubKey, &hkey);
1049 if (res != ERROR_SUCCESS)
1050 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
1052 size = sizeof(wszPageName);
1053 res = RegQueryValueExW(hkey, wszStartPage, NULL, &type, (LPBYTE)wszPageName, &size);
1055 if (res != ERROR_SUCCESS || type != REG_SZ)
1056 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
1058 return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL);
1061 HRESULT go_back(DocHost *This)
1066 if(!This->travellog_position) {
1067 WARN("No history available\n");
1071 url = This->travellog[--This->travellog_position].url;
1073 if(This->doc_navigate) {
1074 hres = async_doc_navigate(This, url, NULL, NULL, 0, FALSE);
1076 FIXME("unsupported doc_navigate FALSE\n");
1084 HRESULT get_location_url(DocHost *This, BSTR *ret)
1086 FIXME("semi-stub\n");
1088 *ret = This->url ? SysAllocString(This->url) : SysAllocStringLen(NULL, 0);
1090 return E_OUTOFMEMORY;
1092 return This->url ? S_OK : S_FALSE;
1095 static inline HlinkFrame *impl_from_IHlinkFrame(IHlinkFrame *iface)
1097 return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface);
1100 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
1102 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1103 return IUnknown_QueryInterface(This->outer, riid, ppv);
1106 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
1108 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1109 return IUnknown_AddRef(This->outer);
1112 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
1114 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1115 return IUnknown_Release(This->outer);
1118 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
1119 IHlinkBrowseContext *pihlbc)
1121 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1122 FIXME("(%p)->(%p)\n", This, pihlbc);
1126 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
1127 IHlinkBrowseContext **ppihlbc)
1129 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1130 FIXME("(%p)->(%p)\n", This, ppihlbc);
1134 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
1135 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
1137 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1139 LPWSTR location = NULL;
1141 TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
1144 FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
1146 /* Windows calls GetTargetFrameName here. */
1148 IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
1151 FIXME("location = %s\n", debugstr_w(location));
1152 CoTaskMemFree(location);
1155 /* Windows calls GetHlinkSite here */
1157 if(grfHLNF & HLNF_OPENINNEWWINDOW) {
1158 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
1162 return navigate_hlink(This->doc_host, mon, pbc, pibsc);
1165 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
1166 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
1168 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1169 FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
1170 debugstr_w(pwzFriendlyName), dwreserved);
1174 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
1175 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
1177 HlinkFrame *This = impl_from_IHlinkFrame(iface);
1178 FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
1179 debugstr_w(pwzFriendlyName));
1183 static const IHlinkFrameVtbl HlinkFrameVtbl = {
1184 HlinkFrame_QueryInterface,
1187 HlinkFrame_SetBrowseContext,
1188 HlinkFrame_GetBrowseContext,
1189 HlinkFrame_Navigate,
1190 HlinkFrame_OnNavigate,
1191 HlinkFrame_UpdateHlink
1194 static inline HlinkFrame *impl_from_ITargetFrame2(ITargetFrame2 *iface)
1196 return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface);
1199 static HRESULT WINAPI TargetFrame2_QueryInterface(ITargetFrame2 *iface, REFIID riid, void **ppv)
1201 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1202 return IUnknown_QueryInterface(This->outer, riid, ppv);
1205 static ULONG WINAPI TargetFrame2_AddRef(ITargetFrame2 *iface)
1207 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1208 return IUnknown_AddRef(This->outer);
1211 static ULONG WINAPI TargetFrame2_Release(ITargetFrame2 *iface)
1213 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1214 return IUnknown_Release(This->outer);
1217 static HRESULT WINAPI TargetFrame2_SetFrameName(ITargetFrame2 *iface, LPCWSTR pszFrameName)
1219 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1220 FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameName));
1224 static HRESULT WINAPI TargetFrame2_GetFrameName(ITargetFrame2 *iface, LPWSTR *ppszFrameName)
1226 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1227 FIXME("(%p)->(%p)\n", This, ppszFrameName);
1231 static HRESULT WINAPI TargetFrame2_GetParentFrame(ITargetFrame2 *iface, IUnknown **ppunkParent)
1233 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1234 FIXME("(%p)->(%p)\n", This, ppunkParent);
1238 static HRESULT WINAPI TargetFrame2_SetFrameSrc(ITargetFrame2 *iface, LPCWSTR pszFrameSrc)
1240 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1241 FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameSrc));
1245 static HRESULT WINAPI TargetFrame2_GetFrameSrc(ITargetFrame2 *iface, LPWSTR *ppszFrameSrc)
1247 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1248 FIXME("(%p)->()\n", This);
1252 static HRESULT WINAPI TargetFrame2_GetFramesContainer(ITargetFrame2 *iface, IOleContainer **ppContainer)
1254 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1255 FIXME("(%p)->(%p)\n", This, ppContainer);
1259 static HRESULT WINAPI TargetFrame2_SetFrameOptions(ITargetFrame2 *iface, DWORD dwFlags)
1261 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1262 FIXME("(%p)->(%x)\n", This, dwFlags);
1266 static HRESULT WINAPI TargetFrame2_GetFrameOptions(ITargetFrame2 *iface, DWORD *pdwFlags)
1268 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1269 FIXME("(%p)->(%p)\n", This, pdwFlags);
1273 static HRESULT WINAPI TargetFrame2_SetFrameMargins(ITargetFrame2 *iface, DWORD dwWidth, DWORD dwHeight)
1275 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1276 FIXME("(%p)->(%d %d)\n", This, dwWidth, dwHeight);
1280 static HRESULT WINAPI TargetFrame2_GetFrameMargins(ITargetFrame2 *iface, DWORD *pdwWidth, DWORD *pdwHeight)
1282 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1283 FIXME("(%p)->(%p %p)\n", This, pdwWidth, pdwHeight);
1287 static HRESULT WINAPI TargetFrame2_FindFrame(ITargetFrame2 *iface, LPCWSTR pszTargetName, DWORD dwFlags, IUnknown **ppunkTargetFrame)
1289 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1290 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(pszTargetName), dwFlags, ppunkTargetFrame);
1294 static HRESULT WINAPI TargetFrame2_GetTargetAlias(ITargetFrame2 *iface, LPCWSTR pszTargetName, LPWSTR *ppszTargetAlias)
1296 HlinkFrame *This = impl_from_ITargetFrame2(iface);
1297 FIXME("(%p)->(%s %p)\n", This, debugstr_w(pszTargetName), ppszTargetAlias);
1301 static const ITargetFrame2Vtbl TargetFrame2Vtbl = {
1302 TargetFrame2_QueryInterface,
1303 TargetFrame2_AddRef,
1304 TargetFrame2_Release,
1305 TargetFrame2_SetFrameName,
1306 TargetFrame2_GetFrameName,
1307 TargetFrame2_GetParentFrame,
1308 TargetFrame2_SetFrameSrc,
1309 TargetFrame2_GetFrameSrc,
1310 TargetFrame2_GetFramesContainer,
1311 TargetFrame2_SetFrameOptions,
1312 TargetFrame2_GetFrameOptions,
1313 TargetFrame2_SetFrameMargins,
1314 TargetFrame2_GetFrameMargins,
1315 TargetFrame2_FindFrame,
1316 TargetFrame2_GetTargetAlias
1319 static inline HlinkFrame *impl_from_ITargetFramePriv2(ITargetFramePriv2 *iface)
1321 return CONTAINING_RECORD(iface, HlinkFrame, ITargetFramePriv2_iface);
1324 static HRESULT WINAPI TargetFramePriv2_QueryInterface(ITargetFramePriv2 *iface, REFIID riid, void **ppv)
1326 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1327 return IUnknown_QueryInterface(This->outer, riid, ppv);
1330 static ULONG WINAPI TargetFramePriv2_AddRef(ITargetFramePriv2 *iface)
1332 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1333 return IUnknown_AddRef(This->outer);
1336 static ULONG WINAPI TargetFramePriv2_Release(ITargetFramePriv2 *iface)
1338 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1339 return IUnknown_Release(This->outer);
1342 static HRESULT WINAPI TargetFramePriv2_FindFrameDownwards(ITargetFramePriv2 *iface,
1343 LPCWSTR pszTargetName, DWORD dwFlags, IUnknown **ppunkTargetFrame)
1345 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1346 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(pszTargetName), dwFlags, ppunkTargetFrame);
1350 static HRESULT WINAPI TargetFramePriv2_FindFrameInContext(ITargetFramePriv2 *iface,
1351 LPCWSTR pszTargetName, IUnknown *punkContextFrame, DWORD dwFlags, IUnknown **ppunkTargetFrame)
1353 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1354 FIXME("(%p)->(%s %p %x %p)\n", This, debugstr_w(pszTargetName), punkContextFrame, dwFlags, ppunkTargetFrame);
1358 static HRESULT WINAPI TargetFramePriv2_OnChildFrameActivate(ITargetFramePriv2 *iface, IUnknown *pUnkChildFrame)
1360 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1361 FIXME("(%p)->(%p)\n", This, pUnkChildFrame);
1365 static HRESULT WINAPI TargetFramePriv2_OnChildFrameDeactivate(ITargetFramePriv2 *iface, IUnknown *pUnkChildFrame)
1367 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1368 FIXME("(%p)->(%p)\n", This, pUnkChildFrame);
1372 static HRESULT WINAPI TargetFramePriv2_NavigateHack(ITargetFramePriv2 *iface, DWORD grfHLNF, LPBC pbc,
1373 IBindStatusCallback *pibsc, LPCWSTR pszTargetName, LPCWSTR pszUrl, LPCWSTR pszLocation)
1375 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1376 FIXME("(%p)->(%x %p %p %s %s %s)\n", This, grfHLNF, pbc, pibsc, debugstr_w(pszTargetName),
1377 debugstr_w(pszUrl), debugstr_w(pszLocation));
1381 static HRESULT WINAPI TargetFramePriv2_FindBrowserByIndex(ITargetFramePriv2 *iface, DWORD dwID, IUnknown **ppunkBrowser)
1383 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1384 FIXME("(%p)->(%d %p)\n", This, dwID, ppunkBrowser);
1388 static HRESULT WINAPI TargetFramePriv2_AggregatedNavigation2(ITargetFramePriv2 *iface, DWORD grfHLNF, LPBC pbc,
1389 IBindStatusCallback *pibsc, LPCWSTR pszTargetName, IUri *pUri, LPCWSTR pszLocation)
1391 HlinkFrame *This = impl_from_ITargetFramePriv2(iface);
1395 TRACE("(%p)->(%x %p %p %s %p %s)\n", This, grfHLNF, pbc, pibsc, debugstr_w(pszTargetName),
1396 pUri, debugstr_w(pszLocation));
1399 * NOTE: This is an undocumented function. It seems to be working the way it's implemented,
1400 * but I couldn't get its tests working. It's used by mshtml to load content in a new
1401 * instance of browser.
1404 hres = CreateURLMonikerEx2(NULL, pUri, &mon, 0);
1408 hres = navigate_hlink(This->doc_host, mon, pbc, pibsc);
1409 IMoniker_Release(mon);
1413 static const ITargetFramePriv2Vtbl TargetFramePriv2Vtbl = {
1414 TargetFramePriv2_QueryInterface,
1415 TargetFramePriv2_AddRef,
1416 TargetFramePriv2_Release,
1417 TargetFramePriv2_FindFrameDownwards,
1418 TargetFramePriv2_FindFrameInContext,
1419 TargetFramePriv2_OnChildFrameActivate,
1420 TargetFramePriv2_OnChildFrameDeactivate,
1421 TargetFramePriv2_NavigateHack,
1422 TargetFramePriv2_FindBrowserByIndex,
1423 TargetFramePriv2_AggregatedNavigation2
1426 BOOL HlinkFrame_QI(HlinkFrame *This, REFIID riid, void **ppv)
1428 if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
1429 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
1430 *ppv = &This->IHlinkFrame_iface;
1431 }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) {
1432 TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv);
1433 *ppv = &This->ITargetFrame2_iface;
1434 }else if(IsEqualGUID(&IID_ITargetFramePriv, riid)) {
1435 TRACE("(%p)->(IID_ITargetFramePriv %p)\n", This, ppv);
1436 *ppv = &This->ITargetFramePriv2_iface;
1437 }else if(IsEqualGUID(&IID_ITargetFramePriv2, riid)) {
1438 TRACE("(%p)->(IID_ITargetFramePriv2 %p)\n", This, ppv);
1439 *ppv = &This->ITargetFramePriv2_iface;
1444 IUnknown_AddRef((IUnknown*)*ppv);
1448 void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host)
1450 This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl;
1451 This->ITargetFrame2_iface.lpVtbl = &TargetFrame2Vtbl;
1452 This->ITargetFramePriv2_iface.lpVtbl = &TargetFramePriv2Vtbl;
1454 This->outer = outer;
1455 This->doc_host = doc_host;