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.

85 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: ilangres.cxx
  7. //
  8. // Contents: CLanguageResourceInterface - an object to expose ICiCLangRes
  9. //
  10. // Classes: CLanguageResourceInterface
  11. //
  12. // History: 2-14-97 mohamedn created
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.cxx>
  16. #pragma hdrstop
  17. #include <ilangres.hxx>
  18. //+---------------------------------------------------------------------------
  19. //
  20. // Member: CLanguageResourceInterface::QueryInterface
  21. //
  22. // Synopsis: Supports IID_IUnknown, IID_ICiCLangRes
  23. //
  24. // History: 2-14-97 mohamedn ICiCLangRes
  25. //
  26. //----------------------------------------------------------------------------
  27. STDMETHODIMP CLanguageResourceInterface::QueryInterface(
  28. REFIID riid,
  29. void **ppvObject)
  30. {
  31. Win4Assert( 0 != ppvObject );
  32. if ( IID_ICiCLangRes == riid )
  33. *ppvObject = (void *)((ICiCLangRes *)this);
  34. else if ( IID_IUnknown == riid )
  35. *ppvObject = (void *)((IUnknown *) (ICiCLangRes *)this);
  36. else
  37. {
  38. *ppvObject = 0;
  39. return E_NOINTERFACE;
  40. }
  41. AddRef();
  42. return S_OK;
  43. } //QueryInterface
  44. //+---------------------------------------------------------------------------
  45. //
  46. // Member: CLanguageResourceInterface::AddRef
  47. //
  48. // History: 2-14-97 mohamedn ICiCLangRes
  49. //
  50. //----------------------------------------------------------------------------
  51. STDMETHODIMP_(ULONG) CLanguageResourceInterface::AddRef()
  52. {
  53. return InterlockedIncrement(&_refCount);
  54. } //AddRef
  55. //+---------------------------------------------------------------------------
  56. //
  57. // Member: CLanguageResourceInterface::Release
  58. //
  59. // History: 2-14-97 mohamedn ICiCLangRes
  60. //
  61. //----------------------------------------------------------------------------
  62. STDMETHODIMP_(ULONG) CLanguageResourceInterface::Release()
  63. {
  64. Win4Assert( _refCount > 0 );
  65. LONG refCount = InterlockedDecrement(&_refCount);
  66. if ( refCount <= 0 )
  67. delete this;
  68. return (ULONG) refCount;
  69. } //Release