- Added IInternetSecurityManager::[SG]etSecuritySite implementation.
- Forward IInternetSecurityManager calls to custom manager.
This commit is contained in:
parent
6f823db58b
commit
bac6e12c05
|
@ -39,17 +39,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
||||||
* InternetSecurityManager implementation
|
* InternetSecurityManager implementation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct SecManagerImpl{
|
typedef struct {
|
||||||
|
const IInternetSecurityManagerVtbl* lpInternetSecurityManagerVtbl;
|
||||||
|
|
||||||
const IInternetSecurityManagerVtbl* lpvtbl1; /* VTable relative to the IInternetSecurityManager interface.*/
|
LONG ref;
|
||||||
|
|
||||||
LONG ref; /* reference counter for this object */
|
|
||||||
|
|
||||||
|
IInternetSecurityMgrSite *mgrsite;
|
||||||
|
IInternetSecurityManager *custom_manager;
|
||||||
} SecManagerImpl;
|
} SecManagerImpl;
|
||||||
|
|
||||||
|
#define SECMGR_THIS(iface) DEFINE_THIS(SecManagerImpl, InternetSecurityManager, iface)
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* iface,REFIID riid,void** ppvObject)
|
static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* iface,REFIID riid,void** ppvObject)
|
||||||
{
|
{
|
||||||
SecManagerImpl *This = (SecManagerImpl *)iface;
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
|
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
|
||||||
|
|
||||||
|
@ -66,8 +69,10 @@ static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* if
|
||||||
*ppvObject = iface;
|
*ppvObject = iface;
|
||||||
|
|
||||||
/* Check that we obtained an interface.*/
|
/* Check that we obtained an interface.*/
|
||||||
if ((*ppvObject)==0)
|
if (!*ppvObject) {
|
||||||
|
WARN("not supported interface %s\n", debugstr_guid(riid));
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Query Interface always increases the reference count by one when it is successful */
|
/* Query Interface always increases the reference count by one when it is successful */
|
||||||
IInternetSecurityManager_AddRef(iface);
|
IInternetSecurityManager_AddRef(iface);
|
||||||
|
@ -77,24 +82,30 @@ static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* if
|
||||||
|
|
||||||
static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
|
static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
|
||||||
{
|
{
|
||||||
SecManagerImpl *This = (SecManagerImpl *)iface;
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
|
TRACE("(%p) ref=%lu\n", This, refCount);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
|
static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
|
||||||
{
|
{
|
||||||
SecManagerImpl *This = (SecManagerImpl *)iface;
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
|
TRACE("(%p) ref=%lu\n", This, refCount);
|
||||||
|
|
||||||
/* destroy the object if there's no more reference on it */
|
/* destroy the object if there's no more reference on it */
|
||||||
if (!refCount){
|
if (!refCount){
|
||||||
|
if(This->mgrsite)
|
||||||
|
IInternetSecurityMgrSite_Release(This->mgrsite);
|
||||||
|
if(This->custom_manager)
|
||||||
|
IInternetSecurityManager_Release(This->custom_manager);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
|
|
||||||
URLMON_UnlockModule();
|
URLMON_UnlockModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,32 +115,94 @@ static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
|
||||||
static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
|
||||||
IInternetSecurityMgrSite *pSite)
|
IInternetSecurityMgrSite *pSite)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p)\n", iface, pSite);
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, pSite);
|
||||||
|
|
||||||
|
if(This->mgrsite)
|
||||||
|
IInternetSecurityMgrSite_Release(This->mgrsite);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
IInternetSecurityManager_Release(This->custom_manager);
|
||||||
|
This->custom_manager = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
This->mgrsite = pSite;
|
||||||
|
|
||||||
|
if(pSite) {
|
||||||
|
IServiceProvider *servprov;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
IInternetSecurityMgrSite_AddRef(pSite);
|
||||||
|
|
||||||
|
hres = IInternetSecurityMgrSite_QueryInterface(pSite, &IID_IServiceProvider,
|
||||||
|
(void**)&servprov);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
IServiceProvider_QueryService(servprov, &SID_SInternetSecurityManager,
|
||||||
|
&IID_IInternetSecurityManager, (void**)&This->custom_manager);
|
||||||
|
IServiceProvider_Release(servprov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
|
||||||
IInternetSecurityMgrSite **ppSite)
|
IInternetSecurityMgrSite **ppSite)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->( %p)\n", iface, ppSite);
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, ppSite);
|
||||||
|
|
||||||
|
if(!ppSite)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if(This->mgrsite)
|
||||||
|
IInternetSecurityMgrSite_AddRef(This->mgrsite);
|
||||||
|
|
||||||
|
*ppSite = This->mgrsite;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
|
||||||
LPCWSTR pwszUrl, DWORD *pdwZone,
|
LPCWSTR pwszUrl, DWORD *pdwZone,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s %p %08lx)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p %08lx)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_MapUrlToZone(This->custom_manager,
|
||||||
|
pwszUrl, pdwZone, dwFlags);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
|
||||||
LPCWSTR pwszUrl,
|
LPCWSTR pwszUrl,
|
||||||
BYTE *pbSecurityId, DWORD *pcbSecurityId,
|
BYTE *pbSecurityId, DWORD *pcbSecurityId,
|
||||||
DWORD dwReserved)
|
DWORD_PTR dwReserved)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s %p %p %08lx)\n", iface, debugstr_w(pwszUrl), pbSecurityId, pcbSecurityId,
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p %p %08lx)\n", iface, debugstr_w(pwszUrl), pbSecurityId, pcbSecurityId,
|
||||||
dwReserved);
|
dwReserved);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_GetSecurityId(This->custom_manager,
|
||||||
|
pwszUrl, pbSecurityId, pcbSecurityId, dwReserved);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +213,20 @@ static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager *
|
||||||
BYTE *pContext, DWORD cbContext,
|
BYTE *pContext, DWORD cbContext,
|
||||||
DWORD dwFlags, DWORD dwReserved)
|
DWORD dwFlags, DWORD dwReserved)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface, debugstr_w(pwszUrl), dwAction,
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface, debugstr_w(pwszUrl), dwAction,
|
||||||
pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
|
pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_ProcessUrlAction(This->custom_manager, pwszUrl, dwAction,
|
||||||
|
pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,22 +237,58 @@ static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager
|
||||||
BYTE *pContext, DWORD cbContext,
|
BYTE *pContext, DWORD cbContext,
|
||||||
DWORD dwReserved)
|
DWORD dwReserved)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
|
||||||
ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
|
ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_QueryCustomPolicy(This->custom_manager, pwszUrl, guidKey,
|
||||||
|
ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
|
||||||
DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
|
DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%08lx %s %08lx)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%08lx %s %08lx)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_SetZoneMapping(This->custom_manager, dwZone,
|
||||||
|
pwszPattern, dwFlags);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
|
static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
|
||||||
DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
|
DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%08lx %p %08lx)\n", iface, dwZone, ppenumString,dwFlags);
|
SecManagerImpl *This = SECMGR_THIS(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%08lx %p %08lx)\n", iface, dwZone, ppenumString,dwFlags);
|
||||||
|
|
||||||
|
if(This->custom_manager) {
|
||||||
|
hres = IInternetSecurityManager_GetZoneMappings(This->custom_manager, dwZone,
|
||||||
|
ppenumString, dwFlags);
|
||||||
|
if(hres != INET_E_DEFAULT_ACTION)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Default action is not implemented\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +315,11 @@ HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
||||||
|
|
||||||
/* Initialize the virtual function table. */
|
/* Initialize the virtual function table. */
|
||||||
This->lpvtbl1 = &VT_SecManagerImpl;
|
This->lpInternetSecurityManagerVtbl = &VT_SecManagerImpl;
|
||||||
This->ref = 1;
|
|
||||||
|
This->ref = 1;
|
||||||
|
This->mgrsite = NULL;
|
||||||
|
This->custom_manager = NULL;
|
||||||
|
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
|
|
||||||
|
@ -468,6 +592,10 @@ HRESULT WINAPI CoInternetCreateSecurityManager( IServiceProvider *pSP,
|
||||||
IInternetSecurityManager **ppSM, DWORD dwReserved )
|
IInternetSecurityManager **ppSM, DWORD dwReserved )
|
||||||
{
|
{
|
||||||
TRACE("%p %p %ld\n", pSP, ppSM, dwReserved );
|
TRACE("%p %p %ld\n", pSP, ppSM, dwReserved );
|
||||||
|
|
||||||
|
if(pSP)
|
||||||
|
FIXME("pSP not supported\n");
|
||||||
|
|
||||||
return SecManagerImpl_Construct(NULL, (void**) ppSM);
|
return SecManagerImpl_Construct(NULL, (void**) ppSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue