ReactOS  0.4.14-dev-1007-g90d795b
mapiutil.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004 Jon Griffiths
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef MAPIUTIL_H_
20 #define MAPIUTIL_H_
21 
22 #include <mapix.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define TAD_ALL_ROWS 1 /* Delete all rows */
29 
31 
32 #define SOF_UNIQUEFILENAME 0x80000000U /* Create a unique (temporary) filename */
33 
34 #if defined (UNICODE) || defined (__WINESRC__)
39 #else
44 #endif
45 #define OPENSTREAMONFILE "OpenStreamOnFile"
46 
48 
49 typedef struct IPropData *LPPROPDATA;
50 
51 #define IPROP_READONLY 0x00001U
52 #define IPROP_READWRITE 0x00002U
53 #define IPROP_CLEAN 0x10000U
54 #define IPROP_DIRTY 0x20000U
55 
56 SCODE WINAPI CreateIProp(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,FREEBUFFER*,
64 
67  LPFREEBUFFER,void (*)(LPSPropTagArray));
71 
72 ULONG WINAPI UlAddRef(void*);
73 ULONG WINAPI UlRelease(void*);
74 
83 
84 #if defined (UNICODE) || defined (__WINESRC__)
87 void WINAPI HexFromBin(LPBYTE,int,LPWSTR);
93 #else
96 void WINAPI HexFromBin(LPBYTE,int,LPSTR);
102 #endif
103 
105 void WINAPI DeinitMapiUtil(void);
106 
107 #define szHrDispatchNotifications "_HrDispatchNotifications@4"
108 #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
109 
110 typedef HRESULT (WINAPI DISPATCHNOTIFICATIONS)(ULONG);
111 typedef DISPATCHNOTIFICATIONS *LPDISPATCHNOTIFICATIONS;
112 typedef SCODE (WINAPI CREATECONVERSATIONINDEX)(ULONG,LPBYTE,ULONG*,LPBYTE*);
113 typedef CREATECONVERSATIONINDEX *LPCREATECONVERSATIONINDEX;
114 
115 typedef struct ITableData *LPTABLEDATA;
116 
117 typedef void (WINAPI CALLERRELEASE)(ULONG,LPTABLEDATA,LPMAPITABLE);
118 
119 /*****************************************************************************
120  * ITableData interface
121  *
122  * The underlying table data structure for IMAPITable.
123  */
124 #define INTERFACE ITableData
126 {
127  /*** IUnknown methods ***/
131  /*** ITableData methods ***/
132  STDMETHOD(HrGetView)(THIS_ LPSSortOrderSet lpSort, CALLERRELEASE *lpRel,
133  ULONG ulData, LPMAPITABLE *lppTable) PURE;
134  STDMETHOD(HrModifyRow)(THIS_ LPSRow lpRow) PURE;
135  STDMETHOD(HrDeleteRow)(THIS_ LPSPropValue lpKey) PURE;
136  STDMETHOD(HrQueryRow)(THIS_ LPSPropValue lpKey, LPSRow *lppRow, ULONG *lpRowNum) PURE;
137  STDMETHOD(HrEnumRow)(THIS_ ULONG ulRowNum, LPSRow *lppRow) PURE;
138  STDMETHOD(HrNotify)(THIS_ ULONG ulFlags, ULONG cValues, LPSPropValue lpValues) PURE;
139  STDMETHOD(HrInsertRow)(THIS_ ULONG ulRow, LPSRow lpRow) PURE;
140  STDMETHOD(HrModifyRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows) PURE;
141  STDMETHOD(HrDeleteRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows, ULONG *lpCount) PURE;
142 };
143 #undef INTERFACE
144 
145 #if !defined(__cplusplus) || defined(CINTERFACE)
146  /*** IUnknown methods ***/
147 #define ITableData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
148 #define ITableData_AddRef(p) (p)->lpVtbl->AddRef(p)
149 #define ITableData_Release(p) (p)->lpVtbl->Release(p)
150  /*** ITableData methods ***/
151 #define ITableData_HrGetView(p,a,b,c,d) (p)->lpVtbl->HrGetView(p,a,b,c,d)
152 #define ITableData_HrModifyRow(p,a) (p)->lpVtbl->HrModifyRow(p,a)
153 #define ITableData_HrDeleteRow(p,a) (p)->lpVtbl->HrDeleteRow(p,a)
154 #define ITableData_HrQueryRow(p,a,b,c) (p)->lpVtbl->HrQueryRow(p,a,b,c)
155 #define ITableData_HrEnumRow(p,a,b) (p)->lpVtbl->HrEnumRow(p,a,b)
156 #define ITableData_HrNotify(p,a,b,c) (p)->lpVtbl->HrNotify(p,a,b,c)
157 #define ITableData_HrInsertRow(p,a,b) (p)->lpVtbl->HrInsertRow(p,a,b)
158 #define ITableData_HrModifyRows(p,a,b) (p)->lpVtbl->HrModifyRows(p,a,b)
159 #define ITableData_HrDeleteRows(p,a,b,c) (p)->lpVtbl->HrDeleteRows(p,a,b,c)
160 #endif
161 
162 SCODE WINAPI CreateTable(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,FREEBUFFER*,
164 
172 
174 
175 static inline FILETIME FtAddFt(FILETIME ftLeft, FILETIME ftRight)
176 {
177  LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
178  union { FILETIME ft; LONG64 ll; } ftmap;
179  ftmap.ll = *pl + *pr;
180  return ftmap.ft;
181 }
182 
183 static inline FILETIME FtSubFt(FILETIME ftLeft, FILETIME ftRight)
184 {
185  LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
186  union { FILETIME ft; LONG64 ll; } ftmap;
187  ftmap.ll = *pl - *pr;
188  return ftmap.ft;
189 }
190 
191 static inline FILETIME FtNegFt(FILETIME ftLeft)
192 {
193  LONG64 *p = (LONG64*)&ftLeft;
194  union { FILETIME ft; LONG64 ll; } ftmap;
195  ftmap.ll = -*p;
196  return ftmap.ft;
197 }
198 
199 static inline FILETIME FtMulDw(DWORD dwLeft, FILETIME ftRight)
200 {
201  LONG64 l = (LONG64)dwLeft, *pr = (LONG64*)&ftRight;
202  union { FILETIME ft; LONG64 ll; } ftmap;
203  ftmap.ll = l * (*pr);
204  return ftmap.ft;
205 }
206 
207 static inline FILETIME FtMulDwDw(DWORD dwLeft, DWORD dwRight)
208 {
209  LONG64 l = (LONG64)dwLeft, r = (LONG64)dwRight;
210  union { FILETIME ft; LONG64 ll; } ftmap;
211  ftmap.ll = l * r;
212  return ftmap.ft;
213 }
214 
215 /*****************************************************************************
216  * IPropData interface
217  *
218  */
219 #define INTERFACE IPropData
220 DECLARE_INTERFACE_(IPropData,IMAPIProp)
221 {
222  /*** IUnknown methods ***/
226  /*** IMAPIProp methods ***/
227  STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
228  STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
229  STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
230  STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
231  STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
232  STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
233  STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
234  STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
235  LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
236  LPSPropProblemArray *lppProbs) PURE;
237  STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
238  LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
239  STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
240  LPMAPINAMEID **lpppNames) PURE;
241  STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
242  /*** IPropData methods ***/
243  STDMETHOD(HrSetObjAccess)(THIS_ ULONG ulAccess) PURE;
244  STDMETHOD(HrSetPropAccess)(THIS_ LPSPropTagArray lpPropTags, ULONG *lpAccess) PURE;
245  STDMETHOD(HrGetPropAccess)(THIS_ LPSPropTagArray *lppPropTags, ULONG **lppAccess) PURE;
246  STDMETHOD(HrAddObjProps)(THIS_ LPSPropTagArray lppPropTags, LPSPropProblemArray *lppProbs) PURE;
247 };
248 #undef INTERFACE
249 
250 #if !defined(__cplusplus) || defined(CINTERFACE)
251  /*** IUnknown methods ***/
252 #define IPropData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
253 #define IPropData_AddRef(p) (p)->lpVtbl->AddRef(p)
254 #define IPropData_Release(p) (p)->lpVtbl->Release(p)
255  /*** IMAPIProp methods ***/
256 #define IPropData_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c)
257 #define IPropData_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a)
258 #define IPropData_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d)
259 #define IPropData_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b)
260 #define IPropData_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
261 #define IPropData_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c)
262 #define IPropData_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b)
263 #define IPropData_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
264 #define IPropData_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
265 #define IPropData_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
266 #define IPropData_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
267 #define IPropData_HrSetObjAccess(p,a) (p)->lpVtbl->HrSetObjAccess(p,a)
268 #define IPropData_HrSetPropAccess(p,a,b) (p)->lpVtbl->HrSetPropAccess(p,a,b)
269 #define IPropData_HrGetPropAccess(p,a,b) (p)->lpVtbl->HrGetPropAccess(p,a,b)
270 #define IPropData_HrAddObjProps(p,a,b) (p)->lpVtbl->HrAddObjProps(p,a,b)
271 #endif
272 
273 #ifdef __cplusplus
274 }
275 #endif
276 
277 #endif /* MAPIUTIL_H_ */
void WINAPI DeinitMapiUtil(void)
Definition: util.c:93
typedef void(WINAPI CALLERRELEASE)(ULONG
static FILETIME FtAddFt(FILETIME ftLeft, FILETIME ftRight)
Definition: mapiutil.h:175
HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER, LPFREEBUFFER, ULONG, LPSTR, LPSTR, LPSTREAM *)
typedef SCODE(WINAPI CREATECONVERSATIONINDEX)(ULONG
#define REFIID
Definition: guiddef.h:118
SCODE WINAPI ScRelocProps(int, LPSPropValue, LPVOID, LPVOID, ULONG *)
Definition: prop.c:934
static FILETIME FtMulDwDw(DWORD dwLeft, DWORD dwRight)
Definition: mapiutil.h:207
UINT WINAPI UFromSz(LPCSTR)
Definition: util.c:677
#define THIS_
Definition: basetyps.h:65
ULONG LPBYTE *typedef CREATECONVERSATIONINDEX * LPCREATECONVERSATIONINDEX
Definition: mapiutil.h:112
_In_ BOOLEAN Release
Definition: classpnp.h:929
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define THIS
Definition: basetyps.h:66
interface IMalloc * LPMALLOC
Definition: objfwd.h:12
ULONG WINAPI UlPropSize(LPSPropValue)
Definition: prop.c:213
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static FILETIME FtMulDw(DWORD dwLeft, FILETIME ftRight)
Definition: mapiutil.h:199
HRESULT WINAPI HrQueryAllRows(LPMAPITABLE, LPSPropTagArray, LPSRestriction, LPSSortOrderSet, LONG, LPSRowSet *)
Definition: util.c:933
void WINAPI FreePadrlist(LPADRLIST)
Definition: prop.c:669
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
IMAPITable * LPMAPITABLE
Definition: mapidefs.h:840
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID WINAPI GetInstance(LPSPropValue, LPSPropValue, ULONG)
LPSTR WINAPI SzFindLastCh(LPCSTR, USHORT)
HRESULT WINAPI HrAddColumnsEx(LPMAPITABLE, LPSPropTagArray, LPALLOCATEBUFFER, LPFREEBUFFER, void(*)(LPSPropTagArray))
SCODE WINAPI ScCopyProps(int, LPSPropValue, LPVOID, ULONG *)
Definition: prop.c:800
interface IStream * LPSTREAM
Definition: objfwd.h:10
struct ITableData * LPTABLEDATA
Definition: mapiutil.h:115
static FILETIME FtSubFt(FILETIME ftLeft, FILETIME ftRight)
Definition: mapiutil.h:183
ULONG WINAPI UlRelease(void *)
Definition: util.c:652
char * LPSTR
Definition: xmlstorage.h:182
SCODE WINAPI ScCountProps(int, LPSPropValue, ULONG *)
HRESULT WINAPI HrAllocAdviseSink(LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK *)
static FILETIME FtNegFt(FILETIME ftLeft)
Definition: mapiutil.h:191
SCODE WINAPI ScInitMapiUtil(ULONG)
Definition: util.c:67
struct IPropData * LPPROPDATA
Definition: mapiutil.h:49
DECLARE_INTERFACE_(ITableData, IUnknown)
Definition: mapiutil.h:125
#define STDMETHOD(m)
Definition: basetyps.h:62
SCODE WINAPI ScDupPropset(int, LPSPropValue, LPALLOCATEBUFFER, LPSPropValue *)
Definition: prop.c:1108
SCODE WINAPI ScRelocNotifications(int, LPNOTIFICATION, LPVOID, LPVOID, ULONG *)
HRESULT WINAPI HrAddColumns(LPMAPITABLE, LPSPropTagArray, LPALLOCATEBUFFER, LPFREEBUFFER)
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
IMAPIProgress * LPMAPIPROGRESS
Definition: mapidefs.h:96
static LPUNKNOWN
Definition: ndr_ole.c:49
LONG SCODE
Definition: compat.h:1901
BOOL WINAPI FEqualNames(LPMAPINAMEID, LPMAPINAMEID)
Definition: util.c:486
SCODE WINAPI ScCountNotifications(int, LPNOTIFICATION, ULONG *)
const char * LPCSTR
Definition: xmlstorage.h:183
struct IMAPIAdviseSink * LPMAPIADVISESINK
Definition: mapidefs.h:92
SCODE WINAPI CreateIProp(LPCIID, ALLOCATEBUFFER *, ALLOCATEMORE *, FREEBUFFER *, LPVOID, LPPROPDATA *)
Definition: prop.c:2307
LPSPropValue WINAPI LpValFindProp(ULONG, ULONG, LPSPropValue)
Definition: prop.c:1076
r l[0]
Definition: byte_order.h:167
int64_t LONG64
Definition: typedefs.h:67
HRESULT WINAPI HrDispatchNotifications(ULONG)
Definition: util.c:243
LONG HRESULT
Definition: typedefs.h:78
ALLOCATEBUFFER * LPALLOCATEBUFFER
Definition: mapidefs.h:76
#define WINAPI
Definition: msvc.h:6
LONG WINAPI LPropCompareProp(LPSPropValue, LPSPropValue)
Definition: prop.c:441
void WINAPI FreeProws(LPSRowSet)
Definition: prop.c:688
unsigned long DWORD
Definition: ntddk_ex.h:95
SCODE WINAPI ScCopyNotifications(int, LPNOTIFICATION, LPVOID, ULONG *)
typedef LPBYTE
Definition: mapiutil.h:112
SCODE WINAPI PropCopyMore(LPSPropValue, LPSPropValue, ALLOCATEMORE *, LPVOID)
Definition: prop.c:64
typedef LPMAPITABLE
Definition: mapiutil.h:117
REFIID LPVOID * ppvObject
Definition: precomp.h:44
LPSPropValue WINAPI PpropFindProp(LPSPropValue, ULONG, ULONG)
Definition: prop.c:639
ULONG WINAPI UlFromSzHex(LPCSTR)
LPSTR WINAPI SzFindCh(LPCSTR, USHORT)
typedef HRESULT(WINAPI DISPATCHNOTIFICATIONS)(ULONG)
BOOL WINAPI FBinFromHex(LPSTR, LPBYTE)
static LPCTSTR lpKey
Definition: virtmem.c:13
void WINAPI HexFromBin(LPBYTE, int, LPSTR)
HRESULT WINAPI HrGetOneProp(LPMAPIPROP, ULONG, LPSPropValue *)
Definition: prop.c:535
DISPATCHNOTIFICATIONS * LPDISPATCHNOTIFICATIONS
Definition: mapiutil.h:111
unsigned short USHORT
Definition: pedump.c:61
LPSTR WINAPI SzFindSz(LPCSTR, LPCSTR)
IMAPIProp * LPMAPIPROP
Definition: mapidefs.h:914
HRESULT WINAPI HrThisThreadAdviseSink(LPMAPIADVISESINK, LPMAPIADVISESINK *)
Definition: util.c:262
w ll
Definition: byte_order.h:166
#define PURE
Definition: basetyps.h:64
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI FPropContainsProp(LPSPropValue, LPSPropValue, ULONG)
Definition: prop.c:300
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
BOOL WINAPI FPropExists(LPMAPIPROP, ULONG)
Definition: prop.c:592
SCODE WINAPI ScBinFromHexBounded(LPSTR, LPBYTE, ULONG)
LPMALLOC WINAPI MAPIGetDefaultMalloc(void)
Definition: imalloc.c:62
NOTIFCALLBACK * LPNOTIFCALLBACK
Definition: mapidefs.h:762
BOOL WINAPI FPropCompareProp(LPSPropValue, ULONG, LPSPropValue)
Definition: prop.c:399
HRESULT WINAPI HrSetOneProp(LPMAPIPROP, LPSPropValue)
Definition: prop.c:568
unsigned int ULONG
Definition: retypes.h:1
FREEBUFFER * LPFREEBUFFER
Definition: mapidefs.h:78
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ULONG WINAPI UlAddRef(void *)
Definition: util.c:627
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
SCODE WINAPI CreateTable(LPCIID, ALLOCATEBUFFER *, ALLOCATEMORE *, FREEBUFFER *, LPVOID, ULONG, ULONG, LPSPropTagArray, LPTABLEDATA *)
HRESULT(WINAPI * LPOPENSTREAMONFILE)(LPALLOCATEBUFFER, LPFREEBUFFER, ULONG, LPSTR, LPSTR, LPSTREAM *)
Definition: mapiutil.h:40