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
;
53 static void dump_BINDINFO(BINDINFO
*bi
)
55 static const char * const BINDINFOF_str
[] = {
57 "BINDINFOF_URLENCODESTGMEDDATA",
58 "BINDINFOF_URLENCODEDEXTRAINFO"
61 static const char * const BINDVERB_str
[] = {
81 bi
->cbSize
, debugstr_w(bi
->szExtraInfo
),
82 bi
->stgmedData
.tymed
, bi
->stgmedData
.u
.hGlobal
, bi
->stgmedData
.pUnkForRelease
,
83 bi
->grfBindInfoF
> BINDINFOF_URLENCODEDEXTRAINFO
84 ? "unknown" : BINDINFOF_str
[bi
->grfBindInfoF
],
85 bi
->dwBindVerb
> BINDVERB_CUSTOM
86 ? "unknown" : BINDVERB_str
[bi
->dwBindVerb
],
87 debugstr_w(bi
->szCustomVerb
),
88 bi
->cbstgmedData
, bi
->dwOptions
, bi
->dwOptionsFlags
, bi
->dwCodePage
,
89 bi
->securityAttributes
.nLength
,
90 bi
->securityAttributes
.lpSecurityDescriptor
,
91 bi
->securityAttributes
.bInheritHandle
,
92 debugstr_guid(&bi
->iid
),
93 bi
->pUnk
, bi
->dwReserved
97 static void set_status_text(BindStatusCallback
*This
, ULONG statuscode
, LPCWSTR str
)
100 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
101 WCHAR fmt
[IDS_STATUSFMT_MAXLEN
];
102 WCHAR buffer
[IDS_STATUSFMT_MAXLEN
+ INTERNET_MAX_URL_LENGTH
];
107 TRACE("(%p, %d, %s)\n", This
, statuscode
, debugstr_w(str
));
109 if (statuscode
&& str
&& *str
) {
111 /* the format string must have one "%s" for the str */
112 LoadStringW(ieframe_instance
, IDS_STATUSFMT_FIRST
+ statuscode
, fmt
, IDS_STATUSFMT_MAXLEN
);
113 snprintfW(buffer
, sizeof(buffer
)/sizeof(WCHAR
), fmt
, str
);
116 V_VT(&arg
) = VT_BSTR
;
117 V_BSTR(&arg
) = str
? SysAllocString(buffer
) : NULL
;
118 TRACE("=> %s\n", debugstr_w(V_BSTR(&arg
)));
120 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_STATUSTEXTCHANGE
, &dispparams
);
122 if(This
->doc_host
->frame
)
123 IOleInPlaceFrame_SetStatusText(This
->doc_host
->frame
, buffer
);
129 HRESULT
set_dochost_url(DocHost
*This
, const WCHAR
*url
)
134 new_url
= heap_strdupW(url
);
136 return E_OUTOFMEMORY
;
141 heap_free(This
->url
);
144 This
->container_vtbl
->SetURL(This
, This
->url
);
148 static inline BindStatusCallback
*impl_from_IBindStatusCallback(IBindStatusCallback
*iface
)
150 return CONTAINING_RECORD(iface
, BindStatusCallback
, IBindStatusCallback_iface
);
153 static HRESULT WINAPI
BindStatusCallback_QueryInterface(IBindStatusCallback
*iface
,
154 REFIID riid
, void **ppv
)
156 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
158 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
159 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
160 *ppv
= &This
->IBindStatusCallback_iface
;
161 }else if(IsEqualGUID(&IID_IBindStatusCallback
, riid
)) {
162 TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This
, ppv
);
163 *ppv
= &This
->IBindStatusCallback_iface
;
164 }else if(IsEqualGUID(&IID_IHttpNegotiate
, riid
)) {
165 TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This
, ppv
);
166 *ppv
= &This
->IHttpNegotiate_iface
;
169 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
170 return E_NOINTERFACE
;
173 IUnknown_AddRef((IUnknown
*)*ppv
);
177 static ULONG WINAPI
BindStatusCallback_AddRef(IBindStatusCallback
*iface
)
179 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
180 LONG ref
= InterlockedIncrement(&This
->ref
);
182 TRACE("(%p) ref=%d\n", This
, ref
);
187 static ULONG WINAPI
BindStatusCallback_Release(IBindStatusCallback
*iface
)
189 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
190 LONG ref
= InterlockedDecrement(&This
->ref
);
192 TRACE("(%p) ref=%d\n", This
, ref
);
196 IOleClientSite_Release(&This
->doc_host
->IOleClientSite_iface
);
198 IBinding_Release(This
->binding
);
200 GlobalFree(This
->post_data
);
201 SysFreeString(This
->headers
);
202 heap_free(This
->url
);
209 static HRESULT WINAPI
BindStatusCallback_OnStartBinding(IBindStatusCallback
*iface
,
210 DWORD dwReserved
, IBinding
*pbind
)
212 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
214 TRACE("(%p)->(%d %p)\n", This
, dwReserved
, pbind
);
216 This
->binding
= pbind
;
217 IBinding_AddRef(This
->binding
);
222 static HRESULT WINAPI
BindStatusCallback_GetPriority(IBindStatusCallback
*iface
,
225 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
226 FIXME("(%p)->(%p)\n", This
, pnPriority
);
230 static HRESULT WINAPI
BindStatusCallback_OnLowResource(IBindStatusCallback
*iface
,
233 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
234 FIXME("(%p)->(%d)\n", This
, reserved
);
238 static DWORD
get_http_status_code(IBinding
*binding
)
240 IWinInetHttpInfo
*http_info
;
241 DWORD status
, size
= sizeof(DWORD
);
244 hres
= IBinding_QueryInterface(binding
, &IID_IWinInetHttpInfo
, (void**)&http_info
);
246 return HTTP_STATUS_OK
;
248 hres
= IWinInetHttpInfo_QueryInfo(http_info
, HTTP_QUERY_STATUS_CODE
|HTTP_QUERY_FLAG_NUMBER
,
249 &status
, &size
, NULL
, NULL
);
250 IWinInetHttpInfo_Release(http_info
);
253 return HTTP_STATUS_OK
;
257 static HRESULT WINAPI
BindStatusCallback_OnProgress(IBindStatusCallback
*iface
,
258 ULONG ulProgress
, ULONG ulProgressMax
, ULONG ulStatusCode
, LPCWSTR szStatusText
)
260 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
263 TRACE("(%p)->(%d %d %d %s)\n", This
, ulProgress
, ulProgressMax
, ulStatusCode
,
264 debugstr_w(szStatusText
));
266 switch(ulStatusCode
) {
267 case BINDSTATUS_REDIRECTING
:
268 return set_dochost_url(This
->doc_host
, szStatusText
);
269 case BINDSTATUS_BEGINDOWNLOADDATA
:
270 set_status_text(This
, ulStatusCode
, szStatusText
);
271 status_code
= get_http_status_code(This
->binding
);
272 if(status_code
!= HTTP_STATUS_OK
)
273 handle_navigation_error(This
->doc_host
, status_code
, This
->url
, NULL
);
276 case BINDSTATUS_FINDINGRESOURCE
:
277 case BINDSTATUS_ENDDOWNLOADDATA
:
278 case BINDSTATUS_SENDINGREQUEST
:
279 set_status_text(This
, ulStatusCode
, szStatusText
);
282 case BINDSTATUS_CONNECTING
:
283 case BINDSTATUS_CACHEFILENAMEAVAILABLE
:
284 case BINDSTATUS_CLASSIDAVAILABLE
:
285 case BINDSTATUS_MIMETYPEAVAILABLE
:
286 case BINDSTATUS_BEGINSYNCOPERATION
:
287 case BINDSTATUS_ENDSYNCOPERATION
:
290 FIXME("status code %u\n", ulStatusCode
);
296 void handle_navigation_error(DocHost
* doc_host
, HRESULT hres
, BSTR url
, IHTMLWindow2
*win2
)
298 VARIANT var_status_code
, var_frame_name
, var_url
;
299 DISPPARAMS dispparams
;
300 VARIANTARG params
[5];
301 VARIANT_BOOL cancel
= VARIANT_FALSE
;
303 dispparams
.cArgs
= 5;
304 dispparams
.cNamedArgs
= 0;
305 dispparams
.rgdispidNamedArgs
= NULL
;
306 dispparams
.rgvarg
= params
;
308 V_VT(params
) = VT_BOOL
|VT_BYREF
;
309 V_BOOLREF(params
) = &cancel
;
311 V_VT(params
+1) = VT_VARIANT
|VT_BYREF
;
312 V_VARIANTREF(params
+1) = &var_status_code
;
313 V_VT(&var_status_code
) = VT_I4
;
314 V_I4(&var_status_code
) = hres
;
316 V_VT(params
+2) = VT_VARIANT
|VT_BYREF
;
317 V_VARIANTREF(params
+2) = &var_frame_name
;
318 V_VT(&var_frame_name
) = VT_BSTR
;
320 hres
= IHTMLWindow2_get_name(win2
, &V_BSTR(&var_frame_name
));
322 V_BSTR(&var_frame_name
) = NULL
;
324 V_BSTR(&var_frame_name
) = NULL
;
326 V_VT(params
+3) = VT_VARIANT
|VT_BYREF
;
327 V_VARIANTREF(params
+3) = &var_url
;
328 V_VT(&var_url
) = VT_BSTR
;
329 V_BSTR(&var_url
) = url
;
331 V_VT(params
+4) = VT_DISPATCH
;
332 V_DISPATCH(params
+4) = (IDispatch
*)doc_host
->wb
;
334 call_sink(doc_host
->cps
.wbe2
, DISPID_NAVIGATEERROR
, &dispparams
);
335 SysFreeString(V_BSTR(&var_frame_name
));
338 FIXME("Navigate to error page\n");
341 static HRESULT WINAPI
BindStatusCallback_OnStopBinding(IBindStatusCallback
*iface
,
342 HRESULT hresult
, LPCWSTR szError
)
344 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
346 TRACE("(%p)->(%08x %s)\n", This
, hresult
, debugstr_w(szError
));
348 set_status_text(This
, 0, emptyW
);
354 handle_navigation_error(This
->doc_host
, hresult
, This
->url
, NULL
);
356 IOleClientSite_Release(&This
->doc_host
->IOleClientSite_iface
);
357 This
->doc_host
= NULL
;
359 IBinding_Release(This
->binding
);
360 This
->binding
= NULL
;
365 static HRESULT WINAPI
BindStatusCallback_GetBindInfo(IBindStatusCallback
*iface
,
366 DWORD
*grfBINDF
, BINDINFO
*pbindinfo
)
368 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
370 TRACE("(%p)->(%p %p)\n", This
, grfBINDF
, pbindinfo
);
372 *grfBINDF
= BINDF_ASYNCHRONOUS
;
374 if(This
->post_data
) {
375 pbindinfo
->dwBindVerb
= BINDVERB_POST
;
377 pbindinfo
->stgmedData
.tymed
= TYMED_HGLOBAL
;
378 pbindinfo
->stgmedData
.u
.hGlobal
= This
->post_data
;
379 pbindinfo
->cbstgmedData
= This
->post_data_len
;
380 pbindinfo
->stgmedData
.pUnkForRelease
= (IUnknown
*)&This
->IBindStatusCallback_iface
;
381 IBindStatusCallback_AddRef(&This
->IBindStatusCallback_iface
);
387 static HRESULT WINAPI
BindStatusCallback_OnDataAvailable(IBindStatusCallback
*iface
,
388 DWORD grfBSCF
, DWORD dwSize
, FORMATETC
*pformatetc
, STGMEDIUM
*pstgmed
)
390 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
391 FIXME("(%p)->(%08x %d %p %p)\n", This
, grfBSCF
, dwSize
, pformatetc
, pstgmed
);
395 static HRESULT WINAPI
BindStatusCallback_OnObjectAvailable(IBindStatusCallback
*iface
,
396 REFIID riid
, IUnknown
*punk
)
398 BindStatusCallback
*This
= impl_from_IBindStatusCallback(iface
);
400 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), punk
);
402 return dochost_object_available(This
->doc_host
, punk
);
405 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
= {
406 BindStatusCallback_QueryInterface
,
407 BindStatusCallback_AddRef
,
408 BindStatusCallback_Release
,
409 BindStatusCallback_OnStartBinding
,
410 BindStatusCallback_GetPriority
,
411 BindStatusCallback_OnLowResource
,
412 BindStatusCallback_OnProgress
,
413 BindStatusCallback_OnStopBinding
,
414 BindStatusCallback_GetBindInfo
,
415 BindStatusCallback_OnDataAvailable
,
416 BindStatusCallback_OnObjectAvailable
419 static inline BindStatusCallback
*impl_from_IHttpNegotiate(IHttpNegotiate
*iface
)
421 return CONTAINING_RECORD(iface
, BindStatusCallback
, IHttpNegotiate_iface
);
424 static HRESULT WINAPI
HttpNegotiate_QueryInterface(IHttpNegotiate
*iface
,
425 REFIID riid
, void **ppv
)
427 BindStatusCallback
*This
= impl_from_IHttpNegotiate(iface
);
428 return IBindStatusCallback_QueryInterface(&This
->IBindStatusCallback_iface
, riid
, ppv
);
431 static ULONG WINAPI
HttpNegotiate_AddRef(IHttpNegotiate
*iface
)
433 BindStatusCallback
*This
= impl_from_IHttpNegotiate(iface
);
434 return IBindStatusCallback_AddRef(&This
->IBindStatusCallback_iface
);
437 static ULONG WINAPI
HttpNegotiate_Release(IHttpNegotiate
*iface
)
439 BindStatusCallback
*This
= impl_from_IHttpNegotiate(iface
);
440 return IBindStatusCallback_Release(&This
->IBindStatusCallback_iface
);
443 static HRESULT WINAPI
HttpNegotiate_BeginningTransaction(IHttpNegotiate
*iface
,
444 LPCWSTR szURL
, LPCWSTR szHeaders
, DWORD dwReserved
, LPWSTR
*pszAdditionalHeaders
)
446 BindStatusCallback
*This
= impl_from_IHttpNegotiate(iface
);
448 TRACE("(%p)->(%s %s %d %p)\n", This
, debugstr_w(szURL
), debugstr_w(szHeaders
),
449 dwReserved
, pszAdditionalHeaders
);
452 int size
= (strlenW(This
->headers
)+1)*sizeof(WCHAR
);
453 *pszAdditionalHeaders
= CoTaskMemAlloc(size
);
454 memcpy(*pszAdditionalHeaders
, This
->headers
, size
);
460 static HRESULT WINAPI
HttpNegotiate_OnResponse(IHttpNegotiate
*iface
,
461 DWORD dwResponseCode
, LPCWSTR szResponseHeaders
, LPCWSTR szRequestHeaders
,
462 LPWSTR
*pszAdditionalRequestHeaders
)
464 BindStatusCallback
*This
= impl_from_IHttpNegotiate(iface
);
465 TRACE("(%p)->(%d %s %s %p)\n", This
, dwResponseCode
, debugstr_w(szResponseHeaders
),
466 debugstr_w(szRequestHeaders
), pszAdditionalRequestHeaders
);
470 static const IHttpNegotiateVtbl HttpNegotiateVtbl
= {
471 HttpNegotiate_QueryInterface
,
472 HttpNegotiate_AddRef
,
473 HttpNegotiate_Release
,
474 HttpNegotiate_BeginningTransaction
,
475 HttpNegotiate_OnResponse
478 static BindStatusCallback
*create_callback(DocHost
*doc_host
, LPCWSTR url
, PBYTE post_data
,
479 ULONG post_data_len
, LPCWSTR headers
)
481 BindStatusCallback
*ret
= heap_alloc(sizeof(BindStatusCallback
));
483 ret
->IBindStatusCallback_iface
.lpVtbl
= &BindStatusCallbackVtbl
;
484 ret
->IHttpNegotiate_iface
.lpVtbl
= &HttpNegotiateVtbl
;
487 ret
->url
= heap_strdupW(url
);
488 ret
->post_data
= NULL
;
489 ret
->post_data_len
= post_data_len
;
490 ret
->headers
= headers
? SysAllocString(headers
) : NULL
;
492 ret
->doc_host
= doc_host
;
493 IOleClientSite_AddRef(&doc_host
->IOleClientSite_iface
);
498 ret
->post_data
= GlobalAlloc(0, post_data_len
);
499 memcpy(ret
->post_data
, post_data
, post_data_len
);
505 static void on_before_navigate2(DocHost
*This
, LPCWSTR url
, SAFEARRAY
*post_data
, LPWSTR headers
, VARIANT_BOOL
*cancel
)
507 VARIANT var_url
, var_flags
, var_frame_name
, var_post_data
, var_post_data2
, var_headers
;
508 DISPPARAMS dispparams
;
509 VARIANTARG params
[7];
511 dispparams
.cArgs
= 7;
512 dispparams
.cNamedArgs
= 0;
513 dispparams
.rgdispidNamedArgs
= NULL
;
514 dispparams
.rgvarg
= params
;
516 This
->busy
= VARIANT_TRUE
;
518 V_VT(params
) = VT_BOOL
|VT_BYREF
;
519 V_BOOLREF(params
) = cancel
;
521 V_VT(params
+1) = (VT_BYREF
|VT_VARIANT
);
522 V_VARIANTREF(params
+1) = &var_headers
;
523 V_VT(&var_headers
) = VT_BSTR
;
524 V_BSTR(&var_headers
) = headers
;
526 V_VT(params
+2) = (VT_BYREF
|VT_VARIANT
);
527 V_VARIANTREF(params
+2) = &var_post_data2
;
528 V_VT(&var_post_data2
) = (VT_BYREF
|VT_VARIANT
);
529 V_VARIANTREF(&var_post_data2
) = &var_post_data
;
532 V_VT(&var_post_data
) = VT_UI1
|VT_ARRAY
;
533 V_ARRAY(&var_post_data
) = post_data
;
535 V_VT(&var_post_data
) = VT_EMPTY
;
538 V_VT(params
+3) = (VT_BYREF
|VT_VARIANT
);
539 V_VARIANTREF(params
+3) = &var_frame_name
;
540 V_VT(&var_frame_name
) = VT_BSTR
;
541 V_BSTR(&var_frame_name
) = NULL
;
543 V_VT(params
+4) = (VT_BYREF
|VT_VARIANT
);
544 V_VARIANTREF(params
+4) = &var_flags
;
545 V_VT(&var_flags
) = VT_I4
;
546 V_I4(&var_flags
) = 0;
548 V_VT(params
+5) = (VT_BYREF
|VT_VARIANT
);
549 V_VARIANTREF(params
+5) = &var_url
;
550 V_VT(&var_url
) = VT_BSTR
;
551 V_BSTR(&var_url
) = SysAllocString(url
);
553 V_VT(params
+6) = (VT_DISPATCH
);
554 V_DISPATCH(params
+6) = (IDispatch
*)This
->wb
;
556 call_sink(This
->cps
.wbe2
, DISPID_BEFORENAVIGATE2
, &dispparams
);
558 SysFreeString(V_BSTR(&var_url
));
561 /* FIXME: urlmon should handle it */
562 static BOOL
try_application_url(LPCWSTR url
)
564 SHELLEXECUTEINFOW exec_info
;
570 static const WCHAR wszURLProtocol
[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
572 hres
= CoInternetParseUrl(url
, PARSE_SCHEMA
, 0, app
, sizeof(app
)/sizeof(WCHAR
), NULL
, 0);
576 res
= RegOpenKeyW(HKEY_CLASSES_ROOT
, app
, &hkey
);
577 if(res
!= ERROR_SUCCESS
)
580 res
= RegQueryValueExW(hkey
, wszURLProtocol
, NULL
, &type
, NULL
, NULL
);
582 if(res
!= ERROR_SUCCESS
|| type
!= REG_SZ
)
585 TRACE("opening application %s\n", debugstr_w(app
));
587 memset(&exec_info
, 0, sizeof(exec_info
));
588 exec_info
.cbSize
= sizeof(exec_info
);
589 exec_info
.lpFile
= url
;
590 exec_info
.nShow
= SW_SHOW
;
592 return ShellExecuteExW(&exec_info
);
595 static HRESULT
create_moniker(LPCWSTR url
, IMoniker
**mon
)
597 WCHAR new_url
[INTERNET_MAX_URL_LENGTH
];
602 return CreateURLMoniker(NULL
, url
, mon
);
604 size
= sizeof(new_url
)/sizeof(WCHAR
);
605 hres
= UrlApplySchemeW(url
, new_url
, &size
, URL_APPLY_GUESSSCHEME
| URL_APPLY_GUESSFILE
);
606 TRACE("was %s got %s\n", debugstr_w(url
), debugstr_w(new_url
));
608 WARN("UrlApplyScheme failed: %08x\n", hres
);
612 return CreateURLMoniker(NULL
, new_url
, mon
);
615 static HRESULT
bind_to_object(DocHost
*This
, IMoniker
*mon
, LPCWSTR url
, IBindCtx
*bindctx
,
616 IBindStatusCallback
*callback
)
618 IUnknown
*unk
= NULL
;
623 IMoniker_AddRef(mon
);
625 hres
= create_moniker(url
, &mon
);
630 hres
= IMoniker_GetDisplayName(mon
, 0, NULL
, &display_name
);
632 FIXME("GetDisplayName failed: %08x\n", hres
);
636 hres
= set_dochost_url(This
, display_name
);
637 CoTaskMemFree(display_name
);
641 IBindCtx_RegisterObjectParam(bindctx
, (LPOLESTR
)SZ_HTML_CLIENTSITE_OBJECTPARAM
,
642 (IUnknown
*)&This
->IOleClientSite_iface
);
644 hres
= IMoniker_BindToObject(mon
, bindctx
, NULL
, &IID_IUnknown
, (void**)&unk
);
645 if(SUCCEEDED(hres
)) {
648 IUnknown_Release(unk
);
649 }else if(try_application_url(url
)) {
652 FIXME("BindToObject failed: %08x\n", hres
);
655 IMoniker_Release(mon
);
659 static void html_window_navigate(DocHost
*This
, IHTMLPrivateWindow
*window
, BSTR url
, BSTR headers
, SAFEARRAY
*post_data
)
661 VARIANT headers_var
, post_data_var
;
665 hres
= set_dochost_url(This
, url
);
669 empty_str
= SysAllocStringLen(NULL
, 0);
672 V_VT(&headers_var
) = VT_BSTR
;
673 V_BSTR(&headers_var
) = headers
;
675 V_VT(&headers_var
) = VT_EMPTY
;
679 V_VT(&post_data_var
) = VT_UI1
|VT_ARRAY
;
680 V_ARRAY(&post_data_var
) = post_data
;
682 V_VT(&post_data_var
) = VT_EMPTY
;
685 set_doc_state(This
, READYSTATE_LOADING
);
686 hres
= IHTMLPrivateWindow_SuperNavigate(window
, url
, empty_str
, NULL
, NULL
, &post_data_var
, &headers_var
, 0);
687 SysFreeString(empty_str
);
689 WARN("SuprtNavigate failed: %08x\n", hres
);
693 task_header_t header
;
696 SAFEARRAY
*post_data
;
698 } task_doc_navigate_t
;
700 static void doc_navigate_task_destr(task_header_t
*t
)
702 task_doc_navigate_t
*task
= (task_doc_navigate_t
*)t
;
704 SysFreeString(task
->url
);
705 SysFreeString(task
->headers
);
707 SafeArrayDestroy(task
->post_data
);
711 static void doc_navigate_proc(DocHost
*This
, task_header_t
*t
)
713 task_doc_navigate_t
*task
= (task_doc_navigate_t
*)t
;
714 IHTMLPrivateWindow
*priv_window
;
717 if(!This
->doc_navigate
) {
722 if(task
->async_notif
) {
723 VARIANT_BOOL cancel
= VARIANT_FALSE
;
724 on_before_navigate2(This
, task
->url
, task
->post_data
, task
->headers
, &cancel
);
726 TRACE("Navigation canceled\n");
731 hres
= IUnknown_QueryInterface(This
->doc_navigate
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
732 if(SUCCEEDED(hres
)) {
733 html_window_navigate(This
, priv_window
, task
->url
, task
->headers
, task
->post_data
);
734 IHTMLPrivateWindow_Release(priv_window
);
736 WARN("Could not get IHTMLPrivateWindow iface: %08x\n", hres
);
740 static HRESULT
async_doc_navigate(DocHost
*This
, LPCWSTR url
, LPCWSTR headers
, PBYTE post_data
, ULONG post_data_size
,
743 task_doc_navigate_t
*task
;
745 TRACE("%s\n", debugstr_w(url
));
747 task
= heap_alloc_zero(sizeof(*task
));
749 return E_OUTOFMEMORY
;
751 task
->url
= SysAllocString(url
);
753 doc_navigate_task_destr(&task
->header
);
754 return E_OUTOFMEMORY
;
758 task
->headers
= SysAllocString(headers
);
760 doc_navigate_task_destr(&task
->header
);
761 return E_OUTOFMEMORY
;
766 task
->post_data
= SafeArrayCreateVector(VT_UI1
, 0, post_data_size
);
767 if(!task
->post_data
) {
768 doc_navigate_task_destr(&task
->header
);
769 return E_OUTOFMEMORY
;
772 memcpy(task
->post_data
->pvData
, post_data
, post_data_size
);
776 VARIANT_BOOL cancel
= VARIANT_FALSE
;
778 on_before_navigate2(This
, task
->url
, task
->post_data
, task
->headers
, &cancel
);
780 TRACE("Navigation canceled\n");
781 doc_navigate_task_destr(&task
->header
);
786 task
->async_notif
= async_notif
;
787 abort_dochost_tasks(This
, doc_navigate_proc
);
788 push_dochost_task(This
, &task
->header
, doc_navigate_proc
, doc_navigate_task_destr
, FALSE
);
792 static HRESULT
navigate_bsc(DocHost
*This
, BindStatusCallback
*bsc
, IMoniker
*mon
)
794 VARIANT_BOOL cancel
= VARIANT_FALSE
;
795 SAFEARRAY
*post_data
= NULL
;
799 set_doc_state(This
, READYSTATE_LOADING
);
802 post_data
= SafeArrayCreateVector(VT_UI1
, 0, bsc
->post_data_len
);
803 memcpy(post_data
->pvData
, post_data
, bsc
->post_data_len
);
806 on_before_navigate2(This
, bsc
->url
, post_data
, bsc
->headers
, &cancel
);
808 SafeArrayDestroy(post_data
);
810 FIXME("Navigation canceled\n");
815 deactivate_document(This
);
817 CreateAsyncBindCtx(0, &bsc
->IBindStatusCallback_iface
, 0, &bindctx
);
820 IOleInPlaceFrame_EnableModeless(This
->frame
, FALSE
);
822 hres
= bind_to_object(This
, mon
, bsc
->url
, bindctx
, &bsc
->IBindStatusCallback_iface
);
825 IOleInPlaceFrame_EnableModeless(This
->frame
, TRUE
);
827 IBindCtx_Release(bindctx
);
833 task_header_t header
;
834 BindStatusCallback
*bsc
;
835 } task_navigate_bsc_t
;
837 static void navigate_bsc_task_destr(task_header_t
*t
)
839 task_navigate_bsc_t
*task
= (task_navigate_bsc_t
*)t
;
841 IBindStatusCallback_Release(&task
->bsc
->IBindStatusCallback_iface
);
845 static void navigate_bsc_proc(DocHost
*This
, task_header_t
*t
)
847 task_navigate_bsc_t
*task
= (task_navigate_bsc_t
*)t
;
850 create_doc_view_hwnd(This
);
852 navigate_bsc(This
, task
->bsc
, NULL
);
856 HRESULT
navigate_url(DocHost
*This
, LPCWSTR url
, const VARIANT
*Flags
,
857 const VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
859 PBYTE post_data
= NULL
;
860 ULONG post_data_len
= 0;
861 LPWSTR headers
= NULL
;
864 TRACE("navigating to %s\n", debugstr_w(url
));
866 if((Flags
&& V_VT(Flags
) != VT_EMPTY
)
867 || (TargetFrameName
&& V_VT(TargetFrameName
) != VT_EMPTY
))
868 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
869 Flags
, Flags
? V_VT(Flags
) : -1, TargetFrameName
,
870 TargetFrameName
? V_VT(TargetFrameName
) : -1);
872 if(PostData
&& V_VT(PostData
) == (VT_ARRAY
| VT_UI1
) && V_ARRAY(PostData
)) {
873 SafeArrayAccessData(V_ARRAY(PostData
), (void**)&post_data
);
874 post_data_len
= V_ARRAY(PostData
)->rgsabound
[0].cElements
;
877 if(Headers
&& V_VT(Headers
) == VT_BSTR
) {
878 headers
= V_BSTR(Headers
);
879 TRACE("Headers: %s\n", debugstr_w(headers
));
882 set_doc_state(This
, READYSTATE_LOADING
);
883 This
->ready_state
= READYSTATE_LOADING
;
885 if(This
->doc_navigate
) {
886 WCHAR new_url
[INTERNET_MAX_URL_LENGTH
];
888 if(PathIsURLW(url
)) {
893 size
= sizeof(new_url
)/sizeof(WCHAR
);
894 hres
= UrlApplySchemeW(url
, new_url
, &size
,
895 URL_APPLY_GUESSSCHEME
| URL_APPLY_GUESSFILE
| URL_APPLY_DEFAULT
);
897 WARN("UrlApplyScheme failed: %08x\n", hres
);
902 hres
= async_doc_navigate(This
, *new_url
? new_url
: url
, headers
, post_data
,
903 post_data_len
, TRUE
);
905 task_navigate_bsc_t
*task
;
907 task
= heap_alloc(sizeof(*task
));
908 task
->bsc
= create_callback(This
, url
, post_data
, post_data_len
, headers
);
909 push_dochost_task(This
, &task
->header
, navigate_bsc_proc
, navigate_bsc_task_destr
, This
->url
== NULL
);
913 SafeArrayUnaccessData(V_ARRAY(PostData
));
918 static HRESULT
navigate_hlink(DocHost
*This
, IMoniker
*mon
, IBindCtx
*bindctx
,
919 IBindStatusCallback
*callback
)
921 IHttpNegotiate
*http_negotiate
;
922 BindStatusCallback
*bsc
;
923 PBYTE post_data
= NULL
;
924 ULONG post_data_len
= 0;
925 LPWSTR headers
= NULL
, url
;
932 hres
= IMoniker_GetDisplayName(mon
, 0, NULL
, &url
);
934 FIXME("GetDisplayName failed: %08x\n", hres
);
936 hres
= IBindStatusCallback_QueryInterface(callback
, &IID_IHttpNegotiate
,
937 (void**)&http_negotiate
);
938 if(SUCCEEDED(hres
)) {
939 static const WCHAR null_string
[] = {0};
941 IHttpNegotiate_BeginningTransaction(http_negotiate
, null_string
, null_string
, 0,
943 IHttpNegotiate_Release(http_negotiate
);
946 memset(&bindinfo
, 0, sizeof(bindinfo
));
947 bindinfo
.cbSize
= sizeof(bindinfo
);
949 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
950 dump_BINDINFO(&bindinfo
);
951 if(bindinfo
.dwBindVerb
== BINDVERB_POST
) {
952 post_data_len
= bindinfo
.cbstgmedData
;
954 post_data
= bindinfo
.stgmedData
.u
.hGlobal
;
957 if(This
->doc_navigate
) {
958 hres
= async_doc_navigate(This
, url
, headers
, post_data
, post_data_len
, FALSE
);
960 bsc
= create_callback(This
, url
, post_data
, post_data_len
, headers
);
961 hres
= navigate_bsc(This
, bsc
, mon
);
962 IBindStatusCallback_Release(&bsc
->IBindStatusCallback_iface
);
966 CoTaskMemFree(headers
);
967 ReleaseBindInfo(&bindinfo
);
972 HRESULT
go_home(DocHost
*This
)
975 DWORD res
, type
, size
;
976 WCHAR wszPageName
[MAX_PATH
];
977 static const WCHAR wszAboutBlank
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
978 static const WCHAR wszStartPage
[] = {'S','t','a','r','t',' ','P','a','g','e',0};
979 static const WCHAR wszSubKey
[] = {'S','o','f','t','w','a','r','e','\\',
980 'M','i','c','r','o','s','o','f','t','\\',
981 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
984 res
= RegOpenKeyW(HKEY_CURRENT_USER
, wszSubKey
, &hkey
);
985 if (res
!= ERROR_SUCCESS
)
986 return navigate_url(This
, wszAboutBlank
, NULL
, NULL
, NULL
, NULL
);
988 size
= sizeof(wszPageName
);
989 res
= RegQueryValueExW(hkey
, wszStartPage
, NULL
, &type
, (LPBYTE
)wszPageName
, &size
);
991 if (res
!= ERROR_SUCCESS
|| type
!= REG_SZ
)
992 return navigate_url(This
, wszAboutBlank
, NULL
, NULL
, NULL
, NULL
);
994 return navigate_url(This
, wszPageName
, NULL
, NULL
, NULL
, NULL
);
997 HRESULT
go_back(DocHost
*This
)
1002 if(!This
->travellog_position
) {
1003 WARN("No history available\n");
1007 url
= This
->travellog
[--This
->travellog_position
].url
;
1009 if(This
->doc_navigate
) {
1010 hres
= async_doc_navigate(This
, url
, NULL
, NULL
, 0, FALSE
);
1012 FIXME("unsupported doc_navigate FALSE\n");
1020 HRESULT
get_location_url(DocHost
*This
, BSTR
*ret
)
1022 FIXME("semi-stub\n");
1024 *ret
= This
->url
? SysAllocString(This
->url
) : SysAllocStringLen(NULL
, 0);
1026 return E_OUTOFMEMORY
;
1028 return This
->url
? S_OK
: S_FALSE
;
1031 static inline HlinkFrame
*impl_from_IHlinkFrame(IHlinkFrame
*iface
)
1033 return CONTAINING_RECORD(iface
, HlinkFrame
, IHlinkFrame_iface
);
1036 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
1038 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1039 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1042 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
1044 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1045 return IUnknown_AddRef(This
->outer
);
1048 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
1050 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1051 return IUnknown_Release(This
->outer
);
1054 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
1055 IHlinkBrowseContext
*pihlbc
)
1057 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1058 FIXME("(%p)->(%p)\n", This
, pihlbc
);
1062 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
1063 IHlinkBrowseContext
**ppihlbc
)
1065 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1066 FIXME("(%p)->(%p)\n", This
, ppihlbc
);
1070 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
1071 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
1073 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1075 LPWSTR location
= NULL
;
1077 TRACE("(%p)->(%08x %p %p %p)\n", This
, grfHLNF
, pbc
, pibsc
, pihlNavigate
);
1080 FIXME("unsupported grfHLNF=%08x\n", grfHLNF
);
1082 /* Windows calls GetTargetFrameName here. */
1084 IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
1087 FIXME("location = %s\n", debugstr_w(location
));
1088 CoTaskMemFree(location
);
1091 /* Windows calls GetHlinkSite here */
1093 if(grfHLNF
& HLNF_OPENINNEWWINDOW
) {
1094 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
1098 return navigate_hlink(This
->doc_host
, mon
, pbc
, pibsc
);
1101 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
1102 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
1104 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1105 FIXME("(%p)->(%08x %p %s %s %d)\n", This
, grfHLNF
, pimkTarget
, debugstr_w(pwzLocation
),
1106 debugstr_w(pwzFriendlyName
), dwreserved
);
1110 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
1111 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
1113 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1114 FIXME("(%p)->(%u %p %s %s)\n", This
, uHLID
, pimkTarget
, debugstr_w(pwzLocation
),
1115 debugstr_w(pwzFriendlyName
));
1119 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
1120 HlinkFrame_QueryInterface
,
1123 HlinkFrame_SetBrowseContext
,
1124 HlinkFrame_GetBrowseContext
,
1125 HlinkFrame_Navigate
,
1126 HlinkFrame_OnNavigate
,
1127 HlinkFrame_UpdateHlink
1130 static inline HlinkFrame
*impl_from_ITargetFrame2(ITargetFrame2
*iface
)
1132 return CONTAINING_RECORD(iface
, HlinkFrame
, IHlinkFrame_iface
);
1135 static HRESULT WINAPI
TargetFrame2_QueryInterface(ITargetFrame2
*iface
, REFIID riid
, void **ppv
)
1137 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1138 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1141 static ULONG WINAPI
TargetFrame2_AddRef(ITargetFrame2
*iface
)
1143 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1144 return IUnknown_AddRef(This
->outer
);
1147 static ULONG WINAPI
TargetFrame2_Release(ITargetFrame2
*iface
)
1149 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1150 return IUnknown_Release(This
->outer
);
1153 static HRESULT WINAPI
TargetFrame2_SetFrameName(ITargetFrame2
*iface
, LPCWSTR pszFrameName
)
1155 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1156 FIXME("(%p)->(%s)\n", This
, debugstr_w(pszFrameName
));
1160 static HRESULT WINAPI
TargetFrame2_GetFrameName(ITargetFrame2
*iface
, LPWSTR
*ppszFrameName
)
1162 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1163 FIXME("(%p)->(%p)\n", This
, ppszFrameName
);
1167 static HRESULT WINAPI
TargetFrame2_GetParentFrame(ITargetFrame2
*iface
, IUnknown
**ppunkParent
)
1169 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1170 FIXME("(%p)->(%p)\n", This
, ppunkParent
);
1174 static HRESULT WINAPI
TargetFrame2_SetFrameSrc(ITargetFrame2
*iface
, LPCWSTR pszFrameSrc
)
1176 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1177 FIXME("(%p)->(%s)\n", This
, debugstr_w(pszFrameSrc
));
1181 static HRESULT WINAPI
TargetFrame2_GetFrameSrc(ITargetFrame2
*iface
, LPWSTR
*ppszFrameSrc
)
1183 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1184 FIXME("(%p)->()\n", This
);
1188 static HRESULT WINAPI
TargetFrame2_GetFramesContainer(ITargetFrame2
*iface
, IOleContainer
**ppContainer
)
1190 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1191 FIXME("(%p)->(%p)\n", This
, ppContainer
);
1195 static HRESULT WINAPI
TargetFrame2_SetFrameOptions(ITargetFrame2
*iface
, DWORD dwFlags
)
1197 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1198 FIXME("(%p)->(%x)\n", This
, dwFlags
);
1202 static HRESULT WINAPI
TargetFrame2_GetFrameOptions(ITargetFrame2
*iface
, DWORD
*pdwFlags
)
1204 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1205 FIXME("(%p)->(%p)\n", This
, pdwFlags
);
1209 static HRESULT WINAPI
TargetFrame2_SetFrameMargins(ITargetFrame2
*iface
, DWORD dwWidth
, DWORD dwHeight
)
1211 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1212 FIXME("(%p)->(%d %d)\n", This
, dwWidth
, dwHeight
);
1216 static HRESULT WINAPI
TargetFrame2_GetFrameMargins(ITargetFrame2
*iface
, DWORD
*pdwWidth
, DWORD
*pdwHeight
)
1218 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1219 FIXME("(%p)->(%p %p)\n", This
, pdwWidth
, pdwHeight
);
1223 static HRESULT WINAPI
TargetFrame2_FindFrame(ITargetFrame2
*iface
, LPCWSTR pszTargetName
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1225 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1226 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(pszTargetName
), dwFlags
, ppunkTargetFrame
);
1230 static HRESULT WINAPI
TargetFrame2_GetTargetAlias(ITargetFrame2
*iface
, LPCWSTR pszTargetName
, LPWSTR
*ppszTargetAlias
)
1232 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1233 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(pszTargetName
), ppszTargetAlias
);
1237 static const ITargetFrame2Vtbl TargetFrame2Vtbl
= {
1238 TargetFrame2_QueryInterface
,
1239 TargetFrame2_AddRef
,
1240 TargetFrame2_Release
,
1241 TargetFrame2_SetFrameName
,
1242 TargetFrame2_GetFrameName
,
1243 TargetFrame2_GetParentFrame
,
1244 TargetFrame2_SetFrameSrc
,
1245 TargetFrame2_GetFrameSrc
,
1246 TargetFrame2_GetFramesContainer
,
1247 TargetFrame2_SetFrameOptions
,
1248 TargetFrame2_GetFrameOptions
,
1249 TargetFrame2_SetFrameMargins
,
1250 TargetFrame2_GetFrameMargins
,
1251 TargetFrame2_FindFrame
,
1252 TargetFrame2_GetTargetAlias
1255 static inline HlinkFrame
*impl_from_ITargetFramePriv2(ITargetFramePriv2
*iface
)
1257 return CONTAINING_RECORD(iface
, HlinkFrame
, ITargetFramePriv2_iface
);
1260 static HRESULT WINAPI
TargetFramePriv2_QueryInterface(ITargetFramePriv2
*iface
, REFIID riid
, void **ppv
)
1262 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1263 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1266 static ULONG WINAPI
TargetFramePriv2_AddRef(ITargetFramePriv2
*iface
)
1268 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1269 return IUnknown_AddRef(This
->outer
);
1272 static ULONG WINAPI
TargetFramePriv2_Release(ITargetFramePriv2
*iface
)
1274 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1275 return IUnknown_Release(This
->outer
);
1278 static HRESULT WINAPI
TargetFramePriv2_FindFrameDownwards(ITargetFramePriv2
*iface
,
1279 LPCWSTR pszTargetName
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1281 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1282 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(pszTargetName
), dwFlags
, ppunkTargetFrame
);
1286 static HRESULT WINAPI
TargetFramePriv2_FindFrameInContext(ITargetFramePriv2
*iface
,
1287 LPCWSTR pszTargetName
, IUnknown
*punkContextFrame
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1289 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1290 FIXME("(%p)->(%s %p %x %p)\n", This
, debugstr_w(pszTargetName
), punkContextFrame
, dwFlags
, ppunkTargetFrame
);
1294 static HRESULT WINAPI
TargetFramePriv2_OnChildFrameActivate(ITargetFramePriv2
*iface
, IUnknown
*pUnkChildFrame
)
1296 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1297 FIXME("(%p)->(%p)\n", This
, pUnkChildFrame
);
1301 static HRESULT WINAPI
TargetFramePriv2_OnChildFrameDeactivate(ITargetFramePriv2
*iface
, IUnknown
*pUnkChildFrame
)
1303 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1304 FIXME("(%p)->(%p)\n", This
, pUnkChildFrame
);
1308 static HRESULT WINAPI
TargetFramePriv2_NavigateHack(ITargetFramePriv2
*iface
, DWORD grfHLNF
, LPBC pbc
,
1309 IBindStatusCallback
*pibsc
, LPCWSTR pszTargetName
, LPCWSTR pszUrl
, LPCWSTR pszLocation
)
1311 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1312 FIXME("(%p)->(%x %p %p %s %s %s)\n", This
, grfHLNF
, pbc
, pibsc
, debugstr_w(pszTargetName
),
1313 debugstr_w(pszUrl
), debugstr_w(pszLocation
));
1317 static HRESULT WINAPI
TargetFramePriv2_FindBrowserByIndex(ITargetFramePriv2
*iface
, DWORD dwID
, IUnknown
**ppunkBrowser
)
1319 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1320 FIXME("(%p)->(%d %p)\n", This
, dwID
, ppunkBrowser
);
1324 static HRESULT WINAPI
TargetFramePriv2_AggregatedNavigation2(ITargetFramePriv2
*iface
, DWORD grfHLNF
, LPBC pbc
,
1325 IBindStatusCallback
*pibsc
, LPCWSTR pszTargetName
, IUri
*pUri
, LPCWSTR pszLocation
)
1327 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1331 TRACE("(%p)->(%x %p %p %s %p %s)\n", This
, grfHLNF
, pbc
, pibsc
, debugstr_w(pszTargetName
),
1332 pUri
, debugstr_w(pszLocation
));
1335 * NOTE: This is an undocumented function. It seems to be working the way it's implemented,
1336 * but I couldn't get its tests working. It's used by mshtml to load content in a new
1337 * instance of browser.
1340 hres
= CreateURLMonikerEx2(NULL
, pUri
, &mon
, 0);
1344 hres
= navigate_hlink(This
->doc_host
, mon
, pbc
, pibsc
);
1345 IMoniker_Release(mon
);
1349 static const ITargetFramePriv2Vtbl TargetFramePriv2Vtbl
= {
1350 TargetFramePriv2_QueryInterface
,
1351 TargetFramePriv2_AddRef
,
1352 TargetFramePriv2_Release
,
1353 TargetFramePriv2_FindFrameDownwards
,
1354 TargetFramePriv2_FindFrameInContext
,
1355 TargetFramePriv2_OnChildFrameActivate
,
1356 TargetFramePriv2_OnChildFrameDeactivate
,
1357 TargetFramePriv2_NavigateHack
,
1358 TargetFramePriv2_FindBrowserByIndex
,
1359 TargetFramePriv2_AggregatedNavigation2
1362 BOOL
HlinkFrame_QI(HlinkFrame
*This
, REFIID riid
, void **ppv
)
1364 if(IsEqualGUID(&IID_IHlinkFrame
, riid
)) {
1365 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This
, ppv
);
1366 *ppv
= &This
->IHlinkFrame_iface
;
1367 }else if(IsEqualGUID(&IID_ITargetFrame2
, riid
)) {
1368 TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This
, ppv
);
1369 *ppv
= &This
->ITargetFrame2_iface
;
1370 }else if(IsEqualGUID(&IID_ITargetFramePriv
, riid
)) {
1371 TRACE("(%p)->(IID_ITargetFramePriv %p)\n", This
, ppv
);
1372 *ppv
= &This
->ITargetFramePriv2_iface
;
1373 }else if(IsEqualGUID(&IID_ITargetFramePriv2
, riid
)) {
1374 TRACE("(%p)->(IID_ITargetFramePriv2 %p)\n", This
, ppv
);
1375 *ppv
= &This
->ITargetFramePriv2_iface
;
1380 IUnknown_AddRef((IUnknown
*)*ppv
);
1384 void HlinkFrame_Init(HlinkFrame
*This
, IUnknown
*outer
, DocHost
*doc_host
)
1386 This
->IHlinkFrame_iface
.lpVtbl
= &HlinkFrameVtbl
;
1387 This
->ITargetFrame2_iface
.lpVtbl
= &TargetFrame2Vtbl
;
1388 This
->ITargetFramePriv2_iface
.lpVtbl
= &TargetFramePriv2Vtbl
;
1390 This
->outer
= outer
;
1391 This
->doc_host
= doc_host
;