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.

72 lines
1.0 KiB

  1. //*******************************************************************************************
  2. //
  3. // Filename : Unknown.cpp
  4. //
  5. // Customized CUnknown implmentations
  6. //
  7. // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
  8. //
  9. //*******************************************************************************************
  10. #include "Pch.H"
  11. #include "ThisDll.H"
  12. #include "Unknown.H"
  13. CUnknown::~CUnknown()
  14. {
  15. }
  16. HRESULT CUnknown::QIHelper(REFIID riid, LPVOID *ppvObj, const IID *apiid[],
  17. LPUNKNOWN aobj[])
  18. {
  19. *ppvObj = NULL;
  20. LPUNKNOWN pObj;
  21. if (riid == IID_IUnknown)
  22. {
  23. pObj = aobj[0];
  24. }
  25. else
  26. {
  27. for (int i=0; ; ++i)
  28. {
  29. if (!apiid[i])
  30. {
  31. return(E_NOINTERFACE);
  32. }
  33. if (*apiid[i] == riid)
  34. {
  35. pObj = aobj[i];
  36. break;
  37. }
  38. }
  39. }
  40. pObj->AddRef();
  41. *ppvObj = pObj;
  42. return(NOERROR);
  43. }
  44. ULONG CUnknown::AddRefHelper()
  45. {
  46. return(m_cRef.AddRef());
  47. }
  48. ULONG CUnknown::ReleaseHelper()
  49. {
  50. if (!m_cRef.Release())
  51. {
  52. delete this;
  53. return(0);
  54. }
  55. return(m_cRef.GetRef());
  56. }