2 * Copyright 2004 Jon Griffiths
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #define TAD_ALL_ROWS 1 /* Delete all rows */
30 LPMALLOC WINAPI
MAPIGetDefaultMalloc(void);
32 #define SOF_UNIQUEFILENAME 0x80000000U /* Create a unique (temporary) filename */
34 #if defined (UNICODE) || defined (__WINESRC__)
35 typedef HRESULT (WINAPI
* LPOPENSTREAMONFILE
)(LPALLOCATEBUFFER
,LPFREEBUFFER
,
36 ULONG
,LPWSTR
,LPWSTR
,LPSTREAM
*);
37 HRESULT WINAPI
OpenStreamOnFile(LPALLOCATEBUFFER
,LPFREEBUFFER
,
38 ULONG
,LPWSTR
,LPWSTR
,LPSTREAM
*);
40 typedef HRESULT (WINAPI
* LPOPENSTREAMONFILE
)(LPALLOCATEBUFFER
,LPFREEBUFFER
,
41 ULONG
,LPSTR
,LPSTR
,LPSTREAM
*);
42 HRESULT WINAPI
OpenStreamOnFile(LPALLOCATEBUFFER
,LPFREEBUFFER
,
43 ULONG
,LPSTR
,LPSTR
,LPSTREAM
*);
45 #define OPENSTREAMONFILE "OpenStreamOnFile"
47 BOOL WINAPI
FEqualNames(LPMAPINAMEID
,LPMAPINAMEID
);
49 typedef struct IPropData IPropData
;
50 typedef IPropData
*LPPROPDATA
;
52 #define IPROP_READONLY 0x00001U
53 #define IPROP_READWRITE 0x00002U
54 #define IPROP_CLEAN 0x10000U
55 #define IPROP_DIRTY 0x20000U
57 SCODE WINAPI
CreateIProp(LPCIID
,ALLOCATEBUFFER
*,ALLOCATEMORE
*,FREEBUFFER
*,
59 SCODE WINAPI
PropCopyMore(LPSPropValue
,LPSPropValue
,ALLOCATEMORE
*,LPVOID
);
60 ULONG WINAPI
UlPropSize(LPSPropValue
);
61 VOID WINAPI
GetInstance(LPSPropValue
,LPSPropValue
,ULONG
);
62 BOOL WINAPI
FPropContainsProp(LPSPropValue
,LPSPropValue
,ULONG
);
63 BOOL WINAPI
FPropCompareProp(LPSPropValue
,ULONG
,LPSPropValue
);
64 LONG WINAPI
LPropCompareProp(LPSPropValue
,LPSPropValue
);
66 HRESULT WINAPI
HrAddColumns(LPMAPITABLE
,LPSPropTagArray
,LPALLOCATEBUFFER
,LPFREEBUFFER
);
67 HRESULT WINAPI
HrAddColumnsEx(LPMAPITABLE
,LPSPropTagArray
,LPALLOCATEBUFFER
,
68 LPFREEBUFFER
,void (*)(LPSPropTagArray
));
69 HRESULT WINAPI
HrAllocAdviseSink(LPNOTIFCALLBACK
,LPVOID
,LPMAPIADVISESINK
*);
70 HRESULT WINAPI
HrThisThreadAdviseSink(LPMAPIADVISESINK
,LPMAPIADVISESINK
*);
71 HRESULT WINAPI
HrDispatchNotifications (ULONG
);
73 ULONG WINAPI
UlAddRef(void*);
74 ULONG WINAPI
UlRelease(void*);
76 HRESULT WINAPI
HrGetOneProp(LPMAPIPROP
,ULONG
,LPSPropValue
*);
77 HRESULT WINAPI
HrSetOneProp(LPMAPIPROP
,LPSPropValue
);
78 BOOL WINAPI
FPropExists(LPMAPIPROP
,ULONG
);
79 void WINAPI
FreePadrlist(LPADRLIST
);
80 void WINAPI
FreeProws(LPSRowSet
);
81 HRESULT WINAPI
HrQueryAllRows(LPMAPITABLE
,LPSPropTagArray
,LPSRestriction
,
82 LPSSortOrderSet
,LONG
,LPSRowSet
*);
83 LPSPropValue WINAPI
PpropFindProp(LPSPropValue
,ULONG
,ULONG
);
85 #if defined (UNICODE) || defined (__WINESRC__)
86 BOOL WINAPI
FBinFromHex(LPWSTR
,LPBYTE
);
87 SCODE WINAPI
ScBinFromHexBounded(LPWSTR
,LPBYTE
,ULONG
);
88 void WINAPI
HexFromBin(LPBYTE
,int,LPWSTR
);
89 ULONG WINAPI
UlFromSzHex(LPCWSTR
);
90 LPWSTR WINAPI
SzFindCh(LPCWSTR
,USHORT
);
91 LPWSTR WINAPI
SzFindLastCh(LPCWSTR
,USHORT
);
92 LPWSTR WINAPI
SzFindSz(LPCWSTR
,LPCWSTR
);
93 UINT WINAPI
UFromSz(LPCSTR
);
95 BOOL WINAPI
FBinFromHex(LPSTR
,LPBYTE
);
96 SCODE WINAPI
ScBinFromHexBounded(LPSTR
,LPBYTE
,ULONG
);
97 void WINAPI
HexFromBin(LPBYTE
,int,LPSTR
);
98 ULONG WINAPI
UlFromSzHex(LPCSTR
);
99 LPSTR WINAPI
SzFindCh(LPCSTR
,USHORT
);
100 LPSTR WINAPI
SzFindLastCh(LPCSTR
,USHORT
);
101 LPSTR WINAPI
SzFindSz(LPCSTR
,LPCSTR
);
102 UINT WINAPI
UFromSz(LPCSTR
);
105 SCODE WINAPI
ScInitMapiUtil(ULONG
);
106 void WINAPI
DeinitMapiUtil(void);
108 #define szHrDispatchNotifications "_HrDispatchNotifications@4"
109 #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
111 typedef HRESULT (WINAPI DISPATCHNOTIFICATIONS
)(ULONG
);
112 typedef DISPATCHNOTIFICATIONS
*LPDISPATCHNOTIFICATIONS
;
113 typedef SCODE (WINAPI CREATECONVERSATIONINDEX
)(ULONG
,LPBYTE
,ULONG
*,LPBYTE
*);
114 typedef CREATECONVERSATIONINDEX
*LPCREATECONVERSATIONINDEX
;
116 typedef struct ITableData ITableData
;
117 typedef ITableData
*LPTABLEDATA
;
119 typedef void (WINAPI CALLERRELEASE
)(ULONG
,LPTABLEDATA
,LPMAPITABLE
);
121 /*****************************************************************************
122 * ITableData interface
124 * The underlying table data structure for IMAPITable.
126 #define INTERFACE ITableData
127 DECLARE_INTERFACE_(ITableData
,IUnknown
)
129 /*** IUnknown methods ***/
130 STDMETHOD_(HRESULT
,QueryInterface
)(THIS_ REFIID riid
, void** ppvObject
) PURE
;
131 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
132 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
133 /*** ITableData methods ***/
134 STDMETHOD(HrGetView
)(THIS_ LPSSortOrderSet lpSort
, CALLERRELEASE
*lpRel
,
135 ULONG ulData
, LPMAPITABLE
*lppTable
) PURE
;
136 STDMETHOD(HrModifyRow
)(THIS_ LPSRow lpRow
) PURE
;
137 STDMETHOD(HrDeleteRow
)(THIS_ LPSPropValue lpKey
) PURE
;
138 STDMETHOD(HrQueryRow
)(THIS_ LPSPropValue lpKey
, LPSRow
*lppRow
, ULONG
*lpRowNum
) PURE
;
139 STDMETHOD(HrEnumRow
)(THIS_ ULONG ulRowNum
, LPSRow
*lppRow
) PURE
;
140 STDMETHOD(HrNotify
)(THIS_ ULONG ulFlags
, ULONG cValues
, LPSPropValue lpValues
) PURE
;
141 STDMETHOD(HrInsertRow
)(THIS_ ULONG ulRow
, LPSRow lpRow
) PURE
;
142 STDMETHOD(HrModifyRows
)(THIS_ ULONG ulFlags
, LPSRowSet lpRows
) PURE
;
143 STDMETHOD(HrDeleteRows
)(THIS_ ULONG ulFlags
, LPSRowSet lpRows
, ULONG
*lpCount
) PURE
;
147 #if !defined(__cplusplus) || defined(CINTERFACE)
148 /*** IUnknown methods ***/
149 #define ITableData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
150 #define ITableData_AddRef(p) (p)->lpVtbl->AddRef(p)
151 #define ITableData_Release(p) (p)->lpVtbl->Release(p)
152 /*** ITableData methods ***/
153 #define ITableData_HrGetView(p,a,b,c,d) (p)->lpVtbl->HrGetView(p,a,b,c,d)
154 #define ITableData_HrModifyRow(p,a) (p)->lpVtbl->HrModifyRow(p,a)
155 #define ITableData_HrDeleteRow(p,a) (p)->lpVtbl->HrDeleteRow(p,a)
156 #define ITableData_HrQueryRow(p,a,b,c) (p)->lpVtbl->HrQueryRow(p,a,b,c)
157 #define ITableData_HrEnumRow(p,a,b) (p)->lpVtbl->HrEnumRow(p,a,b)
158 #define ITableData_HrNotify(p,a,b,c) (p)->lpVtbl->HrNotify(p,a,b,c)
159 #define ITableData_HrInsertRow(p,a,b) (p)->lpVtbl->HrInsertRow(p,a,b)
160 #define ITableData_HrModifyRows(p,a,b) (p)->lpVtbl->HrModifyRows(p,a,b)
161 #define ITableData_HrDeleteRows(p,a,b,c) (p)->lpVtbl->HrDeleteRows(p,a,b,c)
164 SCODE WINAPI
CreateTable(LPCIID
,ALLOCATEBUFFER
*,ALLOCATEMORE
*,FREEBUFFER
*,
165 LPVOID
,ULONG
,ULONG
,LPSPropTagArray
,LPTABLEDATA
*);
167 SCODE WINAPI
ScCountNotifications(int,LPNOTIFICATION
,ULONG
*);
168 SCODE WINAPI
ScCountProps(int,LPSPropValue
,ULONG
*);
169 SCODE WINAPI
ScCopyNotifications(int,LPNOTIFICATION
,LPVOID
,ULONG
*);
170 SCODE WINAPI
ScCopyProps(int,LPSPropValue
,LPVOID
,ULONG
*);
171 SCODE WINAPI
ScDupPropset(int,LPSPropValue
,LPALLOCATEBUFFER
,LPSPropValue
*);
172 SCODE WINAPI
ScRelocNotifications(int,LPNOTIFICATION
,LPVOID
,LPVOID
,ULONG
*);
173 SCODE WINAPI
ScRelocProps(int,LPSPropValue
,LPVOID
,LPVOID
,ULONG
*);
175 LPSPropValue WINAPI
LpValFindProp(ULONG
,ULONG
,LPSPropValue
);
177 static inline FILETIME
FtAddFt(FILETIME ftLeft
, FILETIME ftRight
)
179 LONG64
*pl
= (LONG64
*)&ftLeft
, *pr
= (LONG64
*)&ftRight
;
180 union { FILETIME ft
; LONG64 ll
; } ftmap
;
181 ftmap
.ll
= *pl
+ *pr
;
185 static inline FILETIME
FtSubFt(FILETIME ftLeft
, FILETIME ftRight
)
187 LONG64
*pl
= (LONG64
*)&ftLeft
, *pr
= (LONG64
*)&ftRight
;
188 union { FILETIME ft
; LONG64 ll
; } ftmap
;
189 ftmap
.ll
= *pl
- *pr
;
193 static inline FILETIME
FtNegFt(FILETIME ftLeft
)
195 LONG64
*p
= (LONG64
*)&ftLeft
;
196 union { FILETIME ft
; LONG64 ll
; } ftmap
;
201 static inline FILETIME
FtMulDw(DWORD dwLeft
, FILETIME ftRight
)
203 LONG64 l
= (LONG64
)dwLeft
, *pr
= (LONG64
*)&ftRight
;
204 union { FILETIME ft
; LONG64 ll
; } ftmap
;
205 ftmap
.ll
= l
* (*pr
);
209 static inline FILETIME
FtMulDwDw(DWORD dwLeft
, DWORD dwRight
)
211 LONG64 l
= (LONG64
)dwLeft
, r
= (LONG64
)dwRight
;
212 union { FILETIME ft
; LONG64 ll
; } ftmap
;
217 /*****************************************************************************
218 * IPropData interface
221 #define INTERFACE IPropData
222 DECLARE_INTERFACE_(IPropData
,IMAPIProp
)
224 /*** IUnknown methods ***/
225 STDMETHOD_(HRESULT
,QueryInterface
)(THIS_ REFIID riid
, void** ppvObject
) PURE
;
226 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
227 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
228 /*** IMAPIProp methods ***/
229 STDMETHOD(GetLastError
)(THIS_ HRESULT hRes
, ULONG ulFlags
, LPMAPIERROR
*lppErr
) PURE
;
230 STDMETHOD(SaveChanges
)(THIS_ ULONG ulFlags
) PURE
;
231 STDMETHOD(GetProps
)(THIS_ LPSPropTagArray lpPropTags
, ULONG ulFlags
, ULONG
*lpValues
, LPSPropValue
*lppProps
) PURE
;
232 STDMETHOD(GetPropList
)(THIS_ ULONG ulFlags
, LPSPropTagArray
*lppPropTagArray
) PURE
;
233 STDMETHOD(OpenProperty
)(THIS_ ULONG ulPropTag
, LPCIID lpIid
, ULONG ulOpts
, ULONG ulFlags
, LPUNKNOWN
*lppUnk
) PURE
;
234 STDMETHOD(SetProps
)(THIS_ ULONG cValues
, LPSPropValue lpProps
, LPSPropProblemArray
*lppProbs
) PURE
;
235 STDMETHOD(DeleteProps
)(THIS_ LPSPropTagArray lpPropTags
, LPSPropProblemArray
*lppProbs
) PURE
;
236 STDMETHOD(CopyTo
)(THIS_ ULONG ciidExclude
, LPCIID lpIid
, LPSPropTagArray lpProps
, ULONG ulParam
,
237 LPMAPIPROGRESS lpProgress
, LPCIID lpIface
,LPVOID lpDest
, ULONG ulFlags
,
238 LPSPropProblemArray
*lppProbs
) PURE
;
239 STDMETHOD(CopyProps
)(THIS_ LPSPropTagArray lpIncludeProps
, ULONG ulParam
, LPMAPIPROGRESS lpProgress
,
240 LPCIID lpIid
, LPVOID lpDestObj
, ULONG ulFlags
, LPSPropProblemArray
*lppProblems
) PURE
;
241 STDMETHOD(GetNamesFromIDs
)(THIS_ LPSPropTagArray
*lppPropTags
, LPGUID lpIid
, ULONG ulFlags
, ULONG
*lpCount
,
242 LPMAPINAMEID
**lpppNames
) PURE
;
243 STDMETHOD(GetIDsFromNames
)(THIS_ ULONG cPropNames
, LPMAPINAMEID
*lppNames
, ULONG ulFlags
, LPSPropTagArray
*lppPropTags
) PURE
;
244 /*** IPropData methods ***/
245 STDMETHOD(HrSetObjAccess
)(THIS_ ULONG ulAccess
) PURE
;
246 STDMETHOD(HrSetPropAccess
)(THIS_ LPSPropTagArray lpPropTags
, ULONG
*lpAccess
) PURE
;
247 STDMETHOD(HrGetPropAccess
)(THIS_ LPSPropTagArray
*lppPropTags
, ULONG
**lppAccess
) PURE
;
248 STDMETHOD(HrAddObjProps
)(THIS_ LPSPropTagArray lppPropTags
, LPSPropProblemArray
*lppProbs
) PURE
;
252 #if !defined(__cplusplus) || defined(CINTERFACE)
253 /*** IUnknown methods ***/
254 #define IPropData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
255 #define IPropData_AddRef(p) (p)->lpVtbl->AddRef(p)
256 #define IPropData_Release(p) (p)->lpVtbl->Release(p)
257 /*** IMAPIProp methods ***/
258 #define IPropData_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c)
259 #define IPropData_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a)
260 #define IPropData_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d)
261 #define IPropData_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b)
262 #define IPropData_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
263 #define IPropData_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c)
264 #define IPropData_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b)
265 #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)
266 #define IPropData_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
267 #define IPropData_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
268 #define IPropData_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
269 #define IPropData_HrSetObjAccess(p,a) (p)->lpVtbl->HrSetObjAccess(p,a)
270 #define IPropData_HrSetPropAccess(p,a,b) (p)->lpVtbl->HrSetPropAccess(p,a,b)
271 #define IPropData_HrGetPropAccess(p,a,b) (p)->lpVtbl->HrGetPropAccess(p,a,b)
272 #define IPropData_HrAddObjProps(p,a,b) (p)->lpVtbl->HrAddObjProps(p,a,b)
279 #endif /* MAPIUTIL_H_ */