mshtml: Added beginning support for loading data by an ActiveX object.
This commit is contained in:
parent
e7cb2d35f0
commit
dbbcbd59a5
|
@ -203,31 +203,30 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem)
|
static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem, CLSID *clsid)
|
||||||
{
|
{
|
||||||
IClassFactoryEx *cfex;
|
IClassFactoryEx *cfex;
|
||||||
IClassFactory *cf;
|
IClassFactory *cf;
|
||||||
IUnknown *obj;
|
IUnknown *obj;
|
||||||
DWORD policy;
|
DWORD policy;
|
||||||
CLSID guid;
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(!get_elem_clsid(nselem, &guid)) {
|
if(!get_elem_clsid(nselem, clsid)) {
|
||||||
WARN("Could not determine element CLSID\n");
|
WARN("Could not determine element CLSID\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("clsid %s\n", debugstr_guid(&guid));
|
TRACE("clsid %s\n", debugstr_guid(clsid));
|
||||||
|
|
||||||
policy = 0;
|
policy = 0;
|
||||||
hres = IInternetHostSecurityManager_ProcessUrlAction(HOSTSECMGR(window->doc), URLACTION_ACTIVEX_RUN,
|
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) {
|
if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
|
||||||
WARN("ProcessUrlAction returned %08x %x\n", hres, policy);
|
WARN("ProcessUrlAction returned %08x %x\n", hres, policy);
|
||||||
return NULL;
|
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))
|
if(FAILED(hres))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -250,6 +249,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
|
||||||
nsIDOMElement *nselem;
|
nsIDOMElement *nselem;
|
||||||
HTMLWindow *window;
|
HTMLWindow *window;
|
||||||
IUnknown *obj;
|
IUnknown *obj;
|
||||||
|
CLSID clsid;
|
||||||
NPError err = NPERR_NO_ERROR;
|
NPError err = NPERR_NO_ERROR;
|
||||||
|
|
||||||
TRACE("(%s %p %x %d %p %p %p)\n", debugstr_a(pluginType), instance, mode, argc, argn, argv, saved);
|
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;
|
return NPERR_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = create_activex_object(window, nselem);
|
obj = create_activex_object(window, nselem, &clsid);
|
||||||
if(obj) {
|
if(obj) {
|
||||||
PluginHost *host;
|
PluginHost *host;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = create_plugin_host(window->doc, nselem, obj, &host);
|
hres = create_plugin_host(window->doc, nselem, obj, &clsid, &host);
|
||||||
nsIDOMElement_Release(nselem);
|
nsIDOMElement_Release(nselem);
|
||||||
IUnknown_Release(obj);
|
IUnknown_Release(obj);
|
||||||
if(SUCCEEDED(hres))
|
if(SUCCEEDED(hres))
|
||||||
|
|
|
@ -39,6 +39,81 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||||
const IID IID_HTMLPluginContainer =
|
const IID IID_HTMLPluginContainer =
|
||||||
{0xbd7a6050,0xb373,0x4f6f,{0xa4,0x93,0xdd,0x40,0xc5,0x23,0xa8,0x6a}};
|
{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)
|
static void activate_plugin(PluginHost *host)
|
||||||
{
|
{
|
||||||
IClientSecurity *client_security;
|
IClientSecurity *client_security;
|
||||||
|
@ -74,7 +149,10 @@ static void activate_plugin(PluginHost *host)
|
||||||
FIXME("QuickActivate failed: %08x\n", hres);
|
FIXME("QuickActivate failed: %08x\n", hres);
|
||||||
}else {
|
}else {
|
||||||
FIXME("No IQuickActivate\n");
|
FIXME("No IQuickActivate\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
load_plugin(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_plugin_window(PluginHost *host, HWND hwnd, const RECT *rect)
|
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;
|
PluginHost *host;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -797,6 +875,7 @@ HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknow
|
||||||
|
|
||||||
IUnknown_AddRef(unk);
|
IUnknown_AddRef(unk);
|
||||||
host->plugin_unk = unk;
|
host->plugin_unk = unk;
|
||||||
|
host->clsid = *clsid;
|
||||||
|
|
||||||
host->doc = doc;
|
host->doc = doc;
|
||||||
list_add_tail(&doc->plugin_hosts, &host->entry);
|
list_add_tail(&doc->plugin_hosts, &host->entry);
|
||||||
|
|
|
@ -31,7 +31,9 @@ typedef struct {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
IUnknown *plugin_unk;
|
IUnknown *plugin_unk;
|
||||||
|
CLSID clsid;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
HTMLDocumentNode *doc;
|
HTMLDocumentNode *doc;
|
||||||
struct list entry;
|
struct list entry;
|
||||||
|
@ -47,6 +49,6 @@ struct HTMLPluginContainer {
|
||||||
|
|
||||||
extern const IID IID_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 update_plugin_window(PluginHost*,HWND,const RECT*);
|
||||||
void detach_plugin_hosts(HTMLDocumentNode*);
|
void detach_plugin_hosts(HTMLDocumentNode*);
|
||||||
|
|
Loading…
Reference in New Issue