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.

88 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998
  5. //
  6. // File: isearch.cxx
  7. //
  8. // Contents: The interface specific methods of CSearch
  9. //
  10. // History: 05-Dec-94 Created BartoszM
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <isearch.hxx>
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Method: CSearch::QueryInterface
  19. //
  20. // Synopsis: Rebind to other interface
  21. //
  22. // Arguments: [riid] -- IID of new interface
  23. // [ppvObject] -- New interface * returned here
  24. //
  25. // Returns: S_OK if bind succeeded, E_NOINTERFACE if bind failed
  26. //
  27. // History: 05-Dec-1994 BartoszM Created
  28. //
  29. //--------------------------------------------------------------------------
  30. SCODE STDMETHODCALLTYPE CSearch::QueryInterface( REFIID riid,
  31. void ** ppvObject)
  32. {
  33. if ( 0 == ppvObject )
  34. return E_INVALIDARG;
  35. if ( IID_ISearchQueryHits == riid )
  36. *ppvObject = (IUnknown *)(ISearchQueryHits *)this;
  37. else if ( IID_IUnknown == riid )
  38. *ppvObject = (IUnknown *) this;
  39. else
  40. {
  41. *ppvObject = 0;
  42. return E_NOINTERFACE;
  43. }
  44. AddRef();
  45. return S_OK;
  46. } //QueryInterface
  47. //+-------------------------------------------------------------------------
  48. //
  49. // Method: CSearch::AddRef
  50. //
  51. // Synopsis: Increments refcount
  52. //
  53. // History: 05-Dec-1994 BartoszM Created
  54. //
  55. //--------------------------------------------------------------------------
  56. ULONG STDMETHODCALLTYPE CSearch::AddRef()
  57. {
  58. return InterlockedIncrement( &_cRefs );
  59. }
  60. //+-------------------------------------------------------------------------
  61. //
  62. // Method: CSearch::Release
  63. //
  64. // Synopsis: Decrement refcount. Delete if necessary.
  65. //
  66. // History: 05-Dec-1994 BartoszM Created
  67. //
  68. //--------------------------------------------------------------------------
  69. ULONG STDMETHODCALLTYPE CSearch::Release()
  70. {
  71. unsigned long uTmp = InterlockedDecrement( &_cRefs );
  72. if ( 0 == uTmp )
  73. delete this;
  74. return uTmp;
  75. }