Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

  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. // *** IInternetSecurityManager methods ***
  10. virtual STDMETHODIMP MapUrlToZone(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwReserved)
  11. {
  12. return INET_E_DEFAULT_ACTION;
  13. }
  14. virtual STDMETHODIMP GetSecurityId(LPCWSTR pwszUrl, BYTE* pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
  15. {
  16. return INET_E_DEFAULT_ACTION;
  17. }
  18. virtual STDMETHODIMP ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy,
  19. BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
  20. {
  21. HRESULT hres = INET_E_DEFAULT_ACTION;
  22. if (_IsSafeUrl(pwszUrl))
  23. {
  24. if (cbPolicy >= SIZEOF(DWORD))
  25. {
  26. *(DWORD *)pPolicy = URLPOLICY_ALLOW;
  27. hres = S_OK;
  28. }
  29. else
  30. hres = S_FALSE;
  31. }
  32. return hres;
  33. }
  34. virtual STDMETHODIMP QueryCustomPolicy(LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy,
  35. BYTE *pContext, DWORD cbContext, DWORD dwReserved)
  36. {
  37. return INET_E_DEFAULT_ACTION;
  38. }
  39. virtual STDMETHODIMP SetSecuritySite(IInternetSecurityMgrSite *pSite)
  40. {
  41. return INET_E_DEFAULT_ACTION;
  42. }
  43. virtual STDMETHODIMP GetSecuritySite(IInternetSecurityMgrSite **ppSite)
  44. {
  45. return INET_E_DEFAULT_ACTION;
  46. }
  47. virtual STDMETHODIMP SetZoneMapping(DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags)
  48. {
  49. return INET_E_DEFAULT_ACTION;
  50. }
  51. virtual STDMETHODIMP GetZoneMappings(DWORD dwZone, IEnumString **ppEnumString, DWORD dwFlags)
  52. {
  53. return INET_E_DEFAULT_ACTION;
  54. }
  55. protected:
  56. virtual BOOL _IsSafeUrl(LPCWSTR pwszUrl) = 0;
  57. };
  58. #endif