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.

68 lines
1.3 KiB

  1. /*
  2. * IUNKNOWN.CPP
  3. *
  4. *
  5. *
  6. *
  7. *
  8. *
  9. */
  10. #include <windows.h>
  11. #include <hidclass.h>
  12. #include <hidsdi.h>
  13. #include <ole2.h>
  14. #include <ole2ver.h>
  15. #include "..\inc\opos.h"
  16. #include "oposctrl.h"
  17. STDMETHODIMP_(ULONG) COPOSControl::AddRef(void)
  18. {
  19. return ++m_refCount;
  20. }
  21. STDMETHODIMP_(ULONG) COPOSControl::Release(void)
  22. {
  23. ULONG result; // need sepate variable in case we free
  24. if (--m_refCount == 0){
  25. delete this;
  26. result = 0;
  27. }
  28. else {
  29. result = m_refCount;
  30. }
  31. return result;
  32. }
  33. STDMETHODIMP COPOSControl::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
  34. {
  35. HRESULT result;
  36. if (IsEqualIID(riid, IID_IUnknown) ||
  37. IsEqualIID(riid, IID_OPOS_GENERIC_CONTROL) ||
  38. IsEqualIID(riid, IID_IClassFactory)){
  39. *ppvObj = this;
  40. this->AddRef();
  41. result = NOERROR;
  42. // BUGBUG REMOVE
  43. if (IsEqualIID(riid, IID_IUnknown)) Report("QueryInterface Got IID_IUnknown", 0);
  44. else if (IsEqualIID(riid, IID_OPOS_GENERIC_CONTROL)) Report("QueryInterface Got IID_OPOS_GENERIC_CONTROL", 0);
  45. else if (IsEqualIID(riid, IID_IClassFactory)) Report("QueryInterface Got IID_IClassFactory", 0);
  46. else ASSERT(0);
  47. }
  48. else {
  49. result = ResultFromScode(E_NOINTERFACE);
  50. Report("QueryInterface FAILED", (DWORD)result);
  51. }
  52. return result;
  53. }