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.

42 lines
1.0 KiB

  1. ///////////////////////////////////////////////////////////
  2. // ObjectWithSiteImplSec.h : Secure implementation of IObjectWithSite
  3. // Copyright (c) Microsoft Corporation 2002.
  4. #pragma once
  5. #ifndef OBJECTWITHSITEIMPLSEC_H
  6. #define OBJECTWITHSITEIMPLSEC_H
  7. #include <w32extend.h>
  8. template<class T>
  9. class ATL_NO_VTABLE IObjectWithSiteImplSec : public IObjectWithSite {
  10. public:
  11. PUnknown m_pSite;
  12. // IObjectWithSite
  13. STDMETHOD(GetSite)(REFIID iid, void** ppvSite) {
  14. if (!ppvSite) {
  15. return E_POINTER;
  16. }
  17. T* pT = static_cast<T*>(this);
  18. if (!pT->m_pSite) {
  19. return E_NOINTERFACE;
  20. }
  21. return pT->m_pSite->QueryInterface(iid, ppvSite);
  22. }
  23. STDMETHOD(SetSite)(IUnknown* pSite) {
  24. HRESULT hr = IsSafeSite(pSite);
  25. if (SUCCEEDED(hr)) {
  26. T* pT = static_cast<T*>(this);
  27. pT->m_pSite = pSite;
  28. }
  29. return hr;
  30. }
  31. };
  32. #endif // OBJECTWITHSITEIMPLSEC_H
  33. // end of file objectwithsiteimplsec.h