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];
570 dispparams
.cArgs
= 7;
571 dispparams
.cNamedArgs
= 0;
572 dispparams
.rgdispidNamedArgs
= NULL
;
573 dispparams
.rgvarg
= params
;
575 This
->busy
= VARIANT_TRUE
;
577 V_VT(params
) = VT_BOOL
|VT_BYREF
;
578 V_BOOLREF(params
) = cancel
;
580 V_VT(params
+1) = (VT_BYREF
|VT_VARIANT
);
581 V_VARIANTREF(params
+1) = &var_headers
;
582 V_VT(&var_headers
) = VT_BSTR
;
583 V_BSTR(&var_headers
) = headers
;
585 V_VT(params
+2) = (VT_BYREF
|VT_VARIANT
);
586 V_VARIANTREF(params
+2) = &var_post_data2
;
587 V_VT(&var_post_data2
) = (VT_BYREF
|VT_VARIANT
);
588 V_VARIANTREF(&var_post_data2
) = &var_post_data
;
591 V_VT(&var_post_data
) = VT_UI1
|VT_ARRAY
;
592 V_ARRAY(&var_post_data
) = post_data
;
594 V_VT(&var_post_data
) = VT_EMPTY
;
597 V_VT(params
+3) = (VT_BYREF
|VT_VARIANT
);
598 V_VARIANTREF(params
+3) = &var_frame_name
;
599 V_VT(&var_frame_name
) = VT_BSTR
;
600 V_BSTR(&var_frame_name
) = NULL
;
602 V_VT(params
+4) = (VT_BYREF
|VT_VARIANT
);
603 V_VARIANTREF(params
+4) = &var_flags
;
604 V_VT(&var_flags
) = VT_I4
;
605 V_I4(&var_flags
) = 0;
607 V_VT(params
+5) = (VT_BYREF
|VT_VARIANT
);
608 V_VARIANTREF(params
+5) = &var_url
;
609 V_VT(&var_url
) = VT_BSTR
;
610 V_BSTR(&var_url
) = SysAllocString(url
);
612 V_VT(params
+6) = (VT_DISPATCH
);
613 V_DISPATCH(params
+6) = (IDispatch
*)This
->wb
;
615 call_sink(This
->cps
.wbe2
, DISPID_BEFORENAVIGATE2
, &dispparams
);
617 SysFreeString(V_BSTR(&var_url
));
620 /* FIXME: urlmon should handle it */
621 static BOOL
try_application_url(LPCWSTR url
)
623 SHELLEXECUTEINFOW exec_info
;
629 static const WCHAR wszURLProtocol
[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
631 hres
= CoInternetParseUrl(url
, PARSE_SCHEMA
, 0, app
, sizeof(app
)/sizeof(WCHAR
), NULL
, 0);
635 res
= RegOpenKeyW(HKEY_CLASSES_ROOT
, app
, &hkey
);
636 if(res
!= ERROR_SUCCESS
)
639 res
= RegQueryValueExW(hkey
, wszURLProtocol
, NULL
, &type
, NULL
, NULL
);
641 if(res
!= ERROR_SUCCESS
|| type
!= REG_SZ
)
644 TRACE("opening application %s\n", debugstr_w(app
));
646 memset(&exec_info
, 0, sizeof(exec_info
));
647 exec_info
.cbSize
= sizeof(exec_info
);
648 exec_info
.lpFile
= url
;
649 exec_info
.nShow
= SW_SHOW
;
651 return ShellExecuteExW(&exec_info
);
654 static HRESULT
create_moniker(LPCWSTR url
, IMoniker
**mon
)
656 WCHAR new_url
[INTERNET_MAX_URL_LENGTH
];
661 return CreateURLMoniker(NULL
, url
, mon
);
663 size
= sizeof(new_url
)/sizeof(WCHAR
);
664 hres
= UrlApplySchemeW(url
, new_url
, &size
, URL_APPLY_GUESSSCHEME
| URL_APPLY_GUESSFILE
);
665 TRACE("was %s got %s\n", debugstr_w(url
), debugstr_w(new_url
));
667 WARN("UrlApplyScheme failed: %08x\n", hres
);
671 return CreateURLMoniker(NULL
, new_url
, mon
);
674 static HRESULT
bind_to_object(DocHost
*This
, IMoniker
*mon
, LPCWSTR url
, IBindCtx
*bindctx
,
675 IBindStatusCallback
*callback
)
677 IUnknown
*unk
= NULL
;
682 IMoniker_AddRef(mon
);
684 hres
= create_moniker(url
, &mon
);
689 hres
= IMoniker_GetDisplayName(mon
, 0, NULL
, &display_name
);
691 FIXME("GetDisplayName failed: %08x\n", hres
);
695 hres
= set_dochost_url(This
, display_name
);
696 CoTaskMemFree(display_name
);
700 IBindCtx_RegisterObjectParam(bindctx
, (LPOLESTR
)SZ_HTML_CLIENTSITE_OBJECTPARAM
,
701 (IUnknown
*)&This
->IOleClientSite_iface
);
703 hres
= IMoniker_BindToObject(mon
, bindctx
, NULL
, &IID_IUnknown
, (void**)&unk
);
704 if(SUCCEEDED(hres
)) {
707 IUnknown_Release(unk
);
708 }else if(try_application_url(url
)) {
711 FIXME("BindToObject failed: %08x\n", hres
);
714 IMoniker_Release(mon
);
718 static void html_window_navigate(DocHost
*This
, IHTMLPrivateWindow
*window
, BSTR url
, BSTR headers
, SAFEARRAY
*post_data
)
720 VARIANT headers_var
, post_data_var
;
724 hres
= set_dochost_url(This
, url
);
728 empty_str
= SysAllocStringLen(NULL
, 0);
731 V_VT(&headers_var
) = VT_BSTR
;
732 V_BSTR(&headers_var
) = headers
;
734 V_VT(&headers_var
) = VT_EMPTY
;
738 V_VT(&post_data_var
) = VT_UI1
|VT_ARRAY
;
739 V_ARRAY(&post_data_var
) = post_data
;
741 V_VT(&post_data_var
) = VT_EMPTY
;
744 set_doc_state(This
, READYSTATE_LOADING
);
745 hres
= IHTMLPrivateWindow_SuperNavigate(window
, url
, empty_str
, NULL
, NULL
, &post_data_var
, &headers_var
, 0);
746 SysFreeString(empty_str
);
748 WARN("SuprtNavigate failed: %08x\n", hres
);
752 task_header_t header
;
755 SAFEARRAY
*post_data
;
757 } task_doc_navigate_t
;
759 static void doc_navigate_task_destr(task_header_t
*t
)
761 task_doc_navigate_t
*task
= (task_doc_navigate_t
*)t
;
763 SysFreeString(task
->url
);
764 SysFreeString(task
->headers
);
766 SafeArrayDestroy(task
->post_data
);
770 static void doc_navigate_proc(DocHost
*This
, task_header_t
*t
)
772 task_doc_navigate_t
*task
= (task_doc_navigate_t
*)t
;
773 IHTMLPrivateWindow
*priv_window
;
776 if(!This
->doc_navigate
) {
781 if(task
->async_notif
) {
782 VARIANT_BOOL cancel
= VARIANT_FALSE
;
783 on_before_navigate2(This
, task
->url
, task
->post_data
, task
->headers
, &cancel
);
785 TRACE("Navigation canceled\n");
790 hres
= IUnknown_QueryInterface(This
->doc_navigate
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
791 if(SUCCEEDED(hres
)) {
792 html_window_navigate(This
, priv_window
, task
->url
, task
->headers
, task
->post_data
);
793 IHTMLPrivateWindow_Release(priv_window
);
795 WARN("Could not get IHTMLPrivateWindow iface: %08x\n", hres
);
799 static HRESULT
async_doc_navigate(DocHost
*This
, LPCWSTR url
, LPCWSTR headers
, PBYTE post_data
, ULONG post_data_size
,
802 task_doc_navigate_t
*task
;
804 TRACE("%s\n", debugstr_w(url
));
806 task
= heap_alloc_zero(sizeof(*task
));
808 return E_OUTOFMEMORY
;
810 task
->url
= SysAllocString(url
);
812 doc_navigate_task_destr(&task
->header
);
813 return E_OUTOFMEMORY
;
817 task
->headers
= SysAllocString(headers
);
819 doc_navigate_task_destr(&task
->header
);
820 return E_OUTOFMEMORY
;
825 task
->post_data
= SafeArrayCreateVector(VT_UI1
, 0, post_data_size
);
826 if(!task
->post_data
) {
827 doc_navigate_task_destr(&task
->header
);
828 return E_OUTOFMEMORY
;
831 memcpy(task
->post_data
->pvData
, post_data
, post_data_size
);
835 VARIANT_BOOL cancel
= VARIANT_FALSE
;
837 on_before_navigate2(This
, task
->url
, task
->post_data
, task
->headers
, &cancel
);
839 TRACE("Navigation canceled\n");
840 doc_navigate_task_destr(&task
->header
);
845 task
->async_notif
= async_notif
;
846 abort_dochost_tasks(This
, doc_navigate_proc
);
847 push_dochost_task(This
, &task
->header
, doc_navigate_proc
, doc_navigate_task_destr
, FALSE
);
851 static HRESULT
navigate_bsc(DocHost
*This
, BindStatusCallback
*bsc
, IMoniker
*mon
)
853 VARIANT_BOOL cancel
= VARIANT_FALSE
;
854 SAFEARRAY
*post_data
= NULL
;
858 set_doc_state(This
, READYSTATE_LOADING
);
861 post_data
= SafeArrayCreateVector(VT_UI1
, 0, bsc
->post_data_len
);
862 memcpy(post_data
->pvData
, post_data
, bsc
->post_data_len
);
865 on_before_navigate2(This
, bsc
->url
, post_data
, bsc
->headers
, &cancel
);
867 SafeArrayDestroy(post_data
);
869 FIXME("Navigation canceled\n");
874 deactivate_document(This
);
876 CreateAsyncBindCtx(0, &bsc
->IBindStatusCallback_iface
, 0, &bindctx
);
879 IOleInPlaceFrame_EnableModeless(This
->frame
, FALSE
);
881 hres
= bind_to_object(This
, mon
, bsc
->url
, bindctx
, &bsc
->IBindStatusCallback_iface
);
884 IOleInPlaceFrame_EnableModeless(This
->frame
, TRUE
);
886 IBindCtx_Release(bindctx
);
892 task_header_t header
;
893 BindStatusCallback
*bsc
;
894 } task_navigate_bsc_t
;
896 static void navigate_bsc_task_destr(task_header_t
*t
)
898 task_navigate_bsc_t
*task
= (task_navigate_bsc_t
*)t
;
900 IBindStatusCallback_Release(&task
->bsc
->IBindStatusCallback_iface
);
904 static void navigate_bsc_proc(DocHost
*This
, task_header_t
*t
)
906 task_navigate_bsc_t
*task
= (task_navigate_bsc_t
*)t
;
909 create_doc_view_hwnd(This
);
911 navigate_bsc(This
, task
->bsc
, NULL
);
915 HRESULT
navigate_url(DocHost
*This
, LPCWSTR url
, const VARIANT
*Flags
,
916 const VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
918 PBYTE post_data
= NULL
;
919 ULONG post_data_len
= 0;
920 LPWSTR headers
= NULL
;
923 TRACE("navigating to %s\n", debugstr_w(url
));
925 if((Flags
&& V_VT(Flags
) != VT_EMPTY
)
926 || (TargetFrameName
&& V_VT(TargetFrameName
) != VT_EMPTY
))
927 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
928 Flags
, Flags
? V_VT(Flags
) : -1, TargetFrameName
,
929 TargetFrameName
? V_VT(TargetFrameName
) : -1);
931 if(PostData
&& V_VT(PostData
) == (VT_ARRAY
| VT_UI1
) && V_ARRAY(PostData
)) {
932 SafeArrayAccessData(V_ARRAY(PostData
), (void**)&post_data
);
933 post_data_len
= V_ARRAY(PostData
)->rgsabound
[0].cElements
;
936 if(Headers
&& V_VT(Headers
) == VT_BSTR
) {
937 headers
= V_BSTR(Headers
);
938 TRACE("Headers: %s\n", debugstr_w(headers
));
941 set_doc_state(This
, READYSTATE_LOADING
);
942 This
->ready_state
= READYSTATE_LOADING
;
944 if(This
->doc_navigate
) {
945 WCHAR new_url
[INTERNET_MAX_URL_LENGTH
];
947 if(PathIsURLW(url
)) {
952 size
= sizeof(new_url
)/sizeof(WCHAR
);
953 hres
= UrlApplySchemeW(url
, new_url
, &size
,
954 URL_APPLY_GUESSSCHEME
| URL_APPLY_GUESSFILE
| URL_APPLY_DEFAULT
);
956 WARN("UrlApplyScheme failed: %08x\n", hres
);
961 hres
= async_doc_navigate(This
, *new_url
? new_url
: url
, headers
, post_data
,
962 post_data_len
, TRUE
);
964 task_navigate_bsc_t
*task
;
966 task
= heap_alloc(sizeof(*task
));
967 task
->bsc
= create_callback(This
, url
, post_data
, post_data_len
, headers
);
968 push_dochost_task(This
, &task
->header
, navigate_bsc_proc
, navigate_bsc_task_destr
, This
->url
== NULL
);
972 SafeArrayUnaccessData(V_ARRAY(PostData
));
977 static HRESULT
navigate_hlink(DocHost
*This
, IMoniker
*mon
, IBindCtx
*bindctx
,
978 IBindStatusCallback
*callback
)
980 IHttpNegotiate
*http_negotiate
;
981 BindStatusCallback
*bsc
;
982 PBYTE post_data
= NULL
;
983 ULONG post_data_len
= 0;
984 LPWSTR headers
= NULL
, url
;
991 hres
= IMoniker_GetDisplayName(mon
, 0, NULL
, &url
);
993 FIXME("GetDisplayName failed: %08x\n", hres
);
995 hres
= IBindStatusCallback_QueryInterface(callback
, &IID_IHttpNegotiate
,
996 (void**)&http_negotiate
);
997 if(SUCCEEDED(hres
)) {
998 static const WCHAR null_string
[] = {0};
1000 IHttpNegotiate_BeginningTransaction(http_negotiate
, null_string
, null_string
, 0,
1002 IHttpNegotiate_Release(http_negotiate
);
1005 memset(&bindinfo
, 0, sizeof(bindinfo
));
1006 bindinfo
.cbSize
= sizeof(bindinfo
);
1008 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
1009 dump_BINDINFO(&bindinfo
);
1010 if(bindinfo
.dwBindVerb
== BINDVERB_POST
) {
1011 post_data_len
= bindinfo
.cbstgmedData
;
1013 post_data
= bindinfo
.stgmedData
.u
.hGlobal
;
1016 if(This
->doc_navigate
) {
1017 hres
= async_doc_navigate(This
, url
, headers
, post_data
, post_data_len
, FALSE
);
1019 bsc
= create_callback(This
, url
, post_data
, post_data_len
, headers
);
1020 hres
= navigate_bsc(This
, bsc
, mon
);
1021 IBindStatusCallback_Release(&bsc
->IBindStatusCallback_iface
);
1025 CoTaskMemFree(headers
);
1026 ReleaseBindInfo(&bindinfo
);
1031 HRESULT
go_home(DocHost
*This
)
1034 DWORD res
, type
, size
;
1035 WCHAR wszPageName
[MAX_PATH
];
1036 static const WCHAR wszAboutBlank
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
1037 static const WCHAR wszStartPage
[] = {'S','t','a','r','t',' ','P','a','g','e',0};
1038 static const WCHAR wszSubKey
[] = {'S','o','f','t','w','a','r','e','\\',
1039 'M','i','c','r','o','s','o','f','t','\\',
1040 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
1043 res
= RegOpenKeyW(HKEY_CURRENT_USER
, wszSubKey
, &hkey
);
1044 if (res
!= ERROR_SUCCESS
)
1045 return navigate_url(This
, wszAboutBlank
, NULL
, NULL
, NULL
, NULL
);
1047 size
= sizeof(wszPageName
);
1048 res
= RegQueryValueExW(hkey
, wszStartPage
, NULL
, &type
, (LPBYTE
)wszPageName
, &size
);
1050 if (res
!= ERROR_SUCCESS
|| type
!= REG_SZ
)
1051 return navigate_url(This
, wszAboutBlank
, NULL
, NULL
, NULL
, NULL
);
1053 return navigate_url(This
, wszPageName
, NULL
, NULL
, NULL
, NULL
);
1056 HRESULT
go_back(DocHost
*This
)
1061 if(!This
->travellog_position
) {
1062 WARN("No history available\n");
1066 url
= This
->travellog
[--This
->travellog_position
].url
;
1068 if(This
->doc_navigate
) {
1069 hres
= async_doc_navigate(This
, url
, NULL
, NULL
, 0, FALSE
);
1071 FIXME("unsupported doc_navigate FALSE\n");
1079 HRESULT
get_location_url(DocHost
*This
, BSTR
*ret
)
1081 FIXME("semi-stub\n");
1083 *ret
= This
->url
? SysAllocString(This
->url
) : SysAllocStringLen(NULL
, 0);
1085 return E_OUTOFMEMORY
;
1087 return This
->url
? S_OK
: S_FALSE
;
1090 static inline HlinkFrame
*impl_from_IHlinkFrame(IHlinkFrame
*iface
)
1092 return CONTAINING_RECORD(iface
, HlinkFrame
, IHlinkFrame_iface
);
1095 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
1097 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1098 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1101 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
1103 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1104 return IUnknown_AddRef(This
->outer
);
1107 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
1109 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1110 return IUnknown_Release(This
->outer
);
1113 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
1114 IHlinkBrowseContext
*pihlbc
)
1116 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1117 FIXME("(%p)->(%p)\n", This
, pihlbc
);
1121 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
1122 IHlinkBrowseContext
**ppihlbc
)
1124 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1125 FIXME("(%p)->(%p)\n", This
, ppihlbc
);
1129 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
1130 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
1132 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1134 LPWSTR location
= NULL
;
1136 TRACE("(%p)->(%08x %p %p %p)\n", This
, grfHLNF
, pbc
, pibsc
, pihlNavigate
);
1139 FIXME("unsupported grfHLNF=%08x\n", grfHLNF
);
1141 /* Windows calls GetTargetFrameName here. */
1143 IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
1146 FIXME("location = %s\n", debugstr_w(location
));
1147 CoTaskMemFree(location
);
1150 /* Windows calls GetHlinkSite here */
1152 if(grfHLNF
& HLNF_OPENINNEWWINDOW
) {
1153 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
1157 return navigate_hlink(This
->doc_host
, mon
, pbc
, pibsc
);
1160 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
1161 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
1163 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1164 FIXME("(%p)->(%08x %p %s %s %d)\n", This
, grfHLNF
, pimkTarget
, debugstr_w(pwzLocation
),
1165 debugstr_w(pwzFriendlyName
), dwreserved
);
1169 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
1170 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
1172 HlinkFrame
*This
= impl_from_IHlinkFrame(iface
);
1173 FIXME("(%p)->(%u %p %s %s)\n", This
, uHLID
, pimkTarget
, debugstr_w(pwzLocation
),
1174 debugstr_w(pwzFriendlyName
));
1178 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
1179 HlinkFrame_QueryInterface
,
1182 HlinkFrame_SetBrowseContext
,
1183 HlinkFrame_GetBrowseContext
,
1184 HlinkFrame_Navigate
,
1185 HlinkFrame_OnNavigate
,
1186 HlinkFrame_UpdateHlink
1189 static inline HlinkFrame
*impl_from_ITargetFrame2(ITargetFrame2
*iface
)
1191 return CONTAINING_RECORD(iface
, HlinkFrame
, IHlinkFrame_iface
);
1194 static HRESULT WINAPI
TargetFrame2_QueryInterface(ITargetFrame2
*iface
, REFIID riid
, void **ppv
)
1196 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1197 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1200 static ULONG WINAPI
TargetFrame2_AddRef(ITargetFrame2
*iface
)
1202 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1203 return IUnknown_AddRef(This
->outer
);
1206 static ULONG WINAPI
TargetFrame2_Release(ITargetFrame2
*iface
)
1208 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1209 return IUnknown_Release(This
->outer
);
1212 static HRESULT WINAPI
TargetFrame2_SetFrameName(ITargetFrame2
*iface
, LPCWSTR pszFrameName
)
1214 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1215 FIXME("(%p)->(%s)\n", This
, debugstr_w(pszFrameName
));
1219 static HRESULT WINAPI
TargetFrame2_GetFrameName(ITargetFrame2
*iface
, LPWSTR
*ppszFrameName
)
1221 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1222 FIXME("(%p)->(%p)\n", This
, ppszFrameName
);
1226 static HRESULT WINAPI
TargetFrame2_GetParentFrame(ITargetFrame2
*iface
, IUnknown
**ppunkParent
)
1228 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1229 FIXME("(%p)->(%p)\n", This
, ppunkParent
);
1233 static HRESULT WINAPI
TargetFrame2_SetFrameSrc(ITargetFrame2
*iface
, LPCWSTR pszFrameSrc
)
1235 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1236 FIXME("(%p)->(%s)\n", This
, debugstr_w(pszFrameSrc
));
1240 static HRESULT WINAPI
TargetFrame2_GetFrameSrc(ITargetFrame2
*iface
, LPWSTR
*ppszFrameSrc
)
1242 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1243 FIXME("(%p)->()\n", This
);
1247 static HRESULT WINAPI
TargetFrame2_GetFramesContainer(ITargetFrame2
*iface
, IOleContainer
**ppContainer
)
1249 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1250 FIXME("(%p)->(%p)\n", This
, ppContainer
);
1254 static HRESULT WINAPI
TargetFrame2_SetFrameOptions(ITargetFrame2
*iface
, DWORD dwFlags
)
1256 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1257 FIXME("(%p)->(%x)\n", This
, dwFlags
);
1261 static HRESULT WINAPI
TargetFrame2_GetFrameOptions(ITargetFrame2
*iface
, DWORD
*pdwFlags
)
1263 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1264 FIXME("(%p)->(%p)\n", This
, pdwFlags
);
1268 static HRESULT WINAPI
TargetFrame2_SetFrameMargins(ITargetFrame2
*iface
, DWORD dwWidth
, DWORD dwHeight
)
1270 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1271 FIXME("(%p)->(%d %d)\n", This
, dwWidth
, dwHeight
);
1275 static HRESULT WINAPI
TargetFrame2_GetFrameMargins(ITargetFrame2
*iface
, DWORD
*pdwWidth
, DWORD
*pdwHeight
)
1277 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1278 FIXME("(%p)->(%p %p)\n", This
, pdwWidth
, pdwHeight
);
1282 static HRESULT WINAPI
TargetFrame2_FindFrame(ITargetFrame2
*iface
, LPCWSTR pszTargetName
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1284 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1285 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(pszTargetName
), dwFlags
, ppunkTargetFrame
);
1289 static HRESULT WINAPI
TargetFrame2_GetTargetAlias(ITargetFrame2
*iface
, LPCWSTR pszTargetName
, LPWSTR
*ppszTargetAlias
)
1291 HlinkFrame
*This
= impl_from_ITargetFrame2(iface
);
1292 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(pszTargetName
), ppszTargetAlias
);
1296 static const ITargetFrame2Vtbl TargetFrame2Vtbl
= {
1297 TargetFrame2_QueryInterface
,
1298 TargetFrame2_AddRef
,
1299 TargetFrame2_Release
,
1300 TargetFrame2_SetFrameName
,
1301 TargetFrame2_GetFrameName
,
1302 TargetFrame2_GetParentFrame
,
1303 TargetFrame2_SetFrameSrc
,
1304 TargetFrame2_GetFrameSrc
,
1305 TargetFrame2_GetFramesContainer
,
1306 TargetFrame2_SetFrameOptions
,
1307 TargetFrame2_GetFrameOptions
,
1308 TargetFrame2_SetFrameMargins
,
1309 TargetFrame2_GetFrameMargins
,
1310 TargetFrame2_FindFrame
,
1311 TargetFrame2_GetTargetAlias
1314 static inline HlinkFrame
*impl_from_ITargetFramePriv2(ITargetFramePriv2
*iface
)
1316 return CONTAINING_RECORD(iface
, HlinkFrame
, ITargetFramePriv2_iface
);
1319 static HRESULT WINAPI
TargetFramePriv2_QueryInterface(ITargetFramePriv2
*iface
, REFIID riid
, void **ppv
)
1321 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1322 return IUnknown_QueryInterface(This
->outer
, riid
, ppv
);
1325 static ULONG WINAPI
TargetFramePriv2_AddRef(ITargetFramePriv2
*iface
)
1327 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1328 return IUnknown_AddRef(This
->outer
);
1331 static ULONG WINAPI
TargetFramePriv2_Release(ITargetFramePriv2
*iface
)
1333 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1334 return IUnknown_Release(This
->outer
);
1337 static HRESULT WINAPI
TargetFramePriv2_FindFrameDownwards(ITargetFramePriv2
*iface
,
1338 LPCWSTR pszTargetName
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1340 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1341 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(pszTargetName
), dwFlags
, ppunkTargetFrame
);
1345 static HRESULT WINAPI
TargetFramePriv2_FindFrameInContext(ITargetFramePriv2
*iface
,
1346 LPCWSTR pszTargetName
, IUnknown
*punkContextFrame
, DWORD dwFlags
, IUnknown
**ppunkTargetFrame
)
1348 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1349 FIXME("(%p)->(%s %p %x %p)\n", This
, debugstr_w(pszTargetName
), punkContextFrame
, dwFlags
, ppunkTargetFrame
);
1353 static HRESULT WINAPI
TargetFramePriv2_OnChildFrameActivate(ITargetFramePriv2
*iface
, IUnknown
*pUnkChildFrame
)
1355 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1356 FIXME("(%p)->(%p)\n", This
, pUnkChildFrame
);
1360 static HRESULT WINAPI
TargetFramePriv2_OnChildFrameDeactivate(ITargetFramePriv2
*iface
, IUnknown
*pUnkChildFrame
)
1362 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1363 FIXME("(%p)->(%p)\n", This
, pUnkChildFrame
);
1367 static HRESULT WINAPI
TargetFramePriv2_NavigateHack(ITargetFramePriv2
*iface
, DWORD grfHLNF
, LPBC pbc
,
1368 IBindStatusCallback
*pibsc
, LPCWSTR pszTargetName
, LPCWSTR pszUrl
, LPCWSTR pszLocation
)
1370 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1371 FIXME("(%p)->(%x %p %p %s %s %s)\n", This
, grfHLNF
, pbc
, pibsc
, debugstr_w(pszTargetName
),
1372 debugstr_w(pszUrl
), debugstr_w(pszLocation
));
1376 static HRESULT WINAPI
TargetFramePriv2_FindBrowserByIndex(ITargetFramePriv2
*iface
, DWORD dwID
, IUnknown
**ppunkBrowser
)
1378 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1379 FIXME("(%p)->(%d %p)\n", This
, dwID
, ppunkBrowser
);
1383 static HRESULT WINAPI
TargetFramePriv2_AggregatedNavigation2(ITargetFramePriv2
*iface
, DWORD grfHLNF
, LPBC pbc
,
1384 IBindStatusCallback
*pibsc
, LPCWSTR pszTargetName
, IUri
*pUri
, LPCWSTR pszLocation
)
1386 HlinkFrame
*This
= impl_from_ITargetFramePriv2(iface
);
1390 TRACE("(%p)->(%x %p %p %s %p %s)\n", This
, grfHLNF
, pbc
, pibsc
, debugstr_w(pszTargetName
),
1391 pUri
, debugstr_w(pszLocation
));
1394 * NOTE: This is an undocumented function. It seems to be working the way it's implemented,
1395 * but I couldn't get its tests working. It's used by mshtml to load content in a new
1396 * instance of browser.
1399 hres
= CreateURLMonikerEx2(NULL
, pUri
, &mon
, 0);
1403 hres
= navigate_hlink(This
->doc_host
, mon
, pbc
, pibsc
);
1404 IMoniker_Release(mon
);
1408 static const ITargetFramePriv2Vtbl TargetFramePriv2Vtbl
= {
1409 TargetFramePriv2_QueryInterface
,
1410 TargetFramePriv2_AddRef
,
1411 TargetFramePriv2_Release
,
1412 TargetFramePriv2_FindFrameDownwards
,
1413 TargetFramePriv2_FindFrameInContext
,
1414 TargetFramePriv2_OnChildFrameActivate
,
1415 TargetFramePriv2_OnChildFrameDeactivate
,
1416 TargetFramePriv2_NavigateHack
,
1417 TargetFramePriv2_FindBrowserByIndex
,
1418 TargetFramePriv2_AggregatedNavigation2
1421 BOOL
HlinkFrame_QI(HlinkFrame
*This
, REFIID riid
, void **ppv
)
1423 if(IsEqualGUID(&IID_IHlinkFrame
, riid
)) {
1424 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This
, ppv
);
1425 *ppv
= &This
->IHlinkFrame_iface
;
1426 }else if(IsEqualGUID(&IID_ITargetFrame2
, riid
)) {
1427 TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This
, ppv
);
1428 *ppv
= &This
->ITargetFrame2_iface
;
1429 }else if(IsEqualGUID(&IID_ITargetFramePriv
, riid
)) {
1430 TRACE("(%p)->(IID_ITargetFramePriv %p)\n", This
, ppv
);
1431 *ppv
= &This
->ITargetFramePriv2_iface
;
1432 }else if(IsEqualGUID(&IID_ITargetFramePriv2
, riid
)) {
1433 TRACE("(%p)->(IID_ITargetFramePriv2 %p)\n", This
, ppv
);
1434 *ppv
= &This
->ITargetFramePriv2_iface
;
1439 IUnknown_AddRef((IUnknown
*)*ppv
);
1443 void HlinkFrame_Init(HlinkFrame
*This
, IUnknown
*outer
, DocHost
*doc_host
)
1445 This
->IHlinkFrame_iface
.lpVtbl
= &HlinkFrameVtbl
;
1446 This
->ITargetFrame2_iface
.lpVtbl
= &TargetFrame2Vtbl
;
1447 This
->ITargetFramePriv2_iface
.lpVtbl
= &TargetFramePriv2Vtbl
;
1449 This
->outer
= outer
;
1450 This
->doc_host
= doc_host
;