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 | /*
|
---|
20 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAPIUTIL_H_
|
---|
29 | #define MAPIUTIL_H_
|
---|
30 |
|
---|
31 | #include <mapix.h>
|
---|
32 |
|
---|
33 | #ifdef __cplusplus
|
---|
34 | extern "C" {
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #define TAD_ALL_ROWS 1 /* Delete all rows */
|
---|
38 |
|
---|
39 | LPMALLOC WINAPI MAPIGetDefaultMalloc(void);
|
---|
40 |
|
---|
41 | #define SOF_UNIQUEFILENAME 0x80000000U /* Create a unique (temporary) filename */
|
---|
42 |
|
---|
43 | #if defined (UNICODE) || defined (__WINESRC__)
|
---|
44 | typedef HRESULT (WINAPI * LPOPENSTREAMONFILE)(LPALLOCATEBUFFER,LPFREEBUFFER,
|
---|
45 | ULONG,LPWSTR,LPWSTR,LPSTREAM*);
|
---|
46 | HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
|
---|
47 | ULONG,LPWSTR,LPWSTR,LPSTREAM*);
|
---|
48 | #else
|
---|
49 | typedef HRESULT (WINAPI * LPOPENSTREAMONFILE)(LPALLOCATEBUFFER,LPFREEBUFFER,
|
---|
50 | ULONG,LPSTR,LPSTR,LPSTREAM*);
|
---|
51 | HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
|
---|
52 | ULONG,LPSTR,LPSTR,LPSTREAM*);
|
---|
53 | #endif
|
---|
54 | #define OPENSTREAMONFILE "OpenStreamOnFile"
|
---|
55 |
|
---|
56 | BOOL WINAPI FEqualNames(LPMAPINAMEID,LPMAPINAMEID);
|
---|
57 |
|
---|
58 | typedef struct IPropData *LPPROPDATA;
|
---|
59 |
|
---|
60 | #define IPROP_READONLY 0x00001U
|
---|
61 | #define IPROP_READWRITE 0x00002U
|
---|
62 | #define IPROP_CLEAN 0x10000U
|
---|
63 | #define IPROP_DIRTY 0x20000U
|
---|
64 |
|
---|
65 | SCODE WINAPI CreateIProp(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,FREEBUFFER*,
|
---|
66 | LPVOID,LPPROPDATA*);
|
---|
67 | SCODE WINAPI PropCopyMore(LPSPropValue,LPSPropValue,ALLOCATEMORE*,LPVOID);
|
---|
68 | ULONG WINAPI UlPropSize(LPSPropValue);
|
---|
69 | VOID WINAPI GetInstance(LPSPropValue,LPSPropValue,ULONG);
|
---|
70 | BOOL WINAPI FPropContainsProp(LPSPropValue,LPSPropValue,ULONG);
|
---|
71 | BOOL WINAPI FPropCompareProp(LPSPropValue,ULONG,LPSPropValue);
|
---|
72 | LONG WINAPI LPropCompareProp(LPSPropValue,LPSPropValue);
|
---|
73 |
|
---|
74 | HRESULT WINAPI HrAddColumns(LPMAPITABLE,LPSPropTagArray,LPALLOCATEBUFFER,LPFREEBUFFER);
|
---|
75 | HRESULT WINAPI HrAddColumnsEx(LPMAPITABLE,LPSPropTagArray,LPALLOCATEBUFFER,
|
---|
76 | LPFREEBUFFER,void (*)(LPSPropTagArray));
|
---|
77 | HRESULT WINAPI HrAllocAdviseSink(LPNOTIFCALLBACK,LPVOID,LPMAPIADVISESINK*);
|
---|
78 | HRESULT WINAPI HrThisThreadAdviseSink(LPMAPIADVISESINK,LPMAPIADVISESINK*);
|
---|
79 | HRESULT WINAPI HrDispatchNotifications (ULONG);
|
---|
80 |
|
---|
81 | ULONG WINAPI UlAddRef(void*);
|
---|
82 | ULONG WINAPI UlRelease(void*);
|
---|
83 |
|
---|
84 | HRESULT WINAPI HrGetOneProp(LPMAPIPROP,ULONG,LPSPropValue*);
|
---|
85 | HRESULT WINAPI HrSetOneProp(LPMAPIPROP,LPSPropValue);
|
---|
86 | BOOL WINAPI FPropExists(LPMAPIPROP,ULONG);
|
---|
87 | void WINAPI FreePadrlist(LPADRLIST);
|
---|
88 | void WINAPI FreeProws(LPSRowSet);
|
---|
89 | HRESULT WINAPI HrQueryAllRows(LPMAPITABLE,LPSPropTagArray,LPSRestriction,
|
---|
90 | LPSSortOrderSet,LONG,LPSRowSet*);
|
---|
91 | LPSPropValue WINAPI PpropFindProp(LPSPropValue,ULONG,ULONG);
|
---|
92 |
|
---|
93 | #if defined (UNICODE) || defined (__WINESRC__)
|
---|
94 | BOOL WINAPI FBinFromHex(LPWSTR,LPBYTE);
|
---|
95 | SCODE WINAPI ScBinFromHexBounded(LPWSTR,LPBYTE,ULONG);
|
---|
96 | void WINAPI HexFromBin(LPBYTE,int,LPWSTR);
|
---|
97 | ULONG WINAPI UlFromSzHex(LPCWSTR);
|
---|
98 | LPWSTR WINAPI SzFindCh(LPCWSTR,USHORT);
|
---|
99 | LPWSTR WINAPI SzFindLastCh(LPCWSTR,USHORT);
|
---|
100 | LPWSTR WINAPI SzFindSz(LPCWSTR,LPCWSTR);
|
---|
101 | UINT WINAPI UFromSz(LPCSTR);
|
---|
102 | #else
|
---|
103 | BOOL WINAPI FBinFromHex(LPSTR,LPBYTE);
|
---|
104 | SCODE WINAPI ScBinFromHexBounded(LPSTR,LPBYTE,ULONG);
|
---|
105 | void WINAPI HexFromBin(LPBYTE,int,LPSTR);
|
---|
106 | ULONG WINAPI UlFromSzHex(LPCSTR);
|
---|
107 | LPSTR WINAPI SzFindCh(LPCSTR,USHORT);
|
---|
108 | LPSTR WINAPI SzFindLastCh(LPCSTR,USHORT);
|
---|
109 | LPSTR WINAPI SzFindSz(LPCSTR,LPCSTR);
|
---|
110 | UINT WINAPI UFromSz(LPCSTR);
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | SCODE WINAPI ScInitMapiUtil(ULONG);
|
---|
114 | void WINAPI DeinitMapiUtil(void);
|
---|
115 |
|
---|
116 | #define szHrDispatchNotifications "_HrDispatchNotifications@4"
|
---|
117 | #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
|
---|
118 |
|
---|
119 | typedef HRESULT (WINAPI DISPATCHNOTIFICATIONS)(ULONG);
|
---|
120 | typedef DISPATCHNOTIFICATIONS *LPDISPATCHNOTIFICATIONS;
|
---|
121 | typedef SCODE (WINAPI CREATECONVERSATIONINDEX)(ULONG,LPBYTE,ULONG*,LPBYTE*);
|
---|
122 | typedef CREATECONVERSATIONINDEX *LPCREATECONVERSATIONINDEX;
|
---|
123 |
|
---|
124 | typedef struct ITableData *LPTABLEDATA;
|
---|
125 |
|
---|
126 | typedef void (WINAPI CALLERRELEASE)(ULONG,LPTABLEDATA,LPMAPITABLE);
|
---|
127 |
|
---|
128 | /*****************************************************************************
|
---|
129 | * ITableData interface
|
---|
130 | *
|
---|
131 | * The underlying table data structure for IMAPITable.
|
---|
132 | */
|
---|
133 | #define INTERFACE ITableData
|
---|
134 | DECLARE_INTERFACE_(ITableData,IUnknown)
|
---|
135 | {
|
---|
136 | /*** IUnknown methods ***/
|
---|
137 | STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
---|
138 | STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
---|
139 | STDMETHOD_(ULONG,Release)(THIS) PURE;
|
---|
140 | /*** ITableData methods ***/
|
---|
141 | STDMETHOD(HrGetView)(THIS_ LPSSortOrderSet lpSort, CALLERRELEASE *lpRel,
|
---|
142 | ULONG ulData, LPMAPITABLE *lppTable) PURE;
|
---|
143 | STDMETHOD(HrModifyRow)(THIS_ LPSRow lpRow) PURE;
|
---|
144 | STDMETHOD(HrDeleteRow)(THIS_ LPSPropValue lpKey) PURE;
|
---|
145 | STDMETHOD(HrQueryRow)(THIS_ LPSPropValue lpKey, LPSRow *lppRow, ULONG *lpRowNum) PURE;
|
---|
146 | STDMETHOD(HrEnumRow)(THIS_ ULONG ulRowNum, LPSRow *lppRow) PURE;
|
---|
147 | STDMETHOD(HrNotify)(THIS_ ULONG ulFlags, ULONG cValues, LPSPropValue lpValues) PURE;
|
---|
148 | STDMETHOD(HrInsertRow)(THIS_ ULONG ulRow, LPSRow lpRow) PURE;
|
---|
149 | STDMETHOD(HrModifyRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows) PURE;
|
---|
150 | STDMETHOD(HrDeleteRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows, ULONG *lpCount) PURE;
|
---|
151 | };
|
---|
152 | #undef INTERFACE
|
---|
153 |
|
---|
154 | #if !defined(__cplusplus) || defined(CINTERFACE)
|
---|
155 | /*** IUnknown methods ***/
|
---|
156 | #define ITableData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
---|
157 | #define ITableData_AddRef(p) (p)->lpVtbl->AddRef(p)
|
---|
158 | #define ITableData_Release(p) (p)->lpVtbl->Release(p)
|
---|
159 | /*** ITableData methods ***/
|
---|
160 | #define ITableData_HrGetView(p,a,b,c,d) (p)->lpVtbl->HrGetView(p,a,b,c,d)
|
---|
161 | #define ITableData_HrModifyRow(p,a) (p)->lpVtbl->HrModifyRow(p,a)
|
---|
162 | #define ITableData_HrDeleteRow(p,a) (p)->lpVtbl->HrDeleteRow(p,a)
|
---|
163 | #define ITableData_HrQueryRow(p,a,b,c) (p)->lpVtbl->HrQueryRow(p,a,b,c)
|
---|
164 | #define ITableData_HrEnumRow(p,a,b) (p)->lpVtbl->HrEnumRow(p,a,b)
|
---|
165 | #define ITableData_HrNotify(p,a,b,c) (p)->lpVtbl->HrNotify(p,a,b,c)
|
---|
166 | #define ITableData_HrInsertRow(p,a,b) (p)->lpVtbl->HrInsertRow(p,a,b)
|
---|
167 | #define ITableData_HrModifyRows(p,a,b) (p)->lpVtbl->HrModifyRows(p,a,b)
|
---|
168 | #define ITableData_HrDeleteRows(p,a,b,c) (p)->lpVtbl->HrDeleteRows(p,a,b,c)
|
---|
169 | #endif
|
---|
170 |
|
---|
171 | SCODE WINAPI CreateTable(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,FREEBUFFER*,
|
---|
172 | LPVOID,ULONG,ULONG,LPSPropTagArray,LPTABLEDATA*);
|
---|
173 |
|
---|
174 | SCODE WINAPI ScCountNotifications(int,LPNOTIFICATION,ULONG*);
|
---|
175 | SCODE WINAPI ScCountProps(int,LPSPropValue,ULONG*);
|
---|
176 | SCODE WINAPI ScCopyNotifications(int,LPNOTIFICATION,LPVOID,ULONG*);
|
---|
177 | SCODE WINAPI ScCopyProps(int,LPSPropValue,LPVOID,ULONG*);
|
---|
178 | SCODE WINAPI ScDupPropset(int,LPSPropValue,LPALLOCATEBUFFER,LPSPropValue*);
|
---|
179 | SCODE WINAPI ScRelocNotifications(int,LPNOTIFICATION,LPVOID,LPVOID,ULONG*);
|
---|
180 | SCODE WINAPI ScRelocProps(int,LPSPropValue,LPVOID,LPVOID,ULONG*);
|
---|
181 |
|
---|
182 | LPSPropValue WINAPI LpValFindProp(ULONG,ULONG,LPSPropValue);
|
---|
183 |
|
---|
184 | static inline FILETIME FtAddFt(FILETIME ftLeft, FILETIME ftRight)
|
---|
185 | {
|
---|
186 | LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
|
---|
187 | union { FILETIME ft; LONG64 ll; } ftmap;
|
---|
188 | ftmap.ll = *pl + *pr;
|
---|
189 | return ftmap.ft;
|
---|
190 | }
|
---|
191 |
|
---|
192 | static inline FILETIME FtSubFt(FILETIME ftLeft, FILETIME ftRight)
|
---|
193 | {
|
---|
194 | LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
|
---|
195 | union { FILETIME ft; LONG64 ll; } ftmap;
|
---|
196 | ftmap.ll = *pl - *pr;
|
---|
197 | return ftmap.ft;
|
---|
198 | }
|
---|
199 |
|
---|
200 | static inline FILETIME FtNegFt(FILETIME ftLeft)
|
---|
201 | {
|
---|
202 | LONG64 *p = (LONG64*)&ftLeft;
|
---|
203 | union { FILETIME ft; LONG64 ll; } ftmap;
|
---|
204 | ftmap.ll = -*p;
|
---|
205 | return ftmap.ft;
|
---|
206 | }
|
---|
207 |
|
---|
208 | static inline FILETIME FtMulDw(DWORD dwLeft, FILETIME ftRight)
|
---|
209 | {
|
---|
210 | LONG64 l = (LONG64)dwLeft, *pr = (LONG64*)&ftRight;
|
---|
211 | union { FILETIME ft; LONG64 ll; } ftmap;
|
---|
212 | ftmap.ll = l * (*pr);
|
---|
213 | return ftmap.ft;
|
---|
214 | }
|
---|
215 |
|
---|
216 | static inline FILETIME FtMulDwDw(DWORD dwLeft, DWORD dwRight)
|
---|
217 | {
|
---|
218 | LONG64 l = (LONG64)dwLeft, r = (LONG64)dwRight;
|
---|
219 | union { FILETIME ft; LONG64 ll; } ftmap;
|
---|
220 | ftmap.ll = l * r;
|
---|
221 | return ftmap.ft;
|
---|
222 | }
|
---|
223 |
|
---|
224 | /*****************************************************************************
|
---|
225 | * IPropData interface
|
---|
226 | *
|
---|
227 | */
|
---|
228 | #define INTERFACE IPropData
|
---|
229 | DECLARE_INTERFACE_(IPropData,IMAPIProp)
|
---|
230 | {
|
---|
231 | /*** IUnknown methods ***/
|
---|
232 | STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
---|
233 | STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
---|
234 | STDMETHOD_(ULONG,Release)(THIS) PURE;
|
---|
235 | /*** IMAPIProp methods ***/
|
---|
236 | STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
|
---|
237 | STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
|
---|
238 | STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
|
---|
239 | STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
|
---|
240 | STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
|
---|
241 | STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
|
---|
242 | STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
|
---|
243 | STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
|
---|
244 | LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
|
---|
245 | LPSPropProblemArray *lppProbs) PURE;
|
---|
246 | STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
|
---|
247 | LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
|
---|
248 | STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
|
---|
249 | LPMAPINAMEID **lpppNames) PURE;
|
---|
250 | STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
|
---|
251 | /*** IPropData methods ***/
|
---|
252 | STDMETHOD(HrSetObjAccess)(THIS_ ULONG ulAccess) PURE;
|
---|
253 | STDMETHOD(HrSetPropAccess)(THIS_ LPSPropTagArray lpPropTags, ULONG *lpAccess) PURE;
|
---|
254 | STDMETHOD(HrGetPropAccess)(THIS_ LPSPropTagArray *lppPropTags, ULONG **lppAccess) PURE;
|
---|
255 | STDMETHOD(HrAddObjProps)(THIS_ LPSPropTagArray lppPropTags, LPSPropProblemArray *lppProbs) PURE;
|
---|
256 | };
|
---|
257 | #undef INTERFACE
|
---|
258 |
|
---|
259 | #if !defined(__cplusplus) || defined(CINTERFACE)
|
---|
260 | /*** IUnknown methods ***/
|
---|
261 | #define IPropData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
---|
262 | #define IPropData_AddRef(p) (p)->lpVtbl->AddRef(p)
|
---|
263 | #define IPropData_Release(p) (p)->lpVtbl->Release(p)
|
---|
264 | /*** IMAPIProp methods ***/
|
---|
265 | #define IPropData_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c)
|
---|
266 | #define IPropData_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a)
|
---|
267 | #define IPropData_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d)
|
---|
268 | #define IPropData_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b)
|
---|
269 | #define IPropData_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
|
---|
270 | #define IPropData_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c)
|
---|
271 | #define IPropData_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b)
|
---|
272 | #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)
|
---|
273 | #define IPropData_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
|
---|
274 | #define IPropData_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
|
---|
275 | #define IPropData_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
|
---|
276 | #define IPropData_HrSetObjAccess(p,a) (p)->lpVtbl->HrSetObjAccess(p,a)
|
---|
277 | #define IPropData_HrSetPropAccess(p,a,b) (p)->lpVtbl->HrSetPropAccess(p,a,b)
|
---|
278 | #define IPropData_HrGetPropAccess(p,a,b) (p)->lpVtbl->HrGetPropAccess(p,a,b)
|
---|
279 | #define IPropData_HrAddObjProps(p,a,b) (p)->lpVtbl->HrAddObjProps(p,a,b)
|
---|
280 | #endif
|
---|
281 |
|
---|
282 | #ifdef __cplusplus
|
---|
283 | }
|
---|
284 | #endif
|
---|
285 |
|
---|
286 | #endif /* MAPIUTIL_H_ */
|
---|