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.

29 lines
520 B

  1. #include <objbase.h>
  2. #pragma hdrstop
  3. #include "cowsite.h"
  4. void IUnknown_Set(IUnknown ** ppunk, IUnknown * punk)
  5. {
  6. if (*ppunk)
  7. (*ppunk)->Release();
  8. *ppunk = punk;
  9. if (punk)
  10. punk->AddRef();
  11. }
  12. HRESULT CObjectWithSite::SetSite(IUnknown *punkSite)
  13. {
  14. IUnknown_Set(&_punkSite, punkSite);
  15. return S_OK;
  16. }
  17. HRESULT CObjectWithSite::GetSite(REFIID riid, void **ppvSite)
  18. {
  19. if (_punkSite)
  20. return _punkSite->QueryInterface(riid, ppvSite);
  21. *ppvSite = NULL;
  22. return E_FAIL;
  23. }