Program Files directory should not be in windows directory.
[wine/multimedia.git] / include / mapiutil.h
blob600bfa2bf9a6ff7695c070e1076d65bbfb5e6610
1 /*
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
19 #ifndef MAPIUTIL_H_
20 #define MAPIUTIL_H_
22 #include <mapix.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
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*);
39 #else
40 typedef HRESULT (WINAPI * LPOPENSTREAMONFILE)(LPALLOCATEBUFFER,LPFREEBUFFER,
41 ULONG,LPSTR,LPSTR,LPSTREAM*);
42 HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
43 ULONG,LPSTR,LPSTR,LPSTREAM*);
44 #endif
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*,
58 LPVOID,LPPROPDATA*);
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);
94 #else
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);
103 #endif
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 #define ITableData_METHODS \
128 IUnknown_METHODS \
129 STDMETHOD(HrGetView)(THIS_ LPSSortOrderSet lpSort, CALLERRELEASE *lpRel, \
130 ULONG ulData, LPMAPITABLE *lppTable) PURE; \
131 STDMETHOD(HrModifyRow)(THIS_ LPSRow lpRow) PURE; \
132 STDMETHOD(HrDeleteRow)(THIS_ LPSPropValue lpKey) PURE; \
133 STDMETHOD(HrQueryRow)(THIS_ LPSPropValue lpKey, LPSRow *lppRow, ULONG *lpRowNum) PURE; \
134 STDMETHOD(HrEnumRow)(THIS_ ULONG ulRowNum, LPSRow *lppRow) PURE; \
135 STDMETHOD(HrNotify)(THIS_ ULONG ulFlags, ULONG cValues, LPSPropValue lpValues) PURE; \
136 STDMETHOD(HrInsertRow)(THIS_ ULONG ulRow, LPSRow lpRow) PURE; \
137 STDMETHOD(HrModifyRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows) PURE; \
138 STDMETHOD(HrDeleteRows)(THIS_ ULONG ulFlags, LPSRowSet lpRows, ULONG *lpCount) PURE;
139 ICOM_DEFINE(ITableData,IUnknown)
140 #undef INTERFACE
142 #ifdef COBJMACROS
143 /*** IUnknown methods ***/
144 #define ITableData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
145 #define ITableData_AddRef(p) (p)->lpVtbl->AddRef(p)
146 #define ITableData_Release(p) (p)->lpVtbl->Release(p)
147 /*** ITableData methods ***/
148 #define ITableData_HrGetView(p,a,b,c,d) (p)->lpVtbl->HrGetView(p,a,b,c,d)
149 #define ITableData_HrModifyRow(p,a) (p)->lpVtbl->HrModifyRow(p,a)
150 #define ITableData_HrDeleteRow(p,a) (p)->lpVtbl->HrDeleteRow(p,a)
151 #define ITableData_HrQueryRow(p,a,b,c) (p)->lpVtbl->HrQueryRow(p,a,b,c)
152 #define ITableData_HrEnumRow(p,a,b) (p)->lpVtbl->HrEnumRow(p,a,b)
153 #define ITableData_HrNotify(p,a,b,c) (p)->lpVtbl->HrNotify(p,a,b,c)
154 #define ITableData_HrInsertRow(p,a,b) (p)->lpVtbl->HrInsertRow(p,a,b)
155 #define ITableData_HrModifyRows(p,a,b) (p)->lpVtbl->HrModifyRows(p,a,b)
156 #define ITableData_HrDeleteRows(p,a,b,c) (p)->lpVtbl->HrDeleteRows(p,a,b,c)
157 #endif
159 SCODE WINAPI CreateTable(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,FREEBUFFER*,
160 LPVOID,ULONG,ULONG,LPSPropTagArray,LPTABLEDATA*);
162 SCODE WINAPI ScCountNotifications(int,LPNOTIFICATION,ULONG*);
163 SCODE WINAPI ScCountProps(int,LPSPropValue,ULONG*);
164 SCODE WINAPI ScCopyNotifications(int,LPNOTIFICATION,LPVOID,ULONG*);
165 SCODE WINAPI ScCopyProps(int,LPSPropValue,LPVOID,ULONG*);
166 SCODE WINAPI ScDupPropset(int,LPSPropValue,LPALLOCATEBUFFER,LPSPropValue*);
167 SCODE WINAPI ScRelocNotifications(int,LPNOTIFICATION,LPVOID,LPVOID,ULONG*);
168 SCODE WINAPI ScRelocProps(int,LPSPropValue,LPVOID,LPVOID,ULONG*);
170 LPSPropValue WINAPI LpValFindProp(ULONG,ULONG,LPSPropValue);
172 static inline FILETIME FtAddFt(FILETIME ftLeft, FILETIME ftRight)
174 LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
175 union { FILETIME ft; LONG64 ll; } ftmap;
176 ftmap.ll = *pl + *pr;
177 return ftmap.ft;
180 static inline FILETIME FtSubFt(FILETIME ftLeft, FILETIME ftRight)
182 LONG64 *pl = (LONG64*)&ftLeft, *pr = (LONG64*)&ftRight;
183 union { FILETIME ft; LONG64 ll; } ftmap;
184 ftmap.ll = *pl - *pr;
185 return ftmap.ft;
188 static inline FILETIME FtNegFt(FILETIME ftLeft)
190 LONG64 *p = (LONG64*)&ftLeft;
191 union { FILETIME ft; LONG64 ll; } ftmap;
192 ftmap.ll = -*p;
193 return ftmap.ft;
196 static inline FILETIME FtMulDw(DWORD dwLeft, FILETIME ftRight)
198 LONG64 l = (LONG64)dwLeft, *pr = (LONG64*)&ftRight;
199 union { FILETIME ft; LONG64 ll; } ftmap;
200 ftmap.ll = l * (*pr);
201 return ftmap.ft;
204 static inline FILETIME FtMulDwDw(DWORD dwLeft, DWORD dwRight)
206 LONG64 l = (LONG64)dwLeft, r = (LONG64)dwRight;
207 union { FILETIME ft; LONG64 ll; } ftmap;
208 ftmap.ll = l * r;
209 return ftmap.ft;
212 /*****************************************************************************
213 * IPropData interface
216 #define INTERFACE IPropData
217 #define IPropData_METHODS \
218 IMAPIProp_METHODS \
219 STDMETHOD(HrSetObjAccess)(THIS_ ULONG ulAccess) PURE; \
220 STDMETHOD(HrSetPropAccess)(THIS_ LPSPropTagArray lpPropTags, ULONG *lpAccess) PURE; \
221 STDMETHOD(HrGetPropAccess)(THIS_ LPSPropTagArray *lppPropTags, ULONG **lppAccess) PURE; \
222 STDMETHOD(HrAddObjProps)(THIS_ LPSPropTagArray lppPropTags, LPSPropProblemArray *lppProbs) PURE;
223 ICOM_DEFINE(IPropData,IMAPIProp)
224 #undef INTERFACE
226 #ifdef COBJMACROS
227 /*** IUnknown methods ***/
228 #define IPropData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
229 #define IPropData_AddRef(p) (p)->lpVtbl->AddRef(p)
230 #define IPropData_Release(p) (p)->lpVtbl->Release(p)
231 /*** IMAPIProp methods ***/
232 #define IPropData_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c)
233 #define IPropData_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a)
234 #define IPropData_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d)
235 #define IPropData_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b)
236 #define IPropData_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
237 #define IPropData_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c)
238 #define IPropData_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b)
239 #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)
240 #define IPropData_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
241 #define IPropData_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
242 #define IPropData_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
243 #define IPropData_HrSetObjAccess(p,a) (p)->lpVtbl->HrSetObjAccess(p,a)
244 #define IPropData_HrSetPropAccess(p,a,b) (p)->lpVtbl->HrSetPropAccess(p,a,b)
245 #define IPropData_HrGetPropAccess(p,a,b) (p)->lpVtbl->HrGetPropAccess(p,a,b)
246 #define IPropData_HrAddObjProps(p,a,b) (p)->lpVtbl->HrAddObjProps(p,a,b)
247 #endif
249 #ifdef __cplusplus
251 #endif
253 #endif /* MAPIUTIL_H_ */