Create  Edit  Diff  FrontPage  Index  Search  Changes  Login

HowToSetSiteInfoToMsXml

on IActiveScript?::SetScriptSite?

You must retrieve IServiceProvider? from given IActiveScriptSite? by QI.

Then, you can retrieve IInternetHostSecurityManger? from ServiceProvider?.

Save both interfaces.

IServiceProvider* pProv = NULL;
HRESULT hr = m_pSite->QueryInterface(IID_IServiceProvider, (void**)&pProv);
if (hr == S_OK)
{
    IInternetHostSecurityManager* pScm = NULL;
    hr = pProv->QueryService(SID_SInternetHostSecurityManager, IID_IInternetHostSecurityManager, (void**)&pScm);
    if (hr == S_OK)
    {
        m_pScM = pScm;
    }
    m_pProv = pProv;
}

Everytime when you instantiate the COM componets

If you can bind GUID_CUSTOM_CONFIRMOBJECTSAFETY, then you must call IInternetHostSecurityManager?::QueryCustomPolicy?, or at least you must exchange IObjectSafety? informations from the component.

If you decide to keep the component alive, then set IInternetHostSecurityManager? in the component using IObjectWithSite? if the component has the interface.

The steps are (1)retrieve IObjectWithSite? from the component's IDispatch by QI. (2)If you got the interface, then call IObjectWithSite?::SetSite? with previously saved IInternetHostSecurityManager?.

IObjectWithSite* pSite = NULL;
HRESULT hr = pUnk->QueryInterface(IID_IObjectWithSite, (void**)&pSite);
if (hr == S_OK)
{
    pSite->SetSite(m_pScM);
    pSite->Release();
}

If you didn't set IInternetHostSecurityManager?, then MSXML can't use urlmon to download the file given by load method. So the result will be 80070005 (E_ACCESSDENIED).

Last modified:2004/05/06 21:02:10
Keyword(s):
References: