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.

66 lines
967 B

  1. // #include <oleport.h>
  2. #include <windows.h>
  3. #include <ole2.h>
  4. #include <stdio.h>
  5. #include <tunk.h>
  6. CTestUnk::CTestUnk(void) : _cRefs(1)
  7. {
  8. }
  9. CTestUnk::~CTestUnk(void)
  10. {
  11. }
  12. STDMETHODIMP CTestUnk::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
  13. {
  14. HRESULT hRslt = S_OK;
  15. if (IsEqualIID(riid, IID_IUnknown) ||
  16. IsEqualIID(riid, IID_IParseDisplayName))
  17. {
  18. *ppvObj = (void *)(IParseDisplayName *)this;
  19. AddRef();
  20. }
  21. else
  22. {
  23. *ppvObj = NULL;
  24. hRslt = E_NOINTERFACE;
  25. }
  26. return hRslt;
  27. }
  28. STDMETHODIMP_(ULONG) CTestUnk::AddRef(void)
  29. {
  30. _cRefs++;
  31. return _cRefs;
  32. }
  33. STDMETHODIMP_(ULONG) CTestUnk::Release(void)
  34. {
  35. _cRefs--;
  36. if (_cRefs == 0)
  37. {
  38. delete this;
  39. return 0;
  40. }
  41. else
  42. {
  43. return _cRefs;
  44. }
  45. }
  46. STDMETHODIMP CTestUnk::ParseDisplayName(LPBC pbc, LPOLESTR lpszDisplayName,
  47. ULONG *pchEaten, LPMONIKER *ppmkOut)
  48. {
  49. return S_OK;
  50. }