imessage.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #ifndef _M4L_IMESSAGE_H_
  18. #define _M4L_IMESSAGE_H_
  19. #define _IMESSAGE_H_
  20. #include <initializer_list>
  21. extern "C" {
  22. typedef struct _MSGSESS *LPMSGSESS;
  23. typedef void (__stdcall MSGCALLRELEASE)( ULONG ulCallerData, LPMESSAGE lpMessage );
  24. STDAPI_(SCODE) OpenIMsgSession(LPMALLOC lpMalloc, ULONG ulFlags, LPMSGSESS *lppMsgSess);
  25. STDAPI_(void) CloseIMsgSession(LPMSGSESS lpMsgSess);
  26. STDAPI_(SCODE) OpenIMsgOnIStg(LPMSGSESS lpMsgSess, LPALLOCATEBUFFER lpAllocateBuffer,
  27. LPALLOCATEMORE lpAllocateMore, LPFREEBUFFER lpFreeBuffer, LPMALLOC lpMalloc,
  28. LPVOID lpMapiSup, LPSTORAGE lpStg, MSGCALLRELEASE *lpfMsgCallRelease,
  29. ULONG ulCallerData, ULONG ulFlags, LPMESSAGE *lppMsg);
  30. #define IMSG_NO_ISTG_COMMIT ((ULONG) 0x00000001)
  31. #define PROPATTR_MANDATORY ((ULONG) 0x00000001)
  32. #define PROPATTR_READABLE ((ULONG) 0x00000002)
  33. #define PROPATTR_WRITEABLE ((ULONG) 0x00000004)
  34. #define PROPATTR_NOT_PRESENT ((ULONG) 0x00000008)
  35. } /* extern "C" */
  36. struct SPropAttrArray {
  37. SPropAttrArray(void) = delete;
  38. template<typename _T> SPropAttrArray(std::initializer_list<_T>) = delete;
  39. ULONG cValues;
  40. ULONG aPropAttr[MAPI_DIM];
  41. };
  42. typedef struct SPropAttrArray *LPSPropAttrArray;
  43. #define CbNewSPropAttrArray(_cattr) \
  44. (offsetof(SPropAttrArray,aPropAttr) + (_cattr)*sizeof(ULONG))
  45. #define CbSPropAttrArray(_lparray) \
  46. (offsetof(SPropAttrArray,aPropAttr) + \
  47. (UINT)((_lparray)->cValues)*sizeof(ULONG))
  48. #define SizedSPropAttrArray(_cattr, _name) \
  49. struct _SPropAttrArray_ ## _name { \
  50. ULONG cValues; \
  51. ULONG aPropAttr[_cattr]; \
  52. } _name
  53. extern "C" {
  54. extern STDAPI_(HRESULT) GetAttribIMsgOnIStg(LPVOID lpObject, const SPropTagArray *lpPropTagArray, LPSPropAttrArray *lppPropAttrArray);
  55. extern STDAPI_(HRESULT) SetAttribIMsgOnIStg(void *lpObject, const SPropTagArray *lpPropTags, const SPropAttrArray *lpPropAttrs, LPSPropProblemArray *lppPropProblems);
  56. STDAPI_(SCODE) MapStorageSCode( SCODE StgSCode );
  57. } //extern "C"
  58. #endif /* _M4L_IMESSAGE_H_ */