inetsmgr.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #if !defined(_INETSMGR_H_)
  2. #define _INETSMGR_H_
  3. // whoever inherits this class must implement _IsSafeSite
  4. class CInternetSecurityMgrImpl : public IInternetSecurityManager
  5. {
  6. public:
  7.     // *** IUnknown ***
  8.     // (client must provide!)
  9.     
  10.     // *** IInternetSecurityManager methods ***
  11.     virtual STDMETHODIMP MapUrlToZone(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwReserved)
  12.     {
  13.         return INET_E_DEFAULT_ACTION;
  14.     }
  15.     virtual STDMETHODIMP GetSecurityId(LPCWSTR pwszUrl, BYTE* pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
  16.     {
  17.         return INET_E_DEFAULT_ACTION;
  18.     }
  19.     virtual STDMETHODIMP ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy,
  20.                                   BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
  21.     {
  22.         HRESULT hres = INET_E_DEFAULT_ACTION;
  23.         if (_IsSafeUrl(pwszUrl))
  24.         {
  25.             if (cbPolicy >= SIZEOF(DWORD))
  26.             {
  27.                 *(DWORD *)pPolicy = URLPOLICY_ALLOW;
  28.                 hres = S_OK;
  29.             }
  30.             else
  31.                 hres = S_FALSE;
  32.         }
  33.         return hres;
  34.     }
  35.     virtual STDMETHODIMP QueryCustomPolicy(LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy,
  36.                                    BYTE *pContext, DWORD cbContext, DWORD dwReserved)
  37.     {
  38.         return INET_E_DEFAULT_ACTION;
  39.     }
  40.     virtual STDMETHODIMP SetSecuritySite(IInternetSecurityMgrSite *pSite)
  41.     {
  42.         return INET_E_DEFAULT_ACTION;
  43.     }
  44.     virtual STDMETHODIMP GetSecuritySite(IInternetSecurityMgrSite **ppSite)
  45.     {
  46.         return INET_E_DEFAULT_ACTION;
  47.     }
  48.     virtual STDMETHODIMP SetZoneMapping(DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags)
  49.     {
  50.         return INET_E_DEFAULT_ACTION;
  51.     }
  52.     virtual STDMETHODIMP GetZoneMappings(DWORD dwZone, IEnumString **ppEnumString, DWORD dwFlags)
  53.     {
  54.         return INET_E_DEFAULT_ACTION;
  55.     }
  56. protected:
  57.     virtual BOOL _IsSafeUrl(LPCWSTR pwszUrl) = 0;
  58. };
  59. #endif