2006-02-08 12:42:23 +01:00
|
|
|
/*
|
2008-01-03 16:37:28 +01:00
|
|
|
* Copyright 2006-2007 Jacek Caban for CodeWeavers
|
2006-02-08 12:42:23 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-02-08 12:42:23 +01:00
|
|
|
*/
|
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "ieframe.h"
|
2006-02-08 12:42:23 +01:00
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
#include "exdispid.h"
|
2006-05-12 18:50:27 +02:00
|
|
|
#include "shellapi.h"
|
|
|
|
#include "winreg.h"
|
2008-02-27 18:56:53 +01:00
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "wininet.h"
|
2010-03-13 16:44:24 +01:00
|
|
|
#include "mshtml.h"
|
2006-02-08 12:42:23 +01:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2011-07-29 12:18:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
|
2006-02-08 12:42:23 +01:00
|
|
|
|
2008-01-03 16:40:17 +01:00
|
|
|
static const WCHAR emptyW[] = {0};
|
|
|
|
|
2006-02-15 11:53:21 +01:00
|
|
|
typedef struct {
|
2010-11-13 17:48:21 +01:00
|
|
|
IBindStatusCallback IBindStatusCallback_iface;
|
|
|
|
IHttpNegotiate IHttpNegotiate_iface;
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
2008-01-03 16:36:04 +01:00
|
|
|
DocHost *doc_host;
|
2011-03-28 23:37:36 +02:00
|
|
|
IBinding *binding;
|
2008-01-03 16:36:04 +01:00
|
|
|
|
2008-01-18 21:53:06 +01:00
|
|
|
LPWSTR url;
|
2006-02-15 11:53:21 +01:00
|
|
|
HGLOBAL post_data;
|
2008-01-18 21:54:30 +01:00
|
|
|
BSTR headers;
|
2006-02-15 11:53:21 +01:00
|
|
|
ULONG post_data_len;
|
|
|
|
} BindStatusCallback;
|
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
static void dump_BINDINFO(BINDINFO *bi)
|
|
|
|
{
|
2006-11-29 11:03:30 +01:00
|
|
|
static const char * const BINDINFOF_str[] = {
|
2006-02-15 11:52:40 +01:00
|
|
|
"#0",
|
|
|
|
"BINDINFOF_URLENCODESTGMEDDATA",
|
|
|
|
"BINDINFOF_URLENCODEDEXTRAINFO"
|
|
|
|
};
|
|
|
|
|
2006-11-29 11:03:30 +01:00
|
|
|
static const char * const BINDVERB_str[] = {
|
2006-02-15 11:52:40 +01:00
|
|
|
"BINDVERB_GET",
|
|
|
|
"BINDVERB_POST",
|
|
|
|
"BINDVERB_PUT",
|
|
|
|
"BINDVERB_CUSTOM"
|
|
|
|
};
|
|
|
|
|
|
|
|
TRACE("\n"
|
|
|
|
"BINDINFO = {\n"
|
2006-10-05 23:49:39 +02:00
|
|
|
" %d, %s,\n"
|
|
|
|
" {%d, %p, %p},\n"
|
2006-02-15 11:52:40 +01:00
|
|
|
" %s,\n"
|
|
|
|
" %s,\n"
|
|
|
|
" %s,\n"
|
2006-10-05 23:49:39 +02:00
|
|
|
" %d, %08x, %d, %d\n"
|
|
|
|
" {%d %p %x},\n"
|
2006-02-15 11:52:40 +01:00
|
|
|
" %s\n"
|
2006-10-05 23:49:39 +02:00
|
|
|
" %p, %d\n"
|
2006-02-15 11:52:40 +01:00
|
|
|
"}\n",
|
|
|
|
|
|
|
|
bi->cbSize, debugstr_w(bi->szExtraInfo),
|
|
|
|
bi->stgmedData.tymed, bi->stgmedData.u.hGlobal, bi->stgmedData.pUnkForRelease,
|
|
|
|
bi->grfBindInfoF > BINDINFOF_URLENCODEDEXTRAINFO
|
|
|
|
? "unknown" : BINDINFOF_str[bi->grfBindInfoF],
|
|
|
|
bi->dwBindVerb > BINDVERB_CUSTOM
|
|
|
|
? "unknown" : BINDVERB_str[bi->dwBindVerb],
|
|
|
|
debugstr_w(bi->szCustomVerb),
|
2006-09-29 12:42:10 +02:00
|
|
|
bi->cbstgmedData, bi->dwOptions, bi->dwOptionsFlags, bi->dwCodePage,
|
2006-02-15 11:52:40 +01:00
|
|
|
bi->securityAttributes.nLength,
|
|
|
|
bi->securityAttributes.lpSecurityDescriptor,
|
|
|
|
bi->securityAttributes.bInheritHandle,
|
|
|
|
debugstr_guid(&bi->iid),
|
|
|
|
bi->pUnk, bi->dwReserved
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-01-03 16:39:01 +01:00
|
|
|
static void set_status_text(BindStatusCallback *This, LPCWSTR str)
|
|
|
|
{
|
2008-01-14 16:26:47 +01:00
|
|
|
VARIANTARG arg;
|
|
|
|
DISPPARAMS dispparams = {&arg, NULL, 1, 0};
|
|
|
|
|
|
|
|
if(!This->doc_host)
|
2008-01-03 16:39:01 +01:00
|
|
|
return;
|
|
|
|
|
2008-01-14 16:26:47 +01:00
|
|
|
V_VT(&arg) = VT_BSTR;
|
|
|
|
V_BSTR(&arg) = str ? SysAllocString(str) : NULL;
|
|
|
|
call_sink(This->doc_host->cps.wbe2, DISPID_STATUSTEXTCHANGE, &dispparams);
|
|
|
|
VariantClear(&arg);
|
|
|
|
|
|
|
|
if(This->doc_host->frame)
|
|
|
|
IOleInPlaceFrame_SetStatusText(This->doc_host->frame, str);
|
2008-01-03 16:39:01 +01:00
|
|
|
}
|
|
|
|
|
2011-11-15 13:28:47 +01:00
|
|
|
HRESULT set_dochost_url(DocHost *This, const WCHAR *url)
|
2010-06-29 21:03:22 +02:00
|
|
|
{
|
|
|
|
WCHAR *new_url;
|
|
|
|
|
|
|
|
if(url) {
|
|
|
|
new_url = heap_strdupW(url);
|
|
|
|
if(!new_url)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}else {
|
|
|
|
new_url = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_free(This->url);
|
|
|
|
This->url = new_url;
|
2010-07-29 10:28:02 +02:00
|
|
|
|
|
|
|
This->container_vtbl->SetURL(This, This->url);
|
2010-06-29 21:03:22 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
static inline BindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCallback *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, BindStatusCallback, IBindStatusCallback_iface);
|
2010-11-13 17:48:21 +01:00
|
|
|
}
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-11-13 17:48:21 +01:00
|
|
|
*ppv = &This->IBindStatusCallback_iface;
|
2006-02-15 11:53:21 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
|
2010-11-13 17:48:21 +01:00
|
|
|
*ppv = &This->IBindStatusCallback_iface;
|
2006-02-15 11:53:21 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
|
2010-11-13 17:48:21 +01:00
|
|
|
*ppv = &This->IHttpNegotiate_iface;
|
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
if(!ref) {
|
2008-01-03 16:36:04 +01:00
|
|
|
if(This->doc_host)
|
2010-11-13 17:47:58 +01:00
|
|
|
IOleClientSite_Release(&This->doc_host->IOleClientSite_iface);
|
2011-03-28 23:37:36 +02:00
|
|
|
if(This->binding)
|
|
|
|
IBinding_Release(This->binding);
|
2006-02-15 11:53:21 +01:00
|
|
|
if(This->post_data)
|
|
|
|
GlobalFree(This->post_data);
|
2008-09-21 16:10:14 +02:00
|
|
|
SysFreeString(This->headers);
|
2008-01-18 21:53:06 +01:00
|
|
|
heap_free(This->url);
|
2007-11-28 00:09:35 +01:00
|
|
|
heap_free(This);
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
|
|
|
|
DWORD dwReserved, IBinding *pbind)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2008-01-03 16:36:27 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
|
|
|
|
|
2011-03-28 23:37:36 +02:00
|
|
|
This->binding = pbind;
|
|
|
|
IBinding_AddRef(This->binding);
|
|
|
|
|
2008-01-03 16:36:27 +01:00
|
|
|
return S_OK;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
|
|
|
|
LONG *pnPriority)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, pnPriority);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface,
|
|
|
|
DWORD reserved)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d)\n", This, reserved);
|
2006-02-15 11:53:21 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-03-28 23:37:36 +02:00
|
|
|
static DWORD get_http_status_code(IBinding *binding)
|
|
|
|
{
|
|
|
|
IWinInetHttpInfo *http_info;
|
|
|
|
DWORD status, size = sizeof(DWORD);
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IBinding_QueryInterface(binding, &IID_IWinInetHttpInfo, (void**)&http_info);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return HTTP_STATUS_OK;
|
|
|
|
|
|
|
|
hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,
|
|
|
|
&status, &size, NULL, NULL);
|
|
|
|
IWinInetHttpInfo_Release(http_info);
|
|
|
|
|
|
|
|
if(FAILED(hres))
|
|
|
|
return HTTP_STATUS_OK;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2006-02-15 11:53:21 +01:00
|
|
|
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
|
|
|
|
ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2011-03-28 23:37:36 +02:00
|
|
|
DWORD status_code;
|
2008-01-03 16:39:01 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d %d %d %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
|
2006-02-15 11:53:21 +01:00
|
|
|
debugstr_w(szStatusText));
|
2008-01-03 16:39:01 +01:00
|
|
|
|
|
|
|
switch(ulStatusCode) {
|
2010-06-29 21:03:47 +02:00
|
|
|
case BINDSTATUS_REDIRECTING:
|
|
|
|
return set_dochost_url(This->doc_host, szStatusText);
|
2008-01-03 16:39:01 +01:00
|
|
|
case BINDSTATUS_BEGINDOWNLOADDATA:
|
|
|
|
set_status_text(This, szStatusText); /* FIXME: "Start downloading from site: %s" */
|
2011-03-28 23:37:36 +02:00
|
|
|
status_code = get_http_status_code(This->binding);
|
|
|
|
if(status_code != HTTP_STATUS_OK)
|
|
|
|
handle_navigation_error(This->doc_host, status_code, This->url, NULL);
|
2008-01-03 16:39:01 +01:00
|
|
|
return S_OK;
|
|
|
|
case BINDSTATUS_ENDDOWNLOADDATA:
|
|
|
|
set_status_text(This, szStatusText); /* FIXME: "Downloading from site: %s" */
|
|
|
|
return S_OK;
|
|
|
|
case BINDSTATUS_CLASSIDAVAILABLE:
|
|
|
|
case BINDSTATUS_MIMETYPEAVAILABLE:
|
|
|
|
case BINDSTATUS_BEGINSYNCOPERATION:
|
|
|
|
case BINDSTATUS_ENDSYNCOPERATION:
|
|
|
|
return S_OK;
|
|
|
|
default:
|
|
|
|
FIXME("status code %u\n", ulStatusCode);
|
|
|
|
}
|
|
|
|
|
2009-08-22 19:38:41 +02:00
|
|
|
return S_OK;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
2011-03-14 17:49:27 +01:00
|
|
|
void handle_navigation_error(DocHost* doc_host, HRESULT hres, BSTR url, IHTMLWindow2 *win2)
|
|
|
|
{
|
|
|
|
VARIANT var_status_code, var_frame_name, var_url;
|
|
|
|
DISPPARAMS dispparams;
|
|
|
|
VARIANTARG params[5];
|
|
|
|
VARIANT_BOOL cancel = VARIANT_FALSE;
|
|
|
|
|
|
|
|
dispparams.cArgs = 5;
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
dispparams.rgdispidNamedArgs = NULL;
|
|
|
|
dispparams.rgvarg = params;
|
|
|
|
|
|
|
|
V_VT(params) = VT_BOOL|VT_BYREF;
|
|
|
|
V_BOOLREF(params) = &cancel;
|
|
|
|
|
|
|
|
V_VT(params+1) = VT_VARIANT|VT_BYREF;
|
|
|
|
V_VARIANTREF(params+1) = &var_status_code;
|
|
|
|
V_VT(&var_status_code) = VT_I4;
|
|
|
|
V_I4(&var_status_code) = hres;
|
|
|
|
|
|
|
|
V_VT(params+2) = VT_VARIANT|VT_BYREF;
|
|
|
|
V_VARIANTREF(params+2) = &var_frame_name;
|
|
|
|
V_VT(&var_frame_name) = VT_BSTR;
|
|
|
|
if(win2) {
|
|
|
|
hres = IHTMLWindow2_get_name(win2, &V_BSTR(&var_frame_name));
|
|
|
|
if(FAILED(hres))
|
|
|
|
V_BSTR(&var_frame_name) = NULL;
|
|
|
|
} else
|
|
|
|
V_BSTR(&var_frame_name) = NULL;
|
|
|
|
|
|
|
|
V_VT(params+3) = VT_VARIANT|VT_BYREF;
|
|
|
|
V_VARIANTREF(params+3) = &var_url;
|
|
|
|
V_VT(&var_url) = VT_BSTR;
|
|
|
|
V_BSTR(&var_url) = url;
|
|
|
|
|
|
|
|
V_VT(params+4) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(params+4) = doc_host->disp;
|
|
|
|
|
|
|
|
call_sink(doc_host->cps.wbe2, DISPID_NAVIGATEERROR, &dispparams);
|
|
|
|
SysFreeString(V_BSTR(&var_frame_name));
|
|
|
|
|
|
|
|
if(!cancel)
|
|
|
|
FIXME("Navigate to error page\n");
|
|
|
|
}
|
|
|
|
|
2006-02-15 11:53:21 +01:00
|
|
|
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
|
|
|
|
HRESULT hresult, LPCWSTR szError)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2008-01-03 16:36:04 +01:00
|
|
|
|
2008-01-03 16:40:17 +01:00
|
|
|
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
|
|
|
|
|
|
|
|
set_status_text(This, emptyW);
|
2008-01-03 16:36:04 +01:00
|
|
|
|
2011-03-14 17:49:27 +01:00
|
|
|
if(!This->doc_host)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
if(FAILED(hresult))
|
|
|
|
handle_navigation_error(This->doc_host, hresult, This->url, NULL);
|
|
|
|
|
|
|
|
IOleClientSite_Release(&This->doc_host->IOleClientSite_iface);
|
|
|
|
This->doc_host = NULL;
|
2008-01-03 16:36:04 +01:00
|
|
|
|
2011-03-28 23:37:36 +02:00
|
|
|
IBinding_Release(This->binding);
|
|
|
|
This->binding = NULL;
|
|
|
|
|
2008-01-03 16:40:17 +01:00
|
|
|
return S_OK;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
|
|
|
|
DWORD *grfBINDF, BINDINFO *pbindinfo)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2008-01-03 16:36:48 +01:00
|
|
|
TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2008-01-03 16:36:48 +01:00
|
|
|
*grfBINDF = BINDF_ASYNCHRONOUS;
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
if(This->post_data) {
|
|
|
|
pbindinfo->dwBindVerb = BINDVERB_POST;
|
|
|
|
|
|
|
|
pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
|
|
|
|
pbindinfo->stgmedData.u.hGlobal = This->post_data;
|
2008-01-03 16:36:48 +01:00
|
|
|
pbindinfo->cbstgmedData = This->post_data_len;
|
2010-11-13 17:48:21 +01:00
|
|
|
pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)&This->IBindStatusCallback_iface;
|
|
|
|
IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
|
|
|
|
DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
|
2006-02-15 11:53:21 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-01-03 16:35:42 +01:00
|
|
|
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
|
|
|
|
REFIID riid, IUnknown *punk)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
2008-01-03 16:38:01 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
|
|
|
|
|
2009-08-30 01:00:53 +02:00
|
|
|
return dochost_object_available(This->doc_host, punk);
|
2008-01-03 16:35:42 +01:00
|
|
|
}
|
|
|
|
|
2006-02-15 11:53:21 +01:00
|
|
|
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
|
|
|
|
BindStatusCallback_QueryInterface,
|
|
|
|
BindStatusCallback_AddRef,
|
|
|
|
BindStatusCallback_Release,
|
|
|
|
BindStatusCallback_OnStartBinding,
|
|
|
|
BindStatusCallback_GetPriority,
|
|
|
|
BindStatusCallback_OnLowResource,
|
|
|
|
BindStatusCallback_OnProgress,
|
|
|
|
BindStatusCallback_OnStopBinding,
|
|
|
|
BindStatusCallback_GetBindInfo,
|
2008-01-03 16:35:42 +01:00
|
|
|
BindStatusCallback_OnDataAvailable,
|
|
|
|
BindStatusCallback_OnObjectAvailable
|
2006-02-15 11:53:21 +01:00
|
|
|
};
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
static inline BindStatusCallback *impl_from_IHttpNegotiate(IHttpNegotiate *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, BindStatusCallback, IHttpNegotiate_iface);
|
2010-11-13 17:48:21 +01:00
|
|
|
}
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
|
|
|
|
return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
|
|
|
|
return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
|
|
|
|
return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
|
|
|
|
LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2009-08-22 19:38:41 +02:00
|
|
|
TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
|
2006-02-15 11:53:21 +01:00
|
|
|
dwReserved, pszAdditionalHeaders);
|
|
|
|
|
|
|
|
if(This->headers) {
|
|
|
|
int size = (strlenW(This->headers)+1)*sizeof(WCHAR);
|
|
|
|
*pszAdditionalHeaders = CoTaskMemAlloc(size);
|
|
|
|
memcpy(*pszAdditionalHeaders, This->headers, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface,
|
|
|
|
DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders,
|
|
|
|
LPWSTR *pszAdditionalRequestHeaders)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
|
2009-08-22 19:38:41 +02:00
|
|
|
TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
|
2006-02-15 11:53:21 +01:00
|
|
|
debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
|
2009-08-22 19:38:41 +02:00
|
|
|
return S_OK;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
|
|
|
|
HttpNegotiate_QueryInterface,
|
|
|
|
HttpNegotiate_AddRef,
|
|
|
|
HttpNegotiate_Release,
|
|
|
|
HttpNegotiate_BeginningTransaction,
|
|
|
|
HttpNegotiate_OnResponse
|
|
|
|
};
|
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
static BindStatusCallback *create_callback(DocHost *doc_host, LPCWSTR url, PBYTE post_data,
|
|
|
|
ULONG post_data_len, LPCWSTR headers)
|
2006-02-15 11:53:21 +01:00
|
|
|
{
|
2007-11-28 00:09:35 +01:00
|
|
|
BindStatusCallback *ret = heap_alloc(sizeof(BindStatusCallback));
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
ret->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
|
|
|
|
ret->IHttpNegotiate_iface.lpVtbl = &HttpNegotiateVtbl;
|
2006-02-15 11:53:21 +01:00
|
|
|
|
|
|
|
ret->ref = 1;
|
2008-01-18 21:53:06 +01:00
|
|
|
ret->url = heap_strdupW(url);
|
2006-02-15 11:53:21 +01:00
|
|
|
ret->post_data = NULL;
|
|
|
|
ret->post_data_len = post_data_len;
|
2008-01-18 21:54:30 +01:00
|
|
|
ret->headers = headers ? SysAllocString(headers) : NULL;
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2008-01-03 16:36:04 +01:00
|
|
|
ret->doc_host = doc_host;
|
2010-11-13 17:47:58 +01:00
|
|
|
IOleClientSite_AddRef(&doc_host->IOleClientSite_iface);
|
2008-01-03 16:36:04 +01:00
|
|
|
|
2011-03-28 23:37:36 +02:00
|
|
|
ret->binding = NULL;
|
|
|
|
|
2006-02-15 11:53:21 +01:00
|
|
|
if(post_data) {
|
|
|
|
ret->post_data = GlobalAlloc(0, post_data_len);
|
|
|
|
memcpy(ret->post_data, post_data, post_data_len);
|
|
|
|
}
|
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
return ret;
|
2006-02-15 11:53:21 +01:00
|
|
|
}
|
2006-02-15 11:52:40 +01:00
|
|
|
|
2010-03-13 16:44:08 +01:00
|
|
|
static void on_before_navigate2(DocHost *This, LPCWSTR url, SAFEARRAY *post_data, LPWSTR headers, VARIANT_BOOL *cancel)
|
2006-02-15 11:52:40 +01:00
|
|
|
{
|
|
|
|
VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
|
|
|
|
DISPPARAMS dispparams;
|
|
|
|
VARIANTARG params[7];
|
|
|
|
|
|
|
|
dispparams.cArgs = 7;
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
dispparams.rgdispidNamedArgs = NULL;
|
|
|
|
dispparams.rgvarg = params;
|
|
|
|
|
2008-03-13 13:16:41 +01:00
|
|
|
This->busy = VARIANT_TRUE;
|
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
V_VT(params) = VT_BOOL|VT_BYREF;
|
|
|
|
V_BOOLREF(params) = cancel;
|
|
|
|
|
|
|
|
V_VT(params+1) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(params+1) = &var_headers;
|
|
|
|
V_VT(&var_headers) = VT_BSTR;
|
|
|
|
V_BSTR(&var_headers) = headers;
|
|
|
|
|
|
|
|
V_VT(params+2) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(params+2) = &var_post_data2;
|
|
|
|
V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(&var_post_data2) = &var_post_data;
|
|
|
|
|
2010-03-13 16:44:08 +01:00
|
|
|
if(post_data) {
|
2006-02-15 11:52:40 +01:00
|
|
|
V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
|
2010-03-13 16:44:08 +01:00
|
|
|
V_ARRAY(&var_post_data) = post_data;
|
|
|
|
}else {
|
|
|
|
V_VT(&var_post_data) = VT_EMPTY;
|
2006-02-15 11:52:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
V_VT(params+3) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(params+3) = &var_frame_name;
|
|
|
|
V_VT(&var_frame_name) = VT_BSTR;
|
|
|
|
V_BSTR(&var_frame_name) = NULL;
|
|
|
|
|
|
|
|
V_VT(params+4) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(params+4) = &var_flags;
|
|
|
|
V_VT(&var_flags) = VT_I4;
|
|
|
|
V_I4(&var_flags) = 0;
|
|
|
|
|
|
|
|
V_VT(params+5) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_VARIANTREF(params+5) = &var_url;
|
|
|
|
V_VT(&var_url) = VT_BSTR;
|
2006-03-06 15:53:31 +01:00
|
|
|
V_BSTR(&var_url) = SysAllocString(url);
|
2006-02-15 11:52:40 +01:00
|
|
|
|
|
|
|
V_VT(params+6) = (VT_DISPATCH);
|
2006-04-18 00:44:17 +02:00
|
|
|
V_DISPATCH(params+6) = This->disp;
|
2006-02-15 11:52:40 +01:00
|
|
|
|
2006-05-17 18:25:33 +02:00
|
|
|
call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
|
2006-02-15 11:52:40 +01:00
|
|
|
|
2006-03-06 15:53:31 +01:00
|
|
|
SysFreeString(V_BSTR(&var_url));
|
2006-02-15 11:52:40 +01:00
|
|
|
}
|
|
|
|
|
2008-01-03 16:41:31 +01:00
|
|
|
/* FIXME: urlmon should handle it */
|
2006-05-12 18:50:27 +02:00
|
|
|
static BOOL try_application_url(LPCWSTR url)
|
|
|
|
{
|
|
|
|
SHELLEXECUTEINFOW exec_info;
|
|
|
|
WCHAR app[64];
|
|
|
|
HKEY hkey;
|
|
|
|
DWORD res, type;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
|
|
|
|
|
|
|
|
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
if(res != ERROR_SUCCESS || type != REG_SZ)
|
|
|
|
return FALSE;
|
|
|
|
|
2011-07-27 13:38:43 +02:00
|
|
|
TRACE("opening application %s\n", debugstr_w(app));
|
2011-07-27 14:46:48 +02:00
|
|
|
|
2006-05-12 18:50:27 +02:00
|
|
|
memset(&exec_info, 0, sizeof(exec_info));
|
|
|
|
exec_info.cbSize = sizeof(exec_info);
|
|
|
|
exec_info.lpFile = url;
|
|
|
|
exec_info.nShow = SW_SHOW;
|
|
|
|
|
|
|
|
return ShellExecuteExW(&exec_info);
|
|
|
|
}
|
|
|
|
|
2008-02-27 18:56:53 +01:00
|
|
|
static HRESULT create_moniker(LPCWSTR url, IMoniker **mon)
|
|
|
|
{
|
|
|
|
WCHAR new_url[INTERNET_MAX_URL_LENGTH];
|
|
|
|
DWORD size;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(PathIsURLW(url))
|
|
|
|
return CreateURLMoniker(NULL, url, mon);
|
|
|
|
|
2011-05-15 00:34:03 +02:00
|
|
|
size = sizeof(new_url)/sizeof(WCHAR);
|
|
|
|
hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE);
|
|
|
|
TRACE("was %s got %s\n", debugstr_w(url), debugstr_w(new_url));
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("UrlApplyScheme failed: %08x\n", hres);
|
|
|
|
return hres;
|
2008-02-27 18:56:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return CreateURLMoniker(NULL, new_url, mon);
|
|
|
|
}
|
|
|
|
|
2008-01-03 16:37:28 +01:00
|
|
|
static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
|
|
|
|
IBindStatusCallback *callback)
|
|
|
|
{
|
2009-08-22 19:40:01 +02:00
|
|
|
IUnknown *unk = NULL;
|
2010-06-29 21:03:22 +02:00
|
|
|
WCHAR *display_name;
|
2008-01-03 16:37:28 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
if(mon) {
|
|
|
|
IMoniker_AddRef(mon);
|
|
|
|
}else {
|
2008-02-27 18:56:53 +01:00
|
|
|
hres = create_moniker(url, &mon);
|
|
|
|
if(FAILED(hres))
|
2008-01-18 21:53:39 +01:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2010-06-29 21:03:22 +02:00
|
|
|
hres = IMoniker_GetDisplayName(mon, 0, NULL, &display_name);
|
|
|
|
if(FAILED(hres)) {
|
2008-01-18 21:53:39 +01:00
|
|
|
FIXME("GetDisplayName failed: %08x\n", hres);
|
2010-06-29 21:03:22 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = set_dochost_url(This, display_name);
|
|
|
|
CoTaskMemFree(display_name);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2008-01-18 21:53:39 +01:00
|
|
|
|
2008-01-03 16:37:28 +01:00
|
|
|
IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
|
2010-11-13 17:47:58 +01:00
|
|
|
(IUnknown*)&This->IOleClientSite_iface);
|
2008-01-03 16:37:28 +01:00
|
|
|
|
2009-08-22 19:40:01 +02:00
|
|
|
hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
hres = S_OK;
|
|
|
|
if(unk)
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}else if(try_application_url(url)) {
|
|
|
|
hres = S_OK;
|
2008-01-03 16:40:38 +01:00
|
|
|
}else {
|
2009-08-22 19:40:01 +02:00
|
|
|
FIXME("BindToObject failed: %08x\n", hres);
|
2008-01-03 16:40:38 +01:00
|
|
|
}
|
2008-01-03 16:37:28 +01:00
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
IMoniker_Release(mon);
|
2008-01-03 16:37:28 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
static void html_window_navigate(DocHost *This, IHTMLPrivateWindow *window, BSTR url, BSTR headers, SAFEARRAY *post_data)
|
|
|
|
{
|
|
|
|
VARIANT headers_var, post_data_var;
|
|
|
|
BSTR empty_str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2010-06-29 21:03:22 +02:00
|
|
|
hres = set_dochost_url(This, url);
|
|
|
|
if(FAILED(hres))
|
2010-03-13 16:44:24 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
empty_str = SysAllocStringLen(NULL, 0);
|
|
|
|
|
|
|
|
if(headers) {
|
|
|
|
V_VT(&headers_var) = VT_BSTR;
|
|
|
|
V_BSTR(&headers_var) = headers;
|
|
|
|
}else {
|
|
|
|
V_VT(&headers_var) = VT_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(post_data) {
|
|
|
|
V_VT(&post_data_var) = VT_UI1|VT_ARRAY;
|
|
|
|
V_ARRAY(&post_data_var) = post_data;
|
|
|
|
}else {
|
|
|
|
V_VT(&post_data_var) = VT_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_doc_state(This, READYSTATE_LOADING);
|
|
|
|
hres = IHTMLPrivateWindow_SuperNavigate(window, url, empty_str, NULL, NULL, &post_data_var, &headers_var, 0);
|
|
|
|
SysFreeString(empty_str);
|
|
|
|
if(FAILED(hres))
|
|
|
|
WARN("SuprtNavigate failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
task_header_t header;
|
|
|
|
BSTR url;
|
|
|
|
BSTR headers;
|
|
|
|
SAFEARRAY *post_data;
|
|
|
|
BOOL async_notif;
|
|
|
|
} task_doc_navigate_t;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
static void doc_navigate_task_destr(task_header_t *t)
|
2010-03-13 16:44:24 +01:00
|
|
|
{
|
2011-05-26 17:01:31 +02:00
|
|
|
task_doc_navigate_t *task = (task_doc_navigate_t*)t;
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
SysFreeString(task->url);
|
|
|
|
SysFreeString(task->headers);
|
|
|
|
if(task->post_data)
|
|
|
|
SafeArrayDestroy(task->post_data);
|
2011-05-26 17:01:31 +02:00
|
|
|
heap_free(task);
|
2010-03-13 16:44:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void doc_navigate_proc(DocHost *This, task_header_t *t)
|
|
|
|
{
|
|
|
|
task_doc_navigate_t *task = (task_doc_navigate_t*)t;
|
|
|
|
IHTMLPrivateWindow *priv_window;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
if(!This->doc_navigate) {
|
|
|
|
ERR("Skip nav\n");
|
2010-03-13 16:44:24 +01:00
|
|
|
return;
|
2011-05-26 17:01:31 +02:00
|
|
|
}
|
2010-03-13 16:44:24 +01:00
|
|
|
|
|
|
|
if(task->async_notif) {
|
|
|
|
VARIANT_BOOL cancel = VARIANT_FALSE;
|
|
|
|
on_before_navigate2(This, task->url, task->post_data, task->headers, &cancel);
|
|
|
|
if(cancel) {
|
2011-07-27 13:38:43 +02:00
|
|
|
TRACE("Navigation canceled\n");
|
2010-03-13 16:44:24 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->doc_navigate, &IID_IHTMLPrivateWindow, (void**)&priv_window);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
html_window_navigate(This, priv_window, task->url, task->headers, task->post_data);
|
|
|
|
IHTMLPrivateWindow_Release(priv_window);
|
|
|
|
}else {
|
|
|
|
WARN("Could not get IHTMLPrivateWindow iface: %08x\n", hres);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT async_doc_navigate(DocHost *This, LPCWSTR url, LPCWSTR headers, PBYTE post_data, ULONG post_data_size,
|
|
|
|
BOOL async_notif)
|
|
|
|
{
|
|
|
|
task_doc_navigate_t *task;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
TRACE("%s\n", debugstr_w(url));
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
task = heap_alloc_zero(sizeof(*task));
|
|
|
|
if(!task)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
task->url = SysAllocString(url);
|
2011-05-26 17:01:31 +02:00
|
|
|
if(!task->url) {
|
|
|
|
doc_navigate_task_destr(&task->header);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2010-03-13 16:44:24 +01:00
|
|
|
|
|
|
|
if(headers) {
|
|
|
|
task->headers = SysAllocString(headers);
|
2011-05-26 17:01:31 +02:00
|
|
|
if(!task->headers) {
|
|
|
|
doc_navigate_task_destr(&task->header);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2010-03-13 16:44:24 +01:00
|
|
|
}
|
|
|
|
|
2010-04-25 13:36:45 +02:00
|
|
|
if(post_data) {
|
2010-03-13 16:44:24 +01:00
|
|
|
task->post_data = SafeArrayCreateVector(VT_UI1, 0, post_data_size);
|
2011-05-26 17:01:31 +02:00
|
|
|
if(!task->post_data) {
|
|
|
|
doc_navigate_task_destr(&task->header);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
memcpy(task->post_data->pvData, post_data, post_data_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!async_notif) {
|
|
|
|
VARIANT_BOOL cancel = VARIANT_FALSE;
|
|
|
|
|
|
|
|
on_before_navigate2(This, task->url, task->post_data, task->headers, &cancel);
|
|
|
|
if(cancel) {
|
2011-08-24 15:28:14 +02:00
|
|
|
TRACE("Navigation canceled\n");
|
2011-05-26 17:01:31 +02:00
|
|
|
doc_navigate_task_destr(&task->header);
|
2010-03-13 16:44:24 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task->async_notif = async_notif;
|
2011-05-26 17:02:03 +02:00
|
|
|
abort_dochost_tasks(This, doc_navigate_proc);
|
2011-05-26 17:01:31 +02:00
|
|
|
push_dochost_task(This, &task->header, doc_navigate_proc, doc_navigate_task_destr, FALSE);
|
2010-03-13 16:44:24 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
|
2006-02-15 11:53:21 +01:00
|
|
|
{
|
2008-01-03 16:43:03 +01:00
|
|
|
VARIANT_BOOL cancel = VARIANT_FALSE;
|
2010-03-13 16:44:08 +01:00
|
|
|
SAFEARRAY *post_data = NULL;
|
|
|
|
IBindCtx *bindctx;
|
2006-02-15 11:53:21 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2010-03-13 16:43:48 +01:00
|
|
|
set_doc_state(This, READYSTATE_LOADING);
|
2009-08-30 01:02:03 +02:00
|
|
|
|
2010-03-13 16:44:08 +01:00
|
|
|
if(bsc->post_data) {
|
|
|
|
post_data = SafeArrayCreateVector(VT_UI1, 0, bsc->post_data_len);
|
|
|
|
memcpy(post_data->pvData, post_data, bsc->post_data_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
on_before_navigate2(This, bsc->url, post_data, bsc->headers, &cancel);
|
|
|
|
if(post_data)
|
|
|
|
SafeArrayDestroy(post_data);
|
2008-01-03 16:43:03 +01:00
|
|
|
if(cancel) {
|
|
|
|
FIXME("Navigation canceled\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2008-01-03 16:37:28 +01:00
|
|
|
if(This->document)
|
|
|
|
deactivate_document(This);
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
CreateAsyncBindCtx(0, &bsc->IBindStatusCallback_iface, 0, &bindctx);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2008-01-18 21:53:39 +01:00
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
hres = bind_to_object(This, mon, bsc->url, bindctx, &bsc->IBindStatusCallback_iface);
|
2008-01-18 21:53:39 +01:00
|
|
|
|
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2007-03-09 16:55:07 +01:00
|
|
|
IBindCtx_Release(bindctx);
|
2006-02-15 11:53:21 +01:00
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2008-01-18 21:54:16 +01:00
|
|
|
typedef struct {
|
|
|
|
task_header_t header;
|
|
|
|
BindStatusCallback *bsc;
|
|
|
|
} task_navigate_bsc_t;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
static void navigate_bsc_task_destr(task_header_t *t)
|
|
|
|
{
|
|
|
|
task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
|
|
|
|
|
|
|
|
IBindStatusCallback_Release(&task->bsc->IBindStatusCallback_iface);
|
|
|
|
heap_free(task);
|
|
|
|
}
|
|
|
|
|
2008-01-18 21:54:16 +01:00
|
|
|
static void navigate_bsc_proc(DocHost *This, task_header_t *t)
|
|
|
|
{
|
|
|
|
task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
|
|
|
|
|
|
|
|
if(!This->hwnd)
|
|
|
|
create_doc_view_hwnd(This);
|
|
|
|
|
|
|
|
navigate_bsc(This, task->bsc, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-09 20:12:39 +02:00
|
|
|
HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
|
2007-08-29 23:20:28 +02:00
|
|
|
const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
|
2006-10-19 23:14:00 +02:00
|
|
|
{
|
|
|
|
PBYTE post_data = NULL;
|
|
|
|
ULONG post_data_len = 0;
|
|
|
|
LPWSTR headers = NULL;
|
2010-03-13 16:44:43 +01:00
|
|
|
HRESULT hres = S_OK;
|
2006-10-19 23:14:00 +02:00
|
|
|
|
|
|
|
TRACE("navigating to %s\n", debugstr_w(url));
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
if((Flags && V_VT(Flags) != VT_EMPTY)
|
2006-10-19 23:14:00 +02:00
|
|
|
|| (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
|
2007-10-27 20:01:06 +02:00
|
|
|
FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
|
|
|
|
Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
|
|
|
|
TargetFrameName ? V_VT(TargetFrameName) : -1);
|
2006-10-19 23:14:00 +02:00
|
|
|
|
2010-08-16 12:38:29 +02:00
|
|
|
if(PostData && V_VT(PostData) == (VT_ARRAY | VT_UI1) && V_ARRAY(PostData)) {
|
2010-07-22 13:58:45 +02:00
|
|
|
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
|
|
|
|
post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
|
2006-10-19 23:14:00 +02:00
|
|
|
}
|
|
|
|
|
2010-07-22 13:58:45 +02:00
|
|
|
if(Headers && V_VT(Headers) == VT_BSTR) {
|
2006-10-19 23:14:00 +02:00
|
|
|
headers = V_BSTR(Headers);
|
|
|
|
TRACE("Headers: %s\n", debugstr_w(headers));
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:44:43 +01:00
|
|
|
set_doc_state(This, READYSTATE_LOADING);
|
|
|
|
This->ready_state = READYSTATE_LOADING;
|
|
|
|
|
|
|
|
if(This->doc_navigate) {
|
2010-06-28 12:52:03 +02:00
|
|
|
WCHAR new_url[INTERNET_MAX_URL_LENGTH];
|
|
|
|
|
|
|
|
if(PathIsURLW(url)) {
|
|
|
|
new_url[0] = 0;
|
|
|
|
}else {
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
size = sizeof(new_url)/sizeof(WCHAR);
|
2010-08-19 21:08:12 +02:00
|
|
|
hres = UrlApplySchemeW(url, new_url, &size,
|
2011-05-15 00:38:36 +02:00
|
|
|
URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE | URL_APPLY_DEFAULT);
|
2010-06-28 12:52:03 +02:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("UrlApplyScheme failed: %08x\n", hres);
|
|
|
|
new_url[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = async_doc_navigate(This, *new_url ? new_url : url, headers, post_data,
|
|
|
|
post_data_len, TRUE);
|
2010-03-13 16:44:43 +01:00
|
|
|
}else {
|
|
|
|
task_navigate_bsc_t *task;
|
|
|
|
|
|
|
|
task = heap_alloc(sizeof(*task));
|
|
|
|
task->bsc = create_callback(This, url, post_data, post_data_len, headers);
|
2011-05-26 17:01:31 +02:00
|
|
|
push_dochost_task(This, &task->header, navigate_bsc_proc, navigate_bsc_task_destr, This->url == NULL);
|
2010-03-13 16:44:43 +01:00
|
|
|
}
|
2008-01-03 16:37:28 +01:00
|
|
|
|
2006-10-19 23:14:00 +02:00
|
|
|
if(post_data)
|
|
|
|
SafeArrayUnaccessData(V_ARRAY(PostData));
|
|
|
|
|
2010-03-13 16:44:43 +01:00
|
|
|
return hres;
|
2006-10-19 23:14:00 +02:00
|
|
|
}
|
|
|
|
|
2007-01-29 19:12:56 +01:00
|
|
|
static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
|
|
|
|
IBindStatusCallback *callback)
|
2006-02-15 11:52:40 +01:00
|
|
|
{
|
|
|
|
IHttpNegotiate *http_negotiate;
|
2008-01-18 21:53:39 +01:00
|
|
|
BindStatusCallback *bsc;
|
2006-02-15 11:52:40 +01:00
|
|
|
PBYTE post_data = NULL;
|
|
|
|
ULONG post_data_len = 0;
|
2008-01-18 21:53:39 +01:00
|
|
|
LPWSTR headers = NULL, url;
|
2006-02-15 11:52:40 +01:00
|
|
|
BINDINFO bindinfo;
|
|
|
|
DWORD bindf = 0;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
TRACE("\n");
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
|
|
|
|
if(FAILED(hres))
|
|
|
|
FIXME("GetDisplayName failed: %08x\n", hres);
|
|
|
|
|
2006-02-15 11:52:40 +01:00
|
|
|
hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
|
|
|
|
(void**)&http_negotiate);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
static const WCHAR null_string[] = {0};
|
|
|
|
|
|
|
|
IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
|
|
|
|
&headers);
|
|
|
|
IHttpNegotiate_Release(http_negotiate);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&bindinfo, 0, sizeof(bindinfo));
|
|
|
|
bindinfo.cbSize = sizeof(bindinfo);
|
|
|
|
|
|
|
|
hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
|
2006-03-01 22:06:11 +01:00
|
|
|
dump_BINDINFO(&bindinfo);
|
2006-02-15 11:52:40 +01:00
|
|
|
if(bindinfo.dwBindVerb == BINDVERB_POST) {
|
2006-09-29 12:42:10 +02:00
|
|
|
post_data_len = bindinfo.cbstgmedData;
|
2006-02-15 11:52:40 +01:00
|
|
|
if(post_data_len)
|
|
|
|
post_data = bindinfo.stgmedData.u.hGlobal;
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
if(This->doc_navigate) {
|
|
|
|
hres = async_doc_navigate(This, url, headers, post_data, post_data_len, FALSE);
|
|
|
|
}else {
|
|
|
|
bsc = create_callback(This, url, post_data, post_data_len, headers);
|
|
|
|
hres = navigate_bsc(This, bsc, mon);
|
2010-11-13 17:48:21 +01:00
|
|
|
IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);
|
2010-03-13 16:44:24 +01:00
|
|
|
}
|
2008-01-18 21:53:39 +01:00
|
|
|
|
|
|
|
CoTaskMemFree(url);
|
2008-01-03 16:37:28 +01:00
|
|
|
CoTaskMemFree(headers);
|
|
|
|
ReleaseBindInfo(&bindinfo);
|
2006-03-06 15:53:31 +01:00
|
|
|
|
2008-01-03 16:37:28 +01:00
|
|
|
return hres;
|
2006-02-15 11:52:40 +01:00
|
|
|
}
|
|
|
|
|
2007-09-09 20:13:31 +02:00
|
|
|
HRESULT go_home(DocHost *This)
|
|
|
|
{
|
2008-11-28 10:44:42 +01:00
|
|
|
HKEY hkey;
|
|
|
|
DWORD res, type, size;
|
|
|
|
WCHAR wszPageName[MAX_PATH];
|
2007-09-09 20:13:31 +02:00
|
|
|
static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
2008-11-28 10:44:42 +01:00
|
|
|
static const WCHAR wszStartPage[] = {'S','t','a','r','t',' ','P','a','g','e',0};
|
|
|
|
static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
|
|
|
|
'M','a','i','n',0};
|
|
|
|
|
|
|
|
res = RegOpenKeyW(HKEY_CURRENT_USER, wszSubKey, &hkey);
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
size = sizeof(wszPageName);
|
2008-12-08 19:53:39 +01:00
|
|
|
res = RegQueryValueExW(hkey, wszStartPage, NULL, &type, (LPBYTE)wszPageName, &size);
|
2008-11-28 10:44:42 +01:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
if (res != ERROR_SUCCESS || type != REG_SZ)
|
|
|
|
return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
|
2007-09-09 20:13:31 +02:00
|
|
|
|
2008-11-28 10:44:42 +01:00
|
|
|
return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL);
|
2007-09-09 20:13:31 +02:00
|
|
|
}
|
|
|
|
|
2010-12-17 03:28:06 +01:00
|
|
|
HRESULT get_location_url(DocHost *This, BSTR *ret)
|
|
|
|
{
|
|
|
|
FIXME("semi-stub\n");
|
|
|
|
|
|
|
|
*ret = This->url ? SysAllocString(This->url) : SysAllocStringLen(NULL, 0);
|
|
|
|
if(!*ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
return This->url ? S_OK : S_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
static inline HlinkFrame *impl_from_IHlinkFrame(IHlinkFrame *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface);
|
2010-11-13 17:48:21 +01:00
|
|
|
}
|
2006-02-08 12:42:23 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2010-07-27 18:14:54 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer, riid, ppv);
|
2006-02-08 12:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2010-07-27 18:14:54 +02:00
|
|
|
return IUnknown_AddRef(This->outer);
|
2006-02-08 12:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2010-07-27 18:14:54 +02:00
|
|
|
return IUnknown_Release(This->outer);
|
2006-02-08 12:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
|
|
|
|
IHlinkBrowseContext *pihlbc)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2006-02-08 12:42:23 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, pihlbc);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
|
|
|
|
IHlinkBrowseContext **ppihlbc)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2006-02-08 12:42:23 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppihlbc);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
|
|
|
|
IBindStatusCallback *pibsc, IHlink *pihlNavigate)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2006-02-15 11:52:40 +01:00
|
|
|
IMoniker *mon;
|
|
|
|
LPWSTR location = NULL;
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
|
2006-02-15 11:52:40 +01:00
|
|
|
|
|
|
|
if(grfHLNF)
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
|
2006-02-15 11:52:40 +01:00
|
|
|
|
|
|
|
/* Windows calls GetTargetFrameName here. */
|
|
|
|
|
|
|
|
IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
|
|
|
|
|
|
|
|
if(location) {
|
|
|
|
FIXME("location = %s\n", debugstr_w(location));
|
|
|
|
CoTaskMemFree(location);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Windows calls GetHlinkSite here */
|
|
|
|
|
2006-03-01 22:06:11 +01:00
|
|
|
if(grfHLNF & HLNF_OPENINNEWWINDOW) {
|
|
|
|
FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2010-07-27 18:14:54 +02:00
|
|
|
return navigate_hlink(This->doc_host, mon, pbc, pibsc);
|
2006-02-08 12:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
|
|
|
|
IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
|
2006-02-08 12:42:23 +01:00
|
|
|
debugstr_w(pwzFriendlyName), dwreserved);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
|
|
|
|
IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_IHlinkFrame(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
|
2006-02-08 12:42:23 +01:00
|
|
|
debugstr_w(pwzFriendlyName));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHlinkFrameVtbl HlinkFrameVtbl = {
|
|
|
|
HlinkFrame_QueryInterface,
|
|
|
|
HlinkFrame_AddRef,
|
|
|
|
HlinkFrame_Release,
|
|
|
|
HlinkFrame_SetBrowseContext,
|
|
|
|
HlinkFrame_GetBrowseContext,
|
|
|
|
HlinkFrame_Navigate,
|
|
|
|
HlinkFrame_OnNavigate,
|
|
|
|
HlinkFrame_UpdateHlink
|
|
|
|
};
|
|
|
|
|
2010-11-13 17:48:21 +01:00
|
|
|
static inline HlinkFrame *impl_from_ITargetFrame2(ITargetFrame2 *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface);
|
2010-11-13 17:48:21 +01:00
|
|
|
}
|
2010-05-20 13:47:02 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_QueryInterface(ITargetFrame2 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-07-27 18:15:18 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer, riid, ppv);
|
2010-05-20 13:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TargetFrame2_AddRef(ITargetFrame2 *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-07-27 18:15:18 +02:00
|
|
|
return IUnknown_AddRef(This->outer);
|
2010-05-20 13:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TargetFrame2_Release(ITargetFrame2 *iface)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-07-27 18:15:18 +02:00
|
|
|
return IUnknown_Release(This->outer);
|
2010-05-20 13:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_SetFrameName(ITargetFrame2 *iface, LPCWSTR pszFrameName)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameName));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetFrameName(ITargetFrame2 *iface, LPWSTR *ppszFrameName)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppszFrameName);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetParentFrame(ITargetFrame2 *iface, IUnknown **ppunkParent)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppunkParent);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_SetFrameSrc(ITargetFrame2 *iface, LPCWSTR pszFrameSrc)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameSrc));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetFrameSrc(ITargetFrame2 *iface, LPWSTR *ppszFrameSrc)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->()\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetFramesContainer(ITargetFrame2 *iface, IOleContainer **ppContainer)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppContainer);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_SetFrameOptions(ITargetFrame2 *iface, DWORD dwFlags)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%x)\n", This, dwFlags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetFrameOptions(ITargetFrame2 *iface, DWORD *pdwFlags)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pdwFlags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_SetFrameMargins(ITargetFrame2 *iface, DWORD dwWidth, DWORD dwHeight)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%d %d)\n", This, dwWidth, dwHeight);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetFrameMargins(ITargetFrame2 *iface, DWORD *pdwWidth, DWORD *pdwHeight)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pdwWidth, pdwHeight);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_FindFrame(ITargetFrame2 *iface, LPCWSTR pszTargetName, DWORD dwFlags, IUnknown **ppunkTargetFrame)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(pszTargetName), dwFlags, ppunkTargetFrame);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TargetFrame2_GetTargetAlias(ITargetFrame2 *iface, LPCWSTR pszTargetName, LPWSTR *ppszTargetAlias)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
HlinkFrame *This = impl_from_ITargetFrame2(iface);
|
2010-05-20 13:47:02 +02:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(pszTargetName), ppszTargetAlias);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ITargetFrame2Vtbl TargetFrame2Vtbl = {
|
|
|
|
TargetFrame2_QueryInterface,
|
|
|
|
TargetFrame2_AddRef,
|
|
|
|
TargetFrame2_Release,
|
|
|
|
TargetFrame2_SetFrameName,
|
|
|
|
TargetFrame2_GetFrameName,
|
|
|
|
TargetFrame2_GetParentFrame,
|
|
|
|
TargetFrame2_SetFrameSrc,
|
|
|
|
TargetFrame2_GetFrameSrc,
|
|
|
|
TargetFrame2_GetFramesContainer,
|
|
|
|
TargetFrame2_SetFrameOptions,
|
|
|
|
TargetFrame2_GetFrameOptions,
|
|
|
|
TargetFrame2_SetFrameMargins,
|
|
|
|
TargetFrame2_GetFrameMargins,
|
|
|
|
TargetFrame2_FindFrame,
|
|
|
|
TargetFrame2_GetTargetAlias
|
|
|
|
};
|
|
|
|
|
2010-07-27 18:14:54 +02:00
|
|
|
BOOL HlinkFrame_QI(HlinkFrame *This, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
|
2010-11-13 17:48:21 +01:00
|
|
|
*ppv = &This->IHlinkFrame_iface;
|
2010-07-27 18:15:18 +02:00
|
|
|
}else if(IsEqualGUID(&IID_ITargetFrame2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv);
|
2010-11-13 17:48:21 +01:00
|
|
|
*ppv = &This->ITargetFrame2_iface;
|
2010-07-27 18:14:54 +02:00
|
|
|
}else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host)
|
|
|
|
{
|
2010-11-13 17:48:21 +01:00
|
|
|
This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl;
|
|
|
|
This->ITargetFrame2_iface.lpVtbl = &TargetFrame2Vtbl;
|
2010-07-27 18:14:54 +02:00
|
|
|
|
|
|
|
This->outer = outer;
|
|
|
|
This->doc_host = doc_host;
|
|
|
|
}
|