Author: cwittich
Date: Sun Mar 21 16:08:31 2010
New Revision: 46302
URL:
http://svn.reactos.org/svn/reactos?rev=46302&view=rev
Log:
[SHDOCVW]
sync shdocvw with wine 1.1.41
Modified:
trunk/reactos/dll/win32/shdocvw/dochost.c
trunk/reactos/dll/win32/shdocvw/iexplore.c
trunk/reactos/dll/win32/shdocvw/navigate.c
trunk/reactos/dll/win32/shdocvw/oleobject.c
trunk/reactos/dll/win32/shdocvw/shdocvw.h
trunk/reactos/dll/win32/shdocvw/webbrowser.c
Modified: trunk/reactos/dll/win32/shdocvw/dochost.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/dochost.…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/dochost.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/dochost.c [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -21,8 +21,13 @@
#include "hlink.h"
#include "exdispid.h"
#include "mshtml.h"
+#include "initguid.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
+
+#define DOCHOST_DOCCANNAVIGATE 0
static ATOM doc_view_atom = 0;
@@ -154,16 +159,23 @@
This->is_prop_notif = set;
}
+void set_doc_state(DocHost *This, READYSTATE doc_state)
+{
+ This->doc_state = doc_state;
+ if(doc_state > This->ready_state)
+ This->ready_state = doc_state;
+}
+
static void update_ready_state(DocHost *This, READYSTATE ready_state)
{
- if(ready_state > READYSTATE_LOADING && This->ready_state <=
READYSTATE_LOADING) {
+ if(ready_state > READYSTATE_LOADING && This->doc_state <=
READYSTATE_LOADING)
notif_complete(This, DISPID_NAVIGATECOMPLETE2);
- This->ready_state = ready_state;
- }
-
- if(ready_state == READYSTATE_COMPLETE && This->ready_state <
READYSTATE_COMPLETE) {
- This->ready_state = READYSTATE_COMPLETE;
+
+ if(ready_state == READYSTATE_COMPLETE && This->doc_state <
READYSTATE_COMPLETE) {
+ set_doc_state(This, READYSTATE_COMPLETE);
notif_complete(This, DISPID_DOCUMENTCOMPLETE);
+ }else {
+ set_doc_state(This, ready_state);
}
}
@@ -236,7 +248,7 @@
if(SUCCEEDED(hres)) {
if(ready_state == READYSTATE_COMPLETE)
push_ready_state_task(This, READYSTATE_COMPLETE);
- else
+ if(ready_state != READYSTATE_COMPLETE || This->doc_navigate)
advise_prop_notif(This, TRUE);
}
@@ -314,6 +326,11 @@
IHlinkTarget *hlink = NULL;
HRESULT hres;
+ if(This->doc_navigate) {
+ IUnknown_Release(This->doc_navigate);
+ This->doc_navigate = NULL;
+ }
+
if(This->is_prop_notif)
advise_prop_notif(This, FALSE);
@@ -425,8 +442,34 @@
VARIANT *pvaOut)
{
DocHost *This = OLECMD_THIS(iface);
- FIXME("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup),
nCmdID,
- nCmdexecopt, pvaIn, pvaOut);
+
+ TRACE("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup),
nCmdID,
+ nCmdexecopt, debugstr_variant(pvaIn), debugstr_variant(pvaOut));
+
+ if(!pguidCmdGroup) {
+ FIXME("Unimplemented cmdid %d\n", nCmdID);
+ return E_NOTIMPL;
+ }
+
+ if(IsEqualGUID(pguidCmdGroup, &CGID_DocHostCmdPriv)) {
+ switch(nCmdID) {
+ case DOCHOST_DOCCANNAVIGATE:
+ if(!pvaIn || V_VT(pvaIn) != VT_UNKNOWN)
+ return E_INVALIDARG;
+
+ if(This->doc_navigate)
+ IUnknown_Release(This->doc_navigate);
+ IUnknown_AddRef(V_UNKNOWN(pvaIn));
+ This->doc_navigate = V_UNKNOWN(pvaIn);
+ return S_OK;
+
+ default:
+ FIXME("unsupported command %d of CGID_DocHostCmdPriv\n", nCmdID);
+ return E_NOTIMPL;
+ }
+ }
+
+ FIXME("Unimplemented group %s\n", debugstr_guid(pguidCmdGroup));
return E_NOTIMPL;
}
@@ -709,7 +752,7 @@
if(FAILED(hres))
return hres;
- if(ready_state == READYSTATE_COMPLETE)
+ if(ready_state == READYSTATE_COMPLETE && !This->doc_navigate)
advise_prop_notif(This, FALSE);
push_ready_state_task(This, ready_state);
Modified: trunk/reactos/dll/win32/shdocvw/iexplore.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/iexplore…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/iexplore.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/iexplore.c [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -163,7 +163,7 @@
TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
- ret = heap_alloc(sizeof(InternetExplorer));
+ ret = heap_alloc_zero(sizeof(InternetExplorer));
ret->ref = 0;
ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
Modified: trunk/reactos/dll/win32/shdocvw/navigate.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/navigate…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/navigate.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/navigate.c [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -27,6 +27,7 @@
#include "winreg.h"
#include "shlwapi.h"
#include "wininet.h"
+#include "mshtml.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
@@ -378,8 +379,7 @@
return ret;
}
-static void on_before_navigate2(DocHost *This, LPCWSTR url, const BYTE *post_data,
- ULONG post_data_len, LPWSTR headers, VARIANT_BOOL
*cancel)
+static void on_before_navigate2(DocHost *This, LPCWSTR url, SAFEARRAY *post_data, LPWSTR
headers, VARIANT_BOOL *cancel)
{
VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2,
var_headers;
DISPPARAMS dispparams;
@@ -404,18 +404,12 @@
V_VARIANTREF(params+2) = &var_post_data2;
V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
V_VARIANTREF(&var_post_data2) = &var_post_data;
- VariantInit(&var_post_data);
-
- if(post_data_len) {
- SAFEARRAYBOUND bound = {post_data_len, 0};
- void *data;
-
+
+ if(post_data) {
V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
- V_ARRAY(&var_post_data) = SafeArrayCreate(VT_UI1, 1, &bound);
-
- SafeArrayAccessData(V_ARRAY(&var_post_data), &data);
- memcpy(data, post_data, post_data_len);
- SafeArrayUnaccessData(V_ARRAY(&var_post_data));
+ V_ARRAY(&var_post_data) = post_data;
+ }else {
+ V_VT(&var_post_data) = VT_EMPTY;
}
V_VT(params+3) = (VT_BYREF|VT_VARIANT);
@@ -439,8 +433,6 @@
call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
SysFreeString(V_BSTR(&var_url));
- if(post_data_len)
- SafeArrayDestroy(V_ARRAY(&var_post_data));
}
/* FIXME: urlmon should handle it */
@@ -543,15 +535,153 @@
return S_OK;
}
+static void html_window_navigate(DocHost *This, IHTMLPrivateWindow *window, BSTR url,
BSTR headers, SAFEARRAY *post_data)
+{
+ VARIANT headers_var, post_data_var;
+ WCHAR *new_url;
+ BSTR empty_str;
+ DWORD size;
+ HRESULT hres;
+
+ size = (strlenW(url)+1)*sizeof(WCHAR);
+ new_url = CoTaskMemAlloc(size);
+ if(!new_url)
+ return;
+ memcpy(new_url, url, size);
+ CoTaskMemFree(This->url);
+ This->url = new_url;
+
+ 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;
+
+static HRESULT free_doc_navigate_task(task_doc_navigate_t *task, BOOL free_task)
+{
+ SysFreeString(task->url);
+ SysFreeString(task->headers);
+ if(task->post_data)
+ SafeArrayDestroy(task->post_data);
+ if(free_task)
+ heap_free(task);
+ return E_OUTOFMEMORY;
+}
+
+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;
+
+ if(!This->doc_navigate)
+ return;
+
+ if(task->async_notif) {
+ VARIANT_BOOL cancel = VARIANT_FALSE;
+ on_before_navigate2(This, task->url, task->post_data, task->headers,
&cancel);
+ if(cancel) {
+ TRACE("Navigation calnceled\n");
+ free_doc_navigate_task(task, FALSE);
+ 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);
+ }
+
+ free_doc_navigate_task(task, FALSE);
+}
+
+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;
+
+ task = heap_alloc_zero(sizeof(*task));
+ if(!task)
+ return E_OUTOFMEMORY;
+
+ task->url = SysAllocString(url);
+ if(!task->url)
+ return free_doc_navigate_task(task, TRUE);
+
+ if(headers) {
+ task->headers = SysAllocString(headers);
+ if(!task->headers)
+ return free_doc_navigate_task(task, TRUE);
+ }
+
+ if(task->post_data) {
+ task->post_data = SafeArrayCreateVector(VT_UI1, 0, post_data_size);
+ if(!task->post_data)
+ return free_doc_navigate_task(task, TRUE);
+ 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) {
+ TRACE("Navigation calnceled\n");
+ free_doc_navigate_task(task, TRUE);
+ return S_OK;
+ }
+ }
+
+ task->async_notif = async_notif;
+ push_dochost_task(This, &task->header, doc_navigate_proc, FALSE);
+ return S_OK;
+}
+
static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
{
+ VARIANT_BOOL cancel = VARIANT_FALSE;
+ SAFEARRAY *post_data = NULL;
IBindCtx *bindctx;
- VARIANT_BOOL cancel = VARIANT_FALSE;
HRESULT hres;
- This->ready_state = READYSTATE_LOADING;
-
- on_before_navigate2(This, bsc->url, bsc->post_data, bsc->post_data_len,
bsc->headers, &cancel);
+ set_doc_state(This, READYSTATE_LOADING);
+
+ 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);
if(cancel) {
FIXME("Navigation canceled\n");
return S_OK;
@@ -596,10 +726,10 @@
HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT
*Headers)
{
- task_navigate_bsc_t *task;
PBYTE post_data = NULL;
ULONG post_data_len = 0;
LPWSTR headers = NULL;
+ HRESULT hres = S_OK;
TRACE("navigating to %s\n", debugstr_w(url));
@@ -626,15 +756,23 @@
TRACE("Headers: %s\n", debugstr_w(headers));
}
- task = heap_alloc(sizeof(*task));
- task->bsc = create_callback(This, url, post_data, post_data_len, headers);
+ set_doc_state(This, READYSTATE_LOADING);
+ This->ready_state = READYSTATE_LOADING;
+
+ if(This->doc_navigate) {
+ hres = async_doc_navigate(This, url, headers, post_data, post_data_len, TRUE);
+ }else {
+ task_navigate_bsc_t *task;
+
+ task = heap_alloc(sizeof(*task));
+ task->bsc = create_callback(This, url, post_data, post_data_len, headers);
+ push_dochost_task(This, &task->header, navigate_bsc_proc, This->url ==
NULL);
+ }
if(post_data)
SafeArrayUnaccessData(V_ARRAY(PostData));
- push_dochost_task(This, &task->header, navigate_bsc_proc, This->url ==
NULL);
-
- return S_OK;
+ return hres;
}
static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
@@ -649,6 +787,10 @@
DWORD bindf = 0;
HRESULT hres;
+ hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
+ if(FAILED(hres))
+ FIXME("GetDisplayName failed: %08x\n", hres);
+
hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
(void**)&http_negotiate);
if(SUCCEEDED(hres)) {
@@ -670,16 +812,15 @@
post_data = bindinfo.stgmedData.u.hGlobal;
}
- hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
- if(FAILED(hres))
- FIXME("GetDisplayName failed: %08x\n", hres);
-
- bsc = create_callback(This, url, post_data, post_data_len, headers);
+ 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);
+ IBindStatusCallback_Release(BINDSC(bsc));
+ }
+
CoTaskMemFree(url);
-
- hres = navigate_bsc(This, bsc, mon);
-
- IBindStatusCallback_Release(BINDSC(bsc));
CoTaskMemFree(headers);
ReleaseBindInfo(&bindinfo);
Modified: trunk/reactos/dll/win32/shdocvw/oleobject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/oleobjec…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/oleobject.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/oleobject.c [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -960,17 +960,6 @@
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
- This->client = NULL;
- This->inplace = NULL;
- This->container = NULL;
- This->frame_hwnd = NULL;
- This->uiwindow = NULL;
- This->shell_embedding_hwnd = NULL;
-
- memset(&This->pos_rect, 0, sizeof(RECT));
- memset(&This->clip_rect, 0, sizeof(RECT));
- memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
-
/* Default size is 50x20 pixels, in himetric units */
This->extent.cx = MulDiv( 50, 2540, dpi_x );
This->extent.cy = MulDiv( 20, 2540, dpi_y );
Modified: trunk/reactos/dll/win32/shdocvw/shdocvw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/shdocvw.…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/shdocvw.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/shdocvw.h [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -92,6 +92,7 @@
IUnknown *document;
IOleDocumentView *view;
+ IUnknown *doc_navigate;
HWND hwnd;
HWND frame_hwnd;
@@ -103,6 +104,7 @@
VARIANT_BOOL busy;
READYSTATE ready_state;
+ READYSTATE doc_state;
DWORD prop_notif_cookie;
BOOL is_prop_notif;
@@ -222,6 +224,7 @@
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
HRESULT go_home(DocHost*);
+void set_doc_state(DocHost*,READYSTATE);
#define WM_DOCHOSTTASK (WM_USER+0x300)
void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
@@ -260,6 +263,11 @@
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline void *heap_alloc_zero(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
static inline void *heap_realloc(void *mem, size_t len)
Modified: trunk/reactos/dll/win32/shdocvw/webbrowser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/webbrows…
==============================================================================
--- trunk/reactos/dll/win32/shdocvw/webbrowser.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shdocvw/webbrowser.c [iso-8859-1] Sun Mar 21 16:08:31 2010
@@ -1115,23 +1115,20 @@
TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv,
version);
- ret = heap_alloc(sizeof(WebBrowser));
+ ret = heap_alloc_zero(sizeof(WebBrowser));
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
- ret->ref = 0;
+ ret->ref = 1;
ret->version = version;
DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
- ret->register_browser = VARIANT_FALSE;
ret->visible = VARIANT_TRUE;
ret->menu_bar = VARIANT_TRUE;
ret->address_bar = VARIANT_TRUE;
ret->status_bar = VARIANT_TRUE;
ret->tool_bar = VARIANT_TRUE;
- ret->full_screen = VARIANT_FALSE;
- ret->theater_mode = VARIANT_FALSE;
WebBrowser_OleObject_Init(ret);
WebBrowser_ViewObject_Init(ret);
@@ -1139,14 +1136,11 @@
WebBrowser_ClassInfo_Init(ret);
WebBrowser_HlinkFrame_Init(ret);
+ SHDOCVW_LockModule();
+
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
- if(SUCCEEDED(hres)) {
- SHDOCVW_LockModule();
- }else {
- heap_free(ret);
- return hres;
- }
-
+
+ IWebBrowser2_Release(WEBBROWSER(ret));
return hres;
}