epcontact.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #include <kopano/platform.h>
  18. #include <mapidefs.h>
  19. #include <mapispi.h>
  20. #include <kopano/ECDebug.h>
  21. #include <kopano/Trace.h>
  22. #include <kopano/memory.hpp>
  23. #include "ZCABProvider.h"
  24. #include "EntryPoint.h"
  25. using namespace KCHL;
  26. HRESULT __stdcall MSGServiceEntry(HINSTANCE hInst, LPMALLOC lpMalloc,
  27. LPMAPISUP psup, ULONG ulUIParam, ULONG ulFlags, ULONG ulContext,
  28. ULONG cvals, LPSPropValue pvals, LPPROVIDERADMIN lpAdminProviders,
  29. MAPIERROR **lppMapiError)
  30. {
  31. TRACE_MAPI(TRACE_ENTRY, "MSGServiceEntry", "flags=0x%08X, context=%s", ulFlags, MsgServiceContextToString(ulContext));
  32. HRESULT hr = hrSuccess;
  33. switch(ulContext) {
  34. case MSG_SERVICE_INSTALL:
  35. hr = hrSuccess;
  36. break;
  37. case MSG_SERVICE_UNINSTALL:
  38. hr = hrSuccess;
  39. break;
  40. case MSG_SERVICE_DELETE:
  41. hr = hrSuccess;
  42. break;
  43. case MSG_SERVICE_PROVIDER_CREATE:
  44. // we never get here in linux (see M4LProviderAdmin::CreateProvider)
  45. assert(false);
  46. hr = hrSuccess;
  47. break;
  48. case MSG_SERVICE_PROVIDER_DELETE:
  49. hr = hrSuccess;
  50. break;
  51. case MSG_SERVICE_CONFIGURE:
  52. case MSG_SERVICE_CREATE:
  53. hr = hrSuccess;
  54. break;
  55. };
  56. if (lppMapiError)
  57. *lppMapiError = NULL;
  58. TRACE_MAPI(TRACE_RETURN, "MSGServiceEntry", "%s", GetMAPIErrorDescription(hr).c_str());
  59. return hr;
  60. }
  61. HRESULT __cdecl ABProviderInit(HINSTANCE hInstance, LPMALLOC lpMalloc,
  62. LPALLOCATEBUFFER lpAllocateBuffer, LPALLOCATEMORE lpAllocateMore,
  63. LPFREEBUFFER lpFreeBuffer, ULONG ulFlags, ULONG ulMAPIVer,
  64. ULONG *lpulProviderVer, LPABPROVIDER *lppABProvider)
  65. {
  66. TRACE_MAPI(TRACE_ENTRY, "ZContacts::ABProviderInit", "");
  67. HRESULT hr = hrSuccess;
  68. object_ptr<ZCABProvider> lpABProvider;
  69. if (ulMAPIVer < CURRENT_SPI_VERSION)
  70. {
  71. hr = MAPI_E_VERSION;
  72. goto exit;
  73. }
  74. // create provider and query interface.
  75. hr = ZCABProvider::Create(&~lpABProvider);
  76. if (hr != hrSuccess)
  77. goto exit;
  78. hr = lpABProvider->QueryInterface(IID_IABProvider, (void **)lppABProvider);
  79. if (hr != hrSuccess)
  80. goto exit;
  81. *lpulProviderVer = CURRENT_SPI_VERSION;
  82. exit:
  83. TRACE_MAPI(TRACE_RETURN, "ZContacts::ABProviderInit", "%s", GetMAPIErrorDescription(hr).c_str());
  84. return hr;
  85. }