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.

58 lines
1.4 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. unkhlpr.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #define IMPLEMENT_CONTAINED_QUERYINTERFACE(IClassName) \
  9. STDMETHODIMP IClassName::QueryInterface(REFIID riid, PPVOID ppv) \
  10. { \
  11. return m_pUnkOuter->QueryInterface(riid, ppv); \
  12. }
  13. #define IMPLEMENT_CONTAINED_ADDREF(IClassName) \
  14. STDMETHODIMP_(ULONG) IClassName::AddRef(void) \
  15. { \
  16. ++m_cRef; \
  17. return m_pUnkOuter->AddRef(); \
  18. }
  19. #define IMPLEMENT_CONTAINED_RELEASE(IClassName) \
  20. STDMETHODIMP_(ULONG) IClassName::Release(void) \
  21. { \
  22. --m_cRef; \
  23. return m_pUnkOuter->Release(); \
  24. }
  25. #define IMPLEMENT_CONTAINED_IUNKNOWN(IClassName) \
  26. IMPLEMENT_CONTAINED_QUERYINTERFACE(IClassName) \
  27. IMPLEMENT_CONTAINED_ADDREF(IClassName) \
  28. IMPLEMENT_CONTAINED_RELEASE(IClassName)
  29. #define IMPLEMENT_CONTAINED_CONSTRUCTOR(CClassName, IClassName) \
  30. IClassName::IClassName(CClassName *pObj, LPUNKNOWN pUnkOuter) \
  31. { \
  32. m_cRef = 0; \
  33. m_pObj = pObj; \
  34. m_pUnkOuter = pUnkOuter; \
  35. return; \
  36. }
  37. #define IMPLEMENT_CONTAINED_DESTRUCTOR(IClassName) \
  38. IClassName::~IClassName( void ) \
  39. { \
  40. return; \
  41. }
  42. #define IMPLEMENT_CONTAINED_INTERFACE(CClassName, IClassName) \
  43. IMPLEMENT_CONTAINED_CONSTRUCTOR(CClassName, IClassName) \
  44. IMPLEMENT_CONTAINED_DESTRUCTOR(IClassName) \
  45. IMPLEMENT_CONTAINED_IUNKNOWN(IClassName)