Jacek Caban : mshtml: Added beginning support for loading data by an ActiveX object.
Alexandre Julliard
julliard at winehq.org
Fri Dec 10 11:57:01 CST 2010
Module: wine
Branch: master
Commit: dbbcbd59a5df92e46ac6ba29c4802db292e962bb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dbbcbd59a5df92e46ac6ba29c4802db292e962bb
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Dec 10 16:35:15 2010 +0100
mshtml: Added beginning support for loading data by an ActiveX object.
---
dlls/mshtml/npplugin.c | 16 ++++----
dlls/mshtml/pluginhost.c | 81 +++++++++++++++++++++++++++++++++++++++++++++-
dlls/mshtml/pluginhost.h | 4 ++-
3 files changed, 91 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c
index 93e22da..ad88da2 100644
--- a/dlls/mshtml/npplugin.c
+++ b/dlls/mshtml/npplugin.c
@@ -203,31 +203,30 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid)
return ret;
}
-static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem)
+static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem, CLSID *clsid)
{
IClassFactoryEx *cfex;
IClassFactory *cf;
IUnknown *obj;
DWORD policy;
- CLSID guid;
HRESULT hres;
- if(!get_elem_clsid(nselem, &guid)) {
+ if(!get_elem_clsid(nselem, clsid)) {
WARN("Could not determine element CLSID\n");
return NULL;
}
- TRACE("clsid %s\n", debugstr_guid(&guid));
+ TRACE("clsid %s\n", debugstr_guid(clsid));
policy = 0;
hres = IInternetHostSecurityManager_ProcessUrlAction(HOSTSECMGR(window->doc), URLACTION_ACTIVEX_RUN,
- (BYTE*)&policy, sizeof(policy), (BYTE*)&guid, sizeof(GUID), 0, 0);
+ (BYTE*)&policy, sizeof(policy), (BYTE*)clsid, sizeof(GUID), 0, 0);
if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
WARN("ProcessUrlAction returned %08x %x\n", hres, policy);
return NULL;
}
- hres = CoGetClassObject(&guid, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void**)&cf);
+ hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void**)&cf);
if(FAILED(hres))
return NULL;
@@ -250,6 +249,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
nsIDOMElement *nselem;
HTMLWindow *window;
IUnknown *obj;
+ CLSID clsid;
NPError err = NPERR_NO_ERROR;
TRACE("(%s %p %x %d %p %p %p)\n", debugstr_a(pluginType), instance, mode, argc, argn, argv, saved);
@@ -267,12 +267,12 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
return NPERR_GENERIC_ERROR;
}
- obj = create_activex_object(window, nselem);
+ obj = create_activex_object(window, nselem, &clsid);
if(obj) {
PluginHost *host;
HRESULT hres;
- hres = create_plugin_host(window->doc, nselem, obj, &host);
+ hres = create_plugin_host(window->doc, nselem, obj, &clsid, &host);
nsIDOMElement_Release(nselem);
IUnknown_Release(obj);
if(SUCCEEDED(hres))
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index 785abdd..cfd40fa 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -39,6 +39,81 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
const IID IID_HTMLPluginContainer =
{0xbd7a6050,0xb373,0x4f6f,{0xa4,0x93,0xdd,0x40,0xc5,0x23,0xa8,0x6a}};
+static BOOL check_load_safety(PluginHost *host)
+{
+ DWORD policy_size, policy;
+ struct CONFIRMSAFETY cs;
+ BYTE *ppolicy;
+ HRESULT hres;
+
+ cs.clsid = host->clsid;
+ cs.pUnk = host->plugin_unk;
+ cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
+
+ hres = IInternetHostSecurityManager_QueryCustomPolicy(HOSTSECMGR(host->doc),
+ &GUID_CUSTOM_CONFIRMOBJECTSAFETY, &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
+ if(FAILED(hres))
+ return FALSE;
+
+ policy = *(DWORD*)ppolicy;
+ CoTaskMemFree(ppolicy);
+ return policy == URLPOLICY_ALLOW;
+}
+
+static HRESULT create_prop_bag(IPropertyBag **ret) {
+ *ret = NULL;
+ return S_OK;
+}
+
+static void load_prop_bag(PluginHost *host, IPersistPropertyBag *persist_prop_bag)
+{
+ IPropertyBag *prop_bag;
+ HRESULT hres;
+
+ hres = create_prop_bag(&prop_bag);
+ if(FAILED(hres))
+ return;
+
+ if(prop_bag && !check_load_safety(host)) {
+ IPropertyBag_Release(prop_bag);
+ prop_bag = NULL;
+ }
+
+ if(prop_bag) {
+ hres = IPersistPropertyBag_Load(persist_prop_bag, prop_bag, NULL);
+ IPropertyBag_Release(prop_bag);
+ if(FAILED(hres))
+ WARN("Load failed: %08x\n", hres);
+ }else {
+ hres = IPersistPropertyBag_InitNew(persist_prop_bag);
+ if(FAILED(hres))
+ WARN("InitNew failed: %08x\n", hres);
+ }
+}
+
+static void load_plugin(PluginHost *host)
+{
+ IPersistPropertyBag2 *persist_prop_bag2;
+ IPersistPropertyBag *persist_prop_bag;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IPersistPropertyBag2, (void**)&persist_prop_bag2);
+ if(SUCCEEDED(hres)) {
+ FIXME("Use IPersistPropertyBag2 iface\n");
+ IPersistPropertyBag2_Release(persist_prop_bag2);
+ return;
+ }
+
+ hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IPersistPropertyBag, (void**)&persist_prop_bag);
+ if(SUCCEEDED(hres)) {
+ load_prop_bag(host, persist_prop_bag);
+ IPersistPropertyBag_Release(persist_prop_bag);
+ return;
+ }
+
+ FIXME("No IPersistPeropertyBag iface \n");
+}
+
static void activate_plugin(PluginHost *host)
{
IClientSecurity *client_security;
@@ -74,7 +149,10 @@ static void activate_plugin(PluginHost *host)
FIXME("QuickActivate failed: %08x\n", hres);
}else {
FIXME("No IQuickActivate\n");
+ return;
}
+
+ load_plugin(host);
}
void update_plugin_window(PluginHost *host, HWND hwnd, const RECT *rect)
@@ -769,7 +847,7 @@ void detach_plugin_hosts(HTMLDocumentNode *doc)
}
}
-HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknown *unk, PluginHost **ret)
+HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknown *unk, const CLSID *clsid, PluginHost **ret)
{
PluginHost *host;
HRESULT hres;
@@ -797,6 +875,7 @@ HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknow
IUnknown_AddRef(unk);
host->plugin_unk = unk;
+ host->clsid = *clsid;
host->doc = doc;
list_add_tail(&doc->plugin_hosts, &host->entry);
diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h
index d030a3e..7b88612 100644
--- a/dlls/mshtml/pluginhost.h
+++ b/dlls/mshtml/pluginhost.h
@@ -31,7 +31,9 @@ typedef struct {
LONG ref;
IUnknown *plugin_unk;
+ CLSID clsid;
HWND hwnd;
+ RECT rect;
HTMLDocumentNode *doc;
struct list entry;
@@ -47,6 +49,6 @@ struct HTMLPluginContainer {
extern const IID IID_HTMLPluginContainer;
-HRESULT create_plugin_host(HTMLDocumentNode*,nsIDOMElement*,IUnknown*,PluginHost**);
+HRESULT create_plugin_host(HTMLDocumentNode*,nsIDOMElement*,IUnknown*,const CLSID*,PluginHost**);
void update_plugin_window(PluginHost*,HWND,const RECT*);
void detach_plugin_hosts(HTMLDocumentNode*);
More information about the wine-cvs
mailing list