Leaked source code of windows server 2003
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.

154 lines
4.1 KiB

  1. // File: zonemgr.h
  2. //
  3. // Contents: This file defines the class that implements the base IInternetZoneManager
  4. //
  5. // Classes: CUrlZoneManager
  6. //
  7. // Functions:
  8. //
  9. // History:
  10. //
  11. //----------------------------------------------------------------------------
  12. #ifndef _ZONEMGR_H_
  13. #define _ZONEMGR_H_
  14. class CUrlZoneManager : public IInternetZoneManager
  15. {
  16. public:
  17. // IUnknown methods
  18. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  19. STDMETHODIMP_(ULONG) AddRef(void);
  20. STDMETHODIMP_(ULONG) Release(void);
  21. // IInternetZoneManager overrides
  22. STDMETHODIMP GetZoneAttributes(
  23. /* [in] */ DWORD dwZone,
  24. /* [unique][out][in] */ ZONEATTRIBUTES *pZoneAttributes);
  25. STDMETHODIMP SetZoneAttributes(
  26. /* [in] */ DWORD dwZone,
  27. /* [in] */ ZONEATTRIBUTES *pZoneAttributes);
  28. STDMETHODIMP GetZoneCustomPolicy(
  29. /* [in] */ DWORD dwZone,
  30. /* [in] */ REFGUID guidKey,
  31. /* [size_is][size_is][out] */ BYTE **ppPolicy,
  32. /* [out] */ DWORD *pcbPolicy,
  33. /* [in] */ URLZONEREG urlZoneReg);
  34. STDMETHODIMP SetZoneCustomPolicy(
  35. /* [in] */ DWORD dwZone,
  36. /* [in] */ REFGUID guidKey,
  37. /* [size_is][in] */ BYTE *pPolicy,
  38. /* [in] */ DWORD cbPolicy,
  39. /* [in] */ URLZONEREG urlZoneReg);
  40. STDMETHODIMP GetZoneActionPolicy(
  41. /* [in] */ DWORD dwZone,
  42. /* [in] */ DWORD dwAction,
  43. /* [size_is][out] */ BYTE *pPolicy,
  44. /* [in] */ DWORD cbPolicy,
  45. /* [in] */ URLZONEREG urlZoneReg);
  46. STDMETHODIMP SetZoneActionPolicy(
  47. /* [in] */ DWORD dwZone,
  48. /* [in] */ DWORD dwAction,
  49. /* [size_is][in] */ BYTE *pPolicy,
  50. /* [in] */ DWORD cbPolicy,
  51. /* [in] */ URLZONEREG urlZoneReg);
  52. STDMETHODIMP PromptAction(
  53. /* [in] */ DWORD dwAction,
  54. /* [in] */ HWND hwndParent,
  55. /* [in] */ LPCWSTR pwszUrl,
  56. /* [in] */ LPCWSTR pwszText,
  57. /* [in] */ DWORD dwPromptFlags);
  58. STDMETHODIMP LogAction(
  59. /* [in] */ DWORD dwAction,
  60. /* [in] */ LPCWSTR pwszUrl,
  61. /* [in] */ LPCWSTR pwszText,
  62. /* [in] */ DWORD dwLogFlags);
  63. STDMETHODIMP CreateZoneEnumerator(
  64. /* [out] */ DWORD *pdwEnum,
  65. /* [out] */ DWORD *pdwCount,
  66. /* [in] */ DWORD dwFlags);
  67. STDMETHODIMP GetZoneAt(
  68. /* [in] */ DWORD dwEnum,
  69. /* [in] */ DWORD dwIndex,
  70. /* [out] */ DWORD *pdwZone);
  71. STDMETHODIMP DestroyZoneEnumerator(
  72. /* [in] */ DWORD dwEnum);
  73. STDMETHODIMP CopyTemplatePoliciesToZone(
  74. /* [in] */ DWORD dwTemplate,
  75. /* [in] */ DWORD dwZone,
  76. /* [in] */ DWORD dwReserved);
  77. public:
  78. CUrlZoneManager(IUnknown *pUnkOuter, IUnknown** ppUnkInner );
  79. virtual ~CUrlZoneManager();
  80. virtual BOOL Initialize();
  81. static inline BOOL Cleanup ( )
  82. { delete s_pRegZoneContainer ;
  83. if ( s_bcsectInit ) DeleteCriticalSection(&s_csect) ;
  84. return TRUE;
  85. }
  86. static CRITICAL_SECTION s_csect;
  87. static BOOL s_bcsectInit;
  88. // Aggregation and RefCount support.
  89. protected:
  90. CRefCount m_ref;
  91. class CPrivUnknown : public IUnknown
  92. {
  93. public:
  94. STDMETHOD(QueryInterface) ( REFIID riid, LPVOID FAR* ppvObj);
  95. STDMETHOD_(ULONG,AddRef) (void);
  96. STDMETHOD_(ULONG,Release) (void);
  97. ~CPrivUnknown() {}
  98. CPrivUnknown() : m_ref () {}
  99. private:
  100. CRefCount m_ref; // the total refcount of this object
  101. };
  102. friend class CPrivUnknown;
  103. CPrivUnknown m_Unknown;
  104. IUnknown* m_pUnkOuter;
  105. STDMETHODIMP_(ULONG) PrivAddRef()
  106. {
  107. return m_Unknown.AddRef();
  108. }
  109. STDMETHODIMP_(ULONG) PrivRelease()
  110. {
  111. return m_Unknown.Release();
  112. }
  113. protected:
  114. static CRegZoneContainer* s_pRegZoneContainer;
  115. static inline CRegZone * GetRegZoneById(DWORD dw)
  116. { return s_pRegZoneContainer->GetRegZoneById(dw); }
  117. private:
  118. IServiceProvider *m_pSP;
  119. };
  120. #endif // _ZONEMGR_H_