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.

82 lines
1.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // File: caime.cpp
  4. //
  5. // Contents: CAIME
  6. //
  7. //----------------------------------------------------------------------------
  8. #include "private.h"
  9. #include "globals.h"
  10. #include "idebug.h"
  11. #include "globals.h"
  12. #include "caime.h"
  13. CAIME::CAIME()
  14. {
  15. m_pIActiveIMMIME = NULL;
  16. _pPauseCookie = NULL;
  17. DllAddRef();
  18. _cRef = 1;
  19. }
  20. CAIME::~CAIME()
  21. {
  22. Assert(_pPauseCookie == NULL);
  23. DllRelease();
  24. }
  25. //+---------------------------------------------------------------------------
  26. //
  27. // IUnknown
  28. //
  29. //----------------------------------------------------------------------------
  30. STDAPI CAIME::QueryInterface(REFIID riid, void **ppvObj)
  31. {
  32. if (ppvObj == NULL)
  33. return E_POINTER;
  34. *ppvObj = NULL;
  35. if (IsEqualIID(riid, IID_IUnknown) ||
  36. IsEqualIID(riid, IID_IActiveIME_Private))
  37. {
  38. *ppvObj = SAFECAST(this, IActiveIME_Private *);
  39. }
  40. else if (IsEqualIID(riid, IID_IServiceProvider)) {
  41. *ppvObj = SAFECAST(this, IServiceProvider*);
  42. }
  43. #if 0
  44. else if (IsEqualIID(ridd, IID_IAImmLayer)) {
  45. *ppvObj = SAFECAST(this, IAImmLayer*);
  46. }
  47. #endif
  48. if (*ppvObj == NULL)
  49. {
  50. return E_NOINTERFACE;
  51. }
  52. AddRef();
  53. return S_OK;
  54. }
  55. STDAPI_(ULONG) CAIME::AddRef()
  56. {
  57. _cRef++;
  58. return _cRef;
  59. }
  60. STDAPI_(ULONG) CAIME::Release()
  61. {
  62. _cRef--;
  63. if (0 < _cRef)
  64. return _cRef;
  65. delete this;
  66. return 0;
  67. }