From 4070208e378bb6be65aebc5877b535852008a93a Mon Sep 17 00:00:00 2001 From: Adam Topel Date: Sat, 20 Sep 2025 14:06:36 -0400 Subject: [PATCH 1/2] Add missing declarations --- include/MAPIUtil.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/MAPIUtil.h b/include/MAPIUtil.h index fa363d0..3cbedd4 100644 --- a/include/MAPIUtil.h +++ b/include/MAPIUtil.h @@ -846,6 +846,30 @@ HrIStorageFromStream (LPUNKNOWN lpUnkIn, STDAPI_(SCODE) ScInitMapiUtil(ULONG ulFlags); STDAPI_(VOID) DeinitMapiUtil(VOID); +struct RTF_WCSINFO +{ + ULONG size; + ULONG ulFlags; + ULONG ulInCodePage; + ULONG ulOutCodePage; +}; + +struct RTF_WCSRETINFO +{ + ULONG size; + ULONG ulStreamFlags; +}; + +// Declaration missing from headers +STDAPI_(HRESULT) OpenStreamOnFileW(LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, LPWSTR lpszFileName, LPWSTR lpszPrefix, LPSTREAM FAR* lppStream); + +STDAPI_(HRESULT) WrapCompressedRTFStreamEx(LPSTREAM pCompressedRTFStream, const RTF_WCSINFO* pWCSInfo, + LPSTREAM* ppUncompressedRTFStream, RTF_WCSRETINFO* pRetInfo); + +#define MAPI_NATIVE_BODY 0x00010000 +#define pidExchangeXmitReservedMin 0x3FE0 +#define PR_INTERNET_CPID PROP_TAG(PT_LONG, pidExchangeXmitReservedMin - 0x02) /* * Entry point names. From 1e0824a4d95643b26a74d146252454666c705ee0 Mon Sep 17 00:00:00 2001 From: Stephen Griffin Date: Fri, 26 Sep 2025 09:14:54 -0400 Subject: [PATCH 2/2] Updating struct and function definitions to match MFCMAPI's extraPropTags.h and mapiFunctions.h Updates sub definition in mapiStubLibrary to match Moved MAPI_NATIVE_BODY to MAPIDefs.h Other defines were already in edkmdb.h so removed --- include/MAPIDefS.h | 13 ++++++++++++ include/MAPIUtil.h | 42 ++++++++++++++++++++++++------------- library/mapiStubLibrary.cpp | 6 ++---- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/include/MAPIDefS.h b/include/MAPIDefS.h index 9e83e2d..73fd58c 100644 --- a/include/MAPIDefS.h +++ b/include/MAPIDefS.h @@ -2845,6 +2845,19 @@ DECLARE_MAPI_INTERFACE_(IMAPIProviderShutdown, IUnknown) MAPI_IMAPIPROVIDERSHUTDOWN_METHODS(PURE) }; +/* WrapCompressedRTFStreamEx ---------------------------------------------- */ + +/* Flags for WrapCompressedRTFStreamEx */ + +/****** MAPI_MODIFY ((ULONG) 0x00000001) above */ +/****** STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) above */ +#define MAPI_NATIVE_BODY 0x00010000 + +/* out param type infomation for WrapCompressedRTFStreamEx */ +#define MAPI_NATIVE_BODY_TYPE_RTF 0x00000001 +#define MAPI_NATIVE_BODY_TYPE_HTML 0x00000002 +#define MAPI_NATIVE_BODY_TYPE_PLAINTEXT 0x00000004 + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/include/MAPIUtil.h b/include/MAPIUtil.h index 3cbedd4..9b70cf7 100644 --- a/include/MAPIUtil.h +++ b/include/MAPIUtil.h @@ -846,30 +846,44 @@ HrIStorageFromStream (LPUNKNOWN lpUnkIn, STDAPI_(SCODE) ScInitMapiUtil(ULONG ulFlags); STDAPI_(VOID) DeinitMapiUtil(VOID); +// Definitions for WrapCompressedRTFStreamEx in param for WrapCompressedRTFStreamEX +// https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb905293(v=office.12) struct RTF_WCSINFO { - ULONG size; + ULONG size; // Size of the structure ULONG ulFlags; - ULONG ulInCodePage; - ULONG ulOutCodePage; + /****** MAPI_MODIFY ((ULONG) 0x00000001) above */ + /****** STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) above */ + /****** MAPI_NATIVE_BODY ((ULONG) 0x00010000) mapidefs.h Only used for reading*/ + ULONG ulInCodePage; // Codepage of the message, used when passing MAPI_NATIVE_BODY, ignored otherwise + ULONG ulOutCodePage; // Codepage of the Returned Stream, used when passing MAPI_NATIVE_BODY, ignored otherwise }; +// out param type information for WrapCompressedRTFStreamEX +// https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb905294(v=office.12) struct RTF_WCSRETINFO { - ULONG size; + ULONG size; // Size of the structure ULONG ulStreamFlags; + /****** MAPI_NATIVE_BODY_TYPE_RTF ((ULONG) 0x00000001) mapidefs.h */ + /****** MAPI_NATIVE_BODY_TYPE_HTML ((ULONG) 0x00000002) mapidefs.h */ + /****** MAPI_NATIVE_BODY_TYPE_PLAINTEXT ((ULONG) 0x00000004) mapidefs.h */ }; -// Declaration missing from headers -STDAPI_(HRESULT) OpenStreamOnFileW(LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer, - ULONG ulFlags, LPWSTR lpszFileName, LPWSTR lpszPrefix, LPSTREAM FAR* lppStream); - -STDAPI_(HRESULT) WrapCompressedRTFStreamEx(LPSTREAM pCompressedRTFStream, const RTF_WCSINFO* pWCSInfo, - LPSTREAM* ppUncompressedRTFStream, RTF_WCSRETINFO* pRetInfo); - -#define MAPI_NATIVE_BODY 0x00010000 -#define pidExchangeXmitReservedMin 0x3FE0 -#define PR_INTERNET_CPID PROP_TAG(PT_LONG, pidExchangeXmitReservedMin - 0x02) +STDAPI_(HRESULT) +WrapCompressedRTFStreamEx( + LPSTREAM pCompressedRTFStream, + const RTF_WCSINFO* pWCSInfo, + LPSTREAM* ppUncompressedRTFStream, + RTF_WCSRETINFO* pRetInfo); + +_Check_return_ STDAPI OpenStreamOnFileW( + _In_ LPALLOCATEBUFFER lpAllocateBuffer, + _In_ LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, + _In_z_ LPCWSTR lpszFileName, + _In_opt_z_ LPCWSTR lpszPrefix, + _Out_ LPSTREAM FAR* lppStream); /* * Entry point names. diff --git a/library/mapiStubLibrary.cpp b/library/mapiStubLibrary.cpp index 8d95fbf..a228a01 100644 --- a/library/mapiStubLibrary.cpp +++ b/library/mapiStubLibrary.cpp @@ -53,8 +53,6 @@ struct MAPIOFFLINE_CREATEINFO; struct IMAPIOfflineMgr; -struct RTF_WCSINFO; -struct RTF_WCSRETINFO; #define LINKAGE_EXTERN_C extern "C" #define LINKAGE_NO_EXTERN_C /* */ @@ -2512,8 +2510,8 @@ DEFINE_STUB_FUNCTION_6( LPALLOCATEBUFFER, LPFREEBUFFER, ULONG, - LPWSTR, - LPWSTR, + LPCWSTR, + LPCWSTR, LPSTREAM FAR*, MAPI_E_CALL_FAILED)