Author: akhaldi
Date: Sat Sep 21 12:53:07 2013
New Revision: 60267
URL:
http://svn.reactos.org/svn/reactos?rev=60267&view=rev
Log:
[MAPI32]
* Sync with Wine 1.7.1.
CORE-7469
Modified:
trunk/reactos/dll/win32/mapi32/CMakeLists.txt
trunk/reactos/dll/win32/mapi32/imalloc.c
trunk/reactos/dll/win32/mapi32/mapi32.spec
trunk/reactos/dll/win32/mapi32/mapi32_main.c
trunk/reactos/dll/win32/mapi32/prop.c
trunk/reactos/dll/win32/mapi32/sendmail.c
trunk/reactos/dll/win32/mapi32/stubs.c
trunk/reactos/dll/win32/mapi32/util.c
trunk/reactos/dll/win32/mapi32/util.h
trunk/reactos/include/psdk/mapi.h
trunk/reactos/include/psdk/mapidefs.h
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/mapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/CMakeLists.txt [iso-8859-1] Sat Sep 21 12:53:07
2013
@@ -10,12 +10,11 @@
sendmail.c
util.c
stubs.c
- version.rc
${CMAKE_CURRENT_BINARY_DIR}/mapi32_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/mapi32.def)
-add_library(mapi32 SHARED ${SOURCE})
+add_library(mapi32 SHARED ${SOURCE} version.rc)
set_module_type(mapi32 win32dll)
-target_link_libraries(mapi32 wine uuid)
-add_importlibs(mapi32 shlwapi shell32 user32 advapi32 msvcrt kernel32 ntdll)
+target_link_libraries(mapi32 wine)
+add_importlibs(mapi32 shlwapi user32 advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET mapi32 DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/mapi32/imalloc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/imalloc.c…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/imalloc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/imalloc.c [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -45,11 +45,11 @@
typedef struct
{
- const IMallocVtbl *lpVtbl;
+ IMalloc IMalloc_iface;
LONG lRef;
} MAPI_IMALLOC;
-static MAPI_IMALLOC MAPI_IMalloc = { &MAPI_IMalloc_vt, 0u };
+static MAPI_IMALLOC MAPI_IMalloc = { { &MAPI_IMalloc_vt }, 0 };
extern LONG MAPI_ObjectCount; /* In mapi32_main.c */
@@ -71,8 +71,8 @@
if (mapiFunctions.MAPIGetDefaultMalloc)
return mapiFunctions.MAPIGetDefaultMalloc();
- IMalloc_AddRef((LPMALLOC)&MAPI_IMalloc);
- return (LPMALLOC)&MAPI_IMalloc;
+ IMalloc_AddRef(&MAPI_IMalloc.IMalloc_iface);
+ return &MAPI_IMalloc.IMalloc_iface;
}
/**************************************************************************
Modified: trunk/reactos/dll/win32/mapi32/mapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/mapi32.sp…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/mapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/mapi32.spec [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -16,8 +16,8 @@
24 stub PRProviderInit
25 stub LAUNCHWIZARD
26 stub LaunchWizard@20
- 27 stdcall -private DllGetClassObject(ptr ptr ptr)
- 28 stdcall -private DllCanUnloadNow()
+ @ stdcall -private DllGetClassObject(ptr ptr ptr)
+ @ stdcall -private DllCanUnloadNow()
29 stdcall MAPIOpenFormMgr(ptr ptr)
30 stdcall MAPIOpenFormMgr@8(ptr ptr) MAPIOpenFormMgr
31 stdcall MAPIOpenLocalFormContainer(ptr)
@@ -188,3 +188,4 @@
253 stdcall FixMAPI@0() FixMAPI
254 stdcall FGetComponentPath(str str ptr long long)
255 stdcall FGetComponentPath@20(str str ptr long long) FGetComponentPath
+256 stdcall MAPISendMailW(ptr ptr ptr long long)
Modified: trunk/reactos/dll/win32/mapi32/mapi32_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/mapi32_ma…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/mapi32_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/mapi32_main.c [iso-8859-1] Sat Sep 21 12:53:07
2013
@@ -37,8 +37,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
-LONG MAPI_ObjectCount = 0;
-HINSTANCE hInstMAPI32;
+DECLSPEC_HIDDEN LONG MAPI_ObjectCount = 0;
+DECLSPEC_HIDDEN HINSTANCE hInstMAPI32;
/***********************************************************************
* DllMain (MAPI32.init)
@@ -55,6 +55,7 @@
load_mapi_providers();
break;
case DLL_PROCESS_DETACH:
+ if (fImpLoad) break;
TRACE("DLL_PROCESS_DETACH: %d objects remaining\n", MAPI_ObjectCount);
unload_mapi_providers();
break;
Modified: trunk/reactos/dll/win32/mapi32/prop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/prop.c?re…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/prop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/prop.c [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -225,31 +225,39 @@
switch (PROP_TYPE(lpProp->ulPropTag))
{
case PT_MV_I2: ulRet = lpProp->Value.MVi.cValues;
+ /* fall through */
case PT_BOOLEAN:
case PT_I2: ulRet *= sizeof(USHORT);
break;
case PT_MV_I4: ulRet = lpProp->Value.MVl.cValues;
+ /* fall through */
case PT_ERROR:
case PT_I4: ulRet *= sizeof(LONG);
break;
case PT_MV_I8: ulRet = lpProp->Value.MVli.cValues;
+ /* fall through */
case PT_I8: ulRet *= sizeof(LONG64);
break;
case PT_MV_R4: ulRet = lpProp->Value.MVflt.cValues;
+ /* fall through */
case PT_R4: ulRet *= sizeof(float);
break;
case PT_MV_APPTIME:
case PT_MV_R8: ulRet = lpProp->Value.MVdbl.cValues;
+ /* fall through */
case PT_APPTIME:
case PT_R8: ulRet *= sizeof(double);
break;
case PT_MV_CURRENCY: ulRet = lpProp->Value.MVcur.cValues;
+ /* fall through */
case PT_CURRENCY: ulRet *= sizeof(CY);
break;
case PT_MV_SYSTIME: ulRet = lpProp->Value.MVft.cValues;
+ /* fall through */
case PT_SYSTIME: ulRet *= sizeof(FILETIME);
break;
case PT_MV_CLSID: ulRet = lpProp->Value.MVguid.cValues;
+ /* fall through */
case PT_CLSID: ulRet *= sizeof(GUID);
break;
case PT_MV_STRING8: ulRet = 0u;
@@ -413,12 +421,12 @@
switch (ulOp)
{
- case RELOP_LT: return iCmp < 0 ? TRUE : FALSE;
- case RELOP_LE: return iCmp <= 0 ? TRUE : FALSE;
- case RELOP_GT: return iCmp > 0 ? TRUE : FALSE;
- case RELOP_GE: return iCmp >= 0 ? TRUE : FALSE;
- case RELOP_EQ: return iCmp == 0 ? TRUE : FALSE;
- case RELOP_NE: return iCmp != 0 ? TRUE : FALSE;
+ case RELOP_LT: return iCmp < 0;
+ case RELOP_LE: return iCmp <= 0;
+ case RELOP_GT: return iCmp > 0;
+ case RELOP_GE: return iCmp >= 0;
+ case RELOP_EQ: return iCmp == 0;
+ case RELOP_NE: return iCmp != 0;
}
return FALSE;
}
@@ -709,7 +717,8 @@
* pcBytes [O] If non-NULL, destination for the size of the property array
*
* RETURNS
- * Success: S_OK. If pcBytes is non-NULL, it contains the size of the propery array.
+ * Success: S_OK. If pcBytes is non-NULL, it contains the size of the
+ * properties array.
* Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid or validation
* of the property array fails.
*/
@@ -731,44 +740,44 @@
lpProps[i].ulPropTag == PROP_ID_INVALID)
return MAPI_E_INVALID_PARAMETER;
- if (PROP_TYPE(lpProps[i].ulPropTag) != PT_OBJECT)
- {
- ulPropSize = UlPropSize(&lpProps[i]);
- if (!ulPropSize)
- return MAPI_E_INVALID_PARAMETER;
- }
-
- switch (PROP_TYPE(lpProps[i].ulPropTag))
- {
- case PT_STRING8:
- case PT_UNICODE:
- case PT_CLSID:
- case PT_BINARY:
- case PT_MV_I2:
- case PT_MV_I4:
- case PT_MV_I8:
- case PT_MV_R4:
- case PT_MV_R8:
- case PT_MV_CURRENCY:
- case PT_MV_SYSTIME:
- case PT_MV_APPTIME:
- ulPropSize += sizeof(SPropValue);
- break;
- case PT_MV_CLSID:
- ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) +
sizeof(SPropValue);
- break;
- case PT_MV_STRING8:
- case PT_MV_UNICODE:
- ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) +
sizeof(SPropValue);
- break;
- case PT_MV_BINARY:
- ulPropSize += lpProps[i].Value.MVbin.cValues * sizeof(SBinary) +
sizeof(SPropValue);
- break;
- default:
- ulPropSize = sizeof(SPropValue);
- break;
- }
- ulBytes += ulPropSize;
+ if (PROP_TYPE(lpProps[i].ulPropTag) != PT_OBJECT)
+ {
+ ulPropSize = UlPropSize(&lpProps[i]);
+ if (!ulPropSize)
+ return MAPI_E_INVALID_PARAMETER;
+ }
+
+ switch (PROP_TYPE(lpProps[i].ulPropTag))
+ {
+ case PT_STRING8:
+ case PT_UNICODE:
+ case PT_CLSID:
+ case PT_BINARY:
+ case PT_MV_I2:
+ case PT_MV_I4:
+ case PT_MV_I8:
+ case PT_MV_R4:
+ case PT_MV_R8:
+ case PT_MV_CURRENCY:
+ case PT_MV_SYSTIME:
+ case PT_MV_APPTIME:
+ ulPropSize += sizeof(SPropValue);
+ break;
+ case PT_MV_CLSID:
+ ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) +
sizeof(SPropValue);
+ break;
+ case PT_MV_STRING8:
+ case PT_MV_UNICODE:
+ ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) +
sizeof(SPropValue);
+ break;
+ case PT_MV_BINARY:
+ ulPropSize += lpProps[i].Value.MVbin.cValues * sizeof(SBinary) +
sizeof(SPropValue);
+ break;
+ default:
+ ulPropSize = sizeof(SPropValue);
+ break;
+ }
+ ulBytes += ulPropSize;
}
if (pcBytes)
*pcBytes = ulBytes;
@@ -1377,14 +1386,19 @@
/**************************************************************************
- * IMAPIProp {MAPI32}
- *
- * The default Mapi interface for manipulating object properties.
+ * IPropData {MAPI32}
+ *
+ * A default Mapi interface to provide manipulation of object properties.
*
* DESCRIPTION
- * This object provides an interface to an objects properties. It is exposed
- * by several types of Mapi objects in order to simplify the querying and
- * modification of properties.
+ * This object provides a default interface suitable in some cases as an
+ * implementation of the IMAPIProp interface (which has no default
+ * implementation). In addition to the IMAPIProp() methods inherited, this
+ * interface allows read/write control over access to the object and its
+ * individual properties.
+ *
+ * To obtain the default implementation of this interface from Mapi, call
+ * CreateIProp().
*
* METHODS
*/
@@ -1400,7 +1414,7 @@
/* The main property data collection structure */
typedef struct
{
- const IPropDataVtbl *lpVtbl;
+ IPropData IPropData_iface;
LONG lRef; /* Reference count */
ALLOCATEBUFFER *lpAlloc; /* Memory allocation routine */
ALLOCATEMORE *lpMore; /* Linked memory allocation routine */
@@ -1411,6 +1425,11 @@
CRITICAL_SECTION cs; /* Lock for thread safety */
} IPropDataImpl;
+static inline IPropDataImpl *impl_from_IPropData(IPropData *iface)
+{
+ return CONTAINING_RECORD(iface, IPropDataImpl, IPropData_iface);
+}
+
/* Internal - Get a property value, assumes lock is held */
static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag)
{
@@ -1419,7 +1438,7 @@
LIST_FOR_EACH(cursor, &This->values)
{
LPIPropDataItem current = LIST_ENTRY(cursor, IPropDataItem, entry);
- /* Note that propery types don't have to match, just Id's */
+ /* Note that property types don't have to match, just Id's */
if (PROP_ID(current->value->ulPropTag) == PROP_ID(ulPropTag))
return current;
}
@@ -1479,19 +1498,14 @@
(offsetof(SPropProblemArray,aProblem)+(c)*sizeof(SPropProblem))
/**************************************************************************
- * IMAPIProp_QueryInterface {MAPI32}
+ * IPropData_QueryInterface {MAPI32}
*
* Inherited method from the IUnknown Interface.
* See IUnknown_QueryInterface.
- *
- * NOTES
- * This object exposes the following interfaces:
- * - IUnknown() : The default interface for all COM-Objects.
- * - IMAPIProp() : The default Mapi interface for manipulating object properties.
- */
-static inline HRESULT IMAPIProp_fnQueryInterface(LPMAPIPROP iface, REFIID riid, LPVOID
*ppvObj)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ */
+static HRESULT WINAPI IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID
*ppvObj)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
@@ -1515,14 +1529,14 @@
}
/**************************************************************************
- * IMAPIProp_AddRef {MAPI32}
+ * IPropData_AddRef {MAPI32}
*
* Inherited method from the IUnknown Interface.
* See IUnknown_AddRef.
*/
-static inline ULONG IMAPIProp_fnAddRef(LPMAPIPROP iface)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p)->(count before=%u)\n", This, This->lRef);
@@ -1530,14 +1544,14 @@
}
/**************************************************************************
- * IMAPIProp_Release {MAPI32}
+ * IPropData_Release {MAPI32}
*
* Inherited method from the IUnknown Interface.
* See IUnknown_Release.
*/
-static inline ULONG IMAPIProp_fnRelease(LPMAPIPROP iface)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+static ULONG WINAPI IPropData_fnRelease(LPPROPDATA iface)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
LONG lRef;
TRACE("(%p)->(count before=%u)\n", This, This->lRef);
@@ -1564,7 +1578,7 @@
}
/**************************************************************************
- * IMAPIProp_GetLastError {MAPI32}
+ * IPropData_GetLastError {MAPI32}
*
* Get information about the last error that occurred in an IMAPIProp object.
*
@@ -1585,9 +1599,8 @@
* - It is possible for this function to succeed and set *lppError to NULL,
* if there is no further information to report about hRes.
*/
-static inline HRESULT
-IMAPIProp_fnGetLastError(LPMAPIPROP iface, HRESULT hRes,
- ULONG ulFlags, LPMAPIERROR *lppError)
+static HRESULT WINAPI IPropData_fnGetLastError(LPPROPDATA iface, HRESULT hRes, ULONG
ulFlags,
+ LPMAPIERROR *lppError)
{
TRACE("(%p,0x%08X,0x%08X,%p)\n", iface, hRes, ulFlags, lppError);
@@ -1599,7 +1612,7 @@
}
/**************************************************************************
- * IMAPIProp_SaveChanges {MAPI32}
+ * IPropData_SaveChanges {MAPI32}
*
* Update any changes made to a transactional IMAPIProp object.
*
@@ -1611,8 +1624,7 @@
* Success: S_OK. Any outstanding changes are committed to the object.
* Failure: An HRESULT error code describing the error.
*/
-static inline HRESULT
-IMAPIProp_fnSaveChanges(LPMAPIPROP iface, ULONG ulFlags)
+static HRESULT WINAPI IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
{
TRACE("(%p,0x%08X)\n", iface, ulFlags);
@@ -1622,7 +1634,7 @@
}
/**************************************************************************
- * IMAPIProp_GetProps {MAPI32}
+ * IPropData_GetProps {MAPI32}
*
* Get property values from an IMAPIProp object.
*
@@ -1645,13 +1657,12 @@
* retrieved from iface are present in lppProps with their type
* changed to PT_ERROR and Id unchanged.
*/
-static inline HRESULT
-IMAPIProp_fnGetProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
- ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps)
-{
+static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpTags,
ULONG ulFlags,
+ ULONG *lpCount, LPSPropValue *lppProps)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
HRESULT hRet = S_OK;
- IPropDataImpl *This = (IPropDataImpl*)iface;
TRACE("(%p,%p,0x%08x,%p,%p) stub\n", iface, lpTags, ulFlags,
lpCount, lppProps);
@@ -1712,11 +1723,10 @@
* MAPI_E_BAD_CHARWIDTH, if Ascii or Unicode strings are requested
* and that type of string is not supported.
*/
-static inline HRESULT
-IMAPIProp_fnGetPropList(LPMAPIPROP iface, ULONG ulFlags,
- LPSPropTagArray *lppTags)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+static HRESULT WINAPI IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
+ LPSPropTagArray *lppTags)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
HRESULT hRet;
@@ -1752,16 +1762,15 @@
}
/**************************************************************************
- * IMAPIProp_OpenProperty {MAPI32}
+ * IPropData_OpenProperty {MAPI32}
*
* Not documented at this time.
*
* RETURNS
* An HRESULT success/failure code.
*/
-static inline HRESULT
-IMAPIProp_fnOpenProperty(LPMAPIPROP iface, ULONG ulPropTag, LPCIID iid,
- ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk)
+static HRESULT WINAPI IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag, LPCIID
iid,
+ ULONG ulOpts, ULONG ulFlags, LPUNKNOWN
*lpUnk)
{
FIXME("(%p,%u,%s,%u,0x%08x,%p) stub\n", iface, ulPropTag,
debugstr_guid(iid), ulOpts, ulFlags, lpUnk);
@@ -1770,7 +1779,7 @@
/**************************************************************************
- * IMAPIProp_SetProps {MAPI32}
+ * IPropData_SetProps {MAPI32}
*
* Add or edit the property values in an IMAPIProp object.
*
@@ -1785,11 +1794,10 @@
* exist, or changed to the values in lpProps if they do
* Failure: An HRESULT error code describing the error
*/
-static inline HRESULT
-IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues,
- LPSPropValue lpProps, LPSPropProblemArray *lppProbs)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPSPropValue
lpProps,
+ LPSPropProblemArray *lppProbs)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
HRESULT hRet = S_OK;
ULONG i;
@@ -1849,7 +1857,7 @@
}
/**************************************************************************
- * IMAPIProp_DeleteProps {MAPI32}
+ * IPropData_DeleteProps {MAPI32}
*
* Delete one or more property values from an IMAPIProp object.
*
@@ -1864,7 +1872,7 @@
* errors that occurred.
* Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid.
* E_ACCESSDENIED, if this object was created using CreateIProp() and
- * a subsequent call to IPropData_SetObjAcess() was made specifying
+ * a subsequent call to IPropData_SetObjAccess() was made specifying
* IPROP_READONLY as the access type.
*
* NOTES
@@ -1872,11 +1880,10 @@
* in lpTags but not in iface.
* - lppProbs should be deleted with MAPIFreeBuffer() if returned.
*/
-static inline HRESULT
-IMAPIProp_fnDeleteProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
- LPSPropProblemArray *lppProbs)
-{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+static HRESULT WINAPI IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpTags,
+ LPSPropProblemArray *lppProbs)
+{
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i, numProbs = 0;
HRESULT hRet = S_OK;
@@ -1949,18 +1956,18 @@
/**************************************************************************
- * IMAPIProp_CopyTo {MAPI32}
+ * IPropData_CopyTo {MAPI32}
*
* Not documented at this time.
*
* RETURNS
* An HRESULT success/failure code.
*/
-static inline HRESULT
-IMAPIProp_fnCopyTo(LPMAPIPROP iface, ULONG niids, LPCIID lpiidExcl,
- LPSPropTagArray lpPropsExcl, ULONG ulParam,
- LPMAPIPROGRESS lpIProgress, LPCIID lpIfaceIid, LPVOID lpDstObj,
- ULONG ulFlags, LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnCopyTo(LPPROPDATA iface, ULONG niids, LPCIID lpiidExcl,
+ LPSPropTagArray lpPropsExcl, ULONG ulParam,
+ LPMAPIPROGRESS lpIProgress, LPCIID lpIfaceIid,
+ LPVOID lpDstObj, ULONG ulFlags,
+ LPSPropProblemArray *lppProbs)
{
FIXME("(%p,%u,%p,%p,%x,%p,%s,%p,0x%08X,%p) stub\n", iface, niids,
lpiidExcl, lpPropsExcl, ulParam, lpIProgress,
@@ -1969,18 +1976,17 @@
}
/**************************************************************************
- * IMAPIProp_CopyProps {MAPI32}
+ * IPropData_CopyProps {MAPI32}
*
* Not documented at this time.
*
* RETURNS
* An HRESULT success/failure code.
*/
-static inline HRESULT
-IMAPIProp_fnCopyProps(LPMAPIPROP iface, LPSPropTagArray lpInclProps,
- ULONG ulParam, LPMAPIPROGRESS lpIProgress, LPCIID lpIface,
- LPVOID lpDstObj, ULONG ulFlags,
- LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnCopyProps(LPPROPDATA iface, LPSPropTagArray
lpInclProps,
+ ULONG ulParam, LPMAPIPROGRESS lpIProgress,
+ LPCIID lpIface, LPVOID lpDstObj, ULONG
ulFlags,
+ LPSPropProblemArray *lppProbs)
{
FIXME("(%p,%p,%x,%p,%s,%p,0x%08X,%p) stub\n", iface, lpInclProps,
ulParam, lpIProgress, debugstr_guid(lpIface), lpDstObj, ulFlags,
@@ -1989,7 +1995,7 @@
}
/**************************************************************************
- * IMAPIProp_GetNamesFromIDs {MAPI32}
+ * IPropData_GetNamesFromIDs {MAPI32}
*
* Get the names of properties from their identifiers.
*
@@ -2011,10 +2017,9 @@
* MAPI_W_ERRORS_RETURNED if not all properties were retrieved
* successfully.
*/
-static inline HRESULT
-IMAPIProp_fnGetNamesFromIDs(LPMAPIPROP iface, LPSPropTagArray *lppPropTags,
- LPGUID iid, ULONG ulFlags, ULONG *lpCount,
- LPMAPINAMEID **lpppNames)
+static HRESULT WINAPI IPropData_fnGetNamesFromIDs(LPPROPDATA iface, LPSPropTagArray
*lppPropTags,
+ LPGUID iid, ULONG ulFlags, ULONG
*lpCount,
+ LPMAPINAMEID **lpppNames)
{
FIXME("(%p,%p,%s,0x%08X,%p,%p) stub\n", iface, lppPropTags,
debugstr_guid(iid), ulFlags, lpCount, lpppNames);
@@ -2022,7 +2027,7 @@
}
/**************************************************************************
- * IMAPIProp_GetIDsFromNames {MAPI32}
+ * IPropData_GetIDsFromNames {MAPI32}
*
* Get property identifiers associated with one or more named properties.
*
@@ -2042,10 +2047,9 @@
* MAPI_W_ERRORS_RETURNED if not all properties were retrieved
* successfully.
*/
-static inline HRESULT
-IMAPIProp_fnGetIDsFromNames(LPMAPIPROP iface, ULONG ulNames,
- LPMAPINAMEID *lppNames, ULONG ulFlags,
- LPSPropTagArray *lppPropTags)
+static HRESULT WINAPI IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames,
+ LPMAPINAMEID *lppNames, ULONG ulFlags,
+ LPSPropTagArray *lppPropTags)
{
FIXME("(%p,%d,%p,0x%08X,%p) stub\n",
iface, ulNames, lppNames, ulFlags, lppPropTags);
@@ -2053,214 +2057,6 @@
}
/**************************************************************************
- * IPropData {MAPI32}
- *
- * A default Mapi interface to provide manipulation of object properties.
- *
- * DESCRIPTION
- * This object provides a default interface suitable in some cases as an
- * implementation of the IMAPIProp interface (which has no default
- * implementation). In addition to the IMAPIProp() methods inherited, this
- * interface allows read/write control over access to the object and its
- * individual properties.
- *
- * To obtain the default implementation of this interface from Mapi, call
- * CreateIProp().
- *
- * METHODS
- */
-
-/**************************************************************************
- * IPropData_QueryInterface {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_QueryInterface.
- */
-static HRESULT WINAPI
-IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID *ppvObj)
-{
- return IMAPIProp_fnQueryInterface((LPMAPIPROP)iface, riid, ppvObj);
-}
-
-/**************************************************************************
- * IPropData_AddRef {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_AddRef.
- */
-static ULONG WINAPI
-IPropData_fnAddRef(LPPROPDATA iface)
-{
- return IMAPIProp_fnAddRef((LPMAPIPROP)iface);
-}
-
-/**************************************************************************
- * IPropData_Release {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_Release.
- */
-static ULONG WINAPI
-IPropData_fnRelease(LPPROPDATA iface)
-{
- return IMAPIProp_fnRelease((LPMAPIPROP)iface);
-}
-
-/**************************************************************************
- * IPropData_GetLastError {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetLastError.
- */
-static HRESULT WINAPI
-IPropData_fnGetLastError(LPPROPDATA iface, HRESULT hRes, ULONG ulFlags,
- LPMAPIERROR *lppError)
-{
- return IMAPIProp_fnGetLastError((LPMAPIPROP)iface, hRes, ulFlags, lppError);
-}
-
-/**************************************************************************
- * IPropData_SaveChanges {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_SaveChanges.
- */
-static HRESULT WINAPI
-IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
-{
- return IMAPIProp_fnSaveChanges((LPMAPIPROP)iface, ulFlags);
-}
-
-/**************************************************************************
- * IPropData_GetProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetProps.
- */
-static HRESULT WINAPI
-IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpPropTags,
- ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps)
-{
- return IMAPIProp_fnGetProps((LPMAPIPROP)iface, lpPropTags, ulFlags,
- lpCount, lppProps);
-}
-
-/**************************************************************************
- * IPropData_GetPropList {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetPropList.
- */
-static HRESULT WINAPI
-IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
- LPSPropTagArray *lppPropTags)
-{
- return IMAPIProp_fnGetPropList((LPMAPIPROP)iface, ulFlags, lppPropTags);
-}
-
-/**************************************************************************
- * IPropData_OpenProperty {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_OpenProperty.
- */
-static HRESULT WINAPI
-IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag, LPCIID iid,
- ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk)
-{
- return IMAPIProp_fnOpenProperty((LPMAPIPROP)iface, ulPropTag, iid,
- ulOpts, ulFlags, lpUnk);
-}
-
-/**************************************************************************
- * IPropData_SetProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_SetProps.
- */
-static HRESULT WINAPI
-IPropData_fnSetProps(LPPROPDATA iface, ULONG cValues, LPSPropValue lpProps,
- LPSPropProblemArray *lppProbs)
-{
- return IMAPIProp_fnSetProps((LPMAPIPROP)iface, cValues, lpProps, lppProbs);
-}
-
-/**************************************************************************
- * IPropData_DeleteProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_DeleteProps.
- */
-static HRESULT WINAPI
-IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpPropTags,
- LPSPropProblemArray *lppProbs)
-{
- return IMAPIProp_fnDeleteProps((LPMAPIPROP)iface, lpPropTags, lppProbs);
-}
-
-/**************************************************************************
- * IPropData_CopyTo {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_CopyTo.
- */
-static HRESULT WINAPI
-IPropData_fnCopyTo(LPPROPDATA iface, ULONG ciidExclude, LPCIID lpIid,
- LPSPropTagArray lpProps, ULONG ulParam,
- LPMAPIPROGRESS lpProgress, LPCIID lpIface, LPVOID lpDst,
- ULONG ulFlags, LPSPropProblemArray *lppProbs)
-{
- return IMAPIProp_fnCopyTo((LPMAPIPROP)iface, ciidExclude, lpIid, lpProps,
- ulParam, lpProgress, lpIface, lpDst,
- ulFlags, lppProbs);
-}
-
-/**************************************************************************
- * IPropData_CopyProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_CopyProps.
- */
-static HRESULT WINAPI
-IPropData_fnCopyProps(LPPROPDATA iface, LPSPropTagArray lpProps,
- ULONG ulParam, LPMAPIPROGRESS lpProgress, LPCIID lpIface,
- LPVOID lpDst, ULONG ulFlags, LPSPropProblemArray *lppProbs)
-{
- return IMAPIProp_fnCopyProps((LPMAPIPROP)iface, lpProps, ulParam,
- lpProgress, lpIface, lpDst, ulFlags, lppProbs);
-}
-
-/**************************************************************************
- * IPropData_GetNamesFromIDs {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetNamesFromIDs.
- */
-static HRESULT WINAPI
-IPropData_fnGetNamesFromIDs(LPPROPDATA iface, LPSPropTagArray *lppPropTags,
- LPGUID iid, ULONG ulFlags, ULONG *lpCount,
- LPMAPINAMEID **lpppNames)
-{
- return IMAPIProp_fnGetNamesFromIDs((LPMAPIPROP)iface, lppPropTags, iid,
- ulFlags, lpCount, lpppNames);
-}
-
-/**************************************************************************
- * IPropData_GetIDsFromNames {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetIDsFromNames.
- */
-static HRESULT WINAPI
-IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames,
- LPMAPINAMEID *lppNames, ULONG ulFlags,
- LPSPropTagArray *lppPropTags)
-{
- return IMAPIProp_fnGetIDsFromNames((LPMAPIPROP)iface, ulNames, lppNames,
- ulFlags, lppPropTags);
-}
-
-/**************************************************************************
* IPropData_HrSetObjAccess {MAPI32}
*
* Set the access level of an IPropData object.
@@ -2277,7 +2073,7 @@
static HRESULT WINAPI
IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p,%x)\n", iface, ulAccess);
@@ -2331,8 +2127,7 @@
IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags,
ULONG *lpAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
-
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess);
@@ -2383,7 +2178,7 @@
IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags,
ULONG **lppAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
LPVOID lpMem;
HRESULT hRet;
ULONG i;
@@ -2538,7 +2333,7 @@
if (SUCCEEDED(scode))
{
- lpPropData->lpVtbl = &IPropDataImpl_vtbl;
+ lpPropData->IPropData_iface.lpVtbl = &IPropDataImpl_vtbl;
lpPropData->lRef = 1;
lpPropData->lpAlloc = lpAlloc;
lpPropData->lpMore = lpMore;
@@ -2548,7 +2343,7 @@
list_init(&lpPropData->values);
InitializeCriticalSection(&lpPropData->cs);
lpPropData->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
IPropDataImpl.cs");
- *lppPropData = (LPPROPDATA)lpPropData;
+ *lppPropData = &lpPropData->IPropData_iface;
}
return scode;
}
Modified: trunk/reactos/dll/win32/mapi32/sendmail.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/sendmail.…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/sendmail.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/sendmail.c [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -45,23 +45,58 @@
//#include "shellapi.h"
//#include "shlwapi.h"
#include <wine/debug.h>
+#include <wine/unicode.h>
#include "util.h"
#include "res.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
#define READ_BUF_SIZE 4096
+
+#define STORE_UNICODE_OK 0x00040000
+
+static LPSTR convert_from_unicode(LPCWSTR wstr)
+{
+ LPSTR str;
+ DWORD len;
+
+ if (!wstr)
+ return NULL;
+
+ len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
+ str = HeapAlloc(GetProcessHeap(), 0, len);
+ WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);
+
+ return str;
+}
+
+static LPWSTR convert_to_unicode(LPSTR str)
+{
+ LPWSTR wstr;
+ DWORD len;
+
+ if (!str)
+ return NULL;
+
+ len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+ wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, len);
+
+ return wstr;
+}
/*
Internal function to send a message via Extended MAPI. Wrapper around the Simple
MAPI function MAPISendMail.
*/
-static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam,
lpMapiMessage message,
- FLAGS flags, ULONG reserved)
+static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam,
lpMapiMessageW message,
+ FLAGS flags)
{
- ULONG tags[] = {1, PR_IPM_DRAFTS_ENTRYID};
+ ULONG tags[] = {1, 0};
+ char *subjectA = NULL, *bodyA = NULL;
ULONG retval = MAPI_E_FAILURE;
IMAPISession *session = NULL;
+ BOOL unicode_aware = FALSE;
IMAPITable* msg_table;
LPSRowSet rows = NULL;
IMsgStore* msg_store;
@@ -138,12 +173,32 @@
/* We don't need this any more */
FreeProws(rows);
+ /* Check if the message store supports Unicode */
+ tags[1] = PR_STORE_SUPPORT_MASK;
+ ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values,
&props);
+
+ if ((ret == S_OK) && (props[0].Value.l & STORE_UNICODE_OK))
+ unicode_aware = TRUE;
+ else
+ {
+ /* Don't convert to ANSI */
+ if (flags & MAPI_FORCE_UNICODE)
+ {
+ WARN("No Unicode-capable mail client, and MAPI_FORCE_UNICODE is
specified. MAPISendMail failed.\n");
+ retval = MAPI_E_UNICODE_NOT_SUPPORTED;
+ IMsgStore_Release(msg_store);
+ goto logoff;
+ }
+ }
+
/* First open the inbox, from which the drafts folder can be opened */
if (IMsgStore_GetReceiveFolder(msg_store, NULL, 0, &entry_len, &entry_id,
NULL) == S_OK)
{
IMsgStore_OpenEntry(msg_store, entry_len, entry_id, NULL, 0, &obj_type,
(LPUNKNOWN*) &folder);
MAPIFreeBuffer(entry_id);
}
+
+ tags[1] = PR_IPM_DRAFTS_ENTRYID;
/* Open the drafts folder, or failing that, try asking the message store for the
outbox */
if ((folder == NULL) || ((ret = IMAPIFolder_GetProps(folder, (LPSPropTagArray) tags,
0, &values, &props)) != S_OK))
@@ -179,8 +234,19 @@
/* Set message subject */
if (message->lpszSubject)
{
- p.ulPropTag = PR_SUBJECT_A;
- p.Value.lpszA = message->lpszSubject;
+ if (unicode_aware)
+ {
+ p.ulPropTag = PR_SUBJECT_W;
+ p.Value.lpszW = message->lpszSubject;
+ }
+ else
+ {
+ subjectA = convert_from_unicode(message->lpszSubject);
+
+ p.ulPropTag = PR_SUBJECT_A;
+ p.Value.lpszA = subjectA;
+ }
+
IMessage_SetProps(msg, 1, &p, NULL);
}
@@ -189,10 +255,17 @@
{
LPSTREAM stream = NULL;
- if (IMessage_OpenProperty(msg, PR_BODY_A, &IID_IStream, 0,
+ if (IMessage_OpenProperty(msg, unicode_aware ? PR_BODY_W : PR_BODY_A,
&IID_IStream, 0,
MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*) &stream) == S_OK)
{
- IStream_Write(stream, message->lpszNoteText,
strlen(message->lpszNoteText)+1, NULL);
+ if (unicode_aware)
+ IStream_Write(stream, message->lpszNoteText,
(lstrlenW(message->lpszNoteText)+1) * sizeof(WCHAR), NULL);
+ else
+ {
+ bodyA = convert_from_unicode(message->lpszNoteText);
+ IStream_Write(stream, bodyA, strlen(bodyA)+1, NULL);
+ }
+
IStream_Release(stream);
}
}
@@ -201,20 +274,21 @@
if (message->nFileCount > 0)
{
ULONG num_attach = 0;
- int i, j;
+ unsigned int i;
for (i = 0; i < message->nFileCount; i++)
{
IAttach* attachment = NULL;
+ char *filenameA = NULL;
SPropValue prop[4];
- LPCSTR filename;
+ LPCWSTR filename;
HANDLE file;
if (!message->lpFiles[i].lpszPathName)
continue;
/* Open the attachment for reading */
- file = CreateFileA(message->lpFiles[i].lpszPathName, GENERIC_READ,
FILE_SHARE_READ,
+ file = CreateFileW(message->lpFiles[i].lpszPathName, GENERIC_READ,
FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file == INVALID_HANDLE_VALUE)
@@ -225,9 +299,11 @@
if (!filename)
{
+ int j;
+
filename = message->lpFiles[i].lpszPathName;
- for (j = strlen(message->lpFiles[i].lpszPathName)-1; j >= 0;
j--)
+ for (j = lstrlenW(message->lpFiles[i].lpszPathName)-1; j >= 0;
j--)
{
if (message->lpFiles[i].lpszPathName[i] == '\\' ||
message->lpFiles[i].lpszPathName[i] == '/')
@@ -238,8 +314,8 @@
}
}
- TRACE("Attachment %d path: '%s'; filename:
'%s'\n", i, debugstr_a(message->lpFiles[i].lpszPathName),
- debugstr_a(filename));
+ TRACE("Attachment %u path: '%s'; filename:
'%s'\n", i, debugstr_w(message->lpFiles[i].lpszPathName),
+ debugstr_w(filename));
/* Create the attachment */
if (IMessage_CreateAttach(msg, NULL, 0, &num_attach, &attachment)
!= S_OK)
@@ -254,10 +330,25 @@
prop[0].ulPropTag = PR_ATTACH_METHOD;
prop[0].Value.ul = ATTACH_BY_VALUE;
- prop[1].ulPropTag = PR_ATTACH_LONG_FILENAME_A;
- prop[1].Value.lpszA = (LPSTR) filename;
- prop[2].ulPropTag = PR_ATTACH_FILENAME_A;
- prop[2].Value.lpszA = (LPSTR) filename;
+
+ if (unicode_aware)
+ {
+ prop[1].ulPropTag = PR_ATTACH_LONG_FILENAME_W;
+ prop[1].Value.lpszW = (LPWSTR) filename;
+ prop[2].ulPropTag = PR_ATTACH_FILENAME_W;
+ prop[2].Value.lpszW = (LPWSTR) filename;
+ }
+ else
+ {
+ filenameA = convert_from_unicode(filename);
+
+ prop[1].ulPropTag = PR_ATTACH_LONG_FILENAME_A;
+ prop[1].Value.lpszA = (LPSTR) filenameA;
+ prop[2].ulPropTag = PR_ATTACH_FILENAME_A;
+ prop[2].Value.lpszA = (LPSTR) filenameA;
+
+ }
+
prop[3].ulPropTag = PR_RENDERING_POSITION;
prop[3].Value.l = -1;
@@ -277,7 +368,7 @@
size += read;
}
- TRACE("%d bytes read, %d bytes written of
attachment\n", read, written);
+ TRACE("%d bytes written of attachment\n", size);
IStream_Commit(stream, STGC_DEFAULT);
IStream_Release(stream);
@@ -293,6 +384,8 @@
CloseHandle(file);
IAttach_Release(attachment);
+
+ HeapFree(GetProcessHeap(), 0, filenameA);
}
}
@@ -302,7 +395,7 @@
if (IMAPISession_PrepareForm(session, NULL, msg, &token) == S_OK)
{
- ULONG access = 0, status = 0, flags = 0, pc = 0;
+ ULONG access = 0, status = 0, message_flags = 0, pc = 0;
ULONG pT[2] = {1, PR_MSG_STATUS};
/* Retrieve message status, flags, access rights and class */
@@ -317,7 +410,7 @@
if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) ==
S_OK)
{
- flags = props->Value.ul;
+ message_flags = props->Value.ul;
MAPIFreeBuffer(props);
}
@@ -336,7 +429,7 @@
/* Show the message form (edit window) */
ret = IMAPISession_ShowForm(session, 0, msg_store, draft_folder, NULL,
- token, NULL, 0, status, flags, access,
+ token, NULL, 0, status, message_flags,
access,
props->Value.lpszA);
switch (ret)
@@ -363,6 +456,9 @@
IMAPIFolder_Release(draft_folder);
if (folder) IMAPIFolder_Release(folder);
IMsgStore_Release(msg_store);
+
+ HeapFree(GetProcessHeap(), 0, subjectA);
+ HeapFree(GetProcessHeap(), 0, bodyA);
logoff: ;
IMAPISession_Logoff(session, 0, 0, 0);
@@ -401,7 +497,213 @@
/* Check if we have an Extended MAPI provider - if so, use our wrapper */
if (MAPIInitialize(NULL) == S_OK)
- return sendmail_extended_mapi(session, uiparam, message, flags, reserved);
+ {
+ MapiMessageW messageW;
+ ULONG ret;
+
+ ZeroMemory(&messageW, sizeof(MapiMessageW));
+
+ /* Convert the entries we need to Unicode */
+ messageW.lpszSubject = convert_to_unicode(message->lpszSubject);
+ messageW.lpszNoteText = convert_to_unicode(message->lpszNoteText);
+ messageW.nFileCount = message->nFileCount;
+
+ if (message->nFileCount && message->lpFiles)
+ {
+ lpMapiFileDescW filesW;
+ unsigned int i;
+
+ filesW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiFileDescW)
* message->nFileCount);
+
+ for (i = 0; i < message->nFileCount; i++)
+ {
+ filesW[i].lpszPathName =
convert_to_unicode(message->lpFiles[i].lpszPathName);
+ filesW[i].lpszFileName =
convert_to_unicode(message->lpFiles[i].lpszFileName);
+ }
+
+ messageW.lpFiles = filesW;
+ }
+
+ ret = sendmail_extended_mapi(session, uiparam, &messageW, flags);
+
+ /* Now free everything we allocated */
+ if (message->nFileCount && message->lpFiles)
+ {
+ unsigned int i;
+
+ for (i = 0; i < message->nFileCount; i++)
+ {
+ HeapFree(GetProcessHeap(), 0, messageW.lpFiles[i].lpszPathName);
+ HeapFree(GetProcessHeap(), 0, messageW.lpFiles[i].lpszFileName);
+ }
+
+ HeapFree(GetProcessHeap(), 0, messageW.lpFiles);
+ }
+
+ HeapFree(GetProcessHeap(), 0, messageW.lpszSubject);
+ HeapFree(GetProcessHeap(), 0, messageW.lpszNoteText);
+
+ return ret;
+ }
+
+ /* Display an error message since we apparently have no mail clients */
+ LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) /
sizeof(WCHAR));
+ LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, sizeof(msg_title) /
sizeof(WCHAR));
+
+ MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
+
+ return MAPI_E_NOT_SUPPORTED;
+}
+
+static lpMapiRecipDesc convert_recipient_from_unicode(lpMapiRecipDescW recipW,
lpMapiRecipDesc dest)
+{
+ lpMapiRecipDesc ret;
+
+ if (!recipW)
+ return NULL;
+
+ if (dest)
+ ret = dest;
+ else
+ ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiRecipDesc));
+
+ ret->ulRecipClass = recipW->ulRecipClass;
+ ret->lpszName = convert_from_unicode(recipW->lpszName);
+ ret->lpszAddress = convert_from_unicode(recipW->lpszAddress);
+ ret->ulEIDSize = recipW->ulEIDSize;
+ ret->lpEntryID = recipW->lpEntryID;
+
+ return ret;
+}
+
+/**************************************************************************
+ * MAPISendMailW (MAPI32.256)
+ *
+ * Send a mail.
+ *
+ * PARAMS
+ * session [I] Handle to a MAPI session.
+ * uiparam [I] Parent window handle.
+ * message [I] Pointer to a MAPIMessageW structure.
+ * flags [I] Flags.
+ * reserved [I] Reserved, pass 0.
+ *
+ * RETURNS
+ * Success: SUCCESS_SUCCESS
+ * Failure: MAPI_E_FAILURE
+ *
+ */
+ULONG WINAPI MAPISendMailW(LHANDLE session, ULONG_PTR uiparam,
+ lpMapiMessageW message, FLAGS flags, ULONG reserved)
+{
+ WCHAR msg_title[READ_BUF_SIZE], error_msg[READ_BUF_SIZE];
+
+ /* Check to see if we have a Simple MAPI provider loaded */
+ if (mapiFunctions.MAPISendMailW)
+ return mapiFunctions.MAPISendMailW(session, uiparam, message, flags, reserved);
+
+ /* Check if we have an Extended MAPI provider - if so, use our wrapper */
+ if (MAPIInitialize(NULL) == S_OK)
+ return sendmail_extended_mapi(session, uiparam, message, flags);
+
+ if (mapiFunctions.MAPISendMail)
+ {
+ MapiMessage messageA;
+ ULONG ret;
+
+ if (flags & MAPI_FORCE_UNICODE)
+ return MAPI_E_UNICODE_NOT_SUPPORTED;
+
+ /* Convert to ANSI and send to MAPISendMail */
+ ZeroMemory(&messageA, sizeof(MapiMessage));
+
+ messageA.lpszSubject = convert_from_unicode(message->lpszSubject);
+ messageA.lpszNoteText = convert_from_unicode(message->lpszNoteText);
+ messageA.lpszMessageType = convert_from_unicode(message->lpszMessageType);
+ messageA.lpszDateReceived = convert_from_unicode(message->lpszDateReceived);
+ messageA.lpszConversationID =
convert_from_unicode(message->lpszConversationID);
+ messageA.flFlags = message->flFlags;
+ messageA.lpOriginator = convert_recipient_from_unicode(message->lpOriginator,
NULL);
+ messageA.nRecipCount = message->nRecipCount;
+ messageA.nFileCount = message->nFileCount;
+
+ if (message->nRecipCount && message->lpRecips)
+ {
+ lpMapiRecipDesc recipsA;
+ unsigned int i;
+
+ recipsA = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiRecipDesc)
* message->nRecipCount);
+
+ for (i = 0; i < message->nRecipCount; i++)
+ {
+ convert_recipient_from_unicode(&message->lpRecips[i],
&recipsA[i]);
+ }
+
+ messageA.lpRecips = recipsA;
+ }
+
+ if (message->nFileCount && message->lpFiles)
+ {
+ lpMapiFileDesc filesA;
+ unsigned int i;
+
+ filesA = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiFileDesc) *
message->nFileCount);
+
+ for (i = 0; i < message->nFileCount; i++)
+ {
+ filesA[i].flFlags = message->lpFiles[i].flFlags;
+ filesA[i].nPosition = message->lpFiles[i].nPosition;
+ filesA[i].lpszPathName =
convert_from_unicode(message->lpFiles[i].lpszPathName);
+ filesA[i].lpszFileName =
convert_from_unicode(message->lpFiles[i].lpszFileName);
+ filesA[i].lpFileType = message->lpFiles[i].lpFileType;
+ }
+
+ messageA.lpFiles = filesA;
+ }
+
+ ret = mapiFunctions.MAPISendMail(session, uiparam, &messageA, flags,
reserved);
+
+ /* Now free everything we allocated */
+ if (message->lpOriginator)
+ {
+ HeapFree(GetProcessHeap(), 0, messageA.lpOriginator->lpszName);
+ HeapFree(GetProcessHeap(), 0, messageA.lpOriginator->lpszAddress);
+ HeapFree(GetProcessHeap(), 0, messageA.lpOriginator);
+ }
+
+ if (message->nRecipCount && message->lpRecips)
+ {
+ unsigned int i;
+
+ for (i = 0; i < message->nRecipCount; i++)
+ {
+ HeapFree(GetProcessHeap(), 0, messageA.lpRecips[i].lpszName);
+ HeapFree(GetProcessHeap(), 0, messageA.lpRecips[i].lpszAddress);
+ }
+
+ HeapFree(GetProcessHeap(), 0, messageA.lpRecips);
+ }
+
+ if (message->nFileCount && message->lpFiles)
+ {
+ unsigned int i;
+
+ for (i = 0; i < message->nFileCount; i++)
+ {
+ HeapFree(GetProcessHeap(), 0, messageA.lpFiles[i].lpszPathName);
+ HeapFree(GetProcessHeap(), 0, messageA.lpFiles[i].lpszFileName);
+ }
+
+ HeapFree(GetProcessHeap(), 0, messageA.lpFiles);
+ }
+
+ HeapFree(GetProcessHeap(), 0, messageA.lpszSubject);
+ HeapFree(GetProcessHeap(), 0, messageA.lpszNoteText);
+ HeapFree(GetProcessHeap(), 0, messageA.lpszDateReceived);
+ HeapFree(GetProcessHeap(), 0, messageA.lpszConversationID);
+
+ return ret;
+ }
/* Display an error message since we apparently have no mail clients */
LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) /
sizeof(WCHAR));
Modified: trunk/reactos/dll/win32/mapi32/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/stubs.c?r…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/stubs.c [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -75,17 +75,6 @@
HRESULT
WINAPI
-WrapCompressedRTFStream(
- LPSTREAM lpCompressedRTFStream,
- ULONG ulflags,
- LPSTREAM *lpUncompressedRTFStream)
-{
- UNIMPLEMENTED;
- return E_NOTIMPL;
-}
-
-HRESULT
-WINAPI
HrGetOmiProvidersFlags(
DWORD dwUnknown1,
DWORD dwUnknown2)
Modified: trunk/reactos/dll/win32/mapi32/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/util.c?re…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/util.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/util.c [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -492,7 +492,7 @@
if (lpName1->ulKind == MNID_STRING)
return !strcmpW(lpName1->Kind.lpwstrName, lpName2->Kind.lpwstrName);
- return lpName1->Kind.lID == lpName2->Kind.lID ? TRUE : FALSE;
+ return lpName1->Kind.lID == lpName2->Kind.lID;
}
/**************************************************************************
@@ -937,6 +937,18 @@
FIXME("(%p, %p, %p, %p, %d, %p): stub\n", lpTable, lpPropTags,
lpRestriction, lpSortOrderSet, crowsMax, lppRows);
*lppRows = NULL;
return MAPI_E_CALL_FAILED;
+}
+
+/**************************************************************************
+ * WrapCompressedRTFStream (MAPI32.186)
+ */
+HRESULT WINAPI WrapCompressedRTFStream(LPSTREAM compressed, ULONG flags, LPSTREAM
*uncompressed)
+{
+ if (mapiFunctions.WrapCompressedRTFStream)
+ return mapiFunctions.WrapCompressedRTFStream(compressed, flags, uncompressed);
+
+ FIXME("(%p, 0x%08x, %p): stub\n", compressed, flags, uncompressed);
+ return MAPI_E_NO_SUPPORT;
}
static HMODULE mapi_provider;
@@ -1079,6 +1091,7 @@
mapiFunctions.MAPISaveMail = (void*) GetProcAddress(mapi_provider,
"MAPISaveMail");
mapiFunctions.MAPISendDocuments = (void*) GetProcAddress(mapi_provider,
"MAPISendDocuments");
mapiFunctions.MAPISendMail = (void*) GetProcAddress(mapi_provider,
"MAPISendMail");
+ mapiFunctions.MAPISendMailW = (void*) GetProcAddress(mapi_provider,
"MAPISendMailW");
}
/* Extended MAPI functions */
@@ -1102,6 +1115,7 @@
mapiFunctions.MAPIOpenLocalFormContainer = (void *)
GetProcAddress(mapi_ex_provider, "MAPIOpenLocalFormContainer");
mapiFunctions.OpenStreamOnFile = (void*) GetProcAddress(mapi_ex_provider,
"OpenStreamOnFile@24");
mapiFunctions.ScInitMapiUtil = (void*) GetProcAddress(mapi_ex_provider,
"ScInitMapiUtil@4");
+ mapiFunctions.WrapCompressedRTFStream = (void*) GetProcAddress(mapi_ex_provider,
"WrapCompressedRTFStream@12");
}
cleanUp:
Modified: trunk/reactos/dll/win32/mapi32/util.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/util.h?re…
==============================================================================
--- trunk/reactos/dll/win32/mapi32/util.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mapi32/util.h [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -25,8 +25,8 @@
#include <mapi.h>
//#include <mapix.h>
-extern void load_mapi_providers(void);
-extern void unload_mapi_providers(void);
+extern void load_mapi_providers(void) DECLSPEC_HIDDEN;
+extern void unload_mapi_providers(void) DECLSPEC_HIDDEN;
typedef struct MAPI_FUNCTIONS {
LPMAPIADDRESS MAPIAddress;
@@ -41,6 +41,7 @@
LPMAPIRESOLVENAME MAPIResolveName;
LPMAPISAVEMAIL MAPISaveMail;
LPMAPISENDMAIL MAPISendMail;
+ LPMAPISENDMAILW MAPISendMailW;
LPMAPISENDDOCUMENTS MAPISendDocuments;
LPMAPIUNINITIALIZE MAPIUninitialize;
@@ -58,9 +59,10 @@
HRESULT (WINAPI *HrQueryAllRows) (LPMAPITABLE, LPSPropTagArray,
LPSRestriction, LPSSortOrderSet, LONG, LPSRowSet *);
HRESULT (WINAPI *OpenStreamOnFile) (LPALLOCATEBUFFER, LPFREEBUFFER, ULONG,
LPWSTR, LPWSTR, LPSTREAM *);
SCODE (WINAPI *ScInitMapiUtil) (ULONG ulReserved);
+ HRESULT (WINAPI *WrapCompressedRTFStream) (LPSTREAM, ULONG, LPSTREAM *);
} MAPI_FUNCTIONS;
-extern MAPI_FUNCTIONS mapiFunctions;
-extern HINSTANCE hInstMAPI32;
+extern MAPI_FUNCTIONS mapiFunctions DECLSPEC_HIDDEN;
+extern HINSTANCE hInstMAPI32 DECLSPEC_HIDDEN;
#endif
Modified: trunk/reactos/include/psdk/mapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mapi.h?rev=60…
==============================================================================
--- trunk/reactos/include/psdk/mapi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/mapi.h [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -47,6 +47,16 @@
LPVOID lpFileType;
} MapiFileDesc, *lpMapiFileDesc;
+typedef struct
+{
+ ULONG ulReserved;
+ ULONG flFlags;
+ ULONG nPosition;
+ PWSTR lpszPathName;
+ PWSTR lpszFileName;
+ PVOID lpFileType;
+} MapiFileDescW, *lpMapiFileDescW;
+
#ifndef MAPI_ORIG
#define MAPI_ORIG 0
#define MAPI_TO 1
@@ -63,6 +73,16 @@
ULONG ulEIDSize;
LPVOID lpEntryID;
} MapiRecipDesc, *lpMapiRecipDesc;
+
+typedef struct
+{
+ ULONG ulReserved;
+ ULONG ulRecipClass;
+ PWSTR lpszName;
+ PWSTR lpszAddress;
+ ULONG ulEIDSize;
+ PVOID lpEntryID;
+} MapiRecipDescW, *lpMapiRecipDescW;
typedef struct
{
@@ -80,11 +100,26 @@
lpMapiFileDesc lpFiles;
} MapiMessage, *lpMapiMessage;
+typedef struct
+{
+ ULONG ulReserved;
+ PWSTR lpszSubject;
+ PWSTR lpszNoteText;
+ PWSTR lpszMessageType;
+ PWSTR lpszDateReceived;
+ PWSTR lpszConversationID;
+ FLAGS flFlags;
+ lpMapiRecipDescW lpOriginator;
+ ULONG nRecipCount;
+ lpMapiRecipDescW lpRecips;
+ ULONG nFileCount;
+ lpMapiFileDescW lpFiles;
+} MapiMessageW, *lpMapiMessageW;
/* Error codes */
#ifndef SUCCESS_SUCCESS
-#define SUCCESS_SUCCESS 0L
+#define SUCCESS_SUCCESS 0
#endif
#define MAPI_USER_ABORT 1
@@ -115,6 +150,7 @@
#define MAPI_E_INVALID_EDITFIELDS 24
#define MAPI_E_INVALID_RECIPS 25
#define MAPI_E_NOT_SUPPORTED 26
+#define MAPI_E_UNICODE_NOT_SUPPORTED 27
/* MAPILogon */
@@ -139,6 +175,10 @@
/* MAPISendMail */
#define MAPI_DIALOG 0x00000008
+
+/* MAPISendMailW */
+
+#define MAPI_FORCE_UNICODE 0x00040000
/* API typedefs and prototypes */
@@ -194,6 +234,10 @@
typedef MAPISENDMAIL *LPMAPISENDMAIL;
MAPISENDMAIL MAPISendMail;
+typedef ULONG (WINAPI MAPISENDMAILW)(LHANDLE,ULONG_PTR,lpMapiMessageW,FLAGS,ULONG);
+typedef MAPISENDMAILW *LPMAPISENDMAILW;
+MAPISENDMAILW MAPISendMailW;
+
#ifdef __cplusplus
}
#endif
Modified: trunk/reactos/include/psdk/mapidefs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mapidefs.h?re…
==============================================================================
--- trunk/reactos/include/psdk/mapidefs.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/mapidefs.h [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -446,12 +446,12 @@
} SPropProblemArray, *LPSPropProblemArray;
/* FPropContainsProp flags */
-#define FL_FULLSTRING 0x00000ul /* Exact string match */
-#define FL_SUBSTRING 0x00001ul /* Substring match */
-#define FL_PREFIX 0x00002ul /* Prefix match */
-#define FL_IGNORECASE 0x10000ul /* Case insensitive */
-#define FL_IGNORENONSPACE 0x20000ul /* Ignore non spacing characters */
-#define FL_LOOSE 0x40000ul /* Try very hard to match */
+#define FL_FULLSTRING ((ULONG)0x00000) /* Exact string match */
+#define FL_SUBSTRING ((ULONG)0x00001) /* Substring match */
+#define FL_PREFIX ((ULONG)0x00002) /* Prefix match */
+#define FL_IGNORECASE ((ULONG)0x10000) /* Case insensitive */
+#define FL_IGNORENONSPACE ((ULONG)0x20000) /* Ignore non spacing characters */
+#define FL_LOOSE ((ULONG)0x40000) /* Try very hard to match */
/* Table types returned by IMAPITable_GetStatus() */
@@ -649,18 +649,18 @@
} MAPINAMEID, *LPMAPINAMEID;
/* Desired notification types (bitflags) */
-#define fnevCriticalError 0x00000001UL
-#define fnevNewMail 0x00000002UL
-#define fnevObjectCreated 0x00000004UL
-#define fnevObjectDeleted 0x00000008UL
-#define fnevObjectModified 0x00000010UL
-#define fnevObjectMoved 0x00000020UL
-#define fnevObjectCopied 0x00000040UL
-#define fnevSearchComplete 0x00000080UL
-#define fnevTableModified 0x00000100UL
-#define fnevStatusObjectModified 0x00000200UL
-#define fnevReservedForMapi 0x40000000UL
-#define fnevExtended 0x80000000UL
+#define fnevCriticalError ((ULONG)0x00000001)
+#define fnevNewMail ((ULONG)0x00000002)
+#define fnevObjectCreated ((ULONG)0x00000004)
+#define fnevObjectDeleted ((ULONG)0x00000008)
+#define fnevObjectModified ((ULONG)0x00000010)
+#define fnevObjectMoved ((ULONG)0x00000020)
+#define fnevObjectCopied ((ULONG)0x00000040)
+#define fnevSearchComplete ((ULONG)0x00000080)
+#define fnevTableModified ((ULONG)0x00000100)
+#define fnevStatusObjectModified ((ULONG)0x00000200)
+#define fnevReservedForMapi ((ULONG)0x40000000)
+#define fnevExtended ((ULONG)0x80000000)
/* Type of notification event */
#define TABLE_CHANGED 1U
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Sep 21 12:53:07 2013
@@ -96,7 +96,7 @@
reactos/dll/win32/localspl # Synced to Wine-1.5.26
reactos/dll/win32/localui # Synced to Wine-1.7.1
reactos/dll/win32/lz32 # Synced to Wine-1.5.19
-reactos/dll/win32/mapi32 # Autosync
+reactos/dll/win32/mapi32 # Synced to Wine-1.7.1
reactos/dll/win32/mciavi32 # Synced to Wine-1.5.4
reactos/dll/win32/mcicda # Synced to Wine-1.5.19
reactos/dll/win32/mciqtz32 # Synced to Wine-1.5.4