diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/mapi | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
49 files changed, 14892 insertions, 0 deletions
diff --git a/comm/mailnews/mapi/include/README.md b/comm/mailnews/mapi/include/README.md new file mode 100644 index 0000000000..fe9d707388 --- /dev/null +++ b/comm/mailnews/mapi/include/README.md @@ -0,0 +1,33 @@ +The contents of this directory are from the MAPI Stub Library, formerly +Outlook MAPI Headers. + +The files were downloaded from https://github.com/stephenegriffin/MAPIStubLibrary +at revision 01f9bf8cd2ac39078aabfc4662c873159efd75d6. + +The files have been renamed to lower-cased filenames for cross-compiling +compatibility. + +The content of the imported files was validated by comparing them to the +ones found in the Outlook2010MAPIHeaders.exe that was previously available +from MSDN. No differences were found that affect the code (mostly whitespace). + +MIT License + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/comm/mailnews/mapi/include/mapiaux.h b/comm/mailnews/mapi/include/mapiaux.h new file mode 100644 index 0000000000..4be02ab7da --- /dev/null +++ b/comm/mailnews/mapi/include/mapiaux.h @@ -0,0 +1,235 @@ +/* + * M A P I A U X . H + * + * Messaging Applications Programming Interface. + * + * Copyright (c) 2010 Microsoft Corporation. All Rights Reserved. + * + * Purpose: + * + * This file defines additional interfaces, structures, and constants + * used by the Messaging Applications Programming Interface + */ + + +#ifndef MAPIAUXGUID_H +#ifdef INITGUID +#include <mapiguid.h> +#define MAPIAUXGUID_H +#endif /* INITGUID */ + +#if !defined(INITGUID) || defined(USES_IID_IMsgServiceAdmin2) +DEFINE_OLEGUID(IID_IMsgServiceAdmin2,0x00020387, 0, 0); +#endif + +#if !defined(INITGUID) || defined(USES_IID_IMessageRaw) +DEFINE_OLEGUID(IID_IMessageRaw, 0x0002038A, 0, 0); +#endif + +#endif /* MAPIAUXGUID_H */ + + + +#ifndef MAPIAUX_H +#define MAPIAUX_H + +/* Include common MAPI header files if they haven't been already. */ + +#ifndef MAPIDEFS_H +#include <mapidefs.h> +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +/* Forward interface declarations */ + +DECLARE_MAPI_INTERFACE_PTR(IMsgServiceAdmin2, LPSERVICEADMIN2); + +// Property tags + +#define PR_ATTACH_CONTENT_ID PROP_TAG( PT_TSTRING, 0x3712) +#define PR_ATTACH_CONTENT_ID_W PROP_TAG( PT_UNICODE, 0x3712) +#define PR_ATTACH_CONTENT_ID_A PROP_TAG( PT_STRING8, 0x3712) + +// Additional display attributes, to supplement PR_DISPLAY_TYPE. +#define PR_DISPLAY_TYPE_EX PROP_TAG( PT_LONG, 0x3905) + +#define PR_MSG_EDITOR_FORMAT PROP_TAG( PT_LONG, 0x5909 ) + +#define PR_ROH_FLAGS PROP_TAG( PT_LONG, 0x6623) + +#define PR_ROH_PROXY_AUTH_SCHEME PROP_TAG( PT_LONG, 0x6627) + + +// Constants + +/* MAPILogonEx() flags. */ +#define MAPI_BG_SESSION 0x00200000 /* Used for async profile access */ + +/* Flags for MAPIINIT_0 structure ulFlags value passed to MAPIInitialize() */ +#define MAPI_NO_COINIT 0x00000008 + +/* SaveChanges flags */ +#define SPAMFILTER_ONSAVE ((ULONG) 0x00000080) +#define ITEMPROC_FORCE ((ULONG) 0x00000800) +#define NON_EMS_XP_SAVE ((ULONG) 0x00001000) + +/* Flags for OpenMessageStore() */ +#define MDB_ONLINE ((ULONG) 0x00000100) + + +/* IMsgStore Interface ----------------------------------------------------- */ +/* PR_STORE_SUPPORT_MASK bits */ +#define STORE_UNICODE_OK ((ULONG) 0x00040000) +#define STORE_ITEMPROC ((ULONG) 0x00200000) + +/* Miscellaneous flags */ +#define MAPI_NO_CACHE ((ULONG) 0x00000200) +#define MAPI_CACHE_ONLY ((ULONG) 0x00004000) + + +/* Values for PR_AGING_GRANULARITY (Determines aging is measured by months, weeks, or days) */ +#define AG_MONTHS 0 +#define AG_WEEKS 1 +#define AG_DAYS 2 +#define NUM_AG_TYPES 3 + + +// PR_DISPLAY_TYPE_EX has the following format +// +// 33222222222211111111110000000000 +// 10987654321098765432109876543210 +// +// FAxxxxxxxxxxxxxxRRRRRRRRLLLLLLLL +// +// F = 1 if remote is valid, 0 if it is not +// A = 1 if the user is ACL-able, 0 if the user is not +// x - unused at this time, do not interpret as this may be used in the future +// R = display type from + +#define DTE_FLAG_REMOTE_VALID 0x80000000 +#define DTE_FLAG_ACL_CAPABLE 0x40000000 +#define DTE_MASK_REMOTE 0x0000ff00 +#define DTE_MASK_LOCAL 0x000000ff + +#define DTE_IS_REMOTE_VALID(v) (!!((v) & DTE_FLAG_REMOTE_VALID)) +#define DTE_IS_ACL_CAPABLE(v) (!!((v) & DTE_FLAG_ACL_CAPABLE)) +#define DTE_REMOTE(v) (((v) & DTE_MASK_REMOTE) >> 8) +#define DTE_LOCAL(v) ((v) & DTE_MASK_LOCAL) + +#define DT_ROOM ((ULONG) 0x00000007) +#define DT_EQUIPMENT ((ULONG) 0x00000008) +#define DT_SEC_DISTLIST ((ULONG) 0x00000009) + +// Sender's editor format (PR_MSG_EDITOR_FORMAT) +#define EDITOR_FORMAT_DONTKNOW ((ULONG)0) +#define EDITOR_FORMAT_PLAINTEXT ((ULONG)1) +#define EDITOR_FORMAT_HTML ((ULONG)2) +#define EDITOR_FORMAT_RTF ((ULONG)3) + + +// Flags used in PR_ROH_FLAGS - http://support.microsoft.com/kb/898835 +// Connect to my Exchange mailbox using HTTP +#define ROHFLAGS_USE_ROH 0x1 +// Connect using SSL only +#define ROHFLAGS_SSL_ONLY 0x2 +// Mutually authenticate the session when connecting with SSL +#define ROHFLAGS_MUTUAL_AUTH 0x4 +// On fast networks, connect using HTTP first, then connect using TCP/IP +#define ROHFLAGS_HTTP_FIRST_ON_FAST 0x8 +// On slow networks, connect using HTTP first, then connect using TCP/IP +#define ROHFLAGS_HTTP_FIRST_ON_SLOW 0x20 + +// Flags used in PR_ROH_PROXY_AUTH_SCHEME +// Basic Authentication +#define ROHAUTH_BASIC 0x1 +// NTLM Authentication +#define ROHAUTH_NTLM 0x2 + + +// Interface declarations + +#define MAPI_IMSGSERVICEADMIN_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetMsgServiceTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(CreateMsgService) \ + (THIS_ LPTSTR lpszService, \ + LPTSTR lpszDisplayName, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteMsgService) \ + (THIS_ LPMAPIUID lpUID) IPURE; \ + MAPIMETHOD(CopyMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + LPTSTR lpszDisplayName, \ + LPCIID lpInterfaceToCopy, \ + LPCIID lpInterfaceDst, \ + LPVOID lpObjectDst, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(RenameMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags, \ + LPTSTR lpszDisplayName) IPURE; \ + MAPIMETHOD(ConfigureMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + ULONG cValues, \ + LPSPropValue lpProps) IPURE; \ + MAPIMETHOD(OpenProfileSection) \ + (THIS_ LPMAPIUID lpUID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPPROFSECT FAR * lppProfSect) IPURE; \ + MAPIMETHOD(MsgServiceTransportOrder) \ + (THIS_ ULONG cUID, \ + LPMAPIUID lpUIDList, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(AdminProviders) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags, \ + LPPROVIDERADMIN FAR * lppProviderAdmin) IPURE; \ + MAPIMETHOD(SetPrimaryIdentity) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetProviderTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + +#define MAPI_IMSGSERVICEADMIN_METHODS2(IPURE) \ + MAPIMETHOD(CreateMsgServiceEx) \ + (THIS_ LPTSTR lpszService, \ + LPTSTR lpszDisplayName, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPMAPIUID lpuidService) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMsgServiceAdmin2 +DECLARE_MAPI_INTERFACE_(IMsgServiceAdmin2, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMSGSERVICEADMIN_METHODS(PURE) + MAPI_IMSGSERVICEADMIN_METHODS2(PURE) +}; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* MAPIAUX_H */ diff --git a/comm/mailnews/mapi/include/mapicode.h b/comm/mailnews/mapi/include/mapicode.h new file mode 100644 index 0000000000..1c448c3003 --- /dev/null +++ b/comm/mailnews/mapi/include/mapicode.h @@ -0,0 +1,218 @@ +/* + * M A P I C O D E . H + * + * Status Codes returned by MAPI routines + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPICODE_H +#define MAPICODE_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN64) && !defined (_WIN64) +#define _WIN64 +#endif + +/* + * Under Win64 systems Win32 is also defined for backwards compatibility. + */ + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +/* Define S_OK and ITF_* */ + +#if defined(_WIN64) || defined(_WIN32) +#include <winerror.h> +#endif + + +/* + * On Windows, scodes are 32-bit values laid out as follows: + * + * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+---------------------+-------------------------------+ + * |S|R|C|N|r| Facility | Code | + * +-+-+-+-+-+---------------------+-------------------------------+ + * + * where + * + * S - Severity - indicates success/fail + * + * 0 - Success + * 1 - Fail (COERROR) + * + * R - reserved portion of the facility code, corresponds to Windows + * second severity bit. + * + * C - reserved portion of the facility code, corresponds to Windows + * C field. + * + * N - reserved portion of the facility code. Used to indicate a + * mapped Windows status value. + * + * r - reserved portion of the facility code. Reserved for internal + * use. Used to indicate HRESULT values that are not status + * values, but are instead message ids for display strings. + * + * Facility - is the facility code + * FACILITY_NULL 0x0 + * FACILITY_RPC 0x1 + * FACILITY_DISPATCH 0x2 + * FACILITY_STORAGE 0x3 + * FACILITY_ITF 0x4 + * FACILITY_WIN32 0x7 + * FACILITY_WINDOWS 0x8 + * + * Code - is the facility's status code + * + */ + + + + +/* + * We can't use OLE 2.0 macros to build sCodes because the definition has + * changed and we wish to conform to the new definition. + */ +#define MAKE_MAPI_SCODE(sev,fac,code) \ + ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) + +/* The following two macros are used to build OLE 2.0 style sCodes */ + +#define MAKE_MAPI_E( err ) (MAKE_MAPI_SCODE( 1, FACILITY_ITF, err )) +#define MAKE_MAPI_S( warn ) (MAKE_MAPI_SCODE( 0, FACILITY_ITF, warn )) + +#ifdef SUCCESS_SUCCESS +#undef SUCCESS_SUCCESS +#endif +#define SUCCESS_SUCCESS 0L + +/* General errors (used by more than one MAPI object) */ + +#define MAPI_E_CALL_FAILED E_FAIL +#define MAPI_E_NOT_ENOUGH_MEMORY E_OUTOFMEMORY +#define MAPI_E_INVALID_PARAMETER E_INVALIDARG +#define MAPI_E_INTERFACE_NOT_SUPPORTED E_NOINTERFACE +#define MAPI_E_NO_ACCESS E_ACCESSDENIED + +#define MAPI_E_NO_SUPPORT MAKE_MAPI_E( 0x102 ) +#define MAPI_E_BAD_CHARWIDTH MAKE_MAPI_E( 0x103 ) +#define MAPI_E_STRING_TOO_LONG MAKE_MAPI_E( 0x105 ) +#define MAPI_E_UNKNOWN_FLAGS MAKE_MAPI_E( 0x106 ) +#define MAPI_E_INVALID_ENTRYID MAKE_MAPI_E( 0x107 ) +#define MAPI_E_INVALID_OBJECT MAKE_MAPI_E( 0x108 ) +#define MAPI_E_OBJECT_CHANGED MAKE_MAPI_E( 0x109 ) +#define MAPI_E_OBJECT_DELETED MAKE_MAPI_E( 0x10A ) +#define MAPI_E_BUSY MAKE_MAPI_E( 0x10B ) +#define MAPI_E_NOT_ENOUGH_DISK MAKE_MAPI_E( 0x10D ) +#define MAPI_E_NOT_ENOUGH_RESOURCES MAKE_MAPI_E( 0x10E ) +#define MAPI_E_NOT_FOUND MAKE_MAPI_E( 0x10F ) +#define MAPI_E_VERSION MAKE_MAPI_E( 0x110 ) +#define MAPI_E_LOGON_FAILED MAKE_MAPI_E( 0x111 ) +#define MAPI_E_SESSION_LIMIT MAKE_MAPI_E( 0x112 ) +#define MAPI_E_USER_CANCEL MAKE_MAPI_E( 0x113 ) +#define MAPI_E_UNABLE_TO_ABORT MAKE_MAPI_E( 0x114 ) +#define MAPI_E_NETWORK_ERROR MAKE_MAPI_E( 0x115 ) +#define MAPI_E_DISK_ERROR MAKE_MAPI_E( 0x116 ) +#define MAPI_E_TOO_COMPLEX MAKE_MAPI_E( 0x117 ) +#define MAPI_E_BAD_COLUMN MAKE_MAPI_E( 0x118 ) +#define MAPI_E_EXTENDED_ERROR MAKE_MAPI_E( 0x119 ) +#define MAPI_E_COMPUTED MAKE_MAPI_E( 0x11A ) +#define MAPI_E_CORRUPT_DATA MAKE_MAPI_E( 0x11B ) +#define MAPI_E_UNCONFIGURED MAKE_MAPI_E( 0x11C ) +#define MAPI_E_FAILONEPROVIDER MAKE_MAPI_E( 0x11D ) +#define MAPI_E_UNKNOWN_CPID MAKE_MAPI_E( 0x11E ) +#define MAPI_E_UNKNOWN_LCID MAKE_MAPI_E( 0x11F ) + +/* Flavors of E_ACCESSDENIED, used at logon */ + +#define MAPI_E_PASSWORD_CHANGE_REQUIRED MAKE_MAPI_E( 0x120 ) +#define MAPI_E_PASSWORD_EXPIRED MAKE_MAPI_E( 0x121 ) +#define MAPI_E_INVALID_WORKSTATION_ACCOUNT MAKE_MAPI_E( 0x122 ) +#define MAPI_E_INVALID_ACCESS_TIME MAKE_MAPI_E( 0x123 ) +#define MAPI_E_ACCOUNT_DISABLED MAKE_MAPI_E( 0x124 ) + +/* MAPI base function and status object specific errors and warnings */ + +#define MAPI_E_END_OF_SESSION MAKE_MAPI_E( 0x200 ) +#define MAPI_E_UNKNOWN_ENTRYID MAKE_MAPI_E( 0x201 ) +#define MAPI_E_MISSING_REQUIRED_COLUMN MAKE_MAPI_E( 0x202 ) +#define MAPI_W_NO_SERVICE MAKE_MAPI_S( 0x203 ) + +/* Property specific errors and warnings */ + +#define MAPI_E_BAD_VALUE MAKE_MAPI_E( 0x301 ) +#define MAPI_E_INVALID_TYPE MAKE_MAPI_E( 0x302 ) +#define MAPI_E_TYPE_NO_SUPPORT MAKE_MAPI_E( 0x303 ) +#define MAPI_E_UNEXPECTED_TYPE MAKE_MAPI_E( 0x304 ) +#define MAPI_E_TOO_BIG MAKE_MAPI_E( 0x305 ) +#define MAPI_E_DECLINE_COPY MAKE_MAPI_E( 0x306 ) +#define MAPI_E_UNEXPECTED_ID MAKE_MAPI_E( 0x307 ) + +#define MAPI_W_ERRORS_RETURNED MAKE_MAPI_S( 0x380 ) + +/* Table specific errors and warnings */ + +#define MAPI_E_UNABLE_TO_COMPLETE MAKE_MAPI_E( 0x400 ) +#define MAPI_E_TIMEOUT MAKE_MAPI_E( 0x401 ) +#define MAPI_E_TABLE_EMPTY MAKE_MAPI_E( 0x402 ) +#define MAPI_E_TABLE_TOO_BIG MAKE_MAPI_E( 0x403 ) + +#define MAPI_E_INVALID_BOOKMARK MAKE_MAPI_E( 0x405 ) + +#define MAPI_W_POSITION_CHANGED MAKE_MAPI_S( 0x481 ) +#define MAPI_W_APPROX_COUNT MAKE_MAPI_S( 0x482 ) + +/* Transport specific errors and warnings */ + +#define MAPI_E_WAIT MAKE_MAPI_E( 0x500 ) +#define MAPI_E_CANCEL MAKE_MAPI_E( 0x501 ) +#define MAPI_E_NOT_ME MAKE_MAPI_E( 0x502 ) + +#define MAPI_W_CANCEL_MESSAGE MAKE_MAPI_S( 0x580 ) + +/* Message Store, Folder, and Message specific errors and warnings */ + +#define MAPI_E_CORRUPT_STORE MAKE_MAPI_E( 0x600 ) +#define MAPI_E_NOT_IN_QUEUE MAKE_MAPI_E( 0x601 ) +#define MAPI_E_NO_SUPPRESS MAKE_MAPI_E( 0x602 ) +#define MAPI_E_COLLISION MAKE_MAPI_E( 0x604 ) +#define MAPI_E_NOT_INITIALIZED MAKE_MAPI_E( 0x605 ) +#define MAPI_E_NON_STANDARD MAKE_MAPI_E( 0x606 ) +#define MAPI_E_NO_RECIPIENTS MAKE_MAPI_E( 0x607 ) +#define MAPI_E_SUBMITTED MAKE_MAPI_E( 0x608 ) +#define MAPI_E_HAS_FOLDERS MAKE_MAPI_E( 0x609 ) +#define MAPI_E_HAS_MESSAGES MAKE_MAPI_E( 0x60A ) +#define MAPI_E_FOLDER_CYCLE MAKE_MAPI_E( 0x60B ) + +#define MAPI_W_PARTIAL_COMPLETION MAKE_MAPI_S( 0x680 ) + +/* Address Book specific errors and warnings */ + +#define MAPI_E_AMBIGUOUS_RECIP MAKE_MAPI_E( 0x700 ) + +/* The range 0x0800 to 0x08FF is reserved */ + +/* Obsolete typing shortcut that will go away eventually. */ +#ifndef MakeResult +#define MakeResult(_s) ResultFromScode(_s) +#endif + +/* We expect these to eventually be defined by OLE, but for now, + * here they are. When OLE defines them they can be much more + * efficient than these, but these are "proper" and don't make + * use of any hidden tricks. + */ +#ifndef HR_SUCCEEDED +#define HR_SUCCEEDED(_hr) SUCCEEDED((SCODE)(_hr)) +#define HR_FAILED(_hr) FAILED((SCODE)(_hr)) +#endif + +#endif /* MAPICODE_H */ diff --git a/comm/mailnews/mapi/include/mapidbg.h b/comm/mailnews/mapi/include/mapidbg.h new file mode 100644 index 0000000000..e22c5fce57 --- /dev/null +++ b/comm/mailnews/mapi/include/mapidbg.h @@ -0,0 +1,492 @@ +/* + * M A P I D B G . H + * + * Debugging support for MAPI service providers. + * Support functions are implemented in MAPIDBG.C. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef __MAPIDBG_H_ +#define __MAPIDBG_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN64) && !defined (_WIN64) +#define _WIN64 +#endif + +/* + * Under Win64 systems Win32 is also defined for backwards compatibility. + */ + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +/* + * Debugging Macros ------------------------------------------------------- + * + * IFDBG(x) Results in the expression x if DEBUG is defined, or + * to nothing if DEBUG is not defined + * + * IFNDBG(x) Results in the expression x if DEBUG is not defined, + * or to nothing if DEBUG is defined + * + * Unreferenced(a) Causes a to be referenced so that the compiler + * doesn't issue warnings about unused local variables + * which exist but are reserved for future use (eg + * ulFlags in many cases) + */ + +#if defined(DEBUG) +#define IFDBG(x) x +#define IFNDBG(x) +#else +#define IFDBG(x) +#define IFNDBG(x) x +#endif + +#ifdef __cplusplus +#define EXTERN_C_BEGIN extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_BEGIN +#define EXTERN_C_END +#endif + +#define dimensionof(a) (sizeof(a)/sizeof(*(a))) + +#define Unreferenced(a) ((void)(a)) + +typedef long SCODE; +typedef unsigned long ULONG; +typedef unsigned long DWORD; + +/* + * Assert Macros --------------------------------------------------------- + * + * Assert(a) Displays a message indicating the file and line number + * of this Assert() if a == 0. OK'ing an assert traps + * into the debugger. + * + * AssertSz(a,sz) Works like an Assert(), but displays the string sz + * along with the file and line number. + * + * Side asserts A side assert works like an Assert(), but evaluates + * 'a' even when asserts are not enabled. + * + * NF asserts A NF (Non-Fatal) assert works like an Assert(), but + * continues instead of trapping into the debugger when + * OK'ed. + */ + +#if defined(DEBUG) || defined(ASSERTS_ENABLED) +#define IFTRAP(x) x +#else +#define IFTRAP(x) 0 +#endif + +#define Trap() IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Trap")) +#define TrapSz(psz) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz)) +#define TrapSz1(psz,a1) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1)) +#define TrapSz2(psz,a1,a2) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2)) +#define TrapSz3(psz,a1,a2,a3) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3)) +#define TrapSz4(psz,a1,a2,a3,a4) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4)) +#define TrapSz5(psz,a1,a2,a3,a4,a5) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)) +#define TrapSz6(psz,a1,a2,a3,a4,a5,a6) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6)) +#define TrapSz7(psz,a1,a2,a3,a4,a5,a6,a7) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7)) +#define TrapSz8(psz,a1,a2,a3,a4,a5,a6,a7,a8) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8)) +#define TrapSz9(psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)) + +#define Assert(t) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t),0)) +#define AssertSz(t,psz) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz),0)) +#define AssertSz1(t,psz,a1) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1),0)) +#define AssertSz2(t,psz,a1,a2) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2),0)) +#define AssertSz3(t,psz,a1,a2,a3) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3),0)) +#define AssertSz4(t,psz,a1,a2,a3,a4) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4),0)) +#define AssertSz5(t,psz,a1,a2,a3,a4,a5) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0)) +#define AssertSz6(t,psz,a1,a2,a3,a4,a5,a6) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6),0)) +#define AssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7),0)) +#define AssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8),0)) +#define AssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) IFTRAP(((t) ? 0 : DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9),0)) + +#define SideAssert(t) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,"Assertion Failure: " #t)),0) +#define SideAssertSz(t,psz) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz)),0) +#define SideAssertSz1(t,psz,a1) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1)),0) +#define SideAssertSz2(t,psz,a1,a2) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2)),0) +#define SideAssertSz3(t,psz,a1,a2,a3) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3)),0) +#define SideAssertSz4(t,psz,a1,a2,a3,a4) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0) +#define SideAssertSz5(t,psz,a1,a2,a3,a4,a5) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0) +#define SideAssertSz6(t,psz,a1,a2,a3,a4,a5,a6) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6)),0) +#define SideAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7)),0) +#define SideAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8)),0) +#define SideAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((t) ? 0 : IFTRAP(DebugTrapFn(1,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)),0) + +#define NFAssert(t) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t),0)) +#define NFAssertSz(t,psz) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz),0)) +#define NFAssertSz1(t,psz,a1) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1),0)) +#define NFAssertSz2(t,psz,a1,a2) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2),0)) +#define NFAssertSz3(t,psz,a1,a2,a3) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3),0)) +#define NFAssertSz4(t,psz,a1,a2,a3,a4) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4),0)) +#define NFAssertSz5(t,psz,a1,a2,a3,a4,a5) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5),0)) +#define NFAssertSz6(t,psz,a1,a2,a3,a4,a5,a6) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6),0)) +#define NFAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7),0)) +#define NFAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8),0)) +#define NFAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) IFTRAP(((t) ? 0 : DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9),0)) + +#define NFSideAssert(t) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,"Assertion Failure: " #t)),0) +#define NFSideAssertSz(t,psz) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz)),0) +#define NFSideAssertSz1(t,psz,a1) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1)),0) +#define NFSideAssertSz2(t,psz,a1,a2) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2)),0) +#define NFSideAssertSz3(t,psz,a1,a2,a3) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3)),0) +#define NFSideAssertSz4(t,psz,a1,a2,a3,a4) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4)),0) +#define NFSideAssertSz5(t,psz,a1,a2,a3,a4,a5) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5)),0) +#define NFSideAssertSz6(t,psz,a1,a2,a3,a4,a5,a6) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6)),0) +#define NFSideAssertSz7(t,psz,a1,a2,a3,a4,a5,a6,a7) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7)),0) +#define NFSideAssertSz8(t,psz,a1,a2,a3,a4,a5,a6,a7,a8) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8)),0) +#define NFSideAssertSz9(t,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((t) ? 0 : IFTRAP(DebugTrapFn(0,__FILE__,__LINE__,psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)),0) + +/* + * Trace Macros ------------------------------------------------------------ + * + * DebugTrace Use for arbitrary formatted output. It + * takes exactly the same arguments as the + * Windows wsprintf() function. + * DebugTraceResult Shorthand for error tracing with an + * HRESULT. Arguments are the name of the + * function (not quoted) and the HRESULT. + * DebugTraceSc Shorthand for error tracing with an + * SCODE. Arguments are the name of the + * function (not quoted) and the SCODE. + * DebugTraceArg Shorthand for invalid parameter + * tracing. Arguments are the name of the + * function (not quoted) and a quoted + * string describing the bad parameter. + */ + +#if defined(DEBUG) || defined(TRACES_ENABLED) +#define IFTRACE(x) x +#define DebugTrace DebugTraceFn +#else +#define IFTRACE(x) 0 +#define DebugTrace 1?0:DebugTraceFn +#endif + +#define DebugTraceResult(f,hr) IFTRACE(((hr) ? DebugTraceFn(#f " returns 0x%08lX %s\n", GetScode(hr), SzDecodeScode(GetScode(hr))) : 0)) +#define DebugTraceSc(f,sc) IFTRACE(((sc) ? DebugTraceFn(#f " returns 0x%08lX %s\n", sc, SzDecodeScode(sc)) : 0)) +#define DebugTraceArg(f,s) IFTRACE(DebugTraceFn(#f ": bad parameter: " s "\n")) +#define DebugTraceLine() IFTRACE(DebugTraceFn("File %s, Line %i \n",__FILE__,__LINE__)) +#define DebugTraceProblems(sz, rgprob) IFTRACE(DebugTraceProblemsFn(sz, rgprob)) + +#define TraceSz(psz) IFTRACE(DebugTraceFn("~" psz)) +#define TraceSz1(psz,a1) IFTRACE(DebugTraceFn("~" psz,a1)) +#define TraceSz2(psz,a1,a2) IFTRACE(DebugTraceFn("~" psz,a1,a2)) +#define TraceSz3(psz,a1,a2,a3) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3)) +#define TraceSz4(psz,a1,a2,a3,a4) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4)) +#define TraceSz5(psz,a1,a2,a3,a4,a5) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5)) +#define TraceSz6(psz,a1,a2,a3,a4,a5,a6) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6)) +#define TraceSz7(psz,a1,a2,a3,a4,a5,a6,a7) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7)) +#define TraceSz8(psz,a1,a2,a3,a4,a5,a6,a7,a8) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8)) +#define TraceSz9(psz,a1,a2,a3,a4,a5,a6,a7,a8,a9) IFTRACE(DebugTraceFn("~" psz,a1,a2,a3,a4,a5,a6,a7,a8,a9)) + +/* Debugging Functions ---------------------------------------------------- */ + +EXTERN_C_BEGIN + +#if defined(_WIN64) || defined (_WIN32) +#define EXPORTDBG +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +int EXPORTDBG __cdecl DebugTrapFn(int fFatal, char *pszFile, int iLine, char *pszFormat, ...); +int EXPORTDBG __cdecl DebugTraceFn(char *pszFormat, ...); +void EXPORTDBG __cdecl DebugTraceProblemsFn(char *sz, void *rgprob); +char * EXPORTDBG __cdecl SzDecodeScodeFn(SCODE sc); +char * EXPORTDBG __cdecl SzDecodeUlPropTypeFn(unsigned long ulPropType); +char * EXPORTDBG __cdecl SzDecodeUlPropTagFn(unsigned long ulPropTag); +unsigned long EXPORTDBG __cdecl UlPropTagFromSzFn(char *psz); +SCODE EXPORTDBG __cdecl ScodeFromSzFn(char *psz); +void * EXPORTDBG __cdecl DBGMEM_EncapsulateFn(void * pmalloc, char *pszSubsys, int fCheckOften); +void EXPORTDBG __cdecl DBGMEM_ShutdownFn(void * pmalloc); +void EXPORTDBG __cdecl DBGMEM_CheckMemFn(void * pmalloc, int fReportOrphans); +#if defined(_WIN64) || defined(_WIN32) +void EXPORTDBG __cdecl DBGMEM_LeakHook(FARPROC pfn); +void EXPORTDBG __cdecl GetCallStack(DWORD_PTR *, int, int); +#endif +void EXPORTDBG __cdecl DBGMEM_NoLeakDetectFn(void * pmalloc, void *pv); +void EXPORTDBG __cdecl DBGMEM_SetFailureAtFn(void * pmalloc, ULONG ulFailureAt); +SCODE EXPORTDBG __cdecl ScCheckScFn(SCODE, SCODE *, char *, char *, int); +void * EXPORTDBG __cdecl VMAlloc(ULONG); +void * EXPORTDBG __cdecl VMAllocEx(ULONG, ULONG); +void * EXPORTDBG __cdecl VMRealloc(void *, ULONG); +void * EXPORTDBG __cdecl VMReallocEx(void *, ULONG, ULONG); +ULONG EXPORTDBG __cdecl VMGetSize(void *); +ULONG EXPORTDBG __cdecl VMGetSizeEx(void *, ULONG); +void EXPORTDBG __cdecl VMFree(void *); +void EXPORTDBG __cdecl VMFreeEx(void *, ULONG); + +EXTERN_C_END + +/* + * Debugging Macros ------------------------------------------------------- + * + * SzDecodeScode Returns the string name of an SCODE + * SzDecodeUlPropTag Returns the string name of a property + * tag + * UlPropTagFromSz Given a property tag's name, returns + * its value + * ScodeFromSz Given an SCODE's name, returns its + * value + * + * DBGMEM_Encapsulate Given an IMalloc interface, adds heap- + * checking functionality and returns a + * wrapped interface + * DBGMEM_Shutdown Undoes DBGMEM_Encapsulate, and prints + * out information on any allocations made + * since the interface was encapsulated + * that have not yet been released. + * DBGMEM_CheckMem Checks all memory allocated on the heap, + * and optionally reports leaked blocks. + * DBGMEM_NoLeakDetect Prevents a block from appearing on the leak + * report. Pass NULL for pv to inhibit leak + * reports at all from this heap. + */ + +#ifdef DEBUG + +#define SzDecodeScode(_sc) SzDecodeScodeFn(_sc) +#define SzDecodeUlPropType(_ulPropType) SzDecodeUlPropTypeFn(_ulPropType) +#define SzDecodeUlPropTag(_ulPropTag) SzDecodeUlPropTagFn(_ulPropTag) +#define UlPropTagFromSz(_sz) UlPropTagFromSzFn(_sz) +#define ScodeFromSz(_sz) ScodeFromSzFn(_sz) +#define DBGMEM_Encapsulate(pm, psz, f) DBGMEM_EncapsulateFn(pm, psz, f) +#define DBGMEM_Shutdown(pm) DBGMEM_ShutdownFn(pm) +#define DBGMEM_CheckMem(pm, f) DBGMEM_CheckMemFn(pm, f) +#define DBGMEM_NoLeakDetect(pm, pv) DBGMEM_NoLeakDetectFn(pm, pv) +#define DBGMEM_SetFailureAt(pm, ul) DBGMEM_SetFailureAtFn(pm, ul) + +#else + +#define SzDecodeScode(_sc) (0) +#define SzDecodeUlPropType(_ulPropType) (0) +#define SzDecodeUlPropTag(_ulPropTag) (0) +#define UlPropTagFromSz(_sz) (0) +#define ScodeFromSz(_sz) (0) + +#if defined(__cplusplus) && !defined(CINTERFACE) +#define DBGMEM_Encapsulate(pmalloc, pszSubsys, fCheckOften) \ + ((pmalloc)->AddRef(), (pmalloc)) +#define DBGMEM_Shutdown(pmalloc) \ + ((pmalloc)->Release()) +#else +#define DBGMEM_Encapsulate(pmalloc, pszSubsys, fCheckOften) \ + ((pmalloc)->lpVtbl->AddRef(pmalloc), (pmalloc)) +#define DBGMEM_Shutdown(pmalloc) \ + ((pmalloc)->lpVtbl->Release(pmalloc)) +#endif +#define DBGMEM_CheckMem(pm, f) +#define DBGMEM_NoLeakDetect(pm, pv) +#define DBGMEM_SetFailureAt(pm, ul) + +#endif + +/* + * SCODE maps ------------------------------------------------------------- + * + * ScCheckSc Given an SCODE and method name, verifies + * that the SCODE can legally be returned from + * thet method. Prints out a debug string if + * it cannot. + * HrCheckHr As ScCheckSc, for functions that return + * HRESULT. + */ + +#if defined(DEBUG) && !defined(DOS) +#define ScCheckSc(sc,fn) ScCheckScFn(sc,fn##_Scodes,#fn,__FILE__, __LINE__) +#define HrCheckHr(hr,fn) HrCheckSc(GetScode(hr),fn) +#else +#define ScCheckSc(sc,fn) (sc) +#define HrCheckHr(hr,fn) (hr) +#endif + +#define HrCheckSc(sc,fn) ResultFromScode(ScCheckSc(sc,fn)) + +#if defined(DEBUG) && !defined(DOS) +extern SCODE Common_Scodes[]; +extern SCODE MAPILogon_Scodes[]; +extern SCODE MAPIAllocateBuffer_Scodes[]; +extern SCODE MAPIAllocateMore_Scodes[]; +extern SCODE MAPIFreeBuffer_Scodes[]; + +extern SCODE IUnknown_QueryInterface_Scodes[]; +extern SCODE IUnknown_AddRef_Scodes[]; +extern SCODE IUnknown_Release_Scodes[]; +extern SCODE IUnknown_GetLastError_Scodes[]; + +extern SCODE IMAPIProp_CopyTo_Scodes[]; +extern SCODE IMAPIProp_CopyProps_Scodes[]; +extern SCODE IMAPIProp_DeleteProps_Scodes[]; +extern SCODE IMAPIProp_GetIDsFromNames_Scodes[]; +extern SCODE IMAPIProp_GetLastError_Scodes[]; +extern SCODE IMAPIProp_GetNamesFromIDs_Scodes[]; +extern SCODE IMAPIProp_GetPropList_Scodes[]; +extern SCODE IMAPIProp_GetProps_Scodes[]; +extern SCODE IMAPIProp_OpenProperty_Scodes[]; +extern SCODE IMAPIProp_SetProps_Scodes[]; +extern SCODE IMAPIProp_SaveChanges_Scodes[]; + +extern SCODE IStream_Read_Scodes[]; +extern SCODE IStream_Write_Scodes[]; +extern SCODE IStream_Seek_Scodes[]; +extern SCODE IStream_SetSize_Scodes[]; +extern SCODE IStream_Tell_Scodes[]; +extern SCODE IStream_LockRegion_Scodes[]; +extern SCODE IStream_UnlockRegion_Scodes[]; +extern SCODE IStream_Clone_Scodes[]; +extern SCODE IStream_CopyTo_Scodes[]; +extern SCODE IStream_Revert_Scodes[]; +extern SCODE IStream_Stat_Scodes[]; +extern SCODE IStream_Commit_Scodes[]; + +extern SCODE IMAPITable_GetLastError_Scodes[]; +extern SCODE IMAPITable_Advise_Scodes[]; +extern SCODE IMAPITable_Unadvise_Scodes[]; +extern SCODE IMAPITable_GetStatus_Scodes[]; +extern SCODE IMAPITable_SetColumns_Scodes[]; +extern SCODE IMAPITable_QueryColumns_Scodes[]; +extern SCODE IMAPITable_GetRowCount_Scodes[]; +extern SCODE IMAPITable_SeekRow_Scodes[]; +extern SCODE IMAPITable_SeekRowApprox_Scodes[]; +extern SCODE IMAPITable_QueryPosition_Scodes[]; +extern SCODE IMAPITable_FindRow_Scodes[]; +extern SCODE IMAPITable_Restrict_Scodes[]; +extern SCODE IMAPITable_CreateBookmark_Scodes[]; +extern SCODE IMAPITable_FreeBookmark_Scodes[]; +extern SCODE IMAPITable_SortTable_Scodes[]; +extern SCODE IMAPITable_QuerySortOrder_Scodes[]; +extern SCODE IMAPITable_QueryRows_Scodes[]; +extern SCODE IMAPITable_Abort_Scodes[]; +extern SCODE IMAPITable_ExpandRow_Scodes[]; +extern SCODE IMAPITable_CollapseRow_Scodes[]; +extern SCODE IMAPITable_WaitForCompletion_Scodes[]; +extern SCODE IMAPITable_GetCollapseState_Scodes[]; +extern SCODE IMAPITable_SetCollapseState_Scodes[]; + +extern SCODE IMAPISession_LogOff_Scodes[]; +extern SCODE IMAPISession_Release_Scodes[]; +extern SCODE IMAPISession_GetLastError_Scodes[]; +extern SCODE IMAPISession_GetMsgStoresTable_Scodes[]; +extern SCODE IMAPISession_GetStatusTable_Scodes[]; +extern SCODE IMAPISession_OpenMsgStore_Scodes[]; +extern SCODE IMAPISession_OpenAddressBook_Scodes[]; +extern SCODE IMAPISession_OpenEntry_Scodes[]; +extern SCODE IMAPISession_OpenProfileSection_Scodes[]; +extern SCODE IMAPISession_Advise_Scodes[]; +extern SCODE IMAPISession_Unadvise_Scodes[]; +extern SCODE IMAPISession_CompareEntryIDs_Scodes[]; +extern SCODE IMAPISession_MessageOptions_Scodes[]; +extern SCODE IMAPISession_QueryDefaultMessageOpt_Scodes[]; +extern SCODE IMAPISession_EnumAdrTypes_Scodes[]; +extern SCODE IMAPISession_QueryIdentity_Scodes[]; +extern SCODE IMAPISession_OpenProfileSection_Scodes[]; +extern SCODE IMAPISession_GetStatusTable_Scodes[]; + +extern SCODE IMsgStore_Advise_Scodes[] ; +extern SCODE IMsgStore_Unadvise_Scodes[] ; +extern SCODE IMsgStore_CompareEntryIDs_Scodes[] ; +extern SCODE IMsgStore_OpenEntry_Scodes[] ; +extern SCODE IMsgStore_SetReceiveFolder_Scodes[]; +extern SCODE IMsgStore_GetReceiveFolder_Scodes[]; +extern SCODE IMsgStore_GetReceiveFolderTable_Scodes[]; +extern SCODE IMsgStore_StoreLogoff_Scodes[]; +extern SCODE IMsgStore_AbortSubmit_Scodes[]; +extern SCODE IMsgStore_GetOutgoingQueue_Scodes[] ; +extern SCODE IMsgStore_SetLockState_Scodes[] ; +extern SCODE IMsgStore_FinishedMsg_Scodes[] ; +extern SCODE IMsgStore_NotifyNewMail_Scodes[]; + +extern SCODE IMAPIFolder_GetContentsTable_Scodes[]; +extern SCODE IMAPIFolder_GetHierarchyTable_Scodes[]; +extern SCODE IMAPIFolder_SaveContentsSort_Scodes[]; +extern SCODE IMAPIFolder_OpenEntry_Scodes[]; +extern SCODE IMAPIFolder_CreateMessage_Scodes[]; +extern SCODE IMAPIFolder_CopyMessages_Scodes[]; +extern SCODE IMAPIFolder_DeleteMessages_Scodes[]; +extern SCODE IMAPIFolder_CreateFolder_Scodes[]; +extern SCODE IMAPIFolder_CopyFolder_Scodes[]; +extern SCODE IMAPIFolder_DeleteFolder_Scodes[]; +extern SCODE IMAPIFolder_SetSearchCriteria_Scodes[]; +extern SCODE IMAPIFolder_GetSearchCriteria_Scodes[]; +extern SCODE IMAPIFolder_SetReadFlags_Scodes[]; +extern SCODE IMAPIFolder_GetMessageStatus_Scodes[]; +extern SCODE IMAPIFolder_SetMessageStatus_Scodes[]; +extern SCODE IMAPIFolder_EmptyFolder_Scodes[]; + +extern SCODE IMessage_SaveChanges_Scodes[]; +extern SCODE IMessage_GetAttachmentTable_Scodes[]; +extern SCODE IMessage_OpenAttach_Scodes[]; +extern SCODE IMessage_CreateAttach_Scodes[]; +extern SCODE IMessage_DeleteAttach_Scodes[]; +extern SCODE IMessage_GetRecipientTable_Scodes[]; +extern SCODE IMessage_ModifyRecipients_Scodes[]; +extern SCODE IMessage_SubmitMessage_Scodes[]; +extern SCODE IMessage_SetReadFlag_Scodes[]; + +extern SCODE IAttach_SaveChanges_Scodes[]; + +extern SCODE IAddrBook_OpenEntry_Scodes[]; +extern SCODE IAddrBook_CompareEntryIDs_Scodes[]; +extern SCODE IAddrBook_CreateOneOff_Scodes[]; +extern SCODE IAddrBook_ResolveName_Scodes[]; +extern SCODE IAddrBook_Address_Scodes[]; +extern SCODE IAddrBook_Details_Scodes[]; +extern SCODE IAddrBook_RecipOptions_Scodes[]; +extern SCODE IAddrBook_QueryDefaultRecipOpt_Scodes[]; +extern SCODE IAddrBook_Address_Scodes[]; +extern SCODE IAddrBook_ButtonPress_Scodes[]; + +extern SCODE IABContainer_GetContentsTable_Scodes[]; +extern SCODE IABContainer_GetHierarchyTable_Scodes[]; + +extern SCODE INotifObj_ChangeEvMask_Scodes[]; + +extern SCODE IMAPIStatus_ChangePassword_Scodes[]; +extern SCODE IMAPIStatus_FlushQueues_Scodes[]; +extern SCODE IMAPIStatus_SettingsDialog_Scodes[]; +extern SCODE IMAPIStatus_ValidateState_Scodes[]; + +extern SCODE IMSProvider_Logon_Scodes[]; +extern SCODE IMSProvider_Deinit_Scodes[]; +extern SCODE IMSProvider_Init_Scodes[]; +extern SCODE IMSProvider_SpoolerLogon_Scodes[]; +extern SCODE IMSProvider_Shutdown_Scodes[]; + +extern SCODE SMAPI_MAPILogon_Scodes[]; +extern SCODE SMAPI_MAPILogoff_Scodes[]; +extern SCODE SMAPI_MAPIFreeBuffer_Scodes[]; +extern SCODE SMAPI_MAPISendMail_Scodes[]; +extern SCODE SMAPI_MAPISendDocuments_Scodes[]; +extern SCODE SMAPI_MAPIFindNext_Scodes[]; +extern SCODE SMAPI_MAPIReadMail_Scodes[]; +extern SCODE SMAPI_MAPISaveMail_Scodes[]; +extern SCODE SMAPI_MAPIDeleteMail_Scodes[]; +extern SCODE SMAPI_MAPIAddress_Scodes[]; +extern SCODE SMAPI_MAPIResolveName_Scodes[]; +extern SCODE SMAPI_MAPIDetails_Scodes[]; + +extern SCODE IMSLogon_OpenEntry_Scodes[]; +extern SCODE IMSLogon_OpenStatusEntry_Scodes[]; +extern SCODE IMSLogon_CompareEntryIDs_Scodes[]; +extern SCODE IMSLogon_Advise_Scodes[]; +extern SCODE IMSLogon_Unadvise_Scodes[]; +extern SCODE IMSLogon_Logoff_Scodes[]; +#endif + +/* ------------------------------------------------------------------------ */ + +#endif + diff --git a/comm/mailnews/mapi/include/mapidefs.h b/comm/mailnews/mapi/include/mapidefs.h new file mode 100644 index 0000000000..83597279e3 --- /dev/null +++ b/comm/mailnews/mapi/include/mapidefs.h @@ -0,0 +1,2736 @@ +/* + * M A P I D E F S . H + * + * Definitions used by MAPI clients and service providers. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPIDEFS_H +#define MAPIDEFS_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN64) && !defined (_WIN64) +#define _WIN64 +#endif + +/* + * Under Win64 systems Win32 is also defined for backwards compatibility. + */ + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +#if defined (_WIN64) || defined(_WIN32) /* Must include WINDOWS.H on Win32/Win64 */ +#ifndef _WINDOWS_ +#define INC_OLE2 /* Get the OLE2 stuff */ +#define INC_RPC /* harmless on Windows NT; Windows 95 needs it */ +#define _INC_OLE /* Windows 95 will include OLE1 without this */ +#include <windows.h> +#endif + +#ifndef _OLEERROR_H_ +#include <winerror.h> +#endif +#ifndef _OBJBASE_H_ +#include <objbase.h> +#endif +#endif + +#if defined (DOS) +#ifndef _COMPOBJ_H_ +#include <compobj.h> +#endif +#endif + +#ifndef _INC_STDDEF +#include <stddef.h> +#endif + +/* Array dimension for structures with variable-sized arrays at the end. */ + +#ifndef MAPI_DIM +#define MAPI_DIM 1 +#endif + +/* Provider init type. Force to cdecl always */ + +#ifndef STDMAPIINITCALLTYPE +#if !defined (_MAC) && (defined (_WIN64) || defined(_WIN32)) +#define STDMAPIINITCALLTYPE __cdecl +#else +#define STDMAPIINITCALLTYPE STDMETHODCALLTYPE +#endif +#define STDINITMETHODIMP HRESULT STDMAPIINITCALLTYPE +#define STDINITMETHODIMP_(type) type STDMAPIINITCALLTYPE +#endif + + +#define MAPI_NT_SERVICE ((ULONG) 0x00010000) /* Provider is being loaded in an NT service */ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Simple data types */ + +#if !defined (MIDL_PASS) /* MIDL doesn't want to see these */ + +#ifndef _MAC +typedef wchar_t WCHAR; // wc, 16-bit UNICODE character +#else +// some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char +typedef unsigned short WCHAR; // wc, 16-bit UNICODE character +#endif + +#ifdef UNICODE +typedef WCHAR TCHAR; +#else +typedef char TCHAR; +#endif + + +#if _SAL_VERSION >= 20 +typedef _Null_terminated_ WCHAR FAR * LPWSTR; +typedef _Null_terminated_ const WCHAR FAR * LPCWSTR; +#else +typedef WCHAR FAR * LPWSTR; +typedef const WCHAR FAR * LPCWSTR; +#endif +typedef TCHAR FAR * LPTSTR; +typedef const TCHAR FAR * LPCTSTR; +typedef BYTE FAR * LPBYTE; +#endif /* defined MIDL_PASS */ + +typedef ULONG FAR * LPULONG; + +#ifndef __LHANDLE +#define __LHANDLE +typedef ULONG_PTR LHANDLE, FAR * LPLHANDLE; +#endif + +#if !defined(_WINBASE_) && !defined(_FILETIME_) +#define _FILETIME_ +typedef struct _FILETIME +{ + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME, FAR * LPFILETIME; +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +/* + * This flag is used in many different MAPI calls to signify that + * the object opened by the call should be modifiable (MAPI_MODIFY). + * If the flag MAPI_MAX_ACCESS is set, the object returned should be + * returned at the maximum access level allowed. An additional + * property available on the object (PR_ACCESS_LEVEL) uses the same + * MAPI_MODIFY flag to say just what this new access level is. + */ + +#define MAPI_MODIFY ((ULONG) 0x00000001) + +/* + * The following flags are used to indicate to the client what access + * level is permissible in the object. They appear in PR_ACCESS in + * message and folder objects as well as in contents and associated + * contents tables + */ + +#define MAPI_ACCESS_MODIFY ((ULONG) 0x00000001) +#define MAPI_ACCESS_READ ((ULONG) 0x00000002) +#define MAPI_ACCESS_DELETE ((ULONG) 0x00000004) +#define MAPI_ACCESS_CREATE_HIERARCHY ((ULONG) 0x00000008) +#define MAPI_ACCESS_CREATE_CONTENTS ((ULONG) 0x00000010) +#define MAPI_ACCESS_CREATE_ASSOCIATED ((ULONG) 0x00000020) + +/* + * The MAPI_UNICODE flag is used in many different MAPI calls to signify + * that strings passed through the interface are in Unicode (a 16-bit + * character set). The default is an 8-bit character set. + * + * The value fMapiUnicode can be used as the 'normal' value for + * that bit, given the application's default character set. + */ + +#define MAPI_UNICODE ((ULONG) 0x80000000) + +#ifdef UNICODE +#define fMapiUnicode MAPI_UNICODE +#else +#define fMapiUnicode 0 +#endif + +/* successful HRESULT */ +#define hrSuccess 0 + + + +/* Recipient types */ +#ifndef MAPI_ORIG /* also defined in mapi.h */ +#define MAPI_ORIG 0 /* Recipient is message originator */ +#define MAPI_TO 1 /* Recipient is a primary recipient */ +#define MAPI_CC 2 /* Recipient is a copy recipient */ +#define MAPI_BCC 3 /* Recipient is blind copy recipient */ +#define MAPI_P1 0x10000000 /* Recipient is a P1 resend recipient */ +#define MAPI_SUBMITTED 0x80000000 /* Recipient is already processed */ +/* #define MAPI_AUTHORIZE 4 recipient is a CMC authorizing user */ +/*#define MAPI_DISCRETE 0x10000000 Recipient is a P1 resend recipient */ +#endif + +/* Bit definitions for abFlags[0] of ENTRYID */ +#define MAPI_SHORTTERM 0x80 +#define MAPI_NOTRECIP 0x40 +#define MAPI_THISSESSION 0x20 +#define MAPI_NOW 0x10 +#define MAPI_NOTRESERVED 0x08 + +/* Bit definitions for abFlags[1] of ENTRYID */ +#define MAPI_COMPOUND 0x80 + +/* ENTRYID */ +typedef struct +{ + BYTE abFlags[4]; + BYTE ab[MAPI_DIM]; +} ENTRYID, FAR *LPENTRYID; + +#define CbNewENTRYID(_cb) (offsetof(ENTRYID,ab) + (_cb)) +#define CbENTRYID(_cb) (offsetof(ENTRYID,ab) + (_cb)) +#define SizedENTRYID(_cb, _name) \ + struct _ENTRYID_ ## _name \ +{ \ + BYTE abFlags[4]; \ + BYTE ab[_cb]; \ +} _name + +/* Byte-order-independent version of GUID (world-unique identifier) */ +typedef struct _MAPIUID +{ + BYTE ab[16]; +} MAPIUID, FAR * LPMAPIUID; + +/* Note: need to include C run-times (memory.h) to use this macro */ + +#define IsEqualMAPIUID(lpuid1, lpuid2) (!memcmp(lpuid1, lpuid2, sizeof(MAPIUID))) + +/* + * Constants for one-off entry ID: + * The MAPIUID that identifies the one-off provider; + * the flag that defines whether the embedded strings are Unicode; + * the flag that specifies whether the recipient gets TNEF or not. + */ + +#define MAPI_ONE_OFF_UID { 0x81, 0x2b, 0x1f, 0xa4, 0xbe, 0xa3, 0x10, 0x19, \ + 0x9d, 0x6e, 0x00, 0xdd, 0x01, 0x0f, 0x54, 0x02 } +#define MAPI_ONE_OFF_UNICODE 0x8000 +#define MAPI_ONE_OFF_NO_RICH_INFO 0x0001 + +/* Object type */ + +#define MAPI_STORE ((ULONG) 0x00000001) /* Message Store */ +#define MAPI_ADDRBOOK ((ULONG) 0x00000002) /* Address Book */ +#define MAPI_FOLDER ((ULONG) 0x00000003) /* Folder */ +#define MAPI_ABCONT ((ULONG) 0x00000004) /* Address Book Container */ +#define MAPI_MESSAGE ((ULONG) 0x00000005) /* Message */ +#define MAPI_MAILUSER ((ULONG) 0x00000006) /* Individual Recipient */ +#define MAPI_ATTACH ((ULONG) 0x00000007) /* Attachment */ +#define MAPI_DISTLIST ((ULONG) 0x00000008) /* Distribution List Recipient */ +#define MAPI_PROFSECT ((ULONG) 0x00000009) /* Profile Section */ +#define MAPI_STATUS ((ULONG) 0x0000000A) /* Status Object */ +#define MAPI_SESSION ((ULONG) 0x0000000B) /* Session */ +#define MAPI_FORMINFO ((ULONG) 0x0000000C) /* Form Information */ + + +/* + * Maximum length of profile names and passwords, not including + * the null termination character. + */ +#ifndef cchProfileNameMax +#define cchProfileNameMax 64 +#define cchProfilePassMax 64 +#endif + + +/* Property Types */ + +#define MV_FLAG 0x1000 /* Multi-value flag */ + +#define PT_UNSPECIFIED ((ULONG) 0) /* (Reserved for interface use) type doesn't matter to caller */ +#define PT_NULL ((ULONG) 1) /* NULL property value */ +#define PT_I2 ((ULONG) 2) /* Signed 16-bit value */ +#define PT_LONG ((ULONG) 3) /* Signed 32-bit value */ +#define PT_R4 ((ULONG) 4) /* 4-byte floating point */ +#define PT_DOUBLE ((ULONG) 5) /* Floating point double */ +#define PT_CURRENCY ((ULONG) 6) /* Signed 64-bit int (decimal w/ 4 digits right of decimal pt) */ +#define PT_APPTIME ((ULONG) 7) /* Application time */ +#define PT_ERROR ((ULONG) 10) /* 32-bit error value */ +#define PT_BOOLEAN ((ULONG) 11) /* 16-bit boolean (non-zero true) */ +#define PT_OBJECT ((ULONG) 13) /* Embedded object in a property */ +#define PT_I8 ((ULONG) 20) /* 8-byte signed integer */ +#define PT_STRING8 ((ULONG) 30) /* Null terminated 8-bit character string */ +#define PT_UNICODE ((ULONG) 31) /* Null terminated Unicode string */ +#define PT_SYSTIME ((ULONG) 64) /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */ +#define PT_CLSID ((ULONG) 72) /* OLE GUID */ +#define PT_BINARY ((ULONG) 258) /* Uninterpreted (counted byte array) */ +#define PT_PTR ((ULONG) 259) /* Pointer Variable, scales to the platform */ +/* Changes are likely to these numbers, and to their structures. */ + +/* Alternate property type names for ease of use */ +#define PT_SHORT PT_I2 +#define PT_I4 PT_LONG +#define PT_FLOAT PT_R4 +#define PT_R8 PT_DOUBLE +#define PT_LONGLONG PT_I8 + +/* + * The type of a MAPI-defined string property is indirected, so + * that it defaults to Unicode string on a Unicode platform and to + * String8 on an ANSI or DBCS platform. + * + * Macros are defined here both for the property type, and for the + * field of the property value structure which should be + * dereferenced to obtain the string pointer. + */ + +#ifdef UNICODE +#define PT_TSTRING PT_UNICODE +#define PT_MV_TSTRING (MV_FLAG|PT_UNICODE) +#define LPSZ lpszW +#define LPPSZ lppszW +#define MVSZ MVszW +#else +#define PT_TSTRING PT_STRING8 +#define PT_MV_TSTRING (MV_FLAG|PT_STRING8) +#define LPSZ lpszA +#define LPPSZ lppszA +#define MVSZ MVszA +#endif + + +/* Property Tags + * + * By convention, MAPI never uses 0 or FFFF as a property ID. + * Use as null values, initializers, sentinels, or what have you. + */ + +#define PROP_TYPE_MASK ((ULONG)0x0000FFFF) /* Mask for Property type */ +#define PROP_TYPE(ulPropTag) (((ULONG)(ulPropTag))&PROP_TYPE_MASK) +#define PROP_ID(ulPropTag) (((ULONG)(ulPropTag))>>16) +#define PROP_TAG(ulPropType,ulPropID) ((((ULONG)(ulPropID))<<16)|((ULONG)(ulPropType))) +#define PROP_ID_NULL 0 +#define PROP_ID_INVALID 0xFFFF +#define PR_NULL PROP_TAG( PT_NULL, PROP_ID_NULL) +#define CHANGE_PROP_TYPE(ulPropTag, ulPropType) \ + (((ULONG)0xFFFF0000 & (ulPropTag)) | (ulPropType)) + + +/* Multi-valued Property Types */ + +#define PT_MV_I2 (MV_FLAG|PT_I2) +#define PT_MV_LONG (MV_FLAG|PT_LONG) +#define PT_MV_R4 (MV_FLAG|PT_R4) +#define PT_MV_DOUBLE (MV_FLAG|PT_DOUBLE) +#define PT_MV_CURRENCY (MV_FLAG|PT_CURRENCY) +#define PT_MV_APPTIME (MV_FLAG|PT_APPTIME) +#define PT_MV_SYSTIME (MV_FLAG|PT_SYSTIME) +#define PT_MV_STRING8 (MV_FLAG|PT_STRING8) +#define PT_MV_BINARY (MV_FLAG|PT_BINARY) +#define PT_MV_UNICODE (MV_FLAG|PT_UNICODE) +#define PT_MV_CLSID (MV_FLAG|PT_CLSID) +#define PT_MV_I8 (MV_FLAG|PT_I8) + +/* Alternate property type names for ease of use */ +#define PT_MV_SHORT PT_MV_I2 +#define PT_MV_I4 PT_MV_LONG +#define PT_MV_FLOAT PT_MV_R4 +#define PT_MV_R8 PT_MV_DOUBLE +#define PT_MV_LONGLONG PT_MV_I8 + +/* + * Property type reserved bits + * + * MV_INSTANCE is used as a flag in table operations to request + * that a multi-valued property be presented as a single-valued + * property appearing in multiple rows. + */ + +#define MV_INSTANCE 0x2000 +#define MVI_FLAG (MV_FLAG | MV_INSTANCE) +#define MVI_PROP(tag) ((tag) | MVI_FLAG) + +/* --------------- */ +/* Data Structures */ +/* --------------- */ + +/* Property Tag Array */ + +typedef struct _SPropTagArray +{ + ULONG cValues; + ULONG aulPropTag[MAPI_DIM]; +} SPropTagArray, FAR * LPSPropTagArray; + +#define CbNewSPropTagArray(_ctag) \ + (offsetof(SPropTagArray,aulPropTag) + (_ctag)*sizeof(ULONG)) +#define CbSPropTagArray(_lparray) \ + (offsetof(SPropTagArray,aulPropTag) + \ + (UINT)((_lparray)->cValues)*sizeof(ULONG)) +/* SPropTagArray */ +#define SizedSPropTagArray(_ctag, _name) \ +struct _SPropTagArray_ ## _name \ +{ \ + ULONG cValues; \ + ULONG aulPropTag[_ctag]; \ +} _name + +/* -------------- */ +/* Property Value */ +/* -------------- */ + +typedef struct _SPropValue SPropValue; + + +/* 32-bit CURRENCY definition stolen from oaidl.h */ +/* 16-bit CURRENCY definition stolen from variant.h */ + +#ifndef _tagCY_DEFINED +#define _tagCY_DEFINED +#define _CY_DEFINED +#if defined (DOS) && !defined (_VARIANT_H_) +typedef struct FARSTRUCT tagCY { +#ifdef _MAC + long Hi; + long Lo; +#else + unsigned long Lo; + long Hi; +#endif +} CY; +#elif defined (_WIN64) || defined(_WIN32) +/* real definition that makes the C++ compiler happy */ +typedef union tagCY { + struct { +#ifdef _MAC + long Hi; + long Lo; +#else + unsigned long Lo; + long Hi; +#endif + }; + LONGLONG int64; +} CY; +#endif +#endif + /* size is 8 */ +typedef CY CURRENCY; + +typedef struct _SBinary +{ + ULONG cb; + LPBYTE lpb; +} SBinary, FAR *LPSBinary; + +typedef struct _SShortArray +{ + ULONG cValues; + short int FAR *lpi; +} SShortArray; + +typedef struct _SGuidArray +{ + ULONG cValues; + GUID FAR *lpguid; +} SGuidArray; + +typedef struct _SRealArray +{ + ULONG cValues; + float FAR *lpflt; +} SRealArray; + +typedef struct _SLongArray +{ + ULONG cValues; + LONG FAR *lpl; +} SLongArray; + +typedef struct _SLargeIntegerArray +{ + ULONG cValues; + LARGE_INTEGER FAR *lpli; +} SLargeIntegerArray; + +typedef struct _SDateTimeArray +{ + ULONG cValues; + FILETIME FAR *lpft; +} SDateTimeArray; + +typedef struct _SAppTimeArray +{ + ULONG cValues; + double FAR *lpat; +} SAppTimeArray; + +typedef struct _SCurrencyArray +{ + ULONG cValues; + CURRENCY FAR *lpcur; +} SCurrencyArray; + +typedef struct _SBinaryArray +{ + ULONG cValues; + SBinary FAR *lpbin; +} SBinaryArray; + +typedef struct _SDoubleArray +{ + ULONG cValues; + double FAR *lpdbl; +} SDoubleArray; + +typedef struct _SWStringArray +{ + ULONG cValues; + LPWSTR FAR *lppszW; +} SWStringArray; + +typedef struct _SLPSTRArray +{ + ULONG cValues; + LPSTR FAR *lppszA; +} SLPSTRArray; + +typedef union _PV +{ + short int i; /* case PT_I2 */ + LONG l; /* case PT_LONG */ + ULONG ul; /* alias for PT_LONG */ + LPVOID lpv; /* alias for PT_PTR */ + float flt; /* case PT_R4 */ + double dbl; /* case PT_DOUBLE */ + unsigned short int b; /* case PT_BOOLEAN */ + CURRENCY cur; /* case PT_CURRENCY */ + double at; /* case PT_APPTIME */ + FILETIME ft; /* case PT_SYSTIME */ + LPSTR lpszA; /* case PT_STRING8 */ + SBinary bin; /* case PT_BINARY */ + LPWSTR lpszW; /* case PT_UNICODE */ + LPGUID lpguid; /* case PT_CLSID */ + LARGE_INTEGER li; /* case PT_I8 */ + SShortArray MVi; /* case PT_MV_I2 */ + SLongArray MVl; /* case PT_MV_LONG */ + SRealArray MVflt; /* case PT_MV_R4 */ + SDoubleArray MVdbl; /* case PT_MV_DOUBLE */ + SCurrencyArray MVcur; /* case PT_MV_CURRENCY */ + SAppTimeArray MVat; /* case PT_MV_APPTIME */ + SDateTimeArray MVft; /* case PT_MV_SYSTIME */ + SBinaryArray MVbin; /* case PT_MV_BINARY */ + SLPSTRArray MVszA; /* case PT_MV_STRING8 */ + SWStringArray MVszW; /* case PT_MV_UNICODE */ + SGuidArray MVguid; /* case PT_MV_CLSID */ + SLargeIntegerArray MVli; /* case PT_MV_I8 */ + SCODE err; /* case PT_ERROR */ + LONG x; /* case PT_NULL, PT_OBJECT (no usable value) */ +} __UPV; + +typedef struct _SPropValue +{ + ULONG ulPropTag; + ULONG dwAlignPad; + union _PV Value; +} SPropValue, FAR * LPSPropValue; + + +/* --------------------------------------------- */ +/* Property Problem and Property Problem Arrays */ +/* --------------------------------------------- */ + +typedef struct _SPropProblem +{ + ULONG ulIndex; + ULONG ulPropTag; + SCODE scode; +} SPropProblem, FAR * LPSPropProblem; + +typedef struct _SPropProblemArray +{ + ULONG cProblem; + SPropProblem aProblem[MAPI_DIM]; +} SPropProblemArray, FAR * LPSPropProblemArray; + +#define CbNewSPropProblemArray(_cprob) \ + (offsetof(SPropProblemArray,aProblem) + (_cprob)*sizeof(SPropProblem)) +#define CbSPropProblemArray(_lparray) \ + (offsetof(SPropProblemArray,aProblem) + \ + (UINT) ((_lparray)->cProblem*sizeof(SPropProblem))) +#define SizedSPropProblemArray(_cprob, _name) \ +struct _SPropProblemArray_ ## _name \ +{ \ + ULONG cProblem; \ + SPropProblem aProblem[_cprob]; \ +} _name + +/* + * ENTRYLIST + */ + +typedef SBinaryArray ENTRYLIST, FAR *LPENTRYLIST; + +/* + * FLATENTRYLIST + * MTSID + * FLATMTSIDLIST + */ + +typedef struct { + ULONG cb; + BYTE abEntry[MAPI_DIM]; +} FLATENTRY, FAR *LPFLATENTRY; + +typedef struct { + ULONG cEntries; + ULONG cbEntries; + BYTE abEntries[MAPI_DIM]; +} FLATENTRYLIST, FAR *LPFLATENTRYLIST; + +typedef struct { + ULONG cb; + BYTE ab[MAPI_DIM]; +} MTSID, FAR *LPMTSID; + +typedef struct { + ULONG cMTSIDs; + ULONG cbMTSIDs; + BYTE abMTSIDs[MAPI_DIM]; +} FLATMTSIDLIST, FAR *LPFLATMTSIDLIST; + +#define CbNewFLATENTRY(_cb) (offsetof(FLATENTRY,abEntry) + (_cb)) +#define CbFLATENTRY(_lpentry) (offsetof(FLATENTRY,abEntry) + (_lpentry)->cb) +#define CbNewFLATENTRYLIST(_cb) (offsetof(FLATENTRYLIST,abEntries) + (_cb)) +#define CbFLATENTRYLIST(_lplist) (offsetof(FLATENTRYLIST,abEntries) + (_lplist)->cbEntries) +#define CbNewMTSID(_cb) (offsetof(MTSID,ab) + (_cb)) +#define CbMTSID(_lpentry) (offsetof(MTSID,ab) + (_lpentry)->cb) +#define CbNewFLATMTSIDLIST(_cb) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_cb)) +#define CbFLATMTSIDLIST(_lplist) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_lplist)->cbMTSIDs) +/* No SizedXXX macros for these types. */ + +/* ------------------------------ */ +/* ADRENTRY, ADRLIST */ + +typedef struct _ADRENTRY +{ + ULONG ulReserved1; /* Never used */ + ULONG cValues; + LPSPropValue rgPropVals; +} ADRENTRY, FAR * LPADRENTRY; + +typedef struct _ADRLIST +{ + ULONG cEntries; + ADRENTRY aEntries[MAPI_DIM]; +} ADRLIST, FAR * LPADRLIST; + +#define CbNewADRLIST(_centries) \ + (offsetof(ADRLIST,aEntries) + (_centries)*sizeof(ADRENTRY)) +#define CbADRLIST(_lpadrlist) \ + (offsetof(ADRLIST,aEntries) + (UINT)(_lpadrlist)->cEntries*sizeof(ADRENTRY)) +#define SizedADRLIST(_centries, _name) \ +struct _ADRLIST_ ## _name \ +{ \ + ULONG cEntries; \ + ADRENTRY aEntries[_centries]; \ +} _name + +/* ------------------------------ */ +/* SRow, SRowSet */ + +typedef struct _SRow +{ + ULONG ulAdrEntryPad; /* Pad so SRow's can map to ADRENTRY's */ + ULONG cValues; /* Count of property values */ + LPSPropValue lpProps; /* Property value array */ +} SRow, FAR * LPSRow; + +typedef struct _SRowSet +{ + ULONG cRows; /* Count of rows */ + SRow aRow[MAPI_DIM]; /* Array of rows */ +} SRowSet, FAR * LPSRowSet; + +#define CbNewSRowSet(_crow) (offsetof(SRowSet,aRow) + (_crow)*sizeof(SRow)) +#define CbSRowSet(_lprowset) (offsetof(SRowSet,aRow) + \ + (UINT)((_lprowset)->cRows*sizeof(SRow))) +#define SizedSRowSet(_crow, _name) \ +struct _SRowSet_ ## _name \ +{ \ + ULONG cRows; \ + SRow aRow[_crow]; \ +} _name + +/* MAPI Allocation Routines ------------------------------------------------ */ + +typedef SCODE (STDMETHODCALLTYPE ALLOCATEBUFFER)( + ULONG cbSize, + LPVOID FAR * lppBuffer +); + +typedef SCODE (STDMETHODCALLTYPE ALLOCATEMORE)( + ULONG cbSize, + LPVOID lpObject, + LPVOID FAR * lppBuffer +); + +typedef ULONG (STDAPICALLTYPE FREEBUFFER)( + LPVOID lpBuffer +); + +typedef ALLOCATEBUFFER FAR *LPALLOCATEBUFFER; +typedef ALLOCATEMORE FAR * LPALLOCATEMORE; +typedef FREEBUFFER FAR * LPFREEBUFFER; + +/* MAPI Component Object Model Macros -------------------------------------- */ + +#if defined(MAPI_IF) && (!defined(__cplusplus) || defined(CINTERFACE)) +#define DECLARE_MAPI_INTERFACE(iface) \ + typedef struct iface##Vtbl iface##Vtbl, FAR * iface; \ + struct iface##Vtbl +#define DECLARE_MAPI_INTERFACE_(iface, baseiface) \ + DECLARE_MAPI_INTERFACE(iface) +#define DECLARE_MAPI_INTERFACE_PTR(iface, piface) \ + typedef struct iface##Vtbl iface##Vtbl, FAR * iface, FAR * FAR * piface; +#else +#define DECLARE_MAPI_INTERFACE(iface) \ + DECLARE_INTERFACE(iface) +#define DECLARE_MAPI_INTERFACE_(iface, baseiface) \ + DECLARE_INTERFACE_(iface, baseiface) +#ifdef __cplusplus +#define DECLARE_MAPI_INTERFACE_PTR(iface, piface) \ + interface iface; typedef iface FAR * piface +#else +#define DECLARE_MAPI_INTERFACE_PTR(iface, piface) \ + typedef interface iface iface, FAR * piface +#endif +#endif + +#define MAPIMETHOD(method) MAPIMETHOD_(HRESULT, method) +#define MAPIMETHOD_(type, method) STDMETHOD_(type, method) +#define MAPIMETHOD_DECLARE(type, method, prefix) \ + STDMETHODIMP_(type) prefix##method +#define MAPIMETHOD_TYPEDEF(type, method, prefix) \ + typedef type (STDMETHODCALLTYPE prefix##method##_METHOD) + +#define MAPI_IUNKNOWN_METHODS(IPURE) \ + MAPIMETHOD(QueryInterface) \ + (THIS_ REFIID riid, LPVOID FAR * ppvObj) IPURE; \ + MAPIMETHOD_(ULONG,AddRef) (THIS) IPURE; \ + MAPIMETHOD_(ULONG,Release) (THIS) IPURE; \ + +#undef IMPL +#define IMPL + +/* Pointers to MAPI Interfaces --------------------------------------------- */ + +typedef const IID FAR * LPCIID; + +DECLARE_MAPI_INTERFACE_PTR(IMsgStore, LPMDB); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFolder, LPMAPIFOLDER); +DECLARE_MAPI_INTERFACE_PTR(IMessage, LPMESSAGE); +DECLARE_MAPI_INTERFACE_PTR(IAttach, LPATTACH); +DECLARE_MAPI_INTERFACE_PTR(IAddrBook, LPADRBOOK); +DECLARE_MAPI_INTERFACE_PTR(IABContainer, LPABCONT); +DECLARE_MAPI_INTERFACE_PTR(IMailUser, LPMAILUSER); +DECLARE_MAPI_INTERFACE_PTR(IDistList, LPDISTLIST); +DECLARE_MAPI_INTERFACE_PTR(IMAPIStatus, LPMAPISTATUS); +DECLARE_MAPI_INTERFACE_PTR(IMAPITable, LPMAPITABLE); +DECLARE_MAPI_INTERFACE_PTR(IProfSect, LPPROFSECT); +DECLARE_MAPI_INTERFACE_PTR(IMAPIProp, LPMAPIPROP); +DECLARE_MAPI_INTERFACE_PTR(IMAPIContainer, LPMAPICONTAINER); +DECLARE_MAPI_INTERFACE_PTR(IMAPIAdviseSink, LPMAPIADVISESINK); +DECLARE_MAPI_INTERFACE_PTR(IMAPIProgress, LPMAPIPROGRESS); +DECLARE_MAPI_INTERFACE_PTR(IProviderAdmin, LPPROVIDERADMIN); + +/* Extended MAPI Error Information ----------------------------------------- */ + +typedef struct _MAPIERROR +{ + ULONG ulVersion; + LPTSTR lpszError; + LPTSTR lpszComponent; + ULONG ulLowLevelError; + ULONG ulContext; + +} MAPIERROR, FAR * LPMAPIERROR; + + +/* IMAPIAdviseSink Interface ----------------------------------------------- */ + +/* + * Notification event types. The event types can be combined in a bitmask + * for filtering. Each one has a parameter structure associated with it: + * + * fnevCriticalError ERROR_NOTIFICATION + * fnevNewMail NEWMAIL_NOTIFICATION + * fnevObjectCreated OBJECT_NOTIFICATION + * fnevObjectDeleted OBJECT_NOTIFICATION + * fnevObjectModified OBJECT_NOTIFICATION + * fnevObjectCopied OBJECT_NOTIFICATION + * fnevSearchComplete OBJECT_NOTIFICATION + * fnevTableModified TABLE_NOTIFICATION + * fnevStatusObjectModified ? + * + * fnevExtended EXTENDED_NOTIFICATION + */ + +#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) + +/* TABLE_NOTIFICATION event types passed in ulTableEvent */ + +#define TABLE_CHANGED 1 +#define TABLE_ERROR 2 +#define TABLE_ROW_ADDED 3 +#define TABLE_ROW_DELETED 4 +#define TABLE_ROW_MODIFIED 5 +#define TABLE_SORT_DONE 6 +#define TABLE_RESTRICT_DONE 7 +#define TABLE_SETCOL_DONE 8 +#define TABLE_RELOAD 9 + +/* Event Structures */ + +typedef struct _ERROR_NOTIFICATION +{ + ULONG cbEntryID; + LPENTRYID lpEntryID; + SCODE scode; + ULONG ulFlags; /* 0 or MAPI_UNICODE */ + LPMAPIERROR lpMAPIError; /* Detailed error information */ +} ERROR_NOTIFICATION; + +typedef struct _NEWMAIL_NOTIFICATION +{ + ULONG cbEntryID; + LPENTRYID lpEntryID; /* identifies the new message */ + ULONG cbParentID; + LPENTRYID lpParentID; /* identifies the folder it lives in */ + ULONG ulFlags; /* 0 or MAPI_UNICODE */ + LPTSTR lpszMessageClass; /* message class (UNICODE or string8) */ + ULONG ulMessageFlags; /* copy of PR_MESSAGE_FLAGS */ +} NEWMAIL_NOTIFICATION; + +typedef struct _OBJECT_NOTIFICATION +{ + ULONG cbEntryID; + LPENTRYID lpEntryID; /* EntryID of object */ + ULONG ulObjType; /* Type of object */ + ULONG cbParentID; + LPENTRYID lpParentID; /* EntryID of parent object */ + ULONG cbOldID; + LPENTRYID lpOldID; /* EntryID of old object */ + ULONG cbOldParentID; + LPENTRYID lpOldParentID; /* EntryID of old parent */ + LPSPropTagArray lpPropTagArray; +} OBJECT_NOTIFICATION; + +typedef struct _TABLE_NOTIFICATION +{ + ULONG ulTableEvent; /* Identifies WHICH table event */ + HRESULT hResult; /* Value for TABLE_ERROR */ + SPropValue propIndex; /* This row's "index property" */ + SPropValue propPrior; /* Preceding row's "index property" */ + SRow row; /* New data of added/modified row */ + ULONG ulPad; /* Force to 8-byte boundary */ +} TABLE_NOTIFICATION; + +typedef struct _EXTENDED_NOTIFICATION +{ + ULONG ulEvent; /* extended event code */ + ULONG cb; /* size of event parameters */ + LPBYTE pbEventParameters; /* event parameters */ +} EXTENDED_NOTIFICATION; + +typedef struct +{ + ULONG cbEntryID; + LPENTRYID lpEntryID; + ULONG cValues; + LPSPropValue lpPropVals; +} STATUS_OBJECT_NOTIFICATION; + +typedef struct _NOTIFICATION +{ + ULONG ulEventType; /* notification type, i.e. fnevSomething */ + ULONG ulAlignPad; /* Force to 8-byte boundary */ + union + { + ERROR_NOTIFICATION err; + NEWMAIL_NOTIFICATION newmail; + OBJECT_NOTIFICATION obj; + TABLE_NOTIFICATION tab; + EXTENDED_NOTIFICATION ext; + STATUS_OBJECT_NOTIFICATION statobj; + } info; +} NOTIFICATION, FAR * LPNOTIFICATION; + + +/* Interface used for registering and issuing notification callbacks. */ + +#define MAPI_IMAPIADVISESINK_METHODS(IPURE) \ + MAPIMETHOD_(ULONG, OnNotify) \ + (THIS_ ULONG cNotif, \ + LPNOTIFICATION lpNotifications) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIAdviseSink +DECLARE_MAPI_INTERFACE_(IMAPIAdviseSink, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIADVISESINK_METHODS(PURE) +}; + +/* Callback function type for MAPIAllocAdviseSink */ + +typedef long (STDAPICALLTYPE NOTIFCALLBACK) ( + LPVOID lpvContext, + ULONG cNotification, + LPNOTIFICATION lpNotifications); +typedef NOTIFCALLBACK FAR * LPNOTIFCALLBACK; + +/* + * Message name for the 16-bit MAPI notififcation engine. + * This can be used in 16-bit applications to force processing + * of notification callbacks. + */ + +#define szMAPINotificationMsg "MAPI Notify window message" + + +/* IMAPIProgress Interface ------------------------------------------------- */ + +/* Flag values for the progress indicator */ + +#define MAPI_TOP_LEVEL ((ULONG) 0x00000001) + +#define MAPI_IMAPIPROGRESS_METHODS(IPURE) \ + MAPIMETHOD(Progress) \ + (THIS_ ULONG ulValue, \ + ULONG ulCount, \ + ULONG ulTotal) IPURE; \ + MAPIMETHOD(GetFlags) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(GetMax) \ + (THIS_ ULONG FAR * lpulMax) IPURE; \ + MAPIMETHOD(GetMin) \ + (THIS_ ULONG FAR * lpulMin) IPURE; \ + MAPIMETHOD(SetLimits) \ + (THIS_ LPULONG lpulMin, \ + LPULONG lpulMax, \ + LPULONG lpulFlags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIProgress +DECLARE_MAPI_INTERFACE_(IMAPIProgress, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROGRESS_METHODS(PURE) +}; + + +/* IMAPIProp Interface ----------------------------------------------------- */ + +/* GetLastError */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* + * Version: + */ +#define MAPI_ERROR_VERSION 0x00000000L + +/* GetPropList */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* GetProps */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* SaveChanges */ + +#define KEEP_OPEN_READONLY ((ULONG) 0x00000001) +#define KEEP_OPEN_READWRITE ((ULONG) 0x00000002) +#define FORCE_SAVE ((ULONG) 0x00000004) +/* define MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ + +/* OpenProperty - ulFlags */ +/****** MAPI_MODIFY ((ULONG) 0x00000001) above */ +#define MAPI_CREATE ((ULONG) 0x00000002) +#define STREAM_APPEND ((ULONG) 0x00000004) +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ + +/* OpenProperty - ulInterfaceOptions, IID_IMAPITable */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* CopyTo, CopyProps */ + +#define MAPI_MOVE ((ULONG) 0x00000001) +#define MAPI_NOREPLACE ((ULONG) 0x00000002) +#define MAPI_DECLINE_OK ((ULONG) 0x00000004) + +#ifndef MAPI_DIALOG /* also defined in mapi.h */ +#define MAPI_DIALOG ((ULONG) 0x00000008) +#endif + +#ifndef MAPI_USE_DEFAULT /* also defined in mapi.h */ +#define MAPI_USE_DEFAULT 0x00000040 /* Use default profile in logon */ +#endif + +/* Flags used in GetIDsFromNames */ +/****** MAPI_CREATE ((ULONG) 0x00000002) above */ + +/* Flags used in GetNamesFromIDs (bit fields) */ +#define MAPI_NO_STRINGS ((ULONG) 0x00000001) +#define MAPI_NO_IDS ((ULONG) 0x00000002) + +/* Union discriminator */ +#define MNID_ID 0 +#define MNID_STRING 1 +typedef struct _MAPINAMEID +{ + LPGUID lpguid; + ULONG ulKind; + union { + LONG_PTR lID_Reserved; + LONG lID; + LPWSTR lpwstrName; + } Kind; + +} MAPINAMEID, FAR * LPMAPINAMEID; + +#define MAPI_IMAPIPROP_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(SaveChanges) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetProps) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + ULONG ulFlags, \ + ULONG FAR * lpcValues, \ + LPSPropValue FAR * lppPropArray) IPURE; \ + MAPIMETHOD(GetPropList) \ + (THIS_ ULONG ulFlags, \ + LPSPropTagArray FAR * lppPropTagArray) IPURE; \ + MAPIMETHOD(OpenProperty) \ + (THIS_ ULONG ulPropTag, \ + LPCIID lpiid, \ + ULONG ulInterfaceOptions, \ + ULONG ulFlags, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(SetProps) \ + (THIS_ ULONG cValues, \ + LPSPropValue lpPropArray, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(DeleteProps) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(CopyTo) \ + (THIS_ ULONG ciidExclude, \ + LPCIID rgiidExclude, \ + LPSPropTagArray lpExcludeProps, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + LPCIID lpInterface, \ + LPVOID lpDestObj, \ + ULONG ulFlags, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(CopyProps) \ + (THIS_ LPSPropTagArray lpIncludeProps, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + LPCIID lpInterface, \ + LPVOID lpDestObj, \ + ULONG ulFlags, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(GetNamesFromIDs) \ + (THIS_ LPSPropTagArray FAR * lppPropTags, \ + LPGUID lpPropSetGuid, \ + ULONG ulFlags, \ + ULONG FAR * lpcPropNames, \ + LPMAPINAMEID FAR * FAR * lpppPropNames) IPURE; \ + MAPIMETHOD(GetIDsFromNames) \ + (THIS_ ULONG cPropNames, \ + LPMAPINAMEID FAR * lppPropNames, \ + ULONG ulFlags, \ + LPSPropTagArray FAR * lppPropTags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIProp +DECLARE_MAPI_INTERFACE_(IMAPIProp, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) +}; + +/* IMAPITable Interface ---------------------------------------------------- */ + +/* Table status */ + +#define TBLSTAT_COMPLETE ((ULONG) 0) +#define TBLSTAT_QCHANGED ((ULONG) 7) +#define TBLSTAT_SORTING ((ULONG) 9) +#define TBLSTAT_SORT_ERROR ((ULONG) 10) +#define TBLSTAT_SETTING_COLS ((ULONG) 11) +#define TBLSTAT_SETCOL_ERROR ((ULONG) 13) +#define TBLSTAT_RESTRICTING ((ULONG) 14) +#define TBLSTAT_RESTRICT_ERROR ((ULONG) 15) + + +/* Table Type */ + +#define TBLTYPE_SNAPSHOT ((ULONG) 0) +#define TBLTYPE_KEYSET ((ULONG) 1) +#define TBLTYPE_DYNAMIC ((ULONG) 2) + + +/* Sort order */ + +/* bit 0: set if descending, clear if ascending */ + +#define TABLE_SORT_ASCEND ((ULONG) 0x00000000) +#define TABLE_SORT_DESCEND ((ULONG) 0x00000001) +#define TABLE_SORT_COMBINE ((ULONG) 0x00000002) + + +/* Data structures */ + +typedef struct _SSortOrder +{ + ULONG ulPropTag; /* Column to sort on */ + ULONG ulOrder; /* Ascending, descending, combine to left */ +} SSortOrder, FAR * LPSSortOrder; + +typedef struct _SSortOrderSet +{ + ULONG cSorts; /* Number of sort columns in aSort below*/ + ULONG cCategories; /* 0 for non-categorized, up to cSorts */ + ULONG cExpanded; /* 0 if no categories start expanded, */ + /* up to cExpanded */ + SSortOrder aSort[MAPI_DIM]; /* The sort orders */ +} SSortOrderSet, FAR * LPSSortOrderSet; + +#define CbNewSSortOrderSet(_csort) \ + (offsetof(SSortOrderSet,aSort) + (_csort)*sizeof(SSortOrder)) +#define CbSSortOrderSet(_lpset) \ + (offsetof(SSortOrderSet,aSort) + \ + (UINT)((_lpset)->cSorts*sizeof(SSortOrder))) +#define SizedSSortOrderSet(_csort, _name) \ +struct _SSortOrderSet_ ## _name \ +{ \ + ULONG cSorts; \ + ULONG cCategories; \ + ULONG cExpanded; \ + SSortOrder aSort[_csort]; \ +} _name + +typedef ULONG_PTR BOOKMARK; + +#define BOOKMARK_BEGINNING ((BOOKMARK) 0) /* Before first row */ +#define BOOKMARK_CURRENT ((BOOKMARK) 1) /* Before current row */ +#define BOOKMARK_END ((BOOKMARK) 2) /* After last row */ + +/* Fuzzy Level */ + +#define FL_FULLSTRING ((ULONG) 0x00000000) +#define FL_SUBSTRING ((ULONG) 0x00000001) +#define FL_PREFIX ((ULONG) 0x00000002) + +#define FL_IGNORECASE ((ULONG) 0x00010000) +#define FL_IGNORENONSPACE ((ULONG) 0x00020000) +#define FL_LOOSE ((ULONG) 0x00040000) + +/* Restrictions */ + +typedef struct _SRestriction FAR * LPSRestriction; + +/* Restriction types */ + +#define RES_AND ((ULONG) 0x00000000) +#define RES_OR ((ULONG) 0x00000001) +#define RES_NOT ((ULONG) 0x00000002) +#define RES_CONTENT ((ULONG) 0x00000003) +#define RES_PROPERTY ((ULONG) 0x00000004) +#define RES_COMPAREPROPS ((ULONG) 0x00000005) +#define RES_BITMASK ((ULONG) 0x00000006) +#define RES_SIZE ((ULONG) 0x00000007) +#define RES_EXIST ((ULONG) 0x00000008) +#define RES_SUBRESTRICTION ((ULONG) 0x00000009) +#define RES_COMMENT ((ULONG) 0x0000000A) +#define RES_COUNT ((ULONG) 0x0000000B) // OFFICEDEV: Count restriction to CAP results +#define RES_ANNOTATION ((ULONG) 0x0000000C) // OFFICEDEV: Annotation restriction to pass information like LCID, etc. + +/* Relational operators. These apply to all property comparison restrictions. */ + +#define RELOP_LT ((ULONG) 0) /* < */ +#define RELOP_LE ((ULONG) 1) /* <= */ +#define RELOP_GT ((ULONG) 2) /* > */ +#define RELOP_GE ((ULONG) 3) /* >= */ +#define RELOP_EQ ((ULONG) 4) /* == */ +#define RELOP_NE ((ULONG) 5) /* != */ +#define RELOP_RE ((ULONG) 6) /* LIKE (Regular expression) */ + +/* Bitmask operators, for RES_BITMASK only. */ + +#define BMR_EQZ ((ULONG) 0) /* ==0 */ +#define BMR_NEZ ((ULONG) 1) /* !=0 */ + +/* Subobject identifiers for RES_SUBRESTRICTION only. See MAPITAGS.H. */ + +/* #define PR_MESSAGE_RECIPIENTS PROP_TAG(PT_OBJECT,0x0E12) */ +/* #define PR_MESSAGE_ATTACHMENTS PROP_TAG(PT_OBJECT,0x0E13) */ + +typedef struct _SAndRestriction +{ + ULONG cRes; + LPSRestriction lpRes; +} SAndRestriction; + +typedef struct _SOrRestriction +{ + ULONG cRes; + LPSRestriction lpRes; +} SOrRestriction; + +typedef struct _SNotRestriction +{ + ULONG ulReserved; + LPSRestriction lpRes; +} SNotRestriction; + +typedef struct _SContentRestriction +{ + ULONG ulFuzzyLevel; + ULONG ulPropTag; + LPSPropValue lpProp; +} SContentRestriction; + +typedef struct _SBitMaskRestriction +{ + ULONG relBMR; + ULONG ulPropTag; + ULONG ulMask; +} SBitMaskRestriction; + +typedef struct _SPropertyRestriction +{ + ULONG relop; + ULONG ulPropTag; + LPSPropValue lpProp; +} SPropertyRestriction; + +typedef struct _SComparePropsRestriction +{ + ULONG relop; + ULONG ulPropTag1; + ULONG ulPropTag2; +} SComparePropsRestriction; + +typedef struct _SSizeRestriction +{ + ULONG relop; + ULONG ulPropTag; + ULONG cb; +} SSizeRestriction; + +typedef struct _SExistRestriction +{ + ULONG ulReserved1; + ULONG ulPropTag; + ULONG ulReserved2; +} SExistRestriction; + +typedef struct _SSubRestriction +{ + ULONG ulSubObject; + LPSRestriction lpRes; +} SSubRestriction; + +typedef struct _SCommentRestriction +{ + ULONG cValues; /* # of properties in lpProp */ + LPSRestriction lpRes; + LPSPropValue lpProp; +} SCommentRestriction; + +// OFFICEDEV: The following two restrictions are new to Office 12 and are not +// backwards compatible with older clients. +typedef struct _SAnnotationRestriction +{ + ULONG cValues; /* # of properties in lpProp */ + LPSRestriction lpRes; + LPSPropValue lpProp; +} SAnnotationRestriction; + +typedef struct _SCountRestriction +{ + ULONG ulCount; + LPSRestriction lpRes; +} SCountRestriction; + +typedef struct _SRestriction +{ + ULONG rt; /* Restriction type */ + union + { + SComparePropsRestriction resCompareProps; /* first */ + SAndRestriction resAnd; + SOrRestriction resOr; + SNotRestriction resNot; + SContentRestriction resContent; + SPropertyRestriction resProperty; + SBitMaskRestriction resBitMask; + SSizeRestriction resSize; + SExistRestriction resExist; + SSubRestriction resSub; + SCommentRestriction resComment; + SAnnotationRestriction resAnnotation; // OFFICEDEV: not backwards compatible with Office 11 and older + SCountRestriction resCount; // OFFICEDEV: not backwards compatible with Office 11 and older + } res; +} SRestriction; + +/* SComparePropsRestriction is first in the union so that */ +/* static initializations of 3-value restriction work. */ + +/* Flags of the methods of IMAPITable */ + +/* QueryColumn */ + +#define TBL_ALL_COLUMNS ((ULONG) 0x00000001) + +/* QueryRows */ +/* Possible values for PR_ROW_TYPE (for categorization) */ + +#define TBL_LEAF_ROW ((ULONG) 1) +#define TBL_EMPTY_CATEGORY ((ULONG) 2) +#define TBL_EXPANDED_CATEGORY ((ULONG) 3) +#define TBL_COLLAPSED_CATEGORY ((ULONG) 4) + +/* Table wait flag */ + +#define TBL_NOWAIT ((ULONG) 0x00000001) +/* alternative name for TBL_NOWAIT */ +#define TBL_ASYNC ((ULONG) 0x00000001) +#define TBL_BATCH ((ULONG) 0x00000002) + +/* FindRow */ + +#define DIR_BACKWARD ((ULONG) 0x00000001) + +/* Table cursor states */ + +#define TBL_NOADVANCE ((ULONG) 0x00000001) + +#define MAPI_IMAPITABLE_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(GetStatus) \ + (THIS_ ULONG FAR * lpulTableStatus, \ + ULONG FAR * lpulTableType) IPURE; \ + MAPIMETHOD(SetColumns) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(QueryColumns) \ + (THIS_ ULONG ulFlags, \ + LPSPropTagArray FAR * lpPropTagArray) IPURE; \ + MAPIMETHOD(GetRowCount) \ + (THIS_ ULONG ulFlags, \ + ULONG FAR * lpulCount) IPURE; \ + MAPIMETHOD(SeekRow) \ + (THIS_ BOOKMARK bkOrigin, \ + LONG lRowCount, \ + LONG FAR * lplRowsSought) IPURE; \ + MAPIMETHOD(SeekRowApprox) \ + (THIS_ ULONG ulNumerator, \ + ULONG ulDenominator) IPURE; \ + MAPIMETHOD(QueryPosition) \ + (THIS_ ULONG FAR * lpulRow, \ + ULONG FAR * lpulNumerator, \ + ULONG FAR * lpulDenominator) IPURE; \ + MAPIMETHOD(FindRow) \ + (THIS_ LPSRestriction lpRestriction, \ + BOOKMARK bkOrigin, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(Restrict) \ + (THIS_ LPSRestriction lpRestriction, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(CreateBookmark) \ + (THIS_ BOOKMARK FAR * lpbkPosition) IPURE; \ + MAPIMETHOD(FreeBookmark) \ + (THIS_ BOOKMARK bkPosition) IPURE; \ + MAPIMETHOD(SortTable) \ + (THIS_ LPSSortOrderSet lpSortCriteria, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(QuerySortOrder) \ + (THIS_ LPSSortOrderSet FAR * lppSortCriteria) IPURE; \ + MAPIMETHOD(QueryRows) \ + (THIS_ LONG lRowCount, \ + ULONG ulFlags, \ + LPSRowSet FAR * lppRows) IPURE; \ + MAPIMETHOD(Abort) (THIS) IPURE; \ + MAPIMETHOD(ExpandRow) \ + (THIS_ ULONG cbInstanceKey, \ + LPBYTE pbInstanceKey, \ + ULONG ulRowCount, \ + ULONG ulFlags, \ + LPSRowSet FAR * lppRows, \ + ULONG FAR * lpulMoreRows) IPURE; \ + MAPIMETHOD(CollapseRow) \ + (THIS_ ULONG cbInstanceKey, \ + LPBYTE pbInstanceKey, \ + ULONG ulFlags, \ + ULONG FAR * lpulRowCount) IPURE; \ + MAPIMETHOD(WaitForCompletion) \ + (THIS_ ULONG ulFlags, \ + ULONG ulTimeout, \ + ULONG FAR * lpulTableStatus) IPURE; \ + MAPIMETHOD(GetCollapseState) \ + (THIS_ ULONG ulFlags, \ + ULONG cbInstanceKey, \ + LPBYTE lpbInstanceKey, \ + ULONG FAR * lpcbCollapseState, \ + LPBYTE FAR * lppbCollapseState) IPURE; \ + MAPIMETHOD(SetCollapseState) \ + (THIS_ ULONG ulFlags, \ + ULONG cbCollapseState, \ + LPBYTE pbCollapseState, \ + BOOKMARK FAR * lpbkLocation) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPITable +DECLARE_MAPI_INTERFACE_(IMAPITable, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPITABLE_METHODS(PURE) +}; + +/* IProfSect Interface ----------------------------------------------------- */ + +/* Standard section for public profile properties */ + +#define PS_PROFILE_PROPERTIES_INIT \ +{ 0x98, 0x15, 0xAC, 0x08, 0xAA, 0xB0, 0x10, 0x1A, \ + 0x8C, 0x93, 0x08, 0x00, 0x2B, 0x2A, 0x56, 0xC2 } + + +#define MAPI_IPROFSECT_METHODS(IPURE) + +#undef INTERFACE +#define INTERFACE IProfSect +DECLARE_MAPI_INTERFACE_(IProfSect, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IPROFSECT_METHODS(PURE) +}; + +/* IMAPIStatus Interface --------------------------------------------------- */ + +/* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */ + +#define MAPI_STORE_PROVIDER ((ULONG) 33) /* Message Store */ +#define MAPI_AB ((ULONG) 34) /* Address Book */ +#define MAPI_AB_PROVIDER ((ULONG) 35) /* Address Book Provider */ +#define MAPI_TRANSPORT_PROVIDER ((ULONG) 36) /* Transport Provider */ +#define MAPI_SPOOLER ((ULONG) 37) /* Message Spooler */ +#define MAPI_PROFILE_PROVIDER ((ULONG) 38) /* Profile Provider */ +#define MAPI_SUBSYSTEM ((ULONG) 39) /* Overall Subsystem Status */ +#define MAPI_HOOK_PROVIDER ((ULONG) 40) /* Spooler Hook */ + +#define STATUS_VALIDATE_STATE ((ULONG) 0x00000001) +#define STATUS_SETTINGS_DIALOG ((ULONG) 0x00000002) +#define STATUS_CHANGE_PASSWORD ((ULONG) 0x00000004) +#define STATUS_FLUSH_QUEUES ((ULONG) 0x00000008) + +#define STATUS_DEFAULT_OUTBOUND ((ULONG) 0x00000001) +#define STATUS_DEFAULT_STORE ((ULONG) 0x00000002) +#define STATUS_PRIMARY_IDENTITY ((ULONG) 0x00000004) +#define STATUS_SIMPLE_STORE ((ULONG) 0x00000008) +#define STATUS_XP_PREFER_LAST ((ULONG) 0x00000010) +#define STATUS_NO_PRIMARY_IDENTITY ((ULONG) 0x00000020) +#define STATUS_NO_DEFAULT_STORE ((ULONG) 0x00000040) +#define STATUS_TEMP_SECTION ((ULONG) 0x00000080) +#define STATUS_OWN_STORE ((ULONG) 0x00000100) +/****** HOOK_INBOUND ((ULONG) 0x00000200) Defined in MAPIHOOK.H */ +/****** HOOK_OUTBOUND ((ULONG) 0x00000400) Defined in MAPIHOOK.H */ +#define STATUS_NEED_IPM_TREE ((ULONG) 0x00000800) +#define STATUS_PRIMARY_STORE ((ULONG) 0x00001000) +#define STATUS_SECONDARY_STORE ((ULONG) 0x00002000) + + +/* + * PR_STATUS_CODE bit. Low 16 bits for common values; High 16 bits + * for provider type-specific values. (DCR 304) + */ + +#define STATUS_AVAILABLE ((ULONG) 0x00000001) +#define STATUS_OFFLINE ((ULONG) 0x00000002) +#define STATUS_FAILURE ((ULONG) 0x00000004) + +/* Transport values of PR_STATUS_CODE */ + +#define STATUS_INBOUND_ENABLED ((ULONG) 0x00010000) +#define STATUS_INBOUND_ACTIVE ((ULONG) 0x00020000) +#define STATUS_INBOUND_FLUSH ((ULONG) 0x00040000) +#define STATUS_OUTBOUND_ENABLED ((ULONG) 0x00100000) +#define STATUS_OUTBOUND_ACTIVE ((ULONG) 0x00200000) +#define STATUS_OUTBOUND_FLUSH ((ULONG) 0x00400000) +#define STATUS_REMOTE_ACCESS ((ULONG) 0x00800000) + +/* ValidateState flags */ + +#define SUPPRESS_UI ((ULONG) 0x00000001) +#define REFRESH_XP_HEADER_CACHE ((ULONG) 0x00010000) +#define PROCESS_XP_HEADER_CACHE ((ULONG) 0x00020000) +#define FORCE_XP_CONNECT ((ULONG) 0x00040000) +#define FORCE_XP_DISCONNECT ((ULONG) 0x00080000) +#define CONFIG_CHANGED ((ULONG) 0x00100000) +#define ABORT_XP_HEADER_OPERATION ((ULONG) 0x00200000) +#define SHOW_XP_SESSION_UI ((ULONG) 0x00400000) + +/* SettingsDialog flags */ + +#define UI_READONLY ((ULONG) 0x00000001) + +/* FlushQueues flags */ + +#define FLUSH_UPLOAD ((ULONG) 0x00000002) +#define FLUSH_DOWNLOAD ((ULONG) 0x00000004) +#define FLUSH_FORCE ((ULONG) 0x00000008) +#define FLUSH_NO_UI ((ULONG) 0x00000010) +#define FLUSH_ASYNC_OK ((ULONG) 0x00000020) + +#define MAPI_IMAPISTATUS_METHODS(IPURE) \ + MAPIMETHOD(ValidateState) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(SettingsDialog) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(ChangePassword) \ + (THIS_ LPTSTR lpOldPass, \ + LPTSTR lpNewPass, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(FlushQueues) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG cbTargetTransport, \ + LPENTRYID lpTargetTransport, \ + ULONG ulFlags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIStatus +DECLARE_MAPI_INTERFACE_(IMAPIStatus, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAPISTATUS_METHODS(PURE) +}; + +/* IMAPIContainer Interface ------------------------------------------------ */ + +/* Flags for OpenEntry() */ + +/****** MAPI_MODIFY ((ULONG) 0x00000001) above */ +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +#define MAPI_BEST_ACCESS ((ULONG) 0x00000010) + +/* GetContentsTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +/****** MAPI_ASSOCIATED ((ULONG) 0x00000040) below */ + +/* GetHierarchyTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ +#define CONVENIENT_DEPTH ((ULONG) 0x00000001) +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ + +/* GetSearchCriteria */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ +#define SEARCH_RUNNING ((ULONG) 0x00000001) +#define SEARCH_REBUILD ((ULONG) 0x00000002) +#define SEARCH_RECURSIVE ((ULONG) 0x00000004) +#define SEARCH_FOREGROUND ((ULONG) 0x00000008) + +/* SetSearchCriteria */ +#define STOP_SEARCH ((ULONG) 0x00000001) +#define RESTART_SEARCH ((ULONG) 0x00000002) +#define RECURSIVE_SEARCH ((ULONG) 0x00000004) +#define SHALLOW_SEARCH ((ULONG) 0x00000008) +#define FOREGROUND_SEARCH ((ULONG) 0x00000010) +#define BACKGROUND_SEARCH ((ULONG) 0x00000020) + +#define MAPI_IMAPICONTAINER_METHODS(IPURE) \ + MAPIMETHOD(GetContentsTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(GetHierarchyTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(SetSearchCriteria) \ + (THIS_ LPSRestriction lpRestriction, \ + LPENTRYLIST lpContainerList, \ + ULONG ulSearchFlags) IPURE; \ + MAPIMETHOD(GetSearchCriteria) \ + (THIS_ ULONG ulFlags, \ + LPSRestriction FAR * lppRestriction, \ + LPENTRYLIST FAR * lppContainerList, \ + ULONG FAR * lpulSearchState)IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIContainer +DECLARE_MAPI_INTERFACE_(IMAPIContainer, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAPICONTAINER_METHODS(PURE) +}; + +/* IABContainer Interface -------------------------------------------------- */ + +/* + * IABContainer PR_CONTAINER_FLAGS values + * If AB_UNMODIFIABLE and AB_MODIFIABLE are both set, it means the container + * doesn't know if it's modifiable or not, and the client should + * try to modify the contents but we won't expect it to work. + * If the AB_RECIPIENTS flag is set and neither AB_MODIFIABLE or AB_UNMODIFIABLE + * bits are set, it is an error. + */ + +typedef struct _flaglist +{ + ULONG cFlags; + ULONG ulFlag[MAPI_DIM]; +} FlagList, FAR * LPFlagList; + + +/* + * Container flags + */ +#define AB_RECIPIENTS ((ULONG) 0x00000001) +#define AB_SUBCONTAINERS ((ULONG) 0x00000002) +#define AB_MODIFIABLE ((ULONG) 0x00000004) +#define AB_UNMODIFIABLE ((ULONG) 0x00000008) +#define AB_FIND_ON_OPEN ((ULONG) 0x00000010) +#define AB_NOT_DEFAULT ((ULONG) 0x00000020) + +/* CreateEntry() */ + +#define CREATE_CHECK_DUP_STRICT ((ULONG) 0x00000001) +#define CREATE_CHECK_DUP_LOOSE ((ULONG) 0x00000002) +#define CREATE_REPLACE ((ULONG) 0x00000004) + +/* ResolveNames() - ulFlags */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* ResolveNames() - rgulFlags */ +#define MAPI_UNRESOLVED ((ULONG) 0x00000000) +#define MAPI_AMBIGUOUS ((ULONG) 0x00000001) +#define MAPI_RESOLVED ((ULONG) 0x00000002) + + +#define MAPI_IABCONTAINER_METHODS(IPURE) \ + MAPIMETHOD(CreateEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulCreateFlags, \ + LPMAPIPROP FAR * lppMAPIPropEntry) IPURE; \ + MAPIMETHOD(CopyEntries) \ + (THIS_ LPENTRYLIST lpEntries, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteEntries) \ + (THIS_ LPENTRYLIST lpEntries, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(ResolveNames) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + ULONG ulFlags, \ + LPADRLIST lpAdrList, \ + LPFlagList lpFlagList) IPURE; \ + +#undef INTERFACE +#define INTERFACE IABContainer +DECLARE_MAPI_INTERFACE_(IABContainer, IMAPIContainer) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAPICONTAINER_METHODS(PURE) + MAPI_IABCONTAINER_METHODS(PURE) +}; + +/* IMailUser Interface ----------------------------------------------------- */ + +/* Any call which can create a one-off entryID (i.e. MAPISupport::CreateOneOff + or IAdrBook::CreateOneOff) can encode the value for PR_SEND_RICH_INFO by + passing in the following flag in the ulFlags parameter. Setting this flag + indicates that PR_SEND_RICH_INFO will be FALSE. +*/ +#define MAPI_SEND_NO_RICH_INFO ((ULONG) 0x00010000) + + + + +/* Values of PR_NDR_DIAG_CODE */ + +#define MAPI_DIAG(_code) ((LONG) _code) + +#define MAPI_DIAG_NO_DIAGNOSTIC MAPI_DIAG( -1 ) +#define MAPI_DIAG_OR_NAME_UNRECOGNIZED MAPI_DIAG( 0 ) +#define MAPI_DIAG_OR_NAME_AMBIGUOUS MAPI_DIAG( 1 ) +#define MAPI_DIAG_MTS_CONGESTED MAPI_DIAG( 2 ) +#define MAPI_DIAG_LOOP_DETECTED MAPI_DIAG( 3 ) +#define MAPI_DIAG_RECIPIENT_UNAVAILABLE MAPI_DIAG( 4 ) +#define MAPI_DIAG_MAXIMUM_TIME_EXPIRED MAPI_DIAG( 5 ) +#define MAPI_DIAG_EITS_UNSUPPORTED MAPI_DIAG( 6 ) +#define MAPI_DIAG_CONTENT_TOO_LONG MAPI_DIAG( 7 ) +#define MAPI_DIAG_IMPRACTICAL_TO_CONVERT MAPI_DIAG( 8 ) +#define MAPI_DIAG_PROHIBITED_TO_CONVERT MAPI_DIAG( 9 ) +#define MAPI_DIAG_CONVERSION_UNSUBSCRIBED MAPI_DIAG( 10 ) +#define MAPI_DIAG_PARAMETERS_INVALID MAPI_DIAG( 11 ) +#define MAPI_DIAG_CONTENT_SYNTAX_IN_ERROR MAPI_DIAG( 12 ) +#define MAPI_DIAG_LENGTH_CONSTRAINT_VIOLATD MAPI_DIAG( 13 ) +#define MAPI_DIAG_NUMBER_CONSTRAINT_VIOLATD MAPI_DIAG( 14 ) +#define MAPI_DIAG_CONTENT_TYPE_UNSUPPORTED MAPI_DIAG( 15 ) +#define MAPI_DIAG_TOO_MANY_RECIPIENTS MAPI_DIAG( 16 ) +#define MAPI_DIAG_NO_BILATERAL_AGREEMENT MAPI_DIAG( 17 ) +#define MAPI_DIAG_CRITICAL_FUNC_UNSUPPORTED MAPI_DIAG( 18 ) +#define MAPI_DIAG_CONVERSION_LOSS_PROHIB MAPI_DIAG( 19 ) +#define MAPI_DIAG_LINE_TOO_LONG MAPI_DIAG( 20 ) +#define MAPI_DIAG_PAGE_TOO_LONG MAPI_DIAG( 21 ) +#define MAPI_DIAG_PICTORIAL_SYMBOL_LOST MAPI_DIAG( 22 ) +#define MAPI_DIAG_PUNCTUATION_SYMBOL_LOST MAPI_DIAG( 23 ) +#define MAPI_DIAG_ALPHABETIC_CHARACTER_LOST MAPI_DIAG( 24 ) +#define MAPI_DIAG_MULTIPLE_INFO_LOSSES MAPI_DIAG( 25 ) +#define MAPI_DIAG_REASSIGNMENT_PROHIBITED MAPI_DIAG( 26 ) +#define MAPI_DIAG_REDIRECTION_LOOP_DETECTED MAPI_DIAG( 27 ) +#define MAPI_DIAG_EXPANSION_PROHIBITED MAPI_DIAG( 28 ) +#define MAPI_DIAG_SUBMISSION_PROHIBITED MAPI_DIAG( 29 ) +#define MAPI_DIAG_EXPANSION_FAILED MAPI_DIAG( 30 ) +#define MAPI_DIAG_RENDITION_UNSUPPORTED MAPI_DIAG( 31 ) +#define MAPI_DIAG_MAIL_ADDRESS_INCORRECT MAPI_DIAG( 32 ) +#define MAPI_DIAG_MAIL_OFFICE_INCOR_OR_INVD MAPI_DIAG( 33 ) +#define MAPI_DIAG_MAIL_ADDRESS_INCOMPLETE MAPI_DIAG( 34 ) +#define MAPI_DIAG_MAIL_RECIPIENT_UNKNOWN MAPI_DIAG( 35 ) +#define MAPI_DIAG_MAIL_RECIPIENT_DECEASED MAPI_DIAG( 36 ) +#define MAPI_DIAG_MAIL_ORGANIZATION_EXPIRED MAPI_DIAG( 37 ) +#define MAPI_DIAG_MAIL_REFUSED MAPI_DIAG( 38 ) +#define MAPI_DIAG_MAIL_UNCLAIMED MAPI_DIAG( 39 ) +#define MAPI_DIAG_MAIL_RECIPIENT_MOVED MAPI_DIAG( 40 ) +#define MAPI_DIAG_MAIL_RECIPIENT_TRAVELLING MAPI_DIAG( 41 ) +#define MAPI_DIAG_MAIL_RECIPIENT_DEPARTED MAPI_DIAG( 42 ) +#define MAPI_DIAG_MAIL_NEW_ADDRESS_UNKNOWN MAPI_DIAG( 43 ) +#define MAPI_DIAG_MAIL_FORWARDING_UNWANTED MAPI_DIAG( 44 ) +#define MAPI_DIAG_MAIL_FORWARDING_PROHIB MAPI_DIAG( 45 ) +#define MAPI_DIAG_SECURE_MESSAGING_ERROR MAPI_DIAG( 46 ) +#define MAPI_DIAG_DOWNGRADING_IMPOSSIBLE MAPI_DIAG( 47 ) + +/* Values of PR_DELIVERY_POINT (MH_T_DELIVERY_POINT) */ + +#define MAPI_MH_DP_PUBLIC_UA ((ULONG) 0) +#define MAPI_MH_DP_PRIVATE_UA ((ULONG) 1) +#define MAPI_MH_DP_MS ((ULONG) 2) +#define MAPI_MH_DP_ML ((ULONG) 3) +#define MAPI_MH_DP_PDAU ((ULONG) 4) +#define MAPI_MH_DP_PDS_PATRON ((ULONG) 5) +#define MAPI_MH_DP_OTHER_AU ((ULONG) 6) + + +#define MAPI_IMAILUSER_METHODS(IPURE) + +#undef INTERFACE +#define INTERFACE IMailUser +DECLARE_MAPI_INTERFACE_(IMailUser, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAILUSER_METHODS(PURE) +}; + +/* IDistList Interface ----------------------------------------------------- */ + +#define MAPI_IDISTLIST_METHODS(IPURE) \ + MAPIMETHOD(CreateEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulCreateFlags, \ + LPMAPIPROP FAR * lppMAPIPropEntry) IPURE; \ + MAPIMETHOD(CopyEntries) \ + (THIS_ LPENTRYLIST lpEntries, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteEntries) \ + (THIS_ LPENTRYLIST lpEntries, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(ResolveNames) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + ULONG ulFlags, \ + LPADRLIST lpAdrList, \ + LPFlagList lpFlagList) IPURE; \ + +#undef INTERFACE +#define INTERFACE IDistList +DECLARE_MAPI_INTERFACE_(IDistList, IMAPIContainer) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAPICONTAINER_METHODS(PURE) + MAPI_IDISTLIST_METHODS(PURE) +}; + +/* IMAPIFolder Interface --------------------------------------------------- */ + +/* IMAPIFolder folder type (enum) */ + +#define FOLDER_ROOT ((ULONG) 0x00000000) +#define FOLDER_GENERIC ((ULONG) 0x00000001) +#define FOLDER_SEARCH ((ULONG) 0x00000002) + +/* CreateMessage */ +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +/****** MAPI_ASSOCIATED ((ULONG) 0x00000040) below */ + +/* CopyMessages */ + +#define MESSAGE_MOVE ((ULONG) 0x00000001) +#define MESSAGE_DIALOG ((ULONG) 0x00000002) +/****** MAPI_DECLINE_OK ((ULONG) 0x00000004) above */ + +/* CreateFolder */ + +#define OPEN_IF_EXISTS ((ULONG) 0x00000001) +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* DeleteFolder */ + +#define DEL_MESSAGES ((ULONG) 0x00000001) +#define FOLDER_DIALOG ((ULONG) 0x00000002) +#define DEL_FOLDERS ((ULONG) 0x00000004) + +/* EmptyFolder */ +#define DEL_ASSOCIATED ((ULONG) 0x00000008) + +/* CopyFolder */ + +#define FOLDER_MOVE ((ULONG) 0x00000001) +/****** FOLDER_DIALOG ((ULONG) 0x00000002) above */ +/****** MAPI_DECLINE_OK ((ULONG) 0x00000004) above */ +#define COPY_SUBFOLDERS ((ULONG) 0x00000010) +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + + +/* SetReadFlags */ + +/****** SUPPRESS_RECEIPT ((ULONG) 0x00000001) below */ +/****** FOLDER_DIALOG ((ULONG) 0x00000002) above */ +/****** CLEAR_READ_FLAG ((ULONG) 0x00000004) below */ +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +/****** GENERATE_RECEIPT_ONLY ((ULONG) 0x00000010) below */ +/****** CLEAR_RN_PENDING ((ULONG) 0x00000020) below */ +/****** CLEAR_NRN_PENDING ((ULONG) 0x00000040) below */ + + +/* GetMessageStatus */ + +#define MSGSTATUS_HIGHLIGHTED ((ULONG) 0x00000001) +#define MSGSTATUS_TAGGED ((ULONG) 0x00000002) +#define MSGSTATUS_HIDDEN ((ULONG) 0x00000004) +#define MSGSTATUS_DELMARKED ((ULONG) 0x00000008) + +/* Bits for remote message status */ + +#define MSGSTATUS_REMOTE_DOWNLOAD ((ULONG) 0x00001000) +#define MSGSTATUS_REMOTE_DELETE ((ULONG) 0x00002000) + +/* SaveContentsSort */ + +#define RECURSIVE_SORT ((ULONG) 0x00000002) + +/* PR_STATUS property */ + +#define FLDSTATUS_HIGHLIGHTED ((ULONG) 0x00000001) +#define FLDSTATUS_TAGGED ((ULONG) 0x00000002) +#define FLDSTATUS_HIDDEN ((ULONG) 0x00000004) +#define FLDSTATUS_DELMARKED ((ULONG) 0x00000008) + +#define MAPI_IMAPIFOLDER_METHODS(IPURE) \ + MAPIMETHOD(CreateMessage) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + LPMESSAGE FAR * lppMessage) IPURE; \ + MAPIMETHOD(CopyMessages) \ + (THIS_ LPENTRYLIST lpMsgList, \ + LPCIID lpInterface, \ + LPVOID lpDestFolder, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteMessages) \ + (THIS_ LPENTRYLIST lpMsgList, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(CreateFolder) \ + (THIS_ ULONG ulFolderType, \ + LPTSTR lpszFolderName, \ + LPTSTR lpszFolderComment, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPMAPIFOLDER FAR * lppFolder) IPURE; \ + MAPIMETHOD(CopyFolder) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + LPVOID lpDestFolder, \ + LPTSTR lpszNewFolderName, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteFolder) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(SetReadFlags) \ + (THIS_ LPENTRYLIST lpMsgList, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetMessageStatus) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulFlags, \ + ULONG FAR * lpulMessageStatus) IPURE; \ + MAPIMETHOD(SetMessageStatus) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulNewStatus, \ + ULONG ulNewStatusMask, \ + ULONG FAR * lpulOldStatus) IPURE; \ + MAPIMETHOD(SaveContentsSort) \ + (THIS_ LPSSortOrderSet lpSortCriteria, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(EmptyFolder) \ + (THIS_ ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFolder +DECLARE_MAPI_INTERFACE_(IMAPIFolder, IMAPIContainer) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMAPICONTAINER_METHODS(PURE) + MAPI_IMAPIFOLDER_METHODS(PURE) +}; + +/* IMsgStore Interface ----------------------------------------------------- */ + +/* PR_STORE_SUPPORT_MASK bits */ +#define STORE_ENTRYID_UNIQUE ((ULONG) 0x00000001) +#define STORE_READONLY ((ULONG) 0x00000002) +#define STORE_SEARCH_OK ((ULONG) 0x00000004) +#define STORE_MODIFY_OK ((ULONG) 0x00000008) +#define STORE_CREATE_OK ((ULONG) 0x00000010) +#define STORE_ATTACH_OK ((ULONG) 0x00000020) +#define STORE_OLE_OK ((ULONG) 0x00000040) +#define STORE_SUBMIT_OK ((ULONG) 0x00000080) +#define STORE_NOTIFY_OK ((ULONG) 0x00000100) +#define STORE_MV_PROPS_OK ((ULONG) 0x00000200) +#define STORE_CATEGORIZE_OK ((ULONG) 0x00000400) +#define STORE_RTF_OK ((ULONG) 0x00000800) +#define STORE_RESTRICTION_OK ((ULONG) 0x00001000) +#define STORE_SORT_OK ((ULONG) 0x00002000) +#define STORE_PUBLIC_FOLDERS ((ULONG) 0x00004000) +#define STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) + +/* PR_STORE_STATE bits, try not to collide with PR_STORE_SUPPORT_MASK */ + +#define STORE_HAS_SEARCHES ((ULONG) 0x01000000) + + +/* OpenEntry() */ + +/****** MAPI_MODIFY ((ULONG) 0x00000001) above */ +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +/****** MAPI_BEST_ACCESS ((ULONG) 0x00000010) above */ + +/* SetReceiveFolder() */ + +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* GetReceiveFolder() */ + +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* GetReceiveFolderTable() */ + +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ + +/* StoreLogoff() */ + +#define LOGOFF_NO_WAIT ((ULONG) 0x00000001) +#define LOGOFF_ORDERLY ((ULONG) 0x00000002) +#define LOGOFF_PURGE ((ULONG) 0x00000004) +#define LOGOFF_ABORT ((ULONG) 0x00000008) +#define LOGOFF_QUIET ((ULONG) 0x00000010) + +#define LOGOFF_COMPLETE ((ULONG) 0x00010000) +#define LOGOFF_INBOUND ((ULONG) 0x00020000) +#define LOGOFF_OUTBOUND ((ULONG) 0x00040000) +#define LOGOFF_OUTBOUND_QUEUE ((ULONG) 0x00080000) + +/* SetLockState() */ + +#define MSG_LOCKED ((ULONG) 0x00000001) +#define MSG_UNLOCKED ((ULONG) 0x00000000) + +/* Flag bits for PR_VALID_FOLDER_MASK */ + +#define FOLDER_IPM_SUBTREE_VALID ((ULONG) 0x00000001) +#define FOLDER_IPM_INBOX_VALID ((ULONG) 0x00000002) +#define FOLDER_IPM_OUTBOX_VALID ((ULONG) 0x00000004) +#define FOLDER_IPM_WASTEBASKET_VALID ((ULONG) 0x00000008) +#define FOLDER_IPM_SENTMAIL_VALID ((ULONG) 0x00000010) +#define FOLDER_VIEWS_VALID ((ULONG) 0x00000020) +#define FOLDER_COMMON_VIEWS_VALID ((ULONG) 0x00000040) +#define FOLDER_FINDER_VALID ((ULONG) 0x00000080) + +#define MAPI_IMSGSTORE_METHODS(IPURE) \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(SetReceiveFolder) \ + (THIS_ LPTSTR lpszMessageClass, \ + ULONG ulFlags, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(GetReceiveFolder) \ + (THIS_ LPTSTR lpszMessageClass, \ + ULONG ulFlags, \ + ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID, \ + LPTSTR FAR * lppszExplicitClass) IPURE; \ + MAPIMETHOD(GetReceiveFolderTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(StoreLogoff) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(AbortSubmit) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetOutgoingQueue) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(SetLockState) \ + (THIS_ LPMESSAGE lpMessage, \ + ULONG ulLockState) IPURE; \ + MAPIMETHOD(FinishedMsg) \ + (THIS_ ULONG ulFlags, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(NotifyNewMail) \ + (THIS_ LPNOTIFICATION lpNotification) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMsgStore +DECLARE_MAPI_INTERFACE_(IMsgStore, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMSGSTORE_METHODS(PURE) +}; + +/* IMessage Interface ------------------------------------------------------ */ + +/* SubmitMessage */ + +#define FORCE_SUBMIT ((ULONG) 0x00000001) + +/* Flags defined in PR_MESSAGE_FLAGS */ + +#define MSGFLAG_READ ((ULONG) 0x00000001) +#define MSGFLAG_UNMODIFIED ((ULONG) 0x00000002) +#define MSGFLAG_SUBMIT ((ULONG) 0x00000004) +#define MSGFLAG_UNSENT ((ULONG) 0x00000008) +#define MSGFLAG_HASATTACH ((ULONG) 0x00000010) +#define MSGFLAG_FROMME ((ULONG) 0x00000020) +#define MSGFLAG_ASSOCIATED ((ULONG) 0x00000040) +#define MSGFLAG_RESEND ((ULONG) 0x00000080) +#define MSGFLAG_RN_PENDING ((ULONG) 0x00000100) +#define MSGFLAG_NRN_PENDING ((ULONG) 0x00000200) + +/* Flags defined in PR_SUBMIT_FLAGS */ + +#define SUBMITFLAG_LOCKED ((ULONG) 0x00000001) +#define SUBMITFLAG_PREPROCESS ((ULONG) 0x00000002) + +/* GetAttachmentTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* GetRecipientTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* ModifyRecipients */ + +/* ((ULONG) 0x00000001 is not a valid flag on ModifyRecipients. */ +#define MODRECIP_ADD ((ULONG) 0x00000002) +#define MODRECIP_MODIFY ((ULONG) 0x00000004) +#define MODRECIP_REMOVE ((ULONG) 0x00000008) + +/* SetReadFlag */ + +#define SUPPRESS_RECEIPT ((ULONG) 0x00000001) +#define CLEAR_READ_FLAG ((ULONG) 0x00000004) +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) below */ +#define GENERATE_RECEIPT_ONLY ((ULONG) 0x00000010) +#define CLEAR_RN_PENDING ((ULONG) 0x00000020) +#define CLEAR_NRN_PENDING ((ULONG) 0x00000040) + +/* DeleteAttach */ + +#define ATTACH_DIALOG ((ULONG) 0x00000001) + +/* PR_SECURITY values */ +#define SECURITY_SIGNED ((ULONG) 0x00000001) +#define SECURITY_ENCRYPTED ((ULONG) 0x00000002) + +/* PR_PRIORITY values */ +#define PRIO_URGENT ((long) 1) +#define PRIO_NORMAL ((long) 0) +#define PRIO_NONURGENT ((long) -1) + +/* PR_SENSITIVITY values */ +#define SENSITIVITY_NONE ((ULONG) 0x00000000) +#define SENSITIVITY_PERSONAL ((ULONG) 0x00000001) +#define SENSITIVITY_PRIVATE ((ULONG) 0x00000002) +#define SENSITIVITY_COMPANY_CONFIDENTIAL ((ULONG) 0x00000003) + +/* PR_IMPORTANCE values */ +#define IMPORTANCE_LOW ((long) 0) +#define IMPORTANCE_NORMAL ((long) 1) +#define IMPORTANCE_HIGH ((long) 2) + +#define MAPI_IMESSAGE_METHODS(IPURE) \ + MAPIMETHOD(GetAttachmentTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(OpenAttach) \ + (THIS_ ULONG ulAttachmentNum, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPATTACH FAR * lppAttach) IPURE; \ + MAPIMETHOD(CreateAttach) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulAttachmentNum, \ + LPATTACH FAR * lppAttach) IPURE; \ + MAPIMETHOD(DeleteAttach) \ + (THIS_ ULONG ulAttachmentNum, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetRecipientTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(ModifyRecipients) \ + (THIS_ ULONG ulFlags, \ + LPADRLIST lpMods) IPURE; \ + MAPIMETHOD(SubmitMessage) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(SetReadFlag) \ + (THIS_ ULONG ulFlags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMessage +DECLARE_MAPI_INTERFACE_(IMessage, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IMESSAGE_METHODS(PURE) +}; + +/* IAttach Interface ------------------------------------------------------- */ + +/* IAttach attachment methods: PR_ATTACH_METHOD values */ + +#define NO_ATTACHMENT ((ULONG) 0x00000000) +#define ATTACH_BY_VALUE ((ULONG) 0x00000001) +#define ATTACH_BY_REFERENCE ((ULONG) 0x00000002) +#define ATTACH_BY_REF_RESOLVE ((ULONG) 0x00000003) +#define ATTACH_BY_REF_ONLY ((ULONG) 0x00000004) +#define ATTACH_EMBEDDED_MSG ((ULONG) 0x00000005) +#define ATTACH_OLE ((ULONG) 0x00000006) + +#define MAPI_IATTACH_METHODS(IPURE) + +#undef INTERFACE +#define INTERFACE IAttach +DECLARE_MAPI_INTERFACE_(IAttach, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IATTACH_METHODS(PURE) +}; + +/* --------------------------------- */ +/* Address Book interface definition */ + +/* ADRPARM ulFlags - top 4 bits used for versioning */ + +#define GET_ADRPARM_VERSION(ulFlags) (((ULONG)ulFlags) & 0xF0000000) +#define SET_ADRPARM_VERSION(ulFlags, ulVersion) (((ULONG)ulVersion) | (((ULONG)ulFlags) & 0x0FFFFFFF)) + +/* Current versions of ADRPARM */ +#define ADRPARM_HELP_CTX ((ULONG) 0x00000000) + + +/* ulFlags - bit fields */ +#define DIALOG_MODAL ((ULONG) 0x00000001) +#define DIALOG_SDI ((ULONG) 0x00000002) +#define DIALOG_OPTIONS ((ULONG) 0x00000004) +#define ADDRESS_ONE ((ULONG) 0x00000008) +#define AB_SELECTONLY ((ULONG) 0x00000010) +#define AB_RESOLVE ((ULONG) 0x00000020) + +/* --------------------------------- */ +/* PR_DISPLAY_TYPEs */ +/* + * These standard display types are + * by default handled by MAPI. + * They have default icons associated + * with them. + */ + +/* For address book contents tables */ +#define DT_MAILUSER ((ULONG) 0x00000000) +#define DT_DISTLIST ((ULONG) 0x00000001) +#define DT_FORUM ((ULONG) 0x00000002) +#define DT_AGENT ((ULONG) 0x00000003) +#define DT_ORGANIZATION ((ULONG) 0x00000004) +#define DT_PRIVATE_DISTLIST ((ULONG) 0x00000005) +#define DT_REMOTE_MAILUSER ((ULONG) 0x00000006) + +/* For address book hierarchy tables */ +#define DT_MODIFIABLE ((ULONG) 0x00010000) +#define DT_GLOBAL ((ULONG) 0x00020000) +#define DT_LOCAL ((ULONG) 0x00030000) +#define DT_WAN ((ULONG) 0x00040000) +#define DT_NOT_SPECIFIC ((ULONG) 0x00050000) + +/* For folder hierarchy tables */ +#define DT_FOLDER ((ULONG) 0x01000000) +#define DT_FOLDER_LINK ((ULONG) 0x02000000) +#define DT_FOLDER_SPECIAL ((ULONG) 0x04000000) + +/* Accelerator callback for DIALOG_SDI form of AB UI */ +typedef BOOL (STDMETHODCALLTYPE ACCELERATEABSDI)(ULONG_PTR ulUIParam, + LPVOID lpvmsg); +typedef ACCELERATEABSDI FAR * LPFNABSDI; + +/* Callback to application telling it that the DIALOG_SDI form of the */ +/* AB UI has been dismissed. This is so that the above LPFNABSDI */ +/* function doesn't keep being called. */ +typedef void (STDMETHODCALLTYPE DISMISSMODELESS)(ULONG_PTR ulUIParam, + LPVOID lpvContext); +typedef DISMISSMODELESS FAR * LPFNDISMISS; + +/* + * Prototype for the client function hooked to an optional button on + * the address book dialog + */ + +typedef SCODE (STDMETHODCALLTYPE FAR * LPFNBUTTON)( + ULONG_PTR ulUIParam, + LPVOID lpvContext, + ULONG cbEntryID, + LPENTRYID lpSelection, + ULONG ulFlags +); + + +/* Parameters for the address book dialog */ +typedef struct _ADRPARM +{ + ULONG cbABContEntryID; + LPENTRYID lpABContEntryID; + ULONG ulFlags; + + LPVOID lpReserved; + ULONG ulHelpContext; + LPTSTR lpszHelpFileName; + + LPFNABSDI lpfnABSDI; + LPFNDISMISS lpfnDismiss; + LPVOID lpvDismissContext; + LPTSTR lpszCaption; + LPTSTR lpszNewEntryTitle; + LPTSTR lpszDestWellsTitle; + ULONG cDestFields; + ULONG nDestFieldFocus; + LPTSTR FAR * lppszDestTitles; + ULONG FAR * lpulDestComps; + LPSRestriction lpContRestriction; + LPSRestriction lpHierRestriction; +} ADRPARM, FAR * LPADRPARM; + + +/* ------------ */ +/* Random flags */ + +/* Flag for deferred error */ +#define MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) + +/* Flag for creating and using Folder Associated Information Messages */ +#define MAPI_ASSOCIATED ((ULONG) 0x00000040) + +/* Flags for OpenMessageStore() */ + +#define MDB_NO_DIALOG ((ULONG) 0x00000001) +#define MDB_WRITE ((ULONG) 0x00000004) +/****** MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) above */ +/****** MAPI_BEST_ACCESS ((ULONG) 0x00000010) above */ +#define MDB_TEMPORARY ((ULONG) 0x00000020) +#define MDB_NO_MAIL ((ULONG) 0x00000080) + +/* Flags for OpenAddressBook */ + +#define AB_NO_DIALOG ((ULONG) 0x00000001) + +/* IMAPIControl Interface -------------------------------------------------- */ + +/* Interface used in controls (particularly the button) defined by */ +/* Display Tables. */ + +/* Flags for GetState */ + +#define MAPI_ENABLED ((ULONG) 0x00000000) +#define MAPI_DISABLED ((ULONG) 0x00000001) + +#define MAPI_IMAPICONTROL_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(Activate) \ + (THIS_ ULONG ulFlags, \ + ULONG_PTR ulUIParam) IPURE; \ + MAPIMETHOD(GetState) \ + (THIS_ ULONG ulFlags, \ + ULONG FAR * lpulState) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIControl +DECLARE_MAPI_INTERFACE_(IMAPIControl, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPICONTROL_METHODS(PURE) +}; + +DECLARE_MAPI_INTERFACE_PTR(IMAPIControl, LPMAPICONTROL); + +/* Display Tables ---------------------------------------------------------- */ + +/* Flags used in display tables - that is, PR_CONTROL_FLAGS */ + +#define DT_MULTILINE ((ULONG) 0x00000001) +#define DT_EDITABLE ((ULONG) 0x00000002) +#define DT_REQUIRED ((ULONG) 0x00000004) +#define DT_SET_IMMEDIATE ((ULONG) 0x00000008) +#define DT_PASSWORD_EDIT ((ULONG) 0x00000010) +#define DT_ACCEPT_DBCS ((ULONG) 0x00000020) +#define DT_SET_SELECTION ((ULONG) 0x00000040) + +/* Display Table structures */ + +#define DTCT_LABEL ((ULONG) 0x00000000) +#define DTCT_EDIT ((ULONG) 0x00000001) +#define DTCT_LBX ((ULONG) 0x00000002) +#define DTCT_COMBOBOX ((ULONG) 0x00000003) +#define DTCT_DDLBX ((ULONG) 0x00000004) +#define DTCT_CHECKBOX ((ULONG) 0x00000005) +#define DTCT_GROUPBOX ((ULONG) 0x00000006) +#define DTCT_BUTTON ((ULONG) 0x00000007) +#define DTCT_PAGE ((ULONG) 0x00000008) +#define DTCT_RADIOBUTTON ((ULONG) 0x00000009) +#define DTCT_MVLISTBOX ((ULONG) 0x0000000B) +#define DTCT_MVDDLBX ((ULONG) 0x0000000C) + +/* Labels */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLLABEL +{ + ULONG ulbLpszLabelName; + ULONG ulFlags; +} DTBLLABEL, FAR * LPDTBLLABEL; +#define SizedDtblLabel(n,u) \ +struct _DTBLLABEL_ ## u \ +{ \ + DTBLLABEL dtbllabel; \ + TCHAR lpszLabelName[n]; \ +} u + + +/* Simple Text Edits */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLEDIT +{ + ULONG ulbLpszCharsAllowed; + ULONG ulFlags; + ULONG ulNumCharsAllowed; + ULONG ulPropTag; +} DTBLEDIT, FAR * LPDTBLEDIT; +#define SizedDtblEdit(n,u) \ +struct _DTBLEDIT_ ## u \ +{ \ + DTBLEDIT dtbledit; \ + TCHAR lpszCharsAllowed[n]; \ +} u + +/* List Box */ +/* Valid ulFlags: + */ +#define MAPI_NO_HBAR ((ULONG) 0x00000001) +#define MAPI_NO_VBAR ((ULONG) 0x00000002) + +typedef struct _DTBLLBX +{ + ULONG ulFlags; + ULONG ulPRSetProperty; + ULONG ulPRTableName; +} DTBLLBX, FAR * LPDTBLLBX; + + +/* Combo Box */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLCOMBOBOX +{ + ULONG ulbLpszCharsAllowed; + ULONG ulFlags; + ULONG ulNumCharsAllowed; + ULONG ulPRPropertyName; + ULONG ulPRTableName; +} DTBLCOMBOBOX, FAR * LPDTBLCOMBOBOX; +#define SizedDtblComboBox(n,u) \ +struct _DTBLCOMBOBOX_ ## u \ +{ \ + DTBLCOMBOBOX dtblcombobox; \ + TCHAR lpszCharsAllowed[n]; \ +} u + + +/* Drop Down */ +/* Valid ulFlags: + * none + */ +typedef struct _DTBLDDLBX +{ + ULONG ulFlags; + ULONG ulPRDisplayProperty; + ULONG ulPRSetProperty; + ULONG ulPRTableName; +} DTBLDDLBX, FAR * LPDTBLDDLBX; + + +/* Check Box */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLCHECKBOX +{ + ULONG ulbLpszLabel; + ULONG ulFlags; + ULONG ulPRPropertyName; +} DTBLCHECKBOX, FAR * LPDTBLCHECKBOX; +#define SizedDtblCheckBox(n,u) \ +struct _DTBLCHECKBOX_ ## u \ +{ \ + DTBLCHECKBOX dtblcheckbox; \ + TCHAR lpszLabel[n]; \ +} u + + + +/* Group Box */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLGROUPBOX +{ + ULONG ulbLpszLabel; + ULONG ulFlags; +} DTBLGROUPBOX, FAR * LPDTBLGROUPBOX; +#define SizedDtblGroupBox(n,u) \ +struct _DTBLGROUPBOX_ ## u \ +{ \ + DTBLGROUPBOX dtblgroupbox; \ + TCHAR lpszLabel[n]; \ +} u + +/* Button control */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLBUTTON +{ + ULONG ulbLpszLabel; + ULONG ulFlags; + ULONG ulPRControl; +} DTBLBUTTON, FAR * LPDTBLBUTTON; +#define SizedDtblButton(n,u) \ +struct _DTBLBUTTON_ ## u \ +{ \ + DTBLBUTTON dtblbutton; \ + TCHAR lpszLabel[n]; \ +} u + +/* Pages */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLPAGE +{ + ULONG ulbLpszLabel; + ULONG ulFlags; + ULONG ulbLpszComponent; + ULONG ulContext; +} DTBLPAGE, FAR * LPDTBLPAGE; +#define SizedDtblPage(n,n1,u) \ +struct _DTBLPAGE_ ## u \ +{ \ + DTBLPAGE dtblpage; \ + TCHAR lpszLabel[n]; \ + TCHAR lpszComponent[n1]; \ +} u + +/* Radio button */ +/* Valid ulFlags: + * MAPI_UNICODE + */ +typedef struct _DTBLRADIOBUTTON +{ + ULONG ulbLpszLabel; + ULONG ulFlags; + ULONG ulcButtons; + ULONG ulPropTag; + long lReturnValue; +} DTBLRADIOBUTTON, FAR * LPDTBLRADIOBUTTON; +#define SizedDtblRadioButton(n,u) \ +struct _DTBLRADIOBUTTON_ ## u \ +{ \ + DTBLRADIOBUTTON dtblradiobutton; \ + TCHAR lpszLabel[n]; \ +} u + + +/* MultiValued listbox */ +/* Valid ulFlags: + * none + */ +typedef struct _DTBLMVLISTBOX +{ + ULONG ulFlags; + ULONG ulMVPropTag; +} DTBLMVLISTBOX, FAR * LPDTBLMVLISTBOX; + + +/* MultiValued dropdown */ +/* Valid ulFlags: + * none + */ +typedef struct _DTBLMVDDLBX +{ + ULONG ulFlags; + ULONG ulMVPropTag; +} DTBLMVDDLBX, FAR * LPDTBLMVDDLBX; + + + + + +/* IProviderAdmin Interface ---------------------------------------------- */ + +/* Flags for ConfigureMsgService */ + +#define UI_SERVICE 0x00000002 +#define SERVICE_UI_ALWAYS 0x00000002 /* Duplicate UI_SERVICE for consistency and compatibility */ +#define SERVICE_UI_ALLOWED 0x00000010 +#define UI_CURRENT_PROVIDER_FIRST 0x00000004 +/* MSG_SERVICE_UI_READ_ONLY 0x00000008 - in MAPISPI.H */ + +/* GetProviderTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) above */ + +/* Values for PR_RESOURCE_FLAGS in message service table */ + +#define MAPI_IPROVIDERADMIN_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetProviderTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(CreateProvider) \ + (THIS_ LPTSTR lpszProvider, \ + ULONG cValues, \ + LPSPropValue lpProps, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + MAPIUID FAR * lpUID) IPURE; \ + MAPIMETHOD(DeleteProvider) \ + (THIS_ LPMAPIUID lpUID) IPURE; \ + MAPIMETHOD(OpenProfileSection) \ + (THIS_ LPMAPIUID lpUID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPPROFSECT FAR * lppProfSect) IPURE; \ + + +#undef INTERFACE +#define INTERFACE IProviderAdmin +DECLARE_MAPI_INTERFACE_(IProviderAdmin, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IPROVIDERADMIN_METHODS(PURE) +}; + + + +/* IMAPIClientShutdown Interface ----------------------------------------- */ +DECLARE_MAPI_INTERFACE_PTR(IMAPIClientShutdown, LPMAPICLIENTSHUTDOWN); + +#define MAPI_IMAPICLIENTSHUTDOWN_METHODS(IPURE) \ + MAPIMETHOD(QueryFastShutdown) \ + (THIS) IPURE; \ + MAPIMETHOD(NotifyProcessShutdown) \ + (THIS) IPURE; \ + MAPIMETHOD(DoFastShutdown) \ + (THIS) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIClientShutdown +DECLARE_MAPI_INTERFACE_(IMAPIClientShutdown, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPICLIENTSHUTDOWN_METHODS(PURE) +}; + + +/* IMAPIProviderShutdown Interface --------------------------------------- */ +DECLARE_MAPI_INTERFACE_PTR(IMAPIProviderShutdown, LPMAPIPROVIDERSHUTDOWN); + +#define MAPI_IMAPIPROVIDERSHUTDOWN_METHODS(IPURE) \ + MAPIMETHOD(QueryFastShutdown) \ + (THIS) IPURE; \ + MAPIMETHOD(NotifyProcessShutdown) \ + (THIS) IPURE; \ + MAPIMETHOD(DoFastShutdown) \ + (THIS) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIProviderShutdown +DECLARE_MAPI_INTERFACE_(IMAPIProviderShutdown, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROVIDERSHUTDOWN_METHODS(PURE) +}; + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* MAPIDEFS_H */ diff --git a/comm/mailnews/mapi/include/mapiform.h b/comm/mailnews/mapi/include/mapiform.h new file mode 100644 index 0000000000..e6ab3970ee --- /dev/null +++ b/comm/mailnews/mapi/include/mapiform.h @@ -0,0 +1,632 @@ +/* + * M A P I F O R M . H + * + * Declarations of interfaces for clients and providers of MAPI + * forms and form registries. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPIFORM_H +#define MAPIFORM_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +/* Include common MAPI header files if they haven't been already. */ + +#ifndef MAPIDEFS_H +#include <mapidefs.h> +#include <mapicode.h> +#include <mapiguid.h> +#include <mapitags.h> +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +#ifndef _MAC +typedef const RECT FAR *LPCRECT; +#endif + +/* HFRMREG is an enumeration which represents a registry container. + * Microsoft reserves the values from 0 to 0x3FFF for its own use. + */ + +typedef ULONG HFRMREG; + +#define HFRMREG_DEFAULT 0 +#define HFRMREG_LOCAL 1 +#define HFRMREG_PERSONAL 2 +#define HFRMREG_FOLDER 3 + +DECLARE_MAPI_INTERFACE_PTR(IPersistMessage, LPPERSISTMESSAGE); +DECLARE_MAPI_INTERFACE_PTR(IMAPIMessageSite, LPMAPIMESSAGESITE); +DECLARE_MAPI_INTERFACE_PTR(IMAPISession, LPMAPISESSION); +DECLARE_MAPI_INTERFACE_PTR(IMAPIViewContext, LPMAPIVIEWCONTEXT); +DECLARE_MAPI_INTERFACE_PTR(IMAPIViewAdviseSink, LPMAPIVIEWADVISESINK); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFormAdviseSink, LPMAPIFORMADVISESINK); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFormInfo, LPMAPIFORMINFO); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFormMgr, LPMAPIFORMMGR); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFormContainer, LPMAPIFORMCONTAINER); +DECLARE_MAPI_INTERFACE_PTR(IMAPIForm, LPMAPIFORM); +DECLARE_MAPI_INTERFACE_PTR(IMAPIFormFactory, LPMAPIFORMFACTORY); + +typedef const char FAR *FAR * LPPCSTR; +typedef LPMAPIFORMINFO FAR *LPPMAPIFORMINFO; + +STDAPI MAPIOpenFormMgr(LPMAPISESSION pSession, LPMAPIFORMMGR FAR * ppmgr); +STDAPI MAPIOpenLocalFormContainer(LPMAPIFORMCONTAINER FAR * ppfcnt); + + +/*-- GetLastError ----------------------------------------------------------*/ +/* This defines the GetLastError method held in common by most mapiform + * interfaces. It is defined separately so that an implementor may include + * more than one mapiform interface in a class. + */ + +#define MAPI_GETLASTERROR_METHOD(IPURE) \ + MAPIMETHOD(GetLastError) (THIS_ \ + /*in*/ HRESULT hResult, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIERROR FAR * lppMAPIError) IPURE; \ + + +/*-- IPersistMessage -------------------------------------------------------*/ +/* This interface is implemented by forms and is used to save, + * initialize and load forms to and from messages. + */ + +#define MAPI_IPERSISTMESSAGE_METHODS(IPURE) \ + MAPIMETHOD(GetClassID) (THIS_ LPCLSID lpClassID) IPURE; \ + MAPIMETHOD(IsDirty)(THIS) IPURE; \ + MAPIMETHOD(InitNew)(THIS_ \ + /*in*/ LPMAPIMESSAGESITE pMessageSite, \ + /*in*/ LPMESSAGE pMessage) IPURE; \ + MAPIMETHOD(Load)(THIS_ \ + /*in*/ LPMAPIMESSAGESITE pMessageSite, \ + /*in*/ LPMESSAGE pMessage, \ + /*in*/ ULONG ulMessageStatus, \ + /*in*/ ULONG ulMessageFlags) IPURE; \ + MAPIMETHOD(Save)(THIS_ \ + /*in*/ LPMESSAGE pMessage, \ + /*in*/ ULONG fSameAsLoad) IPURE; \ + MAPIMETHOD(SaveCompleted)(THIS_ \ + /*in*/ LPMESSAGE pMessage) IPURE; \ + MAPIMETHOD(HandsOffMessage)(THIS) IPURE; \ + +#undef INTERFACE +#define INTERFACE IPersistMessage +DECLARE_MAPI_INTERFACE_(IPersistMessage, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IPERSISTMESSAGE_METHODS(PURE) +}; + + +/*-- IMAPIMessageSite ------------------------------------------------------*/ + +#define MAPI_IMAPIMESSAGESITE_METHODS(IPURE) \ + MAPIMETHOD(GetSession) (THIS_ \ + /*out*/ LPMAPISESSION FAR * ppSession) IPURE; \ + MAPIMETHOD(GetStore) (THIS_ \ + /*out*/ LPMDB FAR * ppStore) IPURE; \ + MAPIMETHOD(GetFolder) (THIS_ \ + /*out*/ LPMAPIFOLDER FAR * ppFolder) IPURE; \ + MAPIMETHOD(GetMessage) (THIS_ \ + /*out*/ LPMESSAGE FAR * ppmsg) IPURE; \ + MAPIMETHOD(GetFormManager) (THIS_ \ + /*out*/ LPMAPIFORMMGR FAR * ppFormMgr) IPURE; \ + MAPIMETHOD(NewMessage) (THIS_ \ + /*in*/ ULONG fComposeInFolder, \ + /*in*/ LPMAPIFOLDER pFolderFocus, \ + /*in*/ LPPERSISTMESSAGE pPersistMessage, \ + /*out*/ LPMESSAGE FAR * ppMessage, \ + /*out*/ LPMAPIMESSAGESITE FAR * ppMessageSite, \ + /*out*/ LPMAPIVIEWCONTEXT FAR * ppViewContext) IPURE; \ + MAPIMETHOD(CopyMessage) (THIS_ \ + /*in*/ LPMAPIFOLDER pFolderDestination) IPURE; \ + MAPIMETHOD(MoveMessage) (THIS_ \ + /*in*/ LPMAPIFOLDER pFolderDestination, \ + /*in*/ LPMAPIVIEWCONTEXT pViewContext, \ + /*in*/ LPCRECT prcPosRect) IPURE; \ + MAPIMETHOD(DeleteMessage) (THIS_ \ + /*in*/ LPMAPIVIEWCONTEXT pViewContext, \ + /*in*/ LPCRECT prcPosRect) IPURE; \ + MAPIMETHOD(SaveMessage) (THIS) IPURE; \ + MAPIMETHOD(SubmitMessage) (THIS_ \ + /*in*/ ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetSiteStatus) (THIS_ \ + /*out*/ LPULONG lpulStatus) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIMessageSite +DECLARE_MAPI_INTERFACE_(IMAPIMessageSite, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIMESSAGESITE_METHODS(PURE) +}; + + +/*-- IMAPIForm -------------------------------------------------------------*/ +/* This interface is implemented by forms for the benefit of viewers. + * One method (ShutdownForm) is provided such that simple forms implementing + * only IMAPIForm and IPersistMessage have reasonable embedding behavior. + */ + +#define MAPI_IMAPIFORM_METHODS(IPURE) \ + MAPIMETHOD(SetViewContext) (THIS_ \ + /*in*/ LPMAPIVIEWCONTEXT pViewContext) IPURE; \ + MAPIMETHOD(GetViewContext) (THIS_ \ + /*out*/ LPMAPIVIEWCONTEXT FAR * ppViewContext) IPURE; \ + MAPIMETHOD(ShutdownForm)(THIS_ \ + /*in*/ ULONG ulSaveOptions) IPURE; \ + MAPIMETHOD(DoVerb) (THIS_ \ + /*in*/ LONG iVerb, \ + /*in*/ LPMAPIVIEWCONTEXT lpViewContext, /* can be null */ \ + /*in*/ ULONG_PTR hwndParent, \ + /*in*/ LPCRECT lprcPosRect) IPURE; \ + MAPIMETHOD(Advise)(THIS_ \ + /*in*/ LPMAPIVIEWADVISESINK pAdvise, \ + /*out*/ ULONG_PTR FAR * pdwStatus) IPURE; \ + MAPIMETHOD(Unadvise) (THIS_ \ + /*in*/ ULONG_PTR ulConnection) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIForm +DECLARE_MAPI_INTERFACE_(IMAPIForm, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIFORM_METHODS(PURE) +}; + +typedef enum tagSAVEOPTS +{ + SAVEOPTS_SAVEIFDIRTY = 0, + SAVEOPTS_NOSAVE = 1, + SAVEOPTS_PROMPTSAVE = 2 +} SAVEOPTS; + + +/*-- IMAPIViewContext ------------------------------------------------------*/ +/* Implemented by viewers to support next/previous in forms. + */ + +/* Structure passed in GetPrintSetup */ + +typedef struct { + ULONG ulFlags; /* MAPI_UNICODE */ + HGLOBAL hDevMode; + HGLOBAL hDevNames; + ULONG ulFirstPageNumber; + ULONG fPrintAttachments; +} FORMPRINTSETUP, FAR * LPFORMPRINTSETUP; + +/* Values for pulFormat in GetSaveStream */ + +#define SAVE_FORMAT_TEXT 1 +#define SAVE_FORMAT_RICHTEXT 2 + +/* Values from 0 to 0x3fff are reserved for future definition by Microsoft */ + +#define MAPI_IMAPIVIEWCONTEXT_METHODS(IPURE) \ + MAPIMETHOD(SetAdviseSink)(THIS_ \ + /*in*/ LPMAPIFORMADVISESINK pmvns) IPURE; \ + MAPIMETHOD(ActivateNext)(THIS_ \ + /*in*/ ULONG ulDir, \ + /*in*/ LPCRECT prcPosRect) IPURE; \ + MAPIMETHOD(GetPrintSetup)(THIS_ \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPFORMPRINTSETUP FAR * lppFormPrintSetup) IPURE; \ + MAPIMETHOD(GetSaveStream)(THIS_ \ + /*out*/ ULONG FAR * pulFlags, \ + /*out*/ ULONG FAR * pulFormat, \ + /*out*/ LPSTREAM FAR * ppstm) IPURE; \ + MAPIMETHOD(GetViewStatus) (THIS_ \ + /*out*/ LPULONG lpulStatus) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIViewContext +DECLARE_MAPI_INTERFACE_(IMAPIViewContext, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIVIEWCONTEXT_METHODS(PURE) +}; + +#define VCSTATUS_NEXT 0x00000001 +#define VCSTATUS_PREV 0x00000002 +#define VCSTATUS_MODAL 0x00000004 +#define VCSTATUS_INTERACTIVE 0x00000008 +#define VCSTATUS_READONLY 0x00000010 +#define VCSTATUS_DELETE 0x00010000 +#define VCSTATUS_COPY 0x00020000 +#define VCSTATUS_MOVE 0x00040000 +#define VCSTATUS_SUBMIT 0x00080000 +#define VCSTATUS_DELETE_IS_MOVE 0x00100000 +#define VCSTATUS_SAVE 0x00200000 +#define VCSTATUS_NEW_MESSAGE 0x00400000 + +#define VCDIR_NEXT VCSTATUS_NEXT +#define VCDIR_PREV VCSTATUS_PREV +#define VCDIR_DELETE VCSTATUS_DELETE +#define VCDIR_MOVE VCSTATUS_MOVE + + +/*-- IMAPIFormAdviseSink ---------------------------------------------------*/ +/* Part of form server, held by view; receives notifications from the view. + * + * This part of the form server, but is not an interface on the form + * object. This means that clients should not expect to QueryInterface + * from an IMAPIForm* or IOleObject* to this interface, or vice versa. + */ + +#define MAPI_IMAPIFORMADVISESINK_METHODS(IPURE) \ + STDMETHOD(OnChange)(THIS_ ULONG ulDir) IPURE; \ + STDMETHOD(OnActivateNext)(THIS_ \ + /*in*/ LPCSTR lpszMessageClass, \ + /*in*/ ULONG ulMessageStatus, \ + /*in*/ ULONG ulMessageFlags, \ + /*out*/ LPPERSISTMESSAGE FAR * ppPersistMessage) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFormAdviseSink +DECLARE_MAPI_INTERFACE_(IMAPIFormAdviseSink, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIFORMADVISESINK_METHODS(PURE) +}; + + +/*-- IMAPIViewAdviseSink ---------------------------------------------------*/ +/* Part of view context, held by form; receives notifications from the form. + */ + +#define MAPI_IMAPIVIEWADVISESINK_METHODS(IPURE) \ + MAPIMETHOD(OnShutdown)(THIS) IPURE; \ + MAPIMETHOD(OnNewMessage)(THIS) IPURE; \ + MAPIMETHOD(OnPrint)(THIS_ \ + /*in*/ ULONG dwPageNumber, \ + /*in*/ HRESULT hrStatus) IPURE; \ + MAPIMETHOD(OnSubmitted) (THIS) IPURE; \ + MAPIMETHOD(OnSaved) (THIS) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIViewAdviseSink +DECLARE_MAPI_INTERFACE_(IMAPIViewAdviseSink, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIVIEWADVISESINK_METHODS(PURE) +}; + + +/*-- IMAPIFormInfo ---------------------------------------------------------*/ +/* Is implemented by registries. Describes the form. + */ + +/* Single enum value */ + +typedef struct +{ /* fpev */ + LPTSTR pszDisplayName; /* carries the display string */ + ULONG nVal; /* the value for the above enumeration */ +} SMAPIFormPropEnumVal, FAR * LPMAPIFORMPROPENUMVAL; + +/* MAPI Form property descriptor */ + +/* + * Values for the tag in the SMAPIFormProp structure + * + * Microsoft reserves the range from 0 to 0x3FFF for future use in its other + * forms registry implementations. + */ + +typedef ULONG FORMPROPSPECIALTYPE; + +#define FPST_VANILLA 0 +#define FPST_ENUM_PROP 1 + +typedef struct +{ + ULONG ulFlags; /* Contains MAPI_UNICODE if strings are UNICODE */ + ULONG nPropType; /* type of the property, hiword is 0 */ + MAPINAMEID nmid; /* id of the property */ + LPTSTR pszDisplayName; + FORMPROPSPECIALTYPE nSpecialType; /* tag for the following union */ + union + { + struct + { + MAPINAMEID nmidIdx; + ULONG cfpevAvailable; /* # of enums */ + LPMAPIFORMPROPENUMVAL pfpevAvailable; + } s1; /* Property String/Number association Enumeration */ + } u; +} SMAPIFormProp, FAR * LPMAPIFORMPROP; + +/* Array of form properties */ + +typedef struct +{ + ULONG cProps; + ULONG ulPad; /* Pad to 8-byte alignment for insurance */ + SMAPIFormProp aFormProp[MAPI_DIM]; +} SMAPIFormPropArray, FAR * LPMAPIFORMPROPARRAY; + +#define CbMAPIFormPropArray(_c) \ + (offsetof(SMAPIFormPropArray, aFormProp) + \ + (_c)*sizeof(SMAPIFormProp)) + +/* Structure defining the layout of an mapi verb description */ + +typedef struct +{ + LONG lVerb; + LPTSTR szVerbname; + DWORD fuFlags; + DWORD grfAttribs; + ULONG ulFlags; /* Either 0 or MAPI_UNICODE */ +} SMAPIVerb, FAR * LPMAPIVERB; + +/* Structure used for returning arrays of mapi verbs */ + +typedef struct +{ + ULONG cMAPIVerb; /* Number of verbs in the structure */ + SMAPIVerb aMAPIVerb[MAPI_DIM]; +} SMAPIVerbArray, FAR * LPMAPIVERBARRAY; + +#define CbMAPIVerbArray(_c) \ + (offsetof(SMAPIVerbArray, aMAPIVerb) + \ + (_c)*sizeof(SMAPIVerb)) + +#define MAPI_IMAPIFORMINFO_METHODS(IPURE) \ + MAPIMETHOD(CalcFormPropSet)(THIS_ \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIFORMPROPARRAY FAR * ppFormPropArray) IPURE; \ + MAPIMETHOD(CalcVerbSet)(THIS_ \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIVERBARRAY FAR * ppMAPIVerbArray) IPURE; \ + MAPIMETHOD(MakeIconFromBinary)(THIS_ \ + /*in*/ ULONG nPropID, \ + /*out*/ HICON FAR* phicon) IPURE; \ + MAPIMETHOD(SaveForm)(THIS_ \ + /*in*/ LPCTSTR szFileName) IPURE; \ + MAPIMETHOD(OpenFormContainer)(THIS_ \ + /*out*/ LPMAPIFORMCONTAINER FAR * ppformcontainer) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFormInfo +DECLARE_MAPI_INTERFACE_(IMAPIFormInfo, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) /* note: subsumes getlasterror */ + MAPI_IMAPIFORMINFO_METHODS(PURE) +}; + + +/* Enumeration of permissible values for PR_FORM_MESSAGE_BEHAVIOR */ + +#define MAPI_MESSAGE_BEHAVIOR_IPM 0 +#define MAPI_MESSAGE_BEHAVIOR_FOLDER 1 + + +/*-- IMAPIFormMgr ----------------------------------------------------------*/ +/* The client-visible interface for form resolution and dispatch. + */ + +/* Structure containing an array of message class strings */ + +typedef struct +{ + ULONG cValues; + LPCSTR aMessageClass[MAPI_DIM]; +} SMessageClassArray, FAR * LPSMESSAGECLASSARRAY; + +#define CbMessageClassArray(_c) \ + (offsetof(SMessageClassArray, aMessageClass) + (_c)*sizeof(LPCSTR)) + +/* Structure containing an array of IMAPIFormInfo interfaces */ + +typedef struct +{ + ULONG cForms; + LPMAPIFORMINFO aFormInfo[MAPI_DIM]; +} SMAPIFormInfoArray, FAR * LPSMAPIFORMINFOARRAY; + +#define CbMAPIFormInfoArray(_c) \ + (offsetof(SMAPIFormInfoArray, aFormInfo) + \ + (_c)*sizeof(LPMAPIFORMINFO)) + +/* Flags for IMAPIFormMgr::SelectFormContainer */ + +#define MAPIFORM_SELECT_ALL_REGISTRIES 0 +#define MAPIFORM_SELECT_FOLDER_REGISTRY_ONLY 1 +#define MAPIFORM_SELECT_NON_FOLDER_REGISTRY_ONLY 2 + +/* Flags for IMAPIFormMgr::CalcFormPropSet */ + +#define FORMPROPSET_UNION 0 +#define FORMPROPSET_INTERSECTION 1 + +/* Flags for IMAPIFormMgr::ResolveMessageClass and + IMAPIFormMgr::ResolveMultipleMessageClasses */ + +#define MAPIFORM_EXACTMATCH 0x0020 + +#define MAPI_IMAPIFORMMGR_METHODS(IPURE) \ + MAPIMETHOD(LoadForm)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPCSTR lpszMessageClass, \ + /*in*/ ULONG ulMessageStatus, \ + /*in*/ ULONG ulMessageFlags, \ + /*in*/ LPMAPIFOLDER pFolderFocus, \ + /*in*/ LPMAPIMESSAGESITE pMessageSite, \ + /*in*/ LPMESSAGE pmsg, \ + /*in*/ LPMAPIVIEWCONTEXT pViewContext, \ + /*in*/ REFIID riid, \ + /*out*/ LPVOID FAR *ppvObj) IPURE; \ + MAPIMETHOD(ResolveMessageClass)(THIS_ \ + /*in*/ LPCSTR szMsgClass, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPMAPIFOLDER pFolderFocus, /* can be null */ \ + /*out*/ LPMAPIFORMINFO FAR* ppResult) IPURE; \ + MAPIMETHOD(ResolveMultipleMessageClasses)(THIS_ \ + /*in*/ LPSMESSAGECLASSARRAY pMsgClasses, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPMAPIFOLDER pFolderFocus, /* can be null */ \ + /*out*/ LPSMAPIFORMINFOARRAY FAR * pfrminfoarray) IPURE; \ + MAPIMETHOD(CalcFormPropSet)(THIS_ \ + /*in*/ LPSMAPIFORMINFOARRAY pfrminfoarray, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIFORMPROPARRAY FAR* ppResults) IPURE; \ + MAPIMETHOD(CreateForm)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPMAPIFORMINFO pfrminfoToActivate, \ + /*in*/ REFIID refiidToAsk, \ + /*out*/ LPVOID FAR* ppvObj) IPURE; \ + MAPIMETHOD(SelectForm)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPCTSTR pszTitle, \ + /*in*/ LPMAPIFOLDER pfld, \ + /*out*/ LPMAPIFORMINFO FAR * ppfrminfoReturned) IPURE; \ + MAPIMETHOD(SelectMultipleForms)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPCTSTR pszTitle, \ + /*in*/ LPMAPIFOLDER pfld, \ + /*in*/ LPSMAPIFORMINFOARRAY pfrminfoarray, \ + /*out*/ LPSMAPIFORMINFOARRAY FAR * ppfrminfoarray) IPURE; \ + MAPIMETHOD(SelectFormContainer)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIFORMCONTAINER FAR * lppfcnt) IPURE; \ + MAPIMETHOD(OpenFormContainer)(THIS_ \ + /*in*/ HFRMREG hfrmreg, \ + /*in*/ LPUNKNOWN lpunk, \ + /*out*/ LPMAPIFORMCONTAINER FAR * lppfcnt) IPURE; \ + MAPIMETHOD(PrepareForm)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPMAPIFORMINFO pfrminfo) IPURE; \ + MAPIMETHOD(IsInConflict)(THIS_ \ + /*in*/ ULONG ulMessageFlags, \ + /*in*/ ULONG ulMessageStatus, \ + /*in*/ LPCSTR szMessageClass, \ + /*in*/ LPMAPIFOLDER pFolderFocus) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFormMgr +DECLARE_MAPI_INTERFACE_(IMAPIFormMgr, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIFORMMGR_METHODS(PURE) +}; + +/* Platform numbers (used in .CFG files for forms) */ + +#define MAPIFORM_CPU_X86 1 +#define MAPIFORM_CPU_MIP 2 +#define MAPIFORM_CPU_AXP 3 +#define MAPIFORM_CPU_PPC 4 +#define MAPIFORM_CPU_M68 5 +#define MAPIFORM_CPU_X64 6 + +#define MAPIFORM_OS_WIN_31 1 +#define MAPIFORM_OS_WINNT_35 2 +#define MAPIFORM_OS_WIN_95 3 +#define MAPIFORM_OS_MAC_7x 4 +#define MAPIFORM_OS_WINNT_40 5 +#define MAPIFORM_OS_WINNT_50 6 +#define MAPIFORM_OS_WINNT_60 7 + +#define MAPIFORM_PLATFORM(CPU, OS) ((ULONG) ((((ULONG) CPU) << 16) | OS)) + + +/*-- IMAPIFormContainer -------------------------------------------------*/ + +/* Flags for IMAPIFormMgr::CalcFormPropSet */ + +/* #define FORMPROPSET_UNION 0 */ +/* #define FORMPROPSET_INTERSECTION 1 */ + +/* Flags for IMAPIFormMgr::InstallForm */ + +#define MAPIFORM_INSTALL_DIALOG MAPI_DIALOG +#define MAPIFORM_INSTALL_OVERWRITEONCONFLICT 0x0010 + +/* Flags for IMAPIFormContainer::ResolveMessageClass and + IMAPIFormContainer::ResolveMultipleMessageClasses */ +/* #define MAPIFORM_EXACTIMATCH 0x0020 */ + +#define MAPI_IMAPIFORMCONTAINER_METHODS(IPURE) \ + MAPIMETHOD(InstallForm)(THIS_ \ + /*in*/ ULONG_PTR ulUIParam, \ + /*in*/ ULONG ulFlags, \ + /*in*/ LPCTSTR szCfgPathName) IPURE; \ + MAPIMETHOD(RemoveForm)(THIS_ \ + /*in*/ LPCSTR szMessageClass) IPURE; \ + MAPIMETHOD(ResolveMessageClass) (THIS_ \ + /*in*/ LPCSTR szMessageClass, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIFORMINFO FAR * pforminfo) IPURE; \ + MAPIMETHOD(ResolveMultipleMessageClasses) (THIS_ \ + /*in*/ LPSMESSAGECLASSARRAY pMsgClassArray, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPSMAPIFORMINFOARRAY FAR * ppfrminfoarray) IPURE; \ + MAPIMETHOD(CalcFormPropSet)(THIS_ \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPMAPIFORMPROPARRAY FAR * ppResults) IPURE; \ + MAPIMETHOD(GetDisplay)(THIS_ \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPTSTR FAR * pszDisplayName) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFormContainer +DECLARE_MAPI_INTERFACE_(IMAPIFormContainer, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIFORMCONTAINER_METHODS(PURE) +}; + +/*-- IMAPIFormFactory ------------------------------------------------------*/ + +#define MAPI_IMAPIFORMFACTORY_METHODS(IPURE) \ + MAPIMETHOD(CreateClassFactory) (THIS_ \ + /*in*/ REFCLSID clsidForm, \ + /*in*/ ULONG ulFlags, \ + /*out*/ LPCLASSFACTORY FAR * lppClassFactory) IPURE; \ + MAPIMETHOD(LockServer) (THIS_ \ + /*in*/ ULONG ulFlags, \ + /*in*/ ULONG fLockServer) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPIFormFactory +DECLARE_MAPI_INTERFACE_(IMAPIFormFactory, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_GETLASTERROR_METHOD(PURE) + MAPI_IMAPIFORMFACTORY_METHODS(PURE) +}; + +#endif /* MAPIFORM_H */ diff --git a/comm/mailnews/mapi/include/mapiguid.h b/comm/mailnews/mapi/include/mapiguid.h new file mode 100644 index 0000000000..f7b9dc71fb --- /dev/null +++ b/comm/mailnews/mapi/include/mapiguid.h @@ -0,0 +1,353 @@ +/* + * M A P I G U I D . H + * + * Master definitions of all GUID's for MAPI. + * + * When included without INITGUID defined, this header file + * defines symbols that reference IIDs elsewhere. + * + * When included with INITGUID defined and a "USES_IID_I..." + * statement for each IID used by the subsystem, it generates the + * bytes for those actual IIDs into the associated object file. + * + * This range of 256 GUIDs reserved by OLE for MAPI use October 5, 1992. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +/* + * List of GUIDS allocated by MAPI + * + * 0x00020300 IID_IMAPISession + * 0x00020301 IID_IMAPITable + * 0x00020302 IID_IMAPIAdviseSink + * 0x00020303 IID_IMAPIProp + * 0x00020304 IID_IProfSect + * 0x00020305 IID_IMAPIStatus + * 0x00020306 IID_IMsgStore + * 0x00020307 IID_IMessage + * 0x00020308 IID_IAttachment + * 0x00020309 IID_IAddrBook + * 0x0002030A IID_IMailUser + * 0x0002030B IID_IMAPIContainer + * 0x0002030C IID_IMAPIFolder + * 0x0002030D IID_IABContainer + * 0x0002030E IID_IDistList + * 0x0002030F IID_IMAPISup + * 0x00020310 IID_IMSProvider + * 0x00020311 IID_IABProvider + * 0x00020312 IID_IXPProvider + * 0x00020313 IID_IMSLogon + * 0x00020314 IID_IABLogon + * 0x00020315 IID_IXPLogon + * 0x00020316 IID_IMAPITableData + * 0x00020317 IID_IMAPISpoolerInit + * 0x00020318 IID_IMAPISpoolerSession + * 0x00020319 IID_ITNEF + * 0x0002031A IID_IMAPIPropData + * 0x0002031B IID_IMAPIControl + * 0x0002031C IID_IProfAdmin + * 0x0002031D IID_IMsgServiceAdmin + * 0x0002031E IID_IMAPISpoolerService + * 0x0002031F IID_IMAPIProgress + * 0x00020320 IID_ISpoolerHook + * 0x00020321 IID_IMAPIViewContext + * 0x00020322 IID_IMAPIFormMgr + * 0x00020323 IID_IEnumMAPIFormProp + * 0x00020324 IID_IMAPIFormInfo + * 0x00020325 IID_IProviderAdmin + * 0x00020327 IID_IMAPIForm + * 0x00020328 PS_MAPI + * 0x00020329 PS_PUBLIC_STRINGS + * 0x0002032A IID_IPersistMessage + * 0x0002032B IID_IMAPIViewAdviseSink + * 0x0002032C IID_IStreamDocfile + * 0x0002032D IID_IMAPIFormProp + * 0x0002032E IID_IMAPIFormContainer + * 0x0002032F IID_IMAPIFormAdviseSink + * 0x00020330 IID_IStreamTnef + * 0x00020350 IID_IMAPIFormFactory + * 0x00020370 IID_IMAPIMessageSite + * 0x00020380 PS_ROUTING_EMAIL_ADDRESSES + * 0x00020381 PS_ROUTING_ADDRTYPE + * 0x00020382 PS_ROUTING_DISPLAY_NAME + * 0x00020383 PS_ROUTING_ENTRYID + * 0x00020384 PS_ROUTING_SEARCH_KEY + * 0x00020385 MUID_PROFILE_INSTANCE + * 0x00020397 IID_IMAPIClientShutdown + * 0x00020398 IID_IMAPIProviderShutdown + * + * The remaining GUIDs from 0x00020300 to 0x000203FF are reserved by + * MAPI for future use. The current maximum used by MAPI is 0x00020398 + * + */ + +#ifndef MAPIGUID_H +#ifdef INITGUID +#define MAPIGUID_H +#if _MSC_VER > 1000 +#pragma once +#endif +#endif + +/* Derive from IUnknown */ +#if !defined(INITGUID) || defined(USES_IID_IMAPISession) +DEFINE_OLEGUID(IID_IMAPISession, 0x00020300, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPITable) +DEFINE_OLEGUID(IID_IMAPITable, 0x00020301, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIAdviseSink) +DEFINE_OLEGUID(IID_IMAPIAdviseSink, 0x00020302, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIControl) +DEFINE_OLEGUID(IID_IMAPIControl, 0x0002031B, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IProfAdmin) +DEFINE_OLEGUID(IID_IProfAdmin, 0x0002031C, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMsgServiceAdmin) +DEFINE_OLEGUID(IID_IMsgServiceAdmin,0x0002031D, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IProviderAdmin) +DEFINE_OLEGUID(IID_IProviderAdmin, 0x00020325, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIProgress) +DEFINE_OLEGUID(IID_IMAPIProgress, 0x0002031F, 0, 0); +#endif + +/* MAPIProp or derive from MAPIProp */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIProp) +DEFINE_OLEGUID(IID_IMAPIProp, 0x00020303, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IProfSect) +DEFINE_OLEGUID(IID_IProfSect, 0x00020304, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIStatus) +DEFINE_OLEGUID(IID_IMAPIStatus, 0x00020305, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMsgStore) +DEFINE_OLEGUID(IID_IMsgStore, 0x00020306, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMessage) +DEFINE_OLEGUID(IID_IMessage, 0x00020307, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IAttachment) +DEFINE_OLEGUID(IID_IAttachment, 0x00020308, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IAddrBook) +DEFINE_OLEGUID(IID_IAddrBook, 0x00020309, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMailUser) +DEFINE_OLEGUID(IID_IMailUser, 0x0002030A, 0, 0); +#endif + +/* MAPIContainer or derive from MAPIContainer */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIContainer) +DEFINE_OLEGUID(IID_IMAPIContainer, 0x0002030B, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIFolder) +DEFINE_OLEGUID(IID_IMAPIFolder, 0x0002030C, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IABContainer) +DEFINE_OLEGUID(IID_IABContainer, 0x0002030D, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IDistList) +DEFINE_OLEGUID(IID_IDistList, 0x0002030E, 0, 0); +#endif + +/* MAPI Support Object */ +#if !defined(INITGUID) || defined(USES_IID_IMAPISup) +DEFINE_OLEGUID(IID_IMAPISup, 0x0002030F, 0, 0); +#endif + +/* Provider INIT objects */ +#if !defined(INITGUID) || defined(USES_IID_IMSProvider) +DEFINE_OLEGUID(IID_IMSProvider, 0x00020310, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IABProvider) +DEFINE_OLEGUID(IID_IABProvider, 0x00020311, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IXPProvider) +DEFINE_OLEGUID(IID_IXPProvider, 0x00020312, 0, 0); +#endif + +/* Provider LOGON Objects */ +#if !defined(INITGUID) || defined(USES_IID_IMSLogon) +DEFINE_OLEGUID(IID_IMSLogon, 0x00020313, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IABLogon) +DEFINE_OLEGUID(IID_IABLogon, 0x00020314, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IXPLogon) +DEFINE_OLEGUID(IID_IXPLogon, 0x00020315, 0, 0); +#endif + +/* IMAPITable-in-memory Table Data Object */ +#if !defined(INITGUID) || defined(USES_IID_IMAPITableData) +DEFINE_OLEGUID(IID_IMAPITableData, 0x00020316, 0, 0); +#endif + +/* MAPI Spooler Init Object (internal) */ +#if !defined(INITGUID) || defined(USES_IID_IMAPISpoolerInit) +DEFINE_OLEGUID(IID_IMAPISpoolerInit, 0x00020317, 0, 0); +#endif + +/* MAPI Spooler Session Object (internal) */ +#if !defined(INITGUID) || defined(USES_IID_IMAPISpoolerSession) +DEFINE_OLEGUID(IID_IMAPISpoolerSession, 0x00020318, 0, 0); +#endif + +/* MAPI TNEF Object Interface */ +#if !defined(INITGUID) || defined(USES_IID_ITNEF) +DEFINE_OLEGUID(IID_ITNEF, 0x00020319, 0, 0); +#endif + +/* IMAPIProp-in-memory Property Data Object */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIPropData) +DEFINE_OLEGUID(IID_IMAPIPropData, 0x0002031A, 0, 0); +#endif + +/* MAPI Spooler Hook Object */ +#if !defined(INITGUID) || defined(USES_IID_ISpoolerHook) +DEFINE_OLEGUID(IID_ISpoolerHook, 0x00020320, 0, 0); +#endif + +/* MAPI Spooler Service Object */ +#if !defined(INITGUID) || defined(USES_IID_IMAPISpoolerService) +DEFINE_OLEGUID(IID_IMAPISpoolerService, 0x0002031E, 0, 0); +#endif + +/* MAPI forms, form manager, etc. */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIViewContext) +DEFINE_OLEGUID(IID_IMAPIViewContext, 0x00020321, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormMgr) +DEFINE_OLEGUID(IID_IMAPIFormMgr, 0x00020322, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IEnumMAPIFormProp) +DEFINE_OLEGUID(IID_IEnumMAPIFormProp, 0x00020323, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormInfo) +DEFINE_OLEGUID(IID_IMAPIFormInfo, 0x00020324, 0, 0); +#endif +#if !defined(INITGUID) || defined(USES_IID_IMAPIForm) +DEFINE_OLEGUID(IID_IMAPIForm, 0x00020327, 0, 0); +#endif + + +/* Well known guids for name<->id mappings */ + +/* The name of MAPI's property set */ +#if !defined(INITGUID) || defined(USES_PS_MAPI) +DEFINE_OLEGUID(PS_MAPI, 0x00020328, 0, 0); +#endif + +/* The name of the set of public strings */ +#if !defined(INITGUID) || defined(USES_PS_PUBLIC_STRINGS) +DEFINE_OLEGUID(PS_PUBLIC_STRINGS, 0x00020329, 0, 0); +#endif + + + + +/* MAPI forms, form manager, (cont) */ +#if !defined(INITGUID) || defined(USES_IID_IPersistMessage) +DEFINE_OLEGUID(IID_IPersistMessage, 0x0002032A, 0, 0); +#endif + +/* IMAPIViewAdviseSink */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIViewAdviseSink) +DEFINE_OLEGUID(IID_IMAPIViewAdviseSink, 0x0002032B, 0, 0); +#endif + +/* Message Store OpenProperty */ +#if !defined(INITGUID) || defined(USES_IID_IStreamDocfile) +DEFINE_OLEGUID(IID_IStreamDocfile, 0x0002032C, 0, 0); +#endif + +/* IMAPIFormProp */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormProp) +DEFINE_OLEGUID(IID_IMAPIFormProp, 0x0002032D, 0, 0); +#endif + +/* IMAPIFormContainer */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormContainer) +DEFINE_OLEGUID(IID_IMAPIFormContainer, 0x0002032E, 0, 0); +#endif + +/* IMAPIFormAdviseSink */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormAdviseSink) +DEFINE_OLEGUID(IID_IMAPIFormAdviseSink, 0x0002032F, 0, 0); +#endif + +/* TNEF OpenProperty */ +#if !defined(INITGUID) || defined(USES_IID_IStreamTnef) +DEFINE_OLEGUID(IID_IStreamTnef, 0x00020330, 0, 0); +#endif + +/* IMAPIFormFactory */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIFormFactory) +DEFINE_OLEGUID(IID_IMAPIFormFactory, 0x00020350, 0, 0); +#endif + +/* IMAPIMessageSite */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIMessageSite) +DEFINE_OLEGUID(IID_IMAPIMessageSite, 0x00020370, 0, 0); +#endif + + + +/* Well known guids routing property sets. + Useful when writing applications that route documents + (i.e. Workflow) across gateways. Gateways that speak MAPI + should convert the properties found in the follow property + sets appropriately. */ + +/* PS_ROUTING_EMAIL_ADDRESSES: Addresses that need converting at gateways, etc. */ +#if !defined(INITGUID) || defined(USES_PS_ROUTING_EMAIL_ADDRESSES) +DEFINE_OLEGUID(PS_ROUTING_EMAIL_ADDRESSES, 0x00020380, 0, 0); +#endif + +/* PS_ROUTING_ADDRTYPE: Address types that need converting at gateways, etc. */ +#if !defined(INITGUID) || defined(USES_PS_ROUTING_ADDRTYPE) +DEFINE_OLEGUID(PS_ROUTING_ADDRTYPE, 0x00020381, 0, 0); +#endif + +/* PS_ROUTING_DISPLAY_NAME: Display Name that corresponds to the other props */ +#if !defined(INITGUID) || defined(USES_PS_ROUTING_DISPLAY_NAME) +DEFINE_OLEGUID(PS_ROUTING_DISPLAY_NAME, 0x00020382, 0, 0); +#endif + +/* PS_ROUTING_ENTRYID: (optional) EntryIDs that need converting at gateways, etc. */ +#if !defined(INITGUID) || defined(USES_PS_ROUTING_ENTRYID) +DEFINE_OLEGUID(PS_ROUTING_ENTRYID, 0x00020383, 0, 0); +#endif + +/* PS_ROUTING_SEARCH_KEY: (optional) search keys that need converting at gateways, etc. */ +#if !defined(INITGUID) || defined(USES_PS_ROUTING_SEARCH_KEY) +DEFINE_OLEGUID(PS_ROUTING_SEARCH_KEY, 0x00020384, 0, 0); +#endif + +/* MUID_PROFILE_INSTANCE + Well known section in a profile which contains a property (PR_SEARCH_KEY) which is unique + for any given profile. Applications and providers can depend on this value as being + different for each unique profile. */ +#if !defined(INITGUID) || defined(USES_MUID_PROFILE_INSTANCE) +DEFINE_OLEGUID(MUID_PROFILE_INSTANCE, 0x00020385, 0, 0); +#endif + + +/* Interface GUIDs for Fast Shutdown support */ + +/* IMAPIClientShutdown */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIClientShutdown) +DEFINE_OLEGUID(IID_IMAPIClientShutdown, 0x00020397, 0, 0); +#endif + +/* IMAPIProviderShutdown */ +#if !defined(INITGUID) || defined(USES_IID_IMAPIProviderShutdown) +DEFINE_OLEGUID(IID_IMAPIProviderShutdown, 0x00020398, 0, 0); +#endif + +#endif /* MAPIGUID_H */ diff --git a/comm/mailnews/mapi/include/mapihook.h b/comm/mailnews/mapi/include/mapihook.h new file mode 100644 index 0000000000..a547dcfaad --- /dev/null +++ b/comm/mailnews/mapi/include/mapihook.h @@ -0,0 +1,83 @@ +/* + * M A P I H O O K . H + * + * Defines the SpoolerMsgHook provider interface. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPIHOOK_H +#define MAPIHOOK_H + +#ifndef MAPIDEFS_H +#include <mapidefs.h> +#include <mapicode.h> +#include <mapiguid.h> +#include <mapitags.h> +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ISpoolerHook Interface ------------------------------------------------ */ + +/* MsgHooks */ + +#define HOOK_DELETE ((ULONG) 0x00000001) +#define HOOK_CANCEL ((ULONG) 0x00000002) + +#define MAPI_ISPOOLERHOOK_METHODS(IPURE) \ + MAPIMETHOD(InboundMsgHook) \ + (THIS_ LPMESSAGE lpMessage, \ + LPMAPIFOLDER lpFolder, \ + LPMDB lpMDB, \ + ULONG FAR * lpulFlags, \ + ULONG FAR * lpcbEntryID, \ + LPBYTE FAR * lppEntryID) IPURE; \ + MAPIMETHOD(OutboundMsgHook) \ + (THIS_ LPMESSAGE lpMessage, \ + LPMAPIFOLDER lpFolder, \ + LPMDB lpMDB, \ + ULONG FAR * lpulFlags, \ + ULONG FAR * lpcbEntryID, \ + LPBYTE FAR * lppEntryID) IPURE; \ + +#undef INTERFACE +#define INTERFACE ISpoolerHook +DECLARE_MAPI_INTERFACE_(ISpoolerHook, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_ISPOOLERHOOK_METHODS(PURE) +}; + +DECLARE_MAPI_INTERFACE_PTR(ISpoolerHook, LPSPOOLERHOOK); + +/* Hook Provider Entry Point */ + +#define HOOK_INBOUND ((ULONG) 0x00000200) +#define HOOK_OUTBOUND ((ULONG) 0x00000400) + +typedef HRESULT (STDMAPIINITCALLTYPE HPPROVIDERINIT)( + LPMAPISESSION lpSession, + HINSTANCE hInstance, + LPALLOCATEBUFFER lpAllocateBuffer, + LPALLOCATEMORE lpAllocateMore, + LPFREEBUFFER lpFreeBuffer, + LPMAPIUID lpSectionUID, + ULONG ulFlags, + LPSPOOLERHOOK FAR * lppSpoolerHook +); + +HPPROVIDERINIT HPProviderInit; + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* MAPIHOOK_H */ diff --git a/comm/mailnews/mapi/include/mapinls.h b/comm/mailnews/mapi/include/mapinls.h new file mode 100644 index 0000000000..cc04096a52 --- /dev/null +++ b/comm/mailnews/mapi/include/mapinls.h @@ -0,0 +1,196 @@ +/* + * M A P I N L S . H + * + * Internationalization Support Utilities + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MAPINLS_H_ +#define _MAPINLS_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN64) && !defined (_WIN64) +#define _WIN64 +#endif + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* We don't want to include windows.h in case that conflicts with an */ +/* earlier inclusion of compobj.h */ + +#if !defined(WINAPI) + #if defined(_WIN64) && (_MSC_VER >= 800) + #define WINAPI + #elif defined(_WIN32) && (_MSC_VER >= 800) + #define WINAPI __stdcall + #else + #error "Unknown Platform: MAPI is currently supported on Win32 and Win64" + #endif +#endif + +#if defined(DOS) || defined(_MAC) +#include <string.h> +#endif + +#ifndef FAR +#define FAR +#endif + +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; +typedef unsigned int UINT; +typedef int BOOL; + +#ifndef __CHAR_DEFINED__ +typedef char CHAR; +#endif + +#ifdef UNICODE +typedef WCHAR TCHAR; +#else +typedef char TCHAR; +#endif + +#if !defined(_NATIVE_WCHAR_T_DEFINED) +typedef unsigned short WCHAR; +#endif + +typedef WCHAR FAR * LPWSTR; +typedef const WCHAR FAR * LPCWSTR; +typedef CHAR FAR * LPSTR; +typedef const CHAR FAR * LPCSTR; +typedef TCHAR FAR * LPTSTR; +typedef const TCHAR FAR * LPCTSTR; +typedef DWORD LCID; +typedef const void FAR * LPCVOID; + +#ifndef _MAC +#ifndef LPOLESTR +#if defined(_WIN64) || defined(_WIN32) +#define LPOLESTR LPWSTR +#define LPCOLESTR LPCWSTR +#define OLECHAR WCHAR +#define OLESTR(str) L##str +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif /* _WIN64 || _WIN32*/ +#endif /* LPOLESTR */ +#endif /* _MAC */ + +#define NORM_IGNORECASE 0x00000001 /* ignore case */ +#define NORM_IGNORENONSPACE 0x00000002 /* ignore diacritics */ +#define NORM_IGNORESYMBOLS 0x00000004 /* ignore symbols */ + +#if defined(_WIN64) || defined (_WIN32) /* from winnls.h */ +#define NORM_IGNOREKANATYPE 0x00010000 /* ignore kanatype */ +#define NORM_IGNOREWIDTH 0x00020000 /* ignore width */ +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +#if defined(DOS) || defined(_MAC) + +#define IsBadReadPtr(lp, cb) (FALSE) +#define IsBadWritePtr(lp, cb) (FALSE) +#define IsBadHugeReadPtr(lp, cb) (FALSE) +#define IsBadHugeWritePtr(lp, cb) (FALSE) +#define IsBadCodePtr(lpfn) (FALSE) +#ifdef _MAC +#undef IsBadStringPtr +#endif +#define IsBadStringPtr(lpsz, cchMax) (FALSE) +#define IsBadStringPtrA(lpsz, cchMax) (FALSE) + +#if defined(DOS) + +#define lstrcpyA strcpy +#define lstrlenA strlen +#define lstrcmpA strcmp +#define lstrcmp strcmp +#define lstrcmpi strcmpi +#define lstrcpy strcpy +#define lstrcat strcat +#define lstrlen strlen +#define wsprintf sprintf + +#endif +#endif + +#if defined(DOS) || defined(WIN16) +/* Simulate effect of afx header */ +#define __T(x) x +#define _T(x) __T(x) +#define TEXT _T +#endif + +#define CP_ACP 0 /* default to ANSI code page */ +#define CP_OEMCP 1 /* default to OEM code page */ + +LCID WINAPI MNLS_GetUserDefaultLCID(void); +UINT WINAPI MNLS_GetACP(void); +int WINAPI MNLS_CompareStringA(LCID Locale, DWORD dwCmpFlags, + LPCSTR lpString1, int cchCount1, LPCSTR lpString2, + int cchCount2); +int WINAPI MNLS_CompareStringW(LCID Locale, DWORD dwCmpFlags, + LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, + int cchCount2); +int WINAPI MNLS_MultiByteToWideChar(UINT uCodePage, DWORD dwFlags, + LPCSTR lpMultiByteStr, int cchMultiByte, + LPWSTR lpWideCharStr, int cchWideChar); +int WINAPI MNLS_WideCharToMultiByte(UINT uCodePage, DWORD dwFlags, + LPCWSTR lpWideCharStr, int cchWideChar, + LPSTR lpMultiByteStr, int cchMultiByte, + LPCSTR lpDefaultChar, BOOL FAR *lpfUsedDefaultChar); +int WINAPI MNLS_lstrlenW(LPCWSTR lpString); +int WINAPI MNLS_lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2); +LPWSTR WINAPI MNLS_lstrcpyW(LPWSTR lpString1, LPCWSTR lpString2); +BOOL WINAPI MNLS_IsBadStringPtrW(LPCWSTR lpsz, UINT ucchMax); + +#if (defined (_WIN64) || defined(_WIN32)) && !defined(_WINNT) && !defined(_WIN95) && !defined(_MAC) +#define _WINNT +#endif + +#if !defined(_WINNT) && !defined(_WIN95) +#define GetUserDefaultLCID MNLS_GetUserDefaultLCID +#define GetACP MNLS_GetACP +#define MultiByteToWideChar MNLS_MultiByteToWideChar +#define WideCharToMultiByte MNLS_WideCharToMultiByte +#define CompareStringA MNLS_CompareStringA +#endif + +#if !defined(MAPI_NOWIDECHAR) + +#define lstrlenW MNLS_lstrlenW +#define lstrcmpW MNLS_lstrcmpW +#define lstrcpyW MNLS_lstrcpyW +#define CompareStringW MNLS_CompareStringW + +#if defined(_WINNT) || defined(_WIN95) +#define IsBadStringPtrW MNLS_IsBadStringPtrW +#elif defined(_MAC) +#define IsBadStringPtrW(lpsz, cchMax) (FALSE) +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#define IsBadStringPtrW (FALSE) +#endif + +#endif /* ! MAPI_NOWIDECHAR */ + +#ifdef __cplusplus +} +#endif + +#endif /* _MAPINLS_H_ */ + + diff --git a/comm/mailnews/mapi/include/mapioid.h b/comm/mailnews/mapi/include/mapioid.h new file mode 100644 index 0000000000..8d0536aa75 --- /dev/null +++ b/comm/mailnews/mapi/include/mapioid.h @@ -0,0 +1,106 @@ +/* + * M A P I O I D . H + * + * MAPI OID definition header file + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MAPIOID_ +#define _MAPIOID_ + +/* + * MAPI 1.0 Object Identifiers (OID's) + * + * All MAPI 1.0 OIDs are prefixed by the segment + * + * {iso(1) ansi(2) usa(840) microsoft(113556) mapi(3)} + * + * All MAPI 1.0 tags are also include the addistion segment + * + * {tags(10)} + * + * All MAPI 1.0 encodings are also include the addistion segment + * + * {encodeings(11)} + * + * The set of defined tags are as follows + * + * {{mapiprefix} {tags} {tnef(1)}} MAPI 1.0 TNEF encapsulation tag + * + * {{mapiprefix} {tags} {ole(3)}} MAPI 1.0 OLE prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)}} MAPI 1.0 OLE 1.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v1(1)} {storage(1)}} MAPI 1.0 OLE 1.0 OLESTREAM + * {{mapiprefix} {tags} {ole(3)} {v2(2)}} MAPI 1.0 OLE 2.0 prefix + * {{mapiprefix} {tags} {ole(3)} {v2(2)} {storage(1)}} MAPI 1.0 OLE 2.0 IStorage + * + * The set of defined encodings are as follows + * + * {{mapiprefix} {encodings} {MacBinary(1)}} MAPI 1.0 MacBinary + */ + +#define OID_TAG 0x0A +#define OID_ENCODING 0x0B + +#define DEFINE_OID_1(name, b0, b1) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_2(name, b0, b1, b2) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_3(name, b0, b1, b2, b3) \ + EXTERN_C const BYTE name[] + +#define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ + EXTERN_C const BYTE name[] + +#define CB_OID_1 9 +#define CB_OID_2 10 +#define CB_OID_3 11 +#define CB_OID_4 12 + +#ifdef INITOID +#include <initoid.h> +#endif + +#ifdef USES_OID_TNEF +DEFINE_OID_1(OID_TNEF, OID_TAG, 0x01); +#define CB_OID_TNEF CB_OID_1 +#endif + +#ifdef USES_OID_OLE +DEFINE_OID_1(OID_OLE, OID_TAG, 0x03); +#define CB_OID_OLE CB_OID_1 +#endif + +#ifdef USES_OID_OLE1 +DEFINE_OID_2(OID_OLE1, OID_TAG, 0x03, 0x01); +#define CB_OID_OLE1 CB_OID_2 +#endif + +#ifdef USES_OID_OLE1_STORAGE +DEFINE_OID_3(OID_OLE1_STORAGE, OID_TAG, 0x03, 0x01, 0x01); +#define CB_OID_OLE1_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_OLE2 +DEFINE_OID_2(OID_OLE2, OID_TAG, 0x03, 0x02); +#define CB_OID_OLE2 CB_OID_2 +#endif + +#ifdef USES_OID_OLE2_STORAGE +DEFINE_OID_3(OID_OLE2_STORAGE, OID_TAG, 0x03, 0x02, 0x01); +#define CB_OID_OLE2_STORAGE CB_OID_3 +#endif + +#ifdef USES_OID_MAC_BINARY +DEFINE_OID_1(OID_MAC_BINARY, OID_ENCODING, 0x01); +#define CB_OID_MAC_BINARY CB_OID_1 +#endif + +#ifdef USES_OID_MIMETAG +DEFINE_OID_1(OID_MIMETAG, OID_TAG, 0x04); +#define CB_OID_MIMETAG CB_OID_1 +#endif + +#endif diff --git a/comm/mailnews/mapi/include/mapispi.h b/comm/mailnews/mapi/include/mapispi.h new file mode 100644 index 0000000000..cc326b840a --- /dev/null +++ b/comm/mailnews/mapi/include/mapispi.h @@ -0,0 +1,929 @@ +/* + * M A P I S P I . H + * + * Defines the calls and structures exchanged between MAPI or the spooler + * and the MAPI service providers + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPISPI_H +#define MAPISPI_H +#if _MSC_VER > 1000 +#pragma once +#endif + +/* Include common MAPI header files if they haven't been already. */ +#ifndef MAPIDEFS_H +#include <mapidefs.h> +#endif +#ifndef MAPICODE_H +#include <mapicode.h> +#endif +#ifndef MAPIGUID_H +#include <mapiguid.h> +#endif +#ifndef MAPITAGS_H +#include <mapitags.h> +#endif + + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* The MAPI SPI has a version number. MAPIX.DLL knows and supports + * one or more versions of the SPI. Each provider supports one or + * more versions of the SPI. Checks are performed in both MAPIX.DLL + * and in the provider to ensure that they agree to use exactly one + * version of the MAPI SPI. + * + * The SPI version number is composed of a major (8-bit) version, + * minor (8-bit) version, and micro (16-bit) version. The first + * retail ship of MAPI 1.0 is expected to be version 1.0.0. + * The major version number changes rarely. + * The minor version number changes opon each retail ship of + * MAPI if the SPI has been modified. + * The micro version number changes internally at Microsoft + * during development of MAPI. + * + * The version of the SPI documented by this set of header files + * is ALWAYS known as "CURRENT_SPI_VERSION". If you write a + * service provider, and get a new set of header files, and update + * your code to the new interface, you'll be at the "current" version. + */ +#define CURRENT_SPI_VERSION 0x00010010L + +/* Here are some well-known SPI version numbers: + * (These will eventually be useful for provider-writers who + * might choose to make provider DLLs that support more than + * one version of the MAPI SPI. + */ +#define PDK1_SPI_VERSION 0x00010000L /* 0.1.0 MAPI PDK1 Spring 1993 */ + +#define PDK2_SPI_VERSION 0x00010008L /* 0.1.8 MAPI PDK2 Spring 1994 */ + +#define PDK3_SPI_VERSION 0x00010010L /* 0.1.16 MAPI PDK3 Fall 1994 */ + +/* + * Forward declaration of interface pointers specific to the service + * provider interface. + */ +DECLARE_MAPI_INTERFACE_PTR(IMAPISupport, LPMAPISUP); + +/* IMAPISupport Interface -------------------------------------------------- */ + +/* Notification key structure for the MAPI notification engine */ + +typedef struct +{ + ULONG cb; /* How big the key is */ + BYTE ab[MAPI_DIM]; /* Key contents */ +} NOTIFKEY, FAR * LPNOTIFKEY; + +#define CbNewNOTIFKEY(_cb) (offsetof(NOTIFKEY,ab) + (_cb)) +#define CbNOTIFKEY(_lpkey) (offsetof(NOTIFKEY,ab) + (_lpkey)->cb) +#define SizedNOTIFKEY(_cb, _name) \ + struct _NOTIFKEY_ ## _name \ +{ \ + ULONG cb; \ + BYTE ab[_cb]; \ +} _name + + +/* For Subscribe() */ + +#define NOTIFY_SYNC ((ULONG) 0x40000000) + +/* For Notify() */ + +#define NOTIFY_CANCELED ((ULONG) 0x80000000) + + +/* From the Notification Callback function (well, this is really a ulResult) */ + +#define CALLBACK_DISCONTINUE ((ULONG) 0x80000000) + +/* For Transport's SpoolerNotify() */ + +#define NOTIFY_NEWMAIL ((ULONG) 0x00000001) +#define NOTIFY_READYTOSEND ((ULONG) 0x00000002) +#define NOTIFY_SENTDEFERRED ((ULONG) 0x00000004) +#define NOTIFY_CRITSEC ((ULONG) 0x00001000) +#define NOTIFY_NONCRIT ((ULONG) 0x00002000) +#define NOTIFY_CONFIG_CHANGE ((ULONG) 0x00004000) +#define NOTIFY_CRITICAL_ERROR ((ULONG) 0x10000000) + +/* For Message Store's SpoolerNotify() */ + +#define NOTIFY_NEWMAIL_RECEIVED ((ULONG) 0x20000000) + +/* For ModifyStatusRow() */ + +#define STATUSROW_UPDATE ((ULONG) 0x10000000) + +/* For IStorageFromStream() */ + +#define STGSTRM_RESET ((ULONG) 0x00000000) +#define STGSTRM_CURRENT ((ULONG) 0x10000000) +#define STGSTRM_MODIFY ((ULONG) 0x00000002) +#define STGSTRM_CREATE ((ULONG) 0x00001000) + +/* For GetOneOffTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* For CreateOneOff() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ +/****** MAPI_SEND_NO_RICH_INFO ((ULONG) 0x00010000) */ + +/* For ReadReceipt() */ +#define MAPI_NON_READ ((ULONG) 0x00000001) + +/* For DoConfigPropSheet() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* Preprocessor calls: */ + +/* PreprocessMessage, first ordinal in RegisterPreprocessor(). */ + +typedef HRESULT (STDMETHODCALLTYPE PREPROCESSMESSAGE)( + LPVOID lpvSession, + LPMESSAGE lpMessage, + LPADRBOOK lpAdrBook, + LPMAPIFOLDER lpFolder, + LPALLOCATEBUFFER AllocateBuffer, + LPALLOCATEMORE AllocateMore, + LPFREEBUFFER FreeBuffer, + ULONG FAR *lpcOutbound, + LPMESSAGE FAR * FAR *lpppMessage, + LPADRLIST FAR *lppRecipList); + +/* RemovePreprocessInfo, second ordinal in RegisterPreprocessor(). */ + +typedef HRESULT (STDMETHODCALLTYPE REMOVEPREPROCESSINFO)(LPMESSAGE lpMessage); + +/* Function pointer for GetReleaseInfo */ + +#define MAPI_IMAPISUPPORT_METHODS1(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetMemAllocRoutines) \ + (THIS_ LPALLOCATEBUFFER FAR * lpAllocateBuffer, \ + LPALLOCATEMORE FAR * lpAllocateMore, \ + LPFREEBUFFER FAR * lpFreeBuffer) IPURE; \ + MAPIMETHOD(Subscribe) \ + (THIS_ LPNOTIFKEY lpKey, \ + ULONG ulEventMask, \ + ULONG ulFlags, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unsubscribe) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(Notify) \ + (THIS_ LPNOTIFKEY lpKey, \ + ULONG cNotification, \ + LPNOTIFICATION lpNotifications, \ + ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(ModifyStatusRow) \ + (THIS_ ULONG cValues, \ + LPSPropValue lpColumnVals, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(OpenProfileSection) \ + (THIS_ LPMAPIUID lpUid, \ + ULONG ulFlags, \ + LPPROFSECT FAR * lppProfileObj) IPURE; \ + MAPIMETHOD(RegisterPreprocessor) \ + (THIS_ LPMAPIUID lpMuid, \ + LPTSTR lpszAdrType, \ + LPTSTR lpszDLLName, \ + LPSTR /* String8! */ lpszPreprocess, \ + LPSTR /* String8! */ lpszRemovePreprocessInfo, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(NewUID) \ + (THIS_ LPMAPIUID lpMuid) IPURE; \ + MAPIMETHOD(MakeInvalid) \ + (THIS_ ULONG ulFlags, \ + LPVOID lpObject, \ + ULONG ulRefCount, \ + ULONG cMethods) IPURE; \ + +#define MAPI_IMAPISUPPORT_METHODS2(IPURE) \ + MAPIMETHOD(SpoolerYield) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(SpoolerNotify) \ + (THIS_ ULONG ulFlags, \ + LPVOID lpvData) IPURE; \ + MAPIMETHOD(CreateOneOff) \ + (THIS_ LPTSTR lpszName, \ + LPTSTR lpszAdrType, \ + LPTSTR lpszAddress, \ + ULONG ulFlags, \ + ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID) IPURE; \ + MAPIMETHOD(SetProviderUID) \ + (THIS_ LPMAPIUID lpProviderID, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntry1, \ + LPENTRYID lpEntry1, \ + ULONG cbEntry2, \ + LPENTRYID lpEntry2, \ + ULONG ulCompareFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(OpenTemplateID) \ + (THIS_ ULONG cbTemplateID, \ + LPENTRYID lpTemplateID, \ + ULONG ulTemplateFlags, \ + LPMAPIPROP lpMAPIPropData, \ + LPCIID lpInterface, \ + LPMAPIPROP FAR * lppMAPIPropNew, \ + LPMAPIPROP lpMAPIPropSibling) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulOpenFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(GetOneOffTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(Address) \ + (THIS_ ULONG_PTR FAR * lpulUIParam, \ + LPADRPARM lpAdrParms, \ + LPADRLIST FAR * lppAdrList) IPURE; \ + MAPIMETHOD(Details) \ + (THIS_ ULONG_PTR FAR * lpulUIParam, \ + LPFNDISMISS lpfnDismiss, \ + LPVOID lpvDismissContext, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPFNBUTTON lpfButtonCallback, \ + LPVOID lpvButtonContext, \ + LPTSTR lpszButtonText, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(NewEntry) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + ULONG cbEIDContainer, \ + LPENTRYID lpEIDContainer, \ + ULONG cbEIDNewEntryTpl, \ + LPENTRYID lpEIDNewEntryTpl, \ + ULONG FAR * lpcbEIDNewEntry, \ + LPENTRYID FAR * lppEIDNewEntry) IPURE; \ + MAPIMETHOD(DoConfigPropsheet) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPTSTR lpszTitle, \ + LPMAPITABLE lpDisplayTable, \ + LPMAPIPROP lpCOnfigData, \ + ULONG ulTopPage) IPURE; \ + MAPIMETHOD(CopyMessages) \ + (THIS_ LPCIID lpSrcInterface, \ + LPVOID lpSrcFolder, \ + LPENTRYLIST lpMsgList, \ + LPCIID lpDestInterface, \ + LPVOID lpDestFolder, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(CopyFolder) \ + (THIS_ LPCIID lpSrcInterface, \ + LPVOID lpSrcFolder, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpDestInterface, \ + LPVOID lpDestFolder, \ + LPTSTR lszNewFolderName, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + ULONG ulFlags) IPURE; \ + +#define MAPI_IMAPISUPPORT_METHODS3(IPURE) \ + MAPIMETHOD(DoCopyTo) \ + (THIS_ LPCIID lpSrcInterface, \ + LPVOID lpSrcObj, \ + ULONG ciidExclude, \ + LPCIID rgiidExclude, \ + LPSPropTagArray lpExcludeProps, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + LPCIID lpDestInterface, \ + LPVOID lpDestObj, \ + ULONG ulFlags, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(DoCopyProps) \ + (THIS_ LPCIID lpSrcInterface, \ + LPVOID lpSrcObj, \ + LPSPropTagArray lpIncludeProps, \ + ULONG_PTR ulUIParam, \ + LPMAPIPROGRESS lpProgress, \ + LPCIID lpDestInterface, \ + LPVOID lpDestObj, \ + ULONG ulFlags, \ + LPSPropProblemArray FAR * lppProblems) IPURE; \ + MAPIMETHOD(DoProgressDialog) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPMAPIPROGRESS FAR * lppProgress) IPURE; \ + MAPIMETHOD(ReadReceipt) \ + (THIS_ ULONG ulFlags, \ + LPMESSAGE lpReadMessage, \ + LPMESSAGE FAR * lppEmptyMessage) IPURE; \ + MAPIMETHOD(PrepareSubmit) \ + (THIS_ LPMESSAGE lpMessage, \ + ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(ExpandRecips) \ + (THIS_ LPMESSAGE lpMessage, \ + ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(UpdatePAB) \ + (THIS_ ULONG ulFlags, \ + LPMESSAGE lpMessage) IPURE; \ + MAPIMETHOD(DoSentMail) \ + (THIS_ ULONG ulFlags, \ + LPMESSAGE lpMessage) IPURE; \ + MAPIMETHOD(OpenAddressBook) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + LPADRBOOK FAR * lppAdrBook) IPURE; \ + MAPIMETHOD(Preprocess) \ + (THIS_ ULONG ulFlags, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(CompleteMsg) \ + (THIS_ ULONG ulFlags, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(StoreLogoffTransports) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(StatusRecips) \ + (THIS_ LPMESSAGE lpMessage, \ + LPADRLIST lpRecipList) IPURE; \ + MAPIMETHOD(WrapStoreEntryID) \ + (THIS_ ULONG cbOrigEntry, \ + LPENTRYID lpOrigEntry, \ + ULONG FAR * lpcbWrappedEntry, \ + LPENTRYID FAR * lppWrappedEntry) IPURE; \ + MAPIMETHOD(ModifyProfile) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(IStorageFromStream) \ + (THIS_ LPUNKNOWN lpUnkIn, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPSTORAGE FAR * lppStorageOut) IPURE; \ + MAPIMETHOD(GetSvcConfigSupportObj) \ + (THIS_ ULONG ulFlags, \ + LPMAPISUP FAR * lppSvcSupport) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMAPISupport +DECLARE_MAPI_INTERFACE_(IMAPISupport, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPISUPPORT_METHODS1(PURE) + MAPI_IMAPISUPPORT_METHODS2(PURE) + MAPI_IMAPISUPPORT_METHODS3(PURE) +}; + + +/********************************************************************/ +/* */ +/* ADDRESS BOOK SPI */ +/* */ +/********************************************************************/ + +/* Address Book Provider ------------------------------------------------- */ + +/* OpenTemplateID() */ +#define FILL_ENTRY ((ULONG) 0x00000001) + +/* For Logon() */ + +/*#define AB_NO_DIALOG ((ULONG) 0x00000001) in mapidefs.h */ +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ + + + +DECLARE_MAPI_INTERFACE_PTR(IABProvider, LPABPROVIDER); +DECLARE_MAPI_INTERFACE_PTR(IABLogon, LPABLOGON); + +#define MAPI_IABPROVIDER_METHODS(IPURE) \ + MAPIMETHOD(Shutdown) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(Logon) \ + (THIS_ LPMAPISUP lpMAPISup, \ + ULONG_PTR ulUIParam, \ + LPTSTR lpszProfileName, \ + ULONG ulFlags, \ + ULONG FAR * lpulpcbSecurity, \ + LPBYTE FAR * lppbSecurity, \ + LPMAPIERROR FAR * lppMAPIError, \ + LPABLOGON FAR * lppABLogon) IPURE; \ + +#undef INTERFACE +#define INTERFACE IABProvider +DECLARE_MAPI_INTERFACE_(IABProvider, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IABPROVIDER_METHODS(PURE) +}; + +/* For GetOneOffTable() */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +#define MAPI_IABLOGON_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(Logoff) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(OpenStatusEntry) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPMAPISTATUS FAR * lppEntry) IPURE; \ + MAPIMETHOD(OpenTemplateID) \ + (THIS_ ULONG cbTemplateID, \ + LPENTRYID lpTemplateID, \ + ULONG ulTemplateFlags, \ + LPMAPIPROP lpMAPIPropData, \ + LPCIID lpInterface, \ + LPMAPIPROP FAR * lppMAPIPropNew, \ + LPMAPIPROP lpMAPIPropSibling) IPURE; \ + MAPIMETHOD(GetOneOffTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(PrepareRecips) \ + (THIS_ ULONG ulFlags, \ + LPSPropTagArray lpPropTagArray, \ + LPADRLIST lpRecipList) IPURE; \ + +#undef INTERFACE +#define INTERFACE IABLogon +DECLARE_MAPI_INTERFACE_(IABLogon, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IABLOGON_METHODS(PURE) +}; + +typedef HRESULT (STDMAPIINITCALLTYPE ABPROVIDERINIT)( + HINSTANCE hInstance, + LPMALLOC lpMalloc, + LPALLOCATEBUFFER lpAllocateBuffer, + LPALLOCATEMORE lpAllocateMore, + LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, + ULONG ulMAPIVer, + ULONG FAR * lpulProviderVer, + LPABPROVIDER FAR * lppABProvider +); + +ABPROVIDERINIT ABProviderInit; + + + +/********************************************************************/ +/* */ +/* TRANSPORT SPI */ +/* */ +/********************************************************************/ + +/* For DeinitTransport */ + +#define DEINIT_NORMAL ((ULONG) 0x00000001) +#define DEINIT_HURRY ((ULONG) 0x80000000) + +/* For TransportLogon */ + +/* Flags that the Spooler may pass to the transport: */ + +#define LOGON_NO_DIALOG ((ULONG) 0x00000001) +#define LOGON_NO_CONNECT ((ULONG) 0x00000004) +#define LOGON_NO_INBOUND ((ULONG) 0x00000008) +#define LOGON_NO_OUTBOUND ((ULONG) 0x00000010) +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ + +/* Flags that the transport may pass to the Spooler: */ + +#define LOGON_SP_IDLE ((ULONG) 0x00010000) +#define LOGON_SP_POLL ((ULONG) 0x00020000) +#define LOGON_SP_RESOLVE ((ULONG) 0x00040000) + + +DECLARE_MAPI_INTERFACE_PTR(IXPProvider, LPXPPROVIDER); +DECLARE_MAPI_INTERFACE_PTR(IXPLogon, LPXPLOGON); + +#define MAPI_IXPPROVIDER_METHODS(IPURE) \ + MAPIMETHOD(Shutdown) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(TransportLogon) \ + (THIS_ LPMAPISUP lpMAPISup, \ + ULONG_PTR ulUIParam, \ + __in LPTSTR lpszProfileName, \ + ULONG FAR * lpulFlags, \ + LPMAPIERROR FAR * lppMAPIError, \ + LPXPLOGON FAR * lppXPLogon) IPURE; \ + +#undef INTERFACE +#define INTERFACE IXPProvider +DECLARE_MAPI_INTERFACE_(IXPProvider, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IXPPROVIDER_METHODS(PURE) +}; + +/* OptionData returned from call to RegisterOptions */ + +#define OPTION_TYPE_RECIPIENT ((ULONG) 0x00000001) +#define OPTION_TYPE_MESSAGE ((ULONG) 0x00000002) + +typedef struct _OPTIONDATA +{ + ULONG ulFlags; /* MAPI_RECIPIENT, MAPI_MESSAGE */ + LPGUID lpRecipGUID; /* Same as returned by AddressTypes() */ + LPTSTR lpszAdrType; /* Same as returned by AddressTypes() */ + LPTSTR lpszDLLName; /* Options DLL */ + ULONG ulOrdinal; /* Ordinal in that DLL */ + ULONG cbOptionsData; /* Count of bytes in lpbOptionsData */ + LPBYTE lpbOptionsData; /* Providers per [recip|message] option data */ + ULONG cOptionsProps; /* Count of Options default prop values */ + LPSPropValue lpOptionsProps; /* Default Options property values */ +} OPTIONDATA, FAR *LPOPTIONDATA; + +typedef SCODE (STDMAPIINITCALLTYPE OPTIONCALLBACK)( + HINSTANCE hInst, + LPMALLOC lpMalloc, + ULONG ulFlags, + ULONG cbOptionData, + LPBYTE lpbOptionData, + LPMAPISUP lpMAPISup, + LPMAPIPROP lpDataSource, + LPMAPIPROP FAR * lppWrappedSource, + LPMAPIERROR FAR * lppMAPIError); + +/* For XP_AddressTypes */ + +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ + +/* For XP_RegisterRecipOptions */ + +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ + +/* For XP_RegisterMessageOptions */ + +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ + +/* For TransportNotify */ + +#define NOTIFY_ABORT_DEFERRED ((ULONG) 0x40000000) +#define NOTIFY_CANCEL_MESSAGE ((ULONG) 0x80000000) +#define NOTIFY_BEGIN_INBOUND ((ULONG) 0x00000001) +#define NOTIFY_END_INBOUND ((ULONG) 0x00010000) +#define NOTIFY_BEGIN_OUTBOUND ((ULONG) 0x00000002) +#define NOTIFY_END_OUTBOUND ((ULONG) 0x00020000) +#define NOTIFY_BEGIN_INBOUND_FLUSH ((ULONG) 0x00000004) +#define NOTIFY_END_INBOUND_FLUSH ((ULONG) 0x00040000) +#define NOTIFY_BEGIN_OUTBOUND_FLUSH ((ULONG) 0x00000008) +#define NOTIFY_END_OUTBOUND_FLUSH ((ULONG) 0x00080000) + +/* For TransportLogoff */ + +#define LOGOFF_NORMAL ((ULONG) 0x00000001) +#define LOGOFF_HURRY ((ULONG) 0x80000000) + +/* For SubmitMessage */ + +#define BEGIN_DEFERRED ((ULONG) 0x00000001) + +/* For EndMessage */ + +/* Flags that the Spooler may pass to the Transport: */ + +/* Flags that the transport may pass to the Spooler: */ + +#define END_RESEND_NOW ((ULONG) 0x00010000) +#define END_RESEND_LATER ((ULONG) 0x00020000) +#define END_DONT_RESEND ((ULONG) 0x00040000) + +#define MAPI_IXPLOGON_METHODS(IPURE) \ + MAPIMETHOD(AddressTypes) \ + (THIS_ ULONG FAR * lpulFlags, \ + ULONG FAR * lpcAdrType, \ + __deref_out_ecount_full(*lpcAdrType) LPTSTR FAR * FAR * lpppAdrTypeArray, \ + ULONG FAR * lpcMAPIUID, \ + LPMAPIUID FAR * FAR * lpppUIDArray) IPURE; \ + MAPIMETHOD(RegisterOptions) \ + (THIS_ ULONG FAR * lpulFlags, \ + ULONG FAR * lpcOptions, \ + LPOPTIONDATA FAR * lppOptions) IPURE; \ + MAPIMETHOD(TransportNotify) \ + (THIS_ ULONG FAR * lpulFlags, \ + LPVOID FAR * lppvData) IPURE; \ + MAPIMETHOD(Idle) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(TransportLogoff) \ + (THIS_ ULONG ulFlags) IPURE; \ + MAPIMETHOD(SubmitMessage) \ + (THIS_ ULONG ulFlags, \ + LPMESSAGE lpMessage, \ + ULONG_PTR FAR * lpulMsgRef, \ + ULONG_PTR FAR * lpulReturnParm) IPURE; \ + MAPIMETHOD(EndMessage) \ + (THIS_ ULONG_PTR ulMsgRef, \ + ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(Poll) \ + (THIS_ ULONG FAR * lpulIncoming) IPURE; \ + MAPIMETHOD(StartMessage) \ + (THIS_ ULONG ulFlags, \ + LPMESSAGE lpMessage, \ + ULONG_PTR FAR * lpulMsgRef) IPURE; \ + MAPIMETHOD(OpenStatusEntry) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPMAPISTATUS FAR * lppEntry) IPURE; \ + MAPIMETHOD(ValidateState) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(FlushQueues) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG cbTargetTransport, \ + LPENTRYID lpTargetTransport, \ + ULONG ulFlags) IPURE; \ + +#undef INTERFACE +#define INTERFACE IXPLogon +DECLARE_MAPI_INTERFACE_(IXPLogon, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IXPLOGON_METHODS(PURE) +}; + + +/* Transport Provider Entry Point */ + +typedef HRESULT (STDMAPIINITCALLTYPE XPPROVIDERINIT)( + HINSTANCE hInstance, + LPMALLOC lpMalloc, + LPALLOCATEBUFFER lpAllocateBuffer, + LPALLOCATEMORE lpAllocateMore, + LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, + ULONG ulMAPIVer, + ULONG FAR * lpulProviderVer, + LPXPPROVIDER FAR * lppXPProvider); + +XPPROVIDERINIT XPProviderInit; + +/********************************************************************/ +/* */ +/* MESSAGE STORE SPI */ +/* */ +/********************************************************************/ + +/* Flags and enums */ + +/* For Logon() */ + +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ +/*#define MDB_NO_DIALOG ((ULONG) 0x00000001) in mapidefs.h */ +/*#define MDB_WRITE ((ULONG) 0x00000004) in mapidefs.h */ +/*#define MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) in mapidefs.h */ +/*#define MDB_TEMPORARY ((ULONG) 0x00000020) in mapidefs.h */ +/*#define MDB_NO_MAIL ((ULONG) 0x00000080) in mapidefs.h */ + +/* For SpoolerLogon() */ + +/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */ +/*#define MDB_NO_DIALOG ((ULONG) 0x00000001) in mapidefs.h */ +/*#define MDB_WRITE ((ULONG) 0x00000004) in mapidefs.h */ +/*#define MAPI_DEFERRED_ERRORS ((ULONG) 0x00000008) in mapidefs.h */ + +/* GetCredentials, SetCredentials */ + +#define LOGON_SP_TRANSPORT ((ULONG) 0x00000001) +#define LOGON_SP_PROMPT ((ULONG) 0x00000002) +#define LOGON_SP_NEWPW ((ULONG) 0x00000004) +#define LOGON_CHANGED ((ULONG) 0x00000008) + +/* DoMCDialog */ + +#define DIALOG_FOLDER ((ULONG) 0x00000001) +#define DIALOG_MESSAGE ((ULONG) 0x00000002) +#define DIALOG_PROP ((ULONG) 0x00000004) +#define DIALOG_ATTACH ((ULONG) 0x00000008) + +#define DIALOG_MOVE ((ULONG) 0x00000010) +#define DIALOG_COPY ((ULONG) 0x00000020) +#define DIALOG_DELETE ((ULONG) 0x00000040) + +#define DIALOG_ALLOW_CANCEL ((ULONG) 0x00000080) +#define DIALOG_CONFIRM_CANCEL ((ULONG) 0x00000100) + +/* ExpandRecips */ + +#define NEEDS_PREPROCESSING ((ULONG) 0x00000001) +#define NEEDS_SPOOLER ((ULONG) 0x00000002) + +/* PrepareSubmit */ + +#define CHECK_SENDER ((ULONG) 0x00000001) +#define NON_STANDARD ((ULONG) 0x00010000) + + +DECLARE_MAPI_INTERFACE_PTR(IMSLogon, LPMSLOGON); +DECLARE_MAPI_INTERFACE_PTR(IMSProvider, LPMSPROVIDER); + +/* Message Store Provider Interface (IMSPROVIDER) */ + +#define MAPI_IMSPROVIDER_METHODS(IPURE) \ + MAPIMETHOD(Shutdown) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(Logon) \ + (THIS_ LPMAPISUP lpMAPISup, \ + ULONG_PTR ulUIParam, \ + LPTSTR lpszProfileName, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulFlags, \ + LPCIID lpInterface, \ + ULONG FAR * lpcbSpoolSecurity, \ + LPBYTE FAR * lppbSpoolSecurity, \ + LPMAPIERROR FAR * lppMAPIError, \ + LPMSLOGON FAR * lppMSLogon, \ + LPMDB FAR * lppMDB) IPURE; \ + MAPIMETHOD(SpoolerLogon) \ + (THIS_ LPMAPISUP lpMAPISup, \ + ULONG_PTR ulUIParam, \ + LPTSTR lpszProfileName, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulFlags, \ + LPCIID lpInterface, \ + ULONG cbSpoolSecurity, \ + LPBYTE lpbSpoolSecurity, \ + LPMAPIERROR FAR * lppMAPIError, \ + LPMSLOGON FAR * lppMSLogon, \ + LPMDB FAR * lppMDB) IPURE; \ + MAPIMETHOD(CompareStoreIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMSProvider +DECLARE_MAPI_INTERFACE_(IMSProvider, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMSPROVIDER_METHODS(PURE) +}; + +/* The MSLOGON object is returned by the Logon() method of the + * MSPROVIDER interface. This object is for use by MAPIX.DLL. + */ +#define MAPI_IMSLOGON_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(Logoff) \ + (THIS_ ULONG FAR * lpulFlags) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(OpenStatusEntry) \ + (THIS_ LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPVOID FAR * lppEntry) IPURE; \ + +#undef INTERFACE +#define INTERFACE IMSLogon +DECLARE_MAPI_INTERFACE_(IMSLogon, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMSLOGON_METHODS(PURE) +}; + +/* Message Store Provider Entry Point */ + +typedef HRESULT (STDMAPIINITCALLTYPE MSPROVIDERINIT)( + HINSTANCE hInstance, + LPMALLOC lpMalloc, /* AddRef() if you keep it */ + LPALLOCATEBUFFER lpAllocateBuffer, /* -> AllocateBuffer */ + LPALLOCATEMORE lpAllocateMore, /* -> AllocateMore */ + LPFREEBUFFER lpFreeBuffer, /* -> FreeBuffer */ + ULONG ulFlags, + ULONG ulMAPIVer, + ULONG FAR * lpulProviderVer, + LPMSPROVIDER FAR * lppMSProvider +); + +MSPROVIDERINIT MSProviderInit; + + +/********************************************************************/ +/* */ +/* MESSAGE SERVICE CONFIGURATION */ +/* */ +/********************************************************************/ + +/* Flags for service configuration entry point */ + +/* #define MAPI_UNICODE 0x80000000 */ +/* #define SERVICE_UI_ALWAYS 0x00000002 */ +/* #define SERVICE_UI_ALLOWED 0x00000010 */ +#define MSG_SERVICE_UI_READ_ONLY 0x00000008 /* display parameters only */ +#define SERVICE_LOGON_FAILED 0x00000020 /* reconfigure provider */ + +/* Contexts for service configuration entry point */ + +#define MSG_SERVICE_INSTALL 0x00000001 +#define MSG_SERVICE_CREATE 0x00000002 +#define MSG_SERVICE_CONFIGURE 0x00000003 +#define MSG_SERVICE_DELETE 0x00000004 +#define MSG_SERVICE_UNINSTALL 0x00000005 +#define MSG_SERVICE_PROVIDER_CREATE 0x00000006 +#define MSG_SERVICE_PROVIDER_DELETE 0x00000007 + +/* Prototype for service configuration entry point */ + +typedef HRESULT (STDAPICALLTYPE MSGSERVICEENTRY)( + HINSTANCE hInstance, + LPMALLOC lpMalloc, + LPMAPISUP lpMAPISup, + ULONG_PTR ulUIParam, + ULONG ulFlags, + ULONG ulContext, + ULONG cValues, + LPSPropValue lpProps, + LPPROVIDERADMIN lpProviderAdmin, + LPMAPIERROR FAR *lppMapiError +); +typedef MSGSERVICEENTRY FAR *LPMSGSERVICEENTRY; + + +#ifdef __cplusplus +} +#endif + +#endif /* MAPISPI_H */ + diff --git a/comm/mailnews/mapi/include/mapitags.h b/comm/mailnews/mapi/include/mapitags.h new file mode 100644 index 0000000000..a259cfccd9 --- /dev/null +++ b/comm/mailnews/mapi/include/mapitags.h @@ -0,0 +1,1036 @@ +/* + * M A P I T A G S . H + * + * Property tag definitions for standard properties of MAPI + * objects. + * + * The following ranges should be used for all property IDs. Note that + * property IDs for objects other than messages and recipients should + * all fall in the range 0x3000 to 0x3FFF: + * + * From To Kind of property + * -------------------------------- + * 0001 0BFF MAPI_defined envelope property + * 0C00 0DFF MAPI_defined per-recipient property + * 0E00 0FFF MAPI_defined non-transmittable property + * 1000 2FFF MAPI_defined message content property + * + * 3000 3FFF MAPI_defined property (usually not message or recipient) + * + * 4000 57FF Transport-defined envelope property + * 5800 5FFF Transport-defined per-recipient property + * 6000 65FF User-defined non-transmittable property + * 6600 67FF Provider-defined internal non-transmittable property + * 6800 7BFF Message class-defined content property + * 7C00 7FFF Message class-defined non-transmittable + * property + * + * 8000 FFFE User-defined Name-to-id mapped property + * + * The 3000-3FFF range is further subdivided as follows: + * + * From To Kind of property + * -------------------------------- + * 3000 33FF Common property such as display name, entry ID + * 3400 35FF Message store object + * 3600 36FF Folder or AB container + * 3700 38FF Attachment + * 3900 39FF Address book object + * 3A00 3BFF Mail user + * 3C00 3CFF Distribution list + * 3D00 3DFF Profile section + * 3E00 3FFF Status object + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPITAGS_H +#define MAPITAGS_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +/* Determine if a property is transmittable. */ + +#define FIsTransmittable(ulPropTag) \ + ((PROP_ID (ulPropTag) < (ULONG)0x0E00) || \ + (PROP_ID (ulPropTag) >= (ULONG)0x8000) || \ + ((PROP_ID (ulPropTag) >= (ULONG)0x1000) && (PROP_ID (ulPropTag) < (ULONG)0x6000)) || \ + ((PROP_ID (ulPropTag) >= (ULONG)0x6800) && (PROP_ID (ulPropTag) < (ULONG)0x7C00))) + +/* + * Message envelope properties + */ + +#define PR_ACKNOWLEDGEMENT_MODE PROP_TAG( PT_LONG, 0x0001) +#define PR_ALTERNATE_RECIPIENT_ALLOWED PROP_TAG( PT_BOOLEAN, 0x0002) +#define PR_AUTHORIZING_USERS PROP_TAG( PT_BINARY, 0x0003) +#define PR_AUTO_FORWARD_COMMENT PROP_TAG( PT_TSTRING, 0x0004) +#define PR_AUTO_FORWARD_COMMENT_W PROP_TAG( PT_UNICODE, 0x0004) +#define PR_AUTO_FORWARD_COMMENT_A PROP_TAG( PT_STRING8, 0x0004) +#define PR_AUTO_FORWARDED PROP_TAG( PT_BOOLEAN, 0x0005) +#define PR_CONTENT_CONFIDENTIALITY_ALGORITHM_ID PROP_TAG( PT_BINARY, 0x0006) +#define PR_CONTENT_CORRELATOR PROP_TAG( PT_BINARY, 0x0007) +#define PR_CONTENT_IDENTIFIER PROP_TAG( PT_TSTRING, 0x0008) +#define PR_CONTENT_IDENTIFIER_W PROP_TAG( PT_UNICODE, 0x0008) +#define PR_CONTENT_IDENTIFIER_A PROP_TAG( PT_STRING8, 0x0008) +#define PR_CONTENT_LENGTH PROP_TAG( PT_LONG, 0x0009) +#define PR_CONTENT_RETURN_REQUESTED PROP_TAG( PT_BOOLEAN, 0x000A) + + + +#define PR_CONVERSATION_KEY PROP_TAG( PT_BINARY, 0x000B) + +#define PR_CONVERSION_EITS PROP_TAG( PT_BINARY, 0x000C) +#define PR_CONVERSION_WITH_LOSS_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x000D) +#define PR_CONVERTED_EITS PROP_TAG( PT_BINARY, 0x000E) +#define PR_DEFERRED_DELIVERY_TIME PROP_TAG( PT_SYSTIME, 0x000F) +#define PR_DELIVER_TIME PROP_TAG( PT_SYSTIME, 0x0010) +#define PR_DISCARD_REASON PROP_TAG( PT_LONG, 0x0011) +#define PR_DISCLOSURE_OF_RECIPIENTS PROP_TAG( PT_BOOLEAN, 0x0012) +#define PR_DL_EXPANSION_HISTORY PROP_TAG( PT_BINARY, 0x0013) +#define PR_DL_EXPANSION_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x0014) +#define PR_EXPIRY_TIME PROP_TAG( PT_SYSTIME, 0x0015) +#define PR_IMPLICIT_CONVERSION_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x0016) +#define PR_IMPORTANCE PROP_TAG( PT_LONG, 0x0017) +#define PR_IPM_ID PROP_TAG( PT_BINARY, 0x0018) +#define PR_LATEST_DELIVERY_TIME PROP_TAG( PT_SYSTIME, 0x0019) +#define PR_MESSAGE_CLASS PROP_TAG( PT_TSTRING, 0x001A) +#define PR_MESSAGE_CLASS_W PROP_TAG( PT_UNICODE, 0x001A) +#define PR_MESSAGE_CLASS_A PROP_TAG( PT_STRING8, 0x001A) +#define PR_MESSAGE_DELIVERY_ID PROP_TAG( PT_BINARY, 0x001B) + + + + + +#define PR_MESSAGE_SECURITY_LABEL PROP_TAG( PT_BINARY, 0x001E) +#define PR_OBSOLETED_IPMS PROP_TAG( PT_BINARY, 0x001F) +#define PR_ORIGINALLY_INTENDED_RECIPIENT_NAME PROP_TAG( PT_BINARY, 0x0020) +#define PR_ORIGINAL_EITS PROP_TAG( PT_BINARY, 0x0021) +#define PR_ORIGINATOR_CERTIFICATE PROP_TAG( PT_BINARY, 0x0022) +#define PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0023) +#define PR_ORIGINATOR_RETURN_ADDRESS PROP_TAG( PT_BINARY, 0x0024) + + + +#define PR_PARENT_KEY PROP_TAG( PT_BINARY, 0x0025) +#define PR_PRIORITY PROP_TAG( PT_LONG, 0x0026) + + + +#define PR_ORIGIN_CHECK PROP_TAG( PT_BINARY, 0x0027) +#define PR_PROOF_OF_SUBMISSION_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0028) +#define PR_READ_RECEIPT_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0029) +#define PR_RECEIPT_TIME PROP_TAG( PT_SYSTIME, 0x002A) +#define PR_RECIPIENT_REASSIGNMENT_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x002B) +#define PR_REDIRECTION_HISTORY PROP_TAG( PT_BINARY, 0x002C) +#define PR_RELATED_IPMS PROP_TAG( PT_BINARY, 0x002D) +#define PR_ORIGINAL_SENSITIVITY PROP_TAG( PT_LONG, 0x002E) +#define PR_LANGUAGES PROP_TAG( PT_TSTRING, 0x002F) +#define PR_LANGUAGES_W PROP_TAG( PT_UNICODE, 0x002F) +#define PR_LANGUAGES_A PROP_TAG( PT_STRING8, 0x002F) +#define PR_REPLY_TIME PROP_TAG( PT_SYSTIME, 0x0030) +#define PR_REPORT_TAG PROP_TAG( PT_BINARY, 0x0031) +#define PR_REPORT_TIME PROP_TAG( PT_SYSTIME, 0x0032) +#define PR_RETURNED_IPM PROP_TAG( PT_BOOLEAN, 0x0033) +#define PR_SECURITY PROP_TAG( PT_LONG, 0x0034) +#define PR_INCOMPLETE_COPY PROP_TAG( PT_BOOLEAN, 0x0035) +#define PR_SENSITIVITY PROP_TAG( PT_LONG, 0x0036) +#define PR_SUBJECT PROP_TAG( PT_TSTRING, 0x0037) +#define PR_SUBJECT_W PROP_TAG( PT_UNICODE, 0x0037) +#define PR_SUBJECT_A PROP_TAG( PT_STRING8, 0x0037) +#define PR_SUBJECT_IPM PROP_TAG( PT_BINARY, 0x0038) +#define PR_CLIENT_SUBMIT_TIME PROP_TAG( PT_SYSTIME, 0x0039) +#define PR_REPORT_NAME PROP_TAG( PT_TSTRING, 0x003A) +#define PR_REPORT_NAME_W PROP_TAG( PT_UNICODE, 0x003A) +#define PR_REPORT_NAME_A PROP_TAG( PT_STRING8, 0x003A) +#define PR_SENT_REPRESENTING_SEARCH_KEY PROP_TAG( PT_BINARY, 0x003B) +#define PR_X400_CONTENT_TYPE PROP_TAG( PT_BINARY, 0x003C) +#define PR_SUBJECT_PREFIX PROP_TAG( PT_TSTRING, 0x003D) +#define PR_SUBJECT_PREFIX_W PROP_TAG( PT_UNICODE, 0x003D) +#define PR_SUBJECT_PREFIX_A PROP_TAG( PT_STRING8, 0x003D) +#define PR_NON_RECEIPT_REASON PROP_TAG( PT_LONG, 0x003E) +#define PR_RECEIVED_BY_ENTRYID PROP_TAG( PT_BINARY, 0x003F) +#define PR_RECEIVED_BY_NAME PROP_TAG( PT_TSTRING, 0x0040) +#define PR_RECEIVED_BY_NAME_W PROP_TAG( PT_UNICODE, 0x0040) +#define PR_RECEIVED_BY_NAME_A PROP_TAG( PT_STRING8, 0x0040) +#define PR_SENT_REPRESENTING_ENTRYID PROP_TAG( PT_BINARY, 0x0041) +#define PR_SENT_REPRESENTING_NAME PROP_TAG( PT_TSTRING, 0x0042) +#define PR_SENT_REPRESENTING_NAME_W PROP_TAG( PT_UNICODE, 0x0042) +#define PR_SENT_REPRESENTING_NAME_A PROP_TAG( PT_STRING8, 0x0042) +#define PR_RCVD_REPRESENTING_ENTRYID PROP_TAG( PT_BINARY, 0x0043) +#define PR_RCVD_REPRESENTING_NAME PROP_TAG( PT_TSTRING, 0x0044) +#define PR_RCVD_REPRESENTING_NAME_W PROP_TAG( PT_UNICODE, 0x0044) +#define PR_RCVD_REPRESENTING_NAME_A PROP_TAG( PT_STRING8, 0x0044) +#define PR_REPORT_ENTRYID PROP_TAG( PT_BINARY, 0x0045) +#define PR_READ_RECEIPT_ENTRYID PROP_TAG( PT_BINARY, 0x0046) +#define PR_MESSAGE_SUBMISSION_ID PROP_TAG( PT_BINARY, 0x0047) +#define PR_PROVIDER_SUBMIT_TIME PROP_TAG( PT_SYSTIME, 0x0048) +#define PR_ORIGINAL_SUBJECT PROP_TAG( PT_TSTRING, 0x0049) +#define PR_ORIGINAL_SUBJECT_W PROP_TAG( PT_UNICODE, 0x0049) +#define PR_ORIGINAL_SUBJECT_A PROP_TAG( PT_STRING8, 0x0049) +#define PR_DISC_VAL PROP_TAG( PT_BOOLEAN, 0x004A) +#define PR_ORIG_MESSAGE_CLASS PROP_TAG( PT_TSTRING, 0x004B) +#define PR_ORIG_MESSAGE_CLASS_W PROP_TAG( PT_UNICODE, 0x004B) +#define PR_ORIG_MESSAGE_CLASS_A PROP_TAG( PT_STRING8, 0x004B) +#define PR_ORIGINAL_AUTHOR_ENTRYID PROP_TAG( PT_BINARY, 0x004C) +#define PR_ORIGINAL_AUTHOR_NAME PROP_TAG( PT_TSTRING, 0x004D) +#define PR_ORIGINAL_AUTHOR_NAME_W PROP_TAG( PT_UNICODE, 0x004D) +#define PR_ORIGINAL_AUTHOR_NAME_A PROP_TAG( PT_STRING8, 0x004D) +#define PR_ORIGINAL_SUBMIT_TIME PROP_TAG( PT_SYSTIME, 0x004E) +#define PR_REPLY_RECIPIENT_ENTRIES PROP_TAG( PT_BINARY, 0x004F) +#define PR_REPLY_RECIPIENT_NAMES PROP_TAG( PT_TSTRING, 0x0050) +#define PR_REPLY_RECIPIENT_NAMES_W PROP_TAG( PT_UNICODE, 0x0050) +#define PR_REPLY_RECIPIENT_NAMES_A PROP_TAG( PT_STRING8, 0x0050) + +#define PR_RECEIVED_BY_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0051) +#define PR_RCVD_REPRESENTING_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0052) +#define PR_READ_RECEIPT_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0053) +#define PR_REPORT_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0054) +#define PR_ORIGINAL_DELIVERY_TIME PROP_TAG( PT_SYSTIME, 0x0055) +#define PR_ORIGINAL_AUTHOR_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0056) + +#define PR_MESSAGE_TO_ME PROP_TAG( PT_BOOLEAN, 0x0057) +#define PR_MESSAGE_CC_ME PROP_TAG( PT_BOOLEAN, 0x0058) +#define PR_MESSAGE_RECIP_ME PROP_TAG( PT_BOOLEAN, 0x0059) + +#define PR_ORIGINAL_SENDER_NAME PROP_TAG( PT_TSTRING, 0x005A) +#define PR_ORIGINAL_SENDER_NAME_W PROP_TAG( PT_UNICODE, 0x005A) +#define PR_ORIGINAL_SENDER_NAME_A PROP_TAG( PT_STRING8, 0x005A) +#define PR_ORIGINAL_SENDER_ENTRYID PROP_TAG( PT_BINARY, 0x005B) +#define PR_ORIGINAL_SENDER_SEARCH_KEY PROP_TAG( PT_BINARY, 0x005C) +#define PR_ORIGINAL_SENT_REPRESENTING_NAME PROP_TAG( PT_TSTRING, 0x005D) +#define PR_ORIGINAL_SENT_REPRESENTING_NAME_W PROP_TAG( PT_UNICODE, 0x005D) +#define PR_ORIGINAL_SENT_REPRESENTING_NAME_A PROP_TAG( PT_STRING8, 0x005D) +#define PR_ORIGINAL_SENT_REPRESENTING_ENTRYID PROP_TAG( PT_BINARY, 0x005E) +#define PR_ORIGINAL_SENT_REPRESENTING_SEARCH_KEY PROP_TAG( PT_BINARY, 0x005F) + +#define PR_START_DATE PROP_TAG( PT_SYSTIME, 0x0060) +#define PR_END_DATE PROP_TAG( PT_SYSTIME, 0x0061) +#define PR_OWNER_APPT_ID PROP_TAG( PT_LONG, 0x0062) +#define PR_RESPONSE_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0063) + +#define PR_SENT_REPRESENTING_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0064) +#define PR_SENT_REPRESENTING_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0064) +#define PR_SENT_REPRESENTING_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0064) +#define PR_SENT_REPRESENTING_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0065) +#define PR_SENT_REPRESENTING_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0065) +#define PR_SENT_REPRESENTING_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0065) + +#define PR_ORIGINAL_SENDER_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0066) +#define PR_ORIGINAL_SENDER_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0066) +#define PR_ORIGINAL_SENDER_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0066) +#define PR_ORIGINAL_SENDER_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0067) +#define PR_ORIGINAL_SENDER_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0067) +#define PR_ORIGINAL_SENDER_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0067) + +#define PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0068) +#define PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0068) +#define PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0068) +#define PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0069) +#define PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0069) +#define PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0069) + +#define PR_CONVERSATION_TOPIC PROP_TAG( PT_TSTRING, 0x0070) +#define PR_CONVERSATION_TOPIC_W PROP_TAG( PT_UNICODE, 0x0070) +#define PR_CONVERSATION_TOPIC_A PROP_TAG( PT_STRING8, 0x0070) +#define PR_CONVERSATION_INDEX PROP_TAG( PT_BINARY, 0x0071) + +#define PR_ORIGINAL_DISPLAY_BCC PROP_TAG( PT_TSTRING, 0x0072) +#define PR_ORIGINAL_DISPLAY_BCC_W PROP_TAG( PT_UNICODE, 0x0072) +#define PR_ORIGINAL_DISPLAY_BCC_A PROP_TAG( PT_STRING8, 0x0072) +#define PR_ORIGINAL_DISPLAY_CC PROP_TAG( PT_TSTRING, 0x0073) +#define PR_ORIGINAL_DISPLAY_CC_W PROP_TAG( PT_UNICODE, 0x0073) +#define PR_ORIGINAL_DISPLAY_CC_A PROP_TAG( PT_STRING8, 0x0073) +#define PR_ORIGINAL_DISPLAY_TO PROP_TAG( PT_TSTRING, 0x0074) +#define PR_ORIGINAL_DISPLAY_TO_W PROP_TAG( PT_UNICODE, 0x0074) +#define PR_ORIGINAL_DISPLAY_TO_A PROP_TAG( PT_STRING8, 0x0074) + +#define PR_RECEIVED_BY_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0075) +#define PR_RECEIVED_BY_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0075) +#define PR_RECEIVED_BY_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0075) +#define PR_RECEIVED_BY_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0076) +#define PR_RECEIVED_BY_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0076) +#define PR_RECEIVED_BY_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0076) + +#define PR_RCVD_REPRESENTING_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0077) +#define PR_RCVD_REPRESENTING_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0077) +#define PR_RCVD_REPRESENTING_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0077) +#define PR_RCVD_REPRESENTING_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0078) +#define PR_RCVD_REPRESENTING_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0078) +#define PR_RCVD_REPRESENTING_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0078) + +#define PR_ORIGINAL_AUTHOR_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0079) +#define PR_ORIGINAL_AUTHOR_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0079) +#define PR_ORIGINAL_AUTHOR_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0079) +#define PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x007A) +#define PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x007A) +#define PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x007A) + +#define PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE PROP_TAG( PT_TSTRING, 0x007B) +#define PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x007B) +#define PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x007B) +#define PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x007C) +#define PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x007C) +#define PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x007C) + +#define PR_TRANSPORT_MESSAGE_HEADERS PROP_TAG(PT_TSTRING, 0x007D) +#define PR_TRANSPORT_MESSAGE_HEADERS_W PROP_TAG(PT_UNICODE, 0x007D) +#define PR_TRANSPORT_MESSAGE_HEADERS_A PROP_TAG(PT_STRING8, 0x007D) + +#define PR_DELEGATION PROP_TAG(PT_BINARY, 0x007E) + +#define PR_TNEF_CORRELATION_KEY PROP_TAG(PT_BINARY, 0x007F) + + + +/* + * Message content properties + */ + +#define PR_BODY PROP_TAG( PT_TSTRING, 0x1000) +#define PR_BODY_W PROP_TAG( PT_UNICODE, 0x1000) +#define PR_BODY_A PROP_TAG( PT_STRING8, 0x1000) +#define PR_REPORT_TEXT PROP_TAG( PT_TSTRING, 0x1001) +#define PR_REPORT_TEXT_W PROP_TAG( PT_UNICODE, 0x1001) +#define PR_REPORT_TEXT_A PROP_TAG( PT_STRING8, 0x1001) +#define PR_ORIGINATOR_AND_DL_EXPANSION_HISTORY PROP_TAG( PT_BINARY, 0x1002) +#define PR_REPORTING_DL_NAME PROP_TAG( PT_BINARY, 0x1003) +#define PR_REPORTING_MTA_CERTIFICATE PROP_TAG( PT_BINARY, 0x1004) + +/* Removed PR_REPORT_ORIGIN_AUTHENTICATION_CHECK with DCR 3865, use PR_ORIGIN_CHECK */ + +#define PR_RTF_SYNC_BODY_CRC PROP_TAG( PT_LONG, 0x1006) +#define PR_RTF_SYNC_BODY_COUNT PROP_TAG( PT_LONG, 0x1007) +#define PR_RTF_SYNC_BODY_TAG PROP_TAG( PT_TSTRING, 0x1008) +#define PR_RTF_SYNC_BODY_TAG_W PROP_TAG( PT_UNICODE, 0x1008) +#define PR_RTF_SYNC_BODY_TAG_A PROP_TAG( PT_STRING8, 0x1008) +#define PR_RTF_COMPRESSED PROP_TAG( PT_BINARY, 0x1009) +#define PR_RTF_SYNC_PREFIX_COUNT PROP_TAG( PT_LONG, 0x1010) +#define PR_RTF_SYNC_TRAILING_COUNT PROP_TAG( PT_LONG, 0x1011) +#define PR_ORIGINALLY_INTENDED_RECIP_ENTRYID PROP_TAG( PT_BINARY, 0x1012) + +/* + * Reserved 0x1100-0x1200 + */ + + +/* + * Message recipient properties + */ + +#define PR_CONTENT_INTEGRITY_CHECK PROP_TAG( PT_BINARY, 0x0C00) +#define PR_EXPLICIT_CONVERSION PROP_TAG( PT_LONG, 0x0C01) +#define PR_IPM_RETURN_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C02) +#define PR_MESSAGE_TOKEN PROP_TAG( PT_BINARY, 0x0C03) +#define PR_NDR_REASON_CODE PROP_TAG( PT_LONG, 0x0C04) +#define PR_NDR_DIAG_CODE PROP_TAG( PT_LONG, 0x0C05) +#define PR_NON_RECEIPT_NOTIFICATION_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C06) +#define PR_DELIVERY_POINT PROP_TAG( PT_LONG, 0x0C07) + +#define PR_ORIGINATOR_NON_DELIVERY_REPORT_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C08) +#define PR_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT PROP_TAG( PT_BINARY, 0x0C09) +#define PR_PHYSICAL_DELIVERY_BUREAU_FAX_DELIVERY PROP_TAG( PT_BOOLEAN, 0x0C0A) +#define PR_PHYSICAL_DELIVERY_MODE PROP_TAG( PT_LONG, 0x0C0B) +#define PR_PHYSICAL_DELIVERY_REPORT_REQUEST PROP_TAG( PT_LONG, 0x0C0C) +#define PR_PHYSICAL_FORWARDING_ADDRESS PROP_TAG( PT_BINARY, 0x0C0D) +#define PR_PHYSICAL_FORWARDING_ADDRESS_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C0E) +#define PR_PHYSICAL_FORWARDING_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x0C0F) +#define PR_PHYSICAL_RENDITION_ATTRIBUTES PROP_TAG( PT_BINARY, 0x0C10) +#define PR_PROOF_OF_DELIVERY PROP_TAG( PT_BINARY, 0x0C11) +#define PR_PROOF_OF_DELIVERY_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C12) +#define PR_RECIPIENT_CERTIFICATE PROP_TAG( PT_BINARY, 0x0C13) +#define PR_RECIPIENT_NUMBER_FOR_ADVICE PROP_TAG( PT_TSTRING, 0x0C14) +#define PR_RECIPIENT_NUMBER_FOR_ADVICE_W PROP_TAG( PT_UNICODE, 0x0C14) +#define PR_RECIPIENT_NUMBER_FOR_ADVICE_A PROP_TAG( PT_STRING8, 0x0C14) +#define PR_RECIPIENT_TYPE PROP_TAG( PT_LONG, 0x0C15) +#define PR_REGISTERED_MAIL_TYPE PROP_TAG( PT_LONG, 0x0C16) +#define PR_REPLY_REQUESTED PROP_TAG( PT_BOOLEAN, 0x0C17) +#define PR_REQUESTED_DELIVERY_METHOD PROP_TAG( PT_LONG, 0x0C18) +#define PR_SENDER_ENTRYID PROP_TAG( PT_BINARY, 0x0C19) +#define PR_SENDER_NAME PROP_TAG( PT_TSTRING, 0x0C1A) +#define PR_SENDER_NAME_W PROP_TAG( PT_UNICODE, 0x0C1A) +#define PR_SENDER_NAME_A PROP_TAG( PT_STRING8, 0x0C1A) +#define PR_SUPPLEMENTARY_INFO PROP_TAG( PT_TSTRING, 0x0C1B) +#define PR_SUPPLEMENTARY_INFO_W PROP_TAG( PT_UNICODE, 0x0C1B) +#define PR_SUPPLEMENTARY_INFO_A PROP_TAG( PT_STRING8, 0x0C1B) +#define PR_TYPE_OF_MTS_USER PROP_TAG( PT_LONG, 0x0C1C) +#define PR_SENDER_SEARCH_KEY PROP_TAG( PT_BINARY, 0x0C1D) +#define PR_SENDER_ADDRTYPE PROP_TAG( PT_TSTRING, 0x0C1E) +#define PR_SENDER_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x0C1E) +#define PR_SENDER_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x0C1E) +#define PR_SENDER_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x0C1F) +#define PR_SENDER_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x0C1F) +#define PR_SENDER_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x0C1F) + +/* + * Message non-transmittable properties + */ + +/* + * The two tags, PR_MESSAGE_RECIPIENTS and PR_MESSAGE_ATTACHMENTS, + * are to be used in the exclude list passed to + * IMessage::CopyTo when the caller wants either the recipients or attachments + * of the message to not get copied. It is also used in the ProblemArray + * return from IMessage::CopyTo when an error is encountered copying them + */ + +#define PR_CURRENT_VERSION PROP_TAG( PT_I8, 0x0E00) +#define PR_DELETE_AFTER_SUBMIT PROP_TAG( PT_BOOLEAN, 0x0E01) +#define PR_DISPLAY_BCC PROP_TAG( PT_TSTRING, 0x0E02) +#define PR_DISPLAY_BCC_W PROP_TAG( PT_UNICODE, 0x0E02) +#define PR_DISPLAY_BCC_A PROP_TAG( PT_STRING8, 0x0E02) +#define PR_DISPLAY_CC PROP_TAG( PT_TSTRING, 0x0E03) +#define PR_DISPLAY_CC_W PROP_TAG( PT_UNICODE, 0x0E03) +#define PR_DISPLAY_CC_A PROP_TAG( PT_STRING8, 0x0E03) +#define PR_DISPLAY_TO PROP_TAG( PT_TSTRING, 0x0E04) +#define PR_DISPLAY_TO_W PROP_TAG( PT_UNICODE, 0x0E04) +#define PR_DISPLAY_TO_A PROP_TAG( PT_STRING8, 0x0E04) +#define PR_PARENT_DISPLAY PROP_TAG( PT_TSTRING, 0x0E05) +#define PR_PARENT_DISPLAY_W PROP_TAG( PT_UNICODE, 0x0E05) +#define PR_PARENT_DISPLAY_A PROP_TAG( PT_STRING8, 0x0E05) +#define PR_MESSAGE_DELIVERY_TIME PROP_TAG( PT_SYSTIME, 0x0E06) +#define PR_MESSAGE_FLAGS PROP_TAG( PT_LONG, 0x0E07) +#define PR_MESSAGE_SIZE PROP_TAG( PT_LONG, 0x0E08) +#define PR_PARENT_ENTRYID PROP_TAG( PT_BINARY, 0x0E09) +#define PR_SENTMAIL_ENTRYID PROP_TAG( PT_BINARY, 0x0E0A) +#define PR_CORRELATE PROP_TAG( PT_BOOLEAN, 0x0E0C) +#define PR_CORRELATE_MTSID PROP_TAG( PT_BINARY, 0x0E0D) +#define PR_DISCRETE_VALUES PROP_TAG( PT_BOOLEAN, 0x0E0E) +#define PR_RESPONSIBILITY PROP_TAG( PT_BOOLEAN, 0x0E0F) +#define PR_SPOOLER_STATUS PROP_TAG( PT_LONG, 0x0E10) +#define PR_TRANSPORT_STATUS PROP_TAG( PT_LONG, 0x0E11) +#define PR_MESSAGE_RECIPIENTS PROP_TAG( PT_OBJECT, 0x0E12) +#define PR_MESSAGE_ATTACHMENTS PROP_TAG( PT_OBJECT, 0x0E13) +#define PR_SUBMIT_FLAGS PROP_TAG( PT_LONG, 0x0E14) +#define PR_RECIPIENT_STATUS PROP_TAG( PT_LONG, 0x0E15) +#define PR_TRANSPORT_KEY PROP_TAG( PT_LONG, 0x0E16) +#define PR_MSG_STATUS PROP_TAG( PT_LONG, 0x0E17) +#define PR_MESSAGE_DOWNLOAD_TIME PROP_TAG( PT_LONG, 0x0E18) +#define PR_CREATION_VERSION PROP_TAG( PT_I8, 0x0E19) +#define PR_MODIFY_VERSION PROP_TAG( PT_I8, 0x0E1A) +#define PR_HASATTACH PROP_TAG( PT_BOOLEAN, 0x0E1B) +#define PR_BODY_CRC PROP_TAG( PT_LONG, 0x0E1C) +#define PR_NORMALIZED_SUBJECT PROP_TAG( PT_TSTRING, 0x0E1D) +#define PR_NORMALIZED_SUBJECT_W PROP_TAG( PT_UNICODE, 0x0E1D) +#define PR_NORMALIZED_SUBJECT_A PROP_TAG( PT_STRING8, 0x0E1D) +#define PR_RTF_IN_SYNC PROP_TAG( PT_BOOLEAN, 0x0E1F) +#define PR_ATTACH_SIZE PROP_TAG( PT_LONG, 0x0E20) +#define PR_ATTACH_NUM PROP_TAG( PT_LONG, 0x0E21) +#define PR_PREPROCESS PROP_TAG( PT_BOOLEAN, 0x0E22) + +/* PR_ORIGINAL_DISPLAY_TO, _CC, and _BCC moved to transmittible range 03/09/95 */ + +#define PR_ORIGINATING_MTA_CERTIFICATE PROP_TAG( PT_BINARY, 0x0E25) +#define PR_PROOF_OF_SUBMISSION PROP_TAG( PT_BINARY, 0x0E26) + + +/* + * The range of non-message and non-recipient property IDs (0x3000 - 0x3FFF) is + * further broken down into ranges to make assigning new property IDs easier. + * + * From To Kind of property + * -------------------------------- + * 3000 32FF MAPI_defined common property + * 3200 33FF MAPI_defined form property + * 3400 35FF MAPI_defined message store property + * 3600 36FF MAPI_defined Folder or AB Container property + * 3700 38FF MAPI_defined attachment property + * 3900 39FF MAPI_defined address book property + * 3A00 3BFF MAPI_defined mailuser property + * 3C00 3CFF MAPI_defined DistList property + * 3D00 3DFF MAPI_defined Profile Section property + * 3E00 3EFF MAPI_defined Status property + * 3F00 3FFF MAPI_defined display table property + */ + +/* + * Properties common to numerous MAPI objects. + * + * Those properties that can appear on messages are in the + * non-transmittable range for messages. They start at the high + * end of that range and work down. + * + * Properties that never appear on messages are defined in the common + * property range (see above). + */ + +/* + * properties that are common to multiple objects (including message objects) + * -- these ids are in the non-transmittable range + */ + +#define PR_ENTRYID PROP_TAG( PT_BINARY, 0x0FFF) +#define PR_OBJECT_TYPE PROP_TAG( PT_LONG, 0x0FFE) +#define PR_ICON PROP_TAG( PT_BINARY, 0x0FFD) +#define PR_MINI_ICON PROP_TAG( PT_BINARY, 0x0FFC) +#define PR_STORE_ENTRYID PROP_TAG( PT_BINARY, 0x0FFB) +#define PR_STORE_RECORD_KEY PROP_TAG( PT_BINARY, 0x0FFA) +#define PR_RECORD_KEY PROP_TAG( PT_BINARY, 0x0FF9) +#define PR_MAPPING_SIGNATURE PROP_TAG( PT_BINARY, 0x0FF8) +#define PR_ACCESS_LEVEL PROP_TAG( PT_LONG, 0x0FF7) +#define PR_INSTANCE_KEY PROP_TAG( PT_BINARY, 0x0FF6) +#define PR_ROW_TYPE PROP_TAG( PT_LONG, 0x0FF5) +#define PR_ACCESS PROP_TAG( PT_LONG, 0x0FF4) + +/* + * properties that are common to multiple objects (usually not including message objects) + * -- these ids are in the transmittable range + */ + +#define PR_ROWID PROP_TAG( PT_LONG, 0x3000) +#define PR_DISPLAY_NAME PROP_TAG( PT_TSTRING, 0x3001) +#define PR_DISPLAY_NAME_W PROP_TAG( PT_UNICODE, 0x3001) +#define PR_DISPLAY_NAME_A PROP_TAG( PT_STRING8, 0x3001) +#define PR_ADDRTYPE PROP_TAG( PT_TSTRING, 0x3002) +#define PR_ADDRTYPE_W PROP_TAG( PT_UNICODE, 0x3002) +#define PR_ADDRTYPE_A PROP_TAG( PT_STRING8, 0x3002) +#define PR_EMAIL_ADDRESS PROP_TAG( PT_TSTRING, 0x3003) +#define PR_EMAIL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x3003) +#define PR_EMAIL_ADDRESS_A PROP_TAG( PT_STRING8, 0x3003) +#define PR_COMMENT PROP_TAG( PT_TSTRING, 0x3004) +#define PR_COMMENT_W PROP_TAG( PT_UNICODE, 0x3004) +#define PR_COMMENT_A PROP_TAG( PT_STRING8, 0x3004) +#define PR_DEPTH PROP_TAG( PT_LONG, 0x3005) +#define PR_PROVIDER_DISPLAY PROP_TAG( PT_TSTRING, 0x3006) +#define PR_PROVIDER_DISPLAY_W PROP_TAG( PT_UNICODE, 0x3006) +#define PR_PROVIDER_DISPLAY_A PROP_TAG( PT_STRING8, 0x3006) +#define PR_CREATION_TIME PROP_TAG( PT_SYSTIME, 0x3007) +#define PR_LAST_MODIFICATION_TIME PROP_TAG( PT_SYSTIME, 0x3008) +#define PR_RESOURCE_FLAGS PROP_TAG( PT_LONG, 0x3009) +#define PR_PROVIDER_DLL_NAME PROP_TAG( PT_TSTRING, 0x300A) +#define PR_PROVIDER_DLL_NAME_W PROP_TAG( PT_UNICODE, 0x300A) +#define PR_PROVIDER_DLL_NAME_A PROP_TAG( PT_STRING8, 0x300A) +#define PR_SEARCH_KEY PROP_TAG( PT_BINARY, 0x300B) +#define PR_PROVIDER_UID PROP_TAG( PT_BINARY, 0x300C) +#define PR_PROVIDER_ORDINAL PROP_TAG( PT_LONG, 0x300D) + +/* + * MAPI Form properties + */ +#define PR_FORM_VERSION PROP_TAG(PT_TSTRING, 0x3301) +#define PR_FORM_VERSION_W PROP_TAG(PT_UNICODE, 0x3301) +#define PR_FORM_VERSION_A PROP_TAG(PT_STRING8, 0x3301) +#define PR_FORM_CLSID PROP_TAG(PT_CLSID, 0x3302) +#define PR_FORM_CONTACT_NAME PROP_TAG(PT_TSTRING, 0x3303) +#define PR_FORM_CONTACT_NAME_W PROP_TAG(PT_UNICODE, 0x3303) +#define PR_FORM_CONTACT_NAME_A PROP_TAG(PT_STRING8, 0x3303) +#define PR_FORM_CATEGORY PROP_TAG(PT_TSTRING, 0x3304) +#define PR_FORM_CATEGORY_W PROP_TAG(PT_UNICODE, 0x3304) +#define PR_FORM_CATEGORY_A PROP_TAG(PT_STRING8, 0x3304) +#define PR_FORM_CATEGORY_SUB PROP_TAG(PT_TSTRING, 0x3305) +#define PR_FORM_CATEGORY_SUB_W PROP_TAG(PT_UNICODE, 0x3305) +#define PR_FORM_CATEGORY_SUB_A PROP_TAG(PT_STRING8, 0x3305) +#define PR_FORM_HOST_MAP PROP_TAG(PT_MV_LONG, 0x3306) +#define PR_FORM_HIDDEN PROP_TAG(PT_BOOLEAN, 0x3307) +#define PR_FORM_DESIGNER_NAME PROP_TAG(PT_TSTRING, 0x3308) +#define PR_FORM_DESIGNER_NAME_W PROP_TAG(PT_UNICODE, 0x3308) +#define PR_FORM_DESIGNER_NAME_A PROP_TAG(PT_STRING8, 0x3308) +#define PR_FORM_DESIGNER_GUID PROP_TAG(PT_CLSID, 0x3309) +#define PR_FORM_MESSAGE_BEHAVIOR PROP_TAG(PT_LONG, 0x330A) + +/* + * Message store properties + */ + +#define PR_DEFAULT_STORE PROP_TAG( PT_BOOLEAN, 0x3400) +#define PR_STORE_SUPPORT_MASK PROP_TAG( PT_LONG, 0x340D) +#define PR_STORE_STATE PROP_TAG( PT_LONG, 0x340E) + +#define PR_IPM_SUBTREE_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3410) +#define PR_IPM_OUTBOX_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3411) +#define PR_IPM_WASTEBASKET_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3412) +#define PR_IPM_SENTMAIL_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3413) +#define PR_MDB_PROVIDER PROP_TAG( PT_BINARY, 0x3414) +#define PR_RECEIVE_FOLDER_SETTINGS PROP_TAG( PT_OBJECT, 0x3415) + +#define PR_VALID_FOLDER_MASK PROP_TAG( PT_LONG, 0x35DF) +#define PR_IPM_SUBTREE_ENTRYID PROP_TAG( PT_BINARY, 0x35E0) + +#define PR_IPM_OUTBOX_ENTRYID PROP_TAG( PT_BINARY, 0x35E2) +#define PR_IPM_WASTEBASKET_ENTRYID PROP_TAG( PT_BINARY, 0x35E3) +#define PR_IPM_SENTMAIL_ENTRYID PROP_TAG( PT_BINARY, 0x35E4) +#define PR_VIEWS_ENTRYID PROP_TAG( PT_BINARY, 0x35E5) +#define PR_COMMON_VIEWS_ENTRYID PROP_TAG( PT_BINARY, 0x35E6) +#define PR_FINDER_ENTRYID PROP_TAG( PT_BINARY, 0x35E7) + +/* Proptags 0x35E8-0x35FF reserved for folders "guaranteed" by PR_VALID_FOLDER_MASK */ + + +/* + * Folder and AB Container properties + */ + +#define PR_CONTAINER_FLAGS PROP_TAG( PT_LONG, 0x3600) +#define PR_FOLDER_TYPE PROP_TAG( PT_LONG, 0x3601) +#define PR_CONTENT_COUNT PROP_TAG( PT_LONG, 0x3602) +#define PR_CONTENT_UNREAD PROP_TAG( PT_LONG, 0x3603) +#define PR_CREATE_TEMPLATES PROP_TAG( PT_OBJECT, 0x3604) +#define PR_DETAILS_TABLE PROP_TAG( PT_OBJECT, 0x3605) +#define PR_SEARCH PROP_TAG( PT_OBJECT, 0x3607) +#define PR_SELECTABLE PROP_TAG( PT_BOOLEAN, 0x3609) +#define PR_SUBFOLDERS PROP_TAG( PT_BOOLEAN, 0x360A) +#define PR_STATUS PROP_TAG( PT_LONG, 0x360B) +#define PR_ANR PROP_TAG( PT_TSTRING, 0x360C) +#define PR_ANR_W PROP_TAG( PT_UNICODE, 0x360C) +#define PR_ANR_A PROP_TAG( PT_STRING8, 0x360C) +#define PR_CONTENTS_SORT_ORDER PROP_TAG( PT_MV_LONG, 0x360D) +#define PR_CONTAINER_HIERARCHY PROP_TAG( PT_OBJECT, 0x360E) +#define PR_CONTAINER_CONTENTS PROP_TAG( PT_OBJECT, 0x360F) +#define PR_FOLDER_ASSOCIATED_CONTENTS PROP_TAG( PT_OBJECT, 0x3610) +#define PR_DEF_CREATE_DL PROP_TAG( PT_BINARY, 0x3611) +#define PR_DEF_CREATE_MAILUSER PROP_TAG( PT_BINARY, 0x3612) +#define PR_CONTAINER_CLASS PROP_TAG( PT_TSTRING, 0x3613) +#define PR_CONTAINER_CLASS_W PROP_TAG( PT_UNICODE, 0x3613) +#define PR_CONTAINER_CLASS_A PROP_TAG( PT_STRING8, 0x3613) +#define PR_CONTAINER_MODIFY_VERSION PROP_TAG( PT_I8, 0x3614) +#define PR_AB_PROVIDER_ID PROP_TAG( PT_BINARY, 0x3615) +#define PR_DEFAULT_VIEW_ENTRYID PROP_TAG( PT_BINARY, 0x3616) +#define PR_ASSOC_CONTENT_COUNT PROP_TAG( PT_LONG, 0x3617) + +/* Reserved 0x36C0-0x36FF */ + +/* + * Attachment properties + */ + +#define PR_ATTACHMENT_X400_PARAMETERS PROP_TAG( PT_BINARY, 0x3700) +#define PR_ATTACH_DATA_OBJ PROP_TAG( PT_OBJECT, 0x3701) +#define PR_ATTACH_DATA_BIN PROP_TAG( PT_BINARY, 0x3701) +#define PR_ATTACH_ENCODING PROP_TAG( PT_BINARY, 0x3702) +#define PR_ATTACH_EXTENSION PROP_TAG( PT_TSTRING, 0x3703) +#define PR_ATTACH_EXTENSION_W PROP_TAG( PT_UNICODE, 0x3703) +#define PR_ATTACH_EXTENSION_A PROP_TAG( PT_STRING8, 0x3703) +#define PR_ATTACH_FILENAME PROP_TAG( PT_TSTRING, 0x3704) +#define PR_ATTACH_FILENAME_W PROP_TAG( PT_UNICODE, 0x3704) +#define PR_ATTACH_FILENAME_A PROP_TAG( PT_STRING8, 0x3704) +#define PR_ATTACH_METHOD PROP_TAG( PT_LONG, 0x3705) +#define PR_ATTACH_LONG_FILENAME PROP_TAG( PT_TSTRING, 0x3707) +#define PR_ATTACH_LONG_FILENAME_W PROP_TAG( PT_UNICODE, 0x3707) +#define PR_ATTACH_LONG_FILENAME_A PROP_TAG( PT_STRING8, 0x3707) +#define PR_ATTACH_PATHNAME PROP_TAG( PT_TSTRING, 0x3708) +#define PR_ATTACH_PATHNAME_W PROP_TAG( PT_UNICODE, 0x3708) +#define PR_ATTACH_PATHNAME_A PROP_TAG( PT_STRING8, 0x3708) +#define PR_ATTACH_RENDERING PROP_TAG( PT_BINARY, 0x3709) +#define PR_ATTACH_TAG PROP_TAG( PT_BINARY, 0x370A) +#define PR_RENDERING_POSITION PROP_TAG( PT_LONG, 0x370B) +#define PR_ATTACH_TRANSPORT_NAME PROP_TAG( PT_TSTRING, 0x370C) +#define PR_ATTACH_TRANSPORT_NAME_W PROP_TAG( PT_UNICODE, 0x370C) +#define PR_ATTACH_TRANSPORT_NAME_A PROP_TAG( PT_STRING8, 0x370C) +#define PR_ATTACH_LONG_PATHNAME PROP_TAG( PT_TSTRING, 0x370D) +#define PR_ATTACH_LONG_PATHNAME_W PROP_TAG( PT_UNICODE, 0x370D) +#define PR_ATTACH_LONG_PATHNAME_A PROP_TAG( PT_STRING8, 0x370D) +#define PR_ATTACH_MIME_TAG PROP_TAG( PT_TSTRING, 0x370E) +#define PR_ATTACH_MIME_TAG_W PROP_TAG( PT_UNICODE, 0x370E) +#define PR_ATTACH_MIME_TAG_A PROP_TAG( PT_STRING8, 0x370E) +#define PR_ATTACH_ADDITIONAL_INFO PROP_TAG( PT_BINARY, 0x370F) + +/* + * AB Object properties + */ + +#define PR_DISPLAY_TYPE PROP_TAG( PT_LONG, 0x3900) +#define PR_TEMPLATEID PROP_TAG( PT_BINARY, 0x3902) +#define PR_PRIMARY_CAPABILITY PROP_TAG( PT_BINARY, 0x3904) + + +/* + * Mail user properties + */ +#define PR_7BIT_DISPLAY_NAME PROP_TAG( PT_STRING8, 0x39FF) +#define PR_ACCOUNT PROP_TAG( PT_TSTRING, 0x3A00) +#define PR_ACCOUNT_W PROP_TAG( PT_UNICODE, 0x3A00) +#define PR_ACCOUNT_A PROP_TAG( PT_STRING8, 0x3A00) +#define PR_ALTERNATE_RECIPIENT PROP_TAG( PT_BINARY, 0x3A01) +#define PR_CALLBACK_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A02) +#define PR_CALLBACK_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A02) +#define PR_CALLBACK_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A02) +#define PR_CONVERSION_PROHIBITED PROP_TAG( PT_BOOLEAN, 0x3A03) +#define PR_DISCLOSE_RECIPIENTS PROP_TAG( PT_BOOLEAN, 0x3A04) +#define PR_GENERATION PROP_TAG( PT_TSTRING, 0x3A05) +#define PR_GENERATION_W PROP_TAG( PT_UNICODE, 0x3A05) +#define PR_GENERATION_A PROP_TAG( PT_STRING8, 0x3A05) +#define PR_GIVEN_NAME PROP_TAG( PT_TSTRING, 0x3A06) +#define PR_GIVEN_NAME_W PROP_TAG( PT_UNICODE, 0x3A06) +#define PR_GIVEN_NAME_A PROP_TAG( PT_STRING8, 0x3A06) +#define PR_GOVERNMENT_ID_NUMBER PROP_TAG( PT_TSTRING, 0x3A07) +#define PR_GOVERNMENT_ID_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A07) +#define PR_GOVERNMENT_ID_NUMBER_A PROP_TAG( PT_STRING8, 0x3A07) +#define PR_BUSINESS_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A08) +#define PR_BUSINESS_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A08) +#define PR_BUSINESS_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A08) +#define PR_OFFICE_TELEPHONE_NUMBER PR_BUSINESS_TELEPHONE_NUMBER +#define PR_OFFICE_TELEPHONE_NUMBER_W PR_BUSINESS_TELEPHONE_NUMBER_W +#define PR_OFFICE_TELEPHONE_NUMBER_A PR_BUSINESS_TELEPHONE_NUMBER_A +#define PR_HOME_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A09) +#define PR_HOME_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A09) +#define PR_HOME_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A09) +#define PR_INITIALS PROP_TAG( PT_TSTRING, 0x3A0A) +#define PR_INITIALS_W PROP_TAG( PT_UNICODE, 0x3A0A) +#define PR_INITIALS_A PROP_TAG( PT_STRING8, 0x3A0A) +#define PR_KEYWORD PROP_TAG( PT_TSTRING, 0x3A0B) +#define PR_KEYWORD_W PROP_TAG( PT_UNICODE, 0x3A0B) +#define PR_KEYWORD_A PROP_TAG( PT_STRING8, 0x3A0B) +#define PR_LANGUAGE PROP_TAG( PT_TSTRING, 0x3A0C) +#define PR_LANGUAGE_W PROP_TAG( PT_UNICODE, 0x3A0C) +#define PR_LANGUAGE_A PROP_TAG( PT_STRING8, 0x3A0C) +#define PR_LOCATION PROP_TAG( PT_TSTRING, 0x3A0D) +#define PR_LOCATION_W PROP_TAG( PT_UNICODE, 0x3A0D) +#define PR_LOCATION_A PROP_TAG( PT_STRING8, 0x3A0D) +#define PR_MAIL_PERMISSION PROP_TAG( PT_BOOLEAN, 0x3A0E) +#define PR_MHS_COMMON_NAME PROP_TAG( PT_TSTRING, 0x3A0F) +#define PR_MHS_COMMON_NAME_W PROP_TAG( PT_UNICODE, 0x3A0F) +#define PR_MHS_COMMON_NAME_A PROP_TAG( PT_STRING8, 0x3A0F) +#define PR_ORGANIZATIONAL_ID_NUMBER PROP_TAG( PT_TSTRING, 0x3A10) +#define PR_ORGANIZATIONAL_ID_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A10) +#define PR_ORGANIZATIONAL_ID_NUMBER_A PROP_TAG( PT_STRING8, 0x3A10) +#define PR_SURNAME PROP_TAG( PT_TSTRING, 0x3A11) +#define PR_SURNAME_W PROP_TAG( PT_UNICODE, 0x3A11) +#define PR_SURNAME_A PROP_TAG( PT_STRING8, 0x3A11) +#define PR_ORIGINAL_ENTRYID PROP_TAG( PT_BINARY, 0x3A12) +#define PR_ORIGINAL_DISPLAY_NAME PROP_TAG( PT_TSTRING, 0x3A13) +#define PR_ORIGINAL_DISPLAY_NAME_W PROP_TAG( PT_UNICODE, 0x3A13) +#define PR_ORIGINAL_DISPLAY_NAME_A PROP_TAG( PT_STRING8, 0x3A13) +#define PR_ORIGINAL_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3A14) +#define PR_POSTAL_ADDRESS PROP_TAG( PT_TSTRING, 0x3A15) +#define PR_POSTAL_ADDRESS_W PROP_TAG( PT_UNICODE, 0x3A15) +#define PR_POSTAL_ADDRESS_A PROP_TAG( PT_STRING8, 0x3A15) +#define PR_COMPANY_NAME PROP_TAG( PT_TSTRING, 0x3A16) +#define PR_COMPANY_NAME_W PROP_TAG( PT_UNICODE, 0x3A16) +#define PR_COMPANY_NAME_A PROP_TAG( PT_STRING8, 0x3A16) +#define PR_TITLE PROP_TAG( PT_TSTRING, 0x3A17) +#define PR_TITLE_W PROP_TAG( PT_UNICODE, 0x3A17) +#define PR_TITLE_A PROP_TAG( PT_STRING8, 0x3A17) +#define PR_DEPARTMENT_NAME PROP_TAG( PT_TSTRING, 0x3A18) +#define PR_DEPARTMENT_NAME_W PROP_TAG( PT_UNICODE, 0x3A18) +#define PR_DEPARTMENT_NAME_A PROP_TAG( PT_STRING8, 0x3A18) +#define PR_OFFICE_LOCATION PROP_TAG( PT_TSTRING, 0x3A19) +#define PR_OFFICE_LOCATION_W PROP_TAG( PT_UNICODE, 0x3A19) +#define PR_OFFICE_LOCATION_A PROP_TAG( PT_STRING8, 0x3A19) +#define PR_PRIMARY_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1A) +#define PR_PRIMARY_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1A) +#define PR_PRIMARY_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1A) +#define PR_BUSINESS2_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1B) +#define PR_BUSINESS2_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1B) +#define PR_BUSINESS2_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1B) +#define PR_OFFICE2_TELEPHONE_NUMBER PR_BUSINESS2_TELEPHONE_NUMBER +#define PR_OFFICE2_TELEPHONE_NUMBER_W PR_BUSINESS2_TELEPHONE_NUMBER_W +#define PR_OFFICE2_TELEPHONE_NUMBER_A PR_BUSINESS2_TELEPHONE_NUMBER_A +#define PR_MOBILE_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1C) +#define PR_MOBILE_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1C) +#define PR_MOBILE_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1C) +#define PR_CELLULAR_TELEPHONE_NUMBER PR_MOBILE_TELEPHONE_NUMBER +#define PR_CELLULAR_TELEPHONE_NUMBER_W PR_MOBILE_TELEPHONE_NUMBER_W +#define PR_CELLULAR_TELEPHONE_NUMBER_A PR_MOBILE_TELEPHONE_NUMBER_A +#define PR_RADIO_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1D) +#define PR_RADIO_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1D) +#define PR_RADIO_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1D) +#define PR_CAR_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1E) +#define PR_CAR_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1E) +#define PR_CAR_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1E) +#define PR_OTHER_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A1F) +#define PR_OTHER_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A1F) +#define PR_OTHER_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A1F) +#define PR_TRANSMITABLE_DISPLAY_NAME PROP_TAG( PT_TSTRING, 0x3A20) +#define PR_TRANSMITABLE_DISPLAY_NAME_W PROP_TAG( PT_UNICODE, 0x3A20) +#define PR_TRANSMITABLE_DISPLAY_NAME_A PROP_TAG( PT_STRING8, 0x3A20) +#define PR_PAGER_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A21) +#define PR_PAGER_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A21) +#define PR_PAGER_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A21) +#define PR_BEEPER_TELEPHONE_NUMBER PR_PAGER_TELEPHONE_NUMBER +#define PR_BEEPER_TELEPHONE_NUMBER_W PR_PAGER_TELEPHONE_NUMBER_W +#define PR_BEEPER_TELEPHONE_NUMBER_A PR_PAGER_TELEPHONE_NUMBER_A +#define PR_USER_CERTIFICATE PROP_TAG( PT_BINARY, 0x3A22) +#define PR_PRIMARY_FAX_NUMBER PROP_TAG( PT_TSTRING, 0x3A23) +#define PR_PRIMARY_FAX_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A23) +#define PR_PRIMARY_FAX_NUMBER_A PROP_TAG( PT_STRING8, 0x3A23) +#define PR_BUSINESS_FAX_NUMBER PROP_TAG( PT_TSTRING, 0x3A24) +#define PR_BUSINESS_FAX_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A24) +#define PR_BUSINESS_FAX_NUMBER_A PROP_TAG( PT_STRING8, 0x3A24) +#define PR_HOME_FAX_NUMBER PROP_TAG( PT_TSTRING, 0x3A25) +#define PR_HOME_FAX_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A25) +#define PR_HOME_FAX_NUMBER_A PROP_TAG( PT_STRING8, 0x3A25) +#define PR_COUNTRY PROP_TAG( PT_TSTRING, 0x3A26) +#define PR_COUNTRY_W PROP_TAG( PT_UNICODE, 0x3A26) +#define PR_COUNTRY_A PROP_TAG( PT_STRING8, 0x3A26) +#define PR_BUSINESS_ADDRESS_COUNTRY PR_COUNTRY +#define PR_BUSINESS_ADDRESS_COUNTRY_W PR_COUNTRY_W +#define PR_BUSINESS_ADDRESS_COUNTRY_A PR_COUNTRY_A + +#define PR_LOCALITY PROP_TAG( PT_TSTRING, 0x3A27) +#define PR_LOCALITY_W PROP_TAG( PT_UNICODE, 0x3A27) +#define PR_LOCALITY_A PROP_TAG( PT_STRING8, 0x3A27) +#define PR_BUSINESS_ADDRESS_CITY PR_LOCALITY +#define PR_BUSINESS_ADDRESS_CITY_W PR_LOCALITY_W +#define PR_BUSINESS_ADDRESS_CITY_A PR_LOCALITY_A + +#define PR_STATE_OR_PROVINCE PROP_TAG( PT_TSTRING, 0x3A28) +#define PR_STATE_OR_PROVINCE_W PROP_TAG( PT_UNICODE, 0x3A28) +#define PR_STATE_OR_PROVINCE_A PROP_TAG( PT_STRING8, 0x3A28) +#define PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE PR_STATE_OR_PROVINCE +#define PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W PR_STATE_OR_PROVINCE_W +#define PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A PR_STATE_OR_PROVINCE_A + +#define PR_STREET_ADDRESS PROP_TAG( PT_TSTRING, 0x3A29) +#define PR_STREET_ADDRESS_W PROP_TAG( PT_UNICODE, 0x3A29) +#define PR_STREET_ADDRESS_A PROP_TAG( PT_STRING8, 0x3A29) +#define PR_BUSINESS_ADDRESS_STREET PR_STREET_ADDRESS +#define PR_BUSINESS_ADDRESS_STREET_W PR_STREET_ADDRESS_W +#define PR_BUSINESS_ADDRESS_STREET_A PR_STREET_ADDRESS_A + +#define PR_POSTAL_CODE PROP_TAG( PT_TSTRING, 0x3A2A) +#define PR_POSTAL_CODE_W PROP_TAG( PT_UNICODE, 0x3A2A) +#define PR_POSTAL_CODE_A PROP_TAG( PT_STRING8, 0x3A2A) +#define PR_BUSINESS_ADDRESS_POSTAL_CODE PR_POSTAL_CODE +#define PR_BUSINESS_ADDRESS_POSTAL_CODE_W PR_POSTAL_CODE_W +#define PR_BUSINESS_ADDRESS_POSTAL_CODE_A PR_POSTAL_CODE_A + + +#define PR_POST_OFFICE_BOX PROP_TAG( PT_TSTRING, 0x3A2B) +#define PR_POST_OFFICE_BOX_W PROP_TAG( PT_UNICODE, 0x3A2B) +#define PR_POST_OFFICE_BOX_A PROP_TAG( PT_STRING8, 0x3A2B) +#define PR_BUSINESS_ADDRESS_POST_OFFICE_BOX PR_POST_OFFICE_BOX +#define PR_BUSINESS_ADDRESS_POST_OFFICE_BOX_W PR_POST_OFFICE_BOX_W +#define PR_BUSINESS_ADDRESS_POST_OFFICE_BOX_A PR_POST_OFFICE_BOX_A + + +#define PR_TELEX_NUMBER PROP_TAG( PT_TSTRING, 0x3A2C) +#define PR_TELEX_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A2C) +#define PR_TELEX_NUMBER_A PROP_TAG( PT_STRING8, 0x3A2C) +#define PR_ISDN_NUMBER PROP_TAG( PT_TSTRING, 0x3A2D) +#define PR_ISDN_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A2D) +#define PR_ISDN_NUMBER_A PROP_TAG( PT_STRING8, 0x3A2D) +#define PR_ASSISTANT_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A2E) +#define PR_ASSISTANT_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A2E) +#define PR_ASSISTANT_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A2E) +#define PR_HOME2_TELEPHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A2F) +#define PR_HOME2_TELEPHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A2F) +#define PR_HOME2_TELEPHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A2F) +#define PR_ASSISTANT PROP_TAG( PT_TSTRING, 0x3A30) +#define PR_ASSISTANT_W PROP_TAG( PT_UNICODE, 0x3A30) +#define PR_ASSISTANT_A PROP_TAG( PT_STRING8, 0x3A30) +#define PR_SEND_RICH_INFO PROP_TAG( PT_BOOLEAN, 0x3A40) + +#define PR_WEDDING_ANNIVERSARY PROP_TAG( PT_SYSTIME, 0x3A41) +#define PR_BIRTHDAY PROP_TAG( PT_SYSTIME, 0x3A42) + + +#define PR_HOBBIES PROP_TAG( PT_TSTRING, 0x3A43) +#define PR_HOBBIES_W PROP_TAG( PT_UNICODE, 0x3A43) +#define PR_HOBBIES_A PROP_TAG( PT_STRING8, 0x3A43) + +#define PR_MIDDLE_NAME PROP_TAG( PT_TSTRING, 0x3A44) +#define PR_MIDDLE_NAME_W PROP_TAG( PT_UNICODE, 0x3A44) +#define PR_MIDDLE_NAME_A PROP_TAG( PT_STRING8, 0x3A44) + +#define PR_DISPLAY_NAME_PREFIX PROP_TAG( PT_TSTRING, 0x3A45) +#define PR_DISPLAY_NAME_PREFIX_W PROP_TAG( PT_UNICODE, 0x3A45) +#define PR_DISPLAY_NAME_PREFIX_A PROP_TAG( PT_STRING8, 0x3A45) + +#define PR_PROFESSION PROP_TAG( PT_TSTRING, 0x3A46) +#define PR_PROFESSION_W PROP_TAG( PT_UNICODE, 0x3A46) +#define PR_PROFESSION_A PROP_TAG( PT_STRING8, 0x3A46) + +#define PR_PREFERRED_BY_NAME PROP_TAG( PT_TSTRING, 0x3A47) +#define PR_PREFERRED_BY_NAME_W PROP_TAG( PT_UNICODE, 0x3A47) +#define PR_PREFERRED_BY_NAME_A PROP_TAG( PT_STRING8, 0x3A47) + +#define PR_SPOUSE_NAME PROP_TAG( PT_TSTRING, 0x3A48) +#define PR_SPOUSE_NAME_W PROP_TAG( PT_UNICODE, 0x3A48) +#define PR_SPOUSE_NAME_A PROP_TAG( PT_STRING8, 0x3A48) + +#define PR_COMPUTER_NETWORK_NAME PROP_TAG( PT_TSTRING, 0x3A49) +#define PR_COMPUTER_NETWORK_NAME_W PROP_TAG( PT_UNICODE, 0x3A49) +#define PR_COMPUTER_NETWORK_NAME_A PROP_TAG( PT_STRING8, 0x3A49) + +#define PR_CUSTOMER_ID PROP_TAG( PT_TSTRING, 0x3A4A) +#define PR_CUSTOMER_ID_W PROP_TAG( PT_UNICODE, 0x3A4A) +#define PR_CUSTOMER_ID_A PROP_TAG( PT_STRING8, 0x3A4A) + +#define PR_TTYTDD_PHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A4B) +#define PR_TTYTDD_PHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A4B) +#define PR_TTYTDD_PHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A4B) + +#define PR_FTP_SITE PROP_TAG( PT_TSTRING, 0x3A4C) +#define PR_FTP_SITE_W PROP_TAG( PT_UNICODE, 0x3A4C) +#define PR_FTP_SITE_A PROP_TAG( PT_STRING8, 0x3A4C) + +#define PR_GENDER PROP_TAG( PT_SHORT, 0x3A4D) + +#define PR_MANAGER_NAME PROP_TAG( PT_TSTRING, 0x3A4E) +#define PR_MANAGER_NAME_W PROP_TAG( PT_UNICODE, 0x3A4E) +#define PR_MANAGER_NAME_A PROP_TAG( PT_STRING8, 0x3A4E) + +#define PR_NICKNAME PROP_TAG( PT_TSTRING, 0x3A4F) +#define PR_NICKNAME_W PROP_TAG( PT_UNICODE, 0x3A4F) +#define PR_NICKNAME_A PROP_TAG( PT_STRING8, 0x3A4F) + +#define PR_PERSONAL_HOME_PAGE PROP_TAG( PT_TSTRING, 0x3A50) +#define PR_PERSONAL_HOME_PAGE_W PROP_TAG( PT_UNICODE, 0x3A50) +#define PR_PERSONAL_HOME_PAGE_A PROP_TAG( PT_STRING8, 0x3A50) + + +#define PR_BUSINESS_HOME_PAGE PROP_TAG( PT_TSTRING, 0x3A51) +#define PR_BUSINESS_HOME_PAGE_W PROP_TAG( PT_UNICODE, 0x3A51) +#define PR_BUSINESS_HOME_PAGE_A PROP_TAG( PT_STRING8, 0x3A51) + +#define PR_CONTACT_VERSION PROP_TAG( PT_CLSID, 0x3A52) +#define PR_CONTACT_ENTRYIDS PROP_TAG( PT_MV_BINARY, 0x3A53) + +#define PR_CONTACT_ADDRTYPES PROP_TAG( PT_MV_TSTRING, 0x3A54) +#define PR_CONTACT_ADDRTYPES_W PROP_TAG( PT_MV_UNICODE, 0x3A54) +#define PR_CONTACT_ADDRTYPES_A PROP_TAG( PT_MV_STRING8, 0x3A54) + +#define PR_CONTACT_DEFAULT_ADDRESS_INDEX PROP_TAG( PT_LONG, 0x3A55) + +#define PR_CONTACT_EMAIL_ADDRESSES PROP_TAG( PT_MV_TSTRING, 0x3A56) +#define PR_CONTACT_EMAIL_ADDRESSES_W PROP_TAG( PT_MV_UNICODE, 0x3A56) +#define PR_CONTACT_EMAIL_ADDRESSES_A PROP_TAG( PT_MV_STRING8, 0x3A56) + + +#define PR_COMPANY_MAIN_PHONE_NUMBER PROP_TAG( PT_TSTRING, 0x3A57) +#define PR_COMPANY_MAIN_PHONE_NUMBER_W PROP_TAG( PT_UNICODE, 0x3A57) +#define PR_COMPANY_MAIN_PHONE_NUMBER_A PROP_TAG( PT_STRING8, 0x3A57) + +#define PR_CHILDRENS_NAMES PROP_TAG( PT_MV_TSTRING, 0x3A58) +#define PR_CHILDRENS_NAMES_W PROP_TAG( PT_MV_UNICODE, 0x3A58) +#define PR_CHILDRENS_NAMES_A PROP_TAG( PT_MV_STRING8, 0x3A58) + + + +#define PR_HOME_ADDRESS_CITY PROP_TAG( PT_TSTRING, 0x3A59) +#define PR_HOME_ADDRESS_CITY_W PROP_TAG( PT_UNICODE, 0x3A59) +#define PR_HOME_ADDRESS_CITY_A PROP_TAG( PT_STRING8, 0x3A59) + +#define PR_HOME_ADDRESS_COUNTRY PROP_TAG( PT_TSTRING, 0x3A5A) +#define PR_HOME_ADDRESS_COUNTRY_W PROP_TAG( PT_UNICODE, 0x3A5A) +#define PR_HOME_ADDRESS_COUNTRY_A PROP_TAG( PT_STRING8, 0x3A5A) + +#define PR_HOME_ADDRESS_POSTAL_CODE PROP_TAG( PT_TSTRING, 0x3A5B) +#define PR_HOME_ADDRESS_POSTAL_CODE_W PROP_TAG( PT_UNICODE, 0x3A5B) +#define PR_HOME_ADDRESS_POSTAL_CODE_A PROP_TAG( PT_STRING8, 0x3A5B) + +#define PR_HOME_ADDRESS_STATE_OR_PROVINCE PROP_TAG( PT_TSTRING, 0x3A5C) +#define PR_HOME_ADDRESS_STATE_OR_PROVINCE_W PROP_TAG( PT_UNICODE, 0x3A5C) +#define PR_HOME_ADDRESS_STATE_OR_PROVINCE_A PROP_TAG( PT_STRING8, 0x3A5C) + +#define PR_HOME_ADDRESS_STREET PROP_TAG( PT_TSTRING, 0x3A5D) +#define PR_HOME_ADDRESS_STREET_W PROP_TAG( PT_UNICODE, 0x3A5D) +#define PR_HOME_ADDRESS_STREET_A PROP_TAG( PT_STRING8, 0x3A5D) + +#define PR_HOME_ADDRESS_POST_OFFICE_BOX PROP_TAG( PT_TSTRING, 0x3A5E) +#define PR_HOME_ADDRESS_POST_OFFICE_BOX_W PROP_TAG( PT_UNICODE, 0x3A5E) +#define PR_HOME_ADDRESS_POST_OFFICE_BOX_A PROP_TAG( PT_STRING8, 0x3A5E) + +#define PR_OTHER_ADDRESS_CITY PROP_TAG( PT_TSTRING, 0x3A5F) +#define PR_OTHER_ADDRESS_CITY_W PROP_TAG( PT_UNICODE, 0x3A5F) +#define PR_OTHER_ADDRESS_CITY_A PROP_TAG( PT_STRING8, 0x3A5F) + +#define PR_OTHER_ADDRESS_COUNTRY PROP_TAG( PT_TSTRING, 0x3A60) +#define PR_OTHER_ADDRESS_COUNTRY_W PROP_TAG( PT_UNICODE, 0x3A60) +#define PR_OTHER_ADDRESS_COUNTRY_A PROP_TAG( PT_STRING8, 0x3A60) + +#define PR_OTHER_ADDRESS_POSTAL_CODE PROP_TAG( PT_TSTRING, 0x3A61) +#define PR_OTHER_ADDRESS_POSTAL_CODE_W PROP_TAG( PT_UNICODE, 0x3A61) +#define PR_OTHER_ADDRESS_POSTAL_CODE_A PROP_TAG( PT_STRING8, 0x3A61) + +#define PR_OTHER_ADDRESS_STATE_OR_PROVINCE PROP_TAG( PT_TSTRING, 0x3A62) +#define PR_OTHER_ADDRESS_STATE_OR_PROVINCE_W PROP_TAG( PT_UNICODE, 0x3A62) +#define PR_OTHER_ADDRESS_STATE_OR_PROVINCE_A PROP_TAG( PT_STRING8, 0x3A62) + +#define PR_OTHER_ADDRESS_STREET PROP_TAG( PT_TSTRING, 0x3A63) +#define PR_OTHER_ADDRESS_STREET_W PROP_TAG( PT_UNICODE, 0x3A63) +#define PR_OTHER_ADDRESS_STREET_A PROP_TAG( PT_STRING8, 0x3A63) + +#define PR_OTHER_ADDRESS_POST_OFFICE_BOX PROP_TAG( PT_TSTRING, 0x3A64) +#define PR_OTHER_ADDRESS_POST_OFFICE_BOX_W PROP_TAG( PT_UNICODE, 0x3A64) +#define PR_OTHER_ADDRESS_POST_OFFICE_BOX_A PROP_TAG( PT_STRING8, 0x3A64) + + +/* + * Profile section properties + */ + +#define PR_STORE_PROVIDERS PROP_TAG( PT_BINARY, 0x3D00) +#define PR_AB_PROVIDERS PROP_TAG( PT_BINARY, 0x3D01) +#define PR_TRANSPORT_PROVIDERS PROP_TAG( PT_BINARY, 0x3D02) + +#define PR_DEFAULT_PROFILE PROP_TAG( PT_BOOLEAN, 0x3D04) +#define PR_AB_SEARCH_PATH PROP_TAG( PT_MV_BINARY, 0x3D05) +#define PR_AB_DEFAULT_DIR PROP_TAG( PT_BINARY, 0x3D06) +#define PR_AB_DEFAULT_PAB PROP_TAG( PT_BINARY, 0x3D07) + +#define PR_FILTERING_HOOKS PROP_TAG( PT_BINARY, 0x3D08) +#define PR_SERVICE_NAME PROP_TAG( PT_TSTRING, 0x3D09) +#define PR_SERVICE_NAME_W PROP_TAG( PT_UNICODE, 0x3D09) +#define PR_SERVICE_NAME_A PROP_TAG( PT_STRING8, 0x3D09) +#define PR_SERVICE_DLL_NAME PROP_TAG( PT_TSTRING, 0x3D0A) +#define PR_SERVICE_DLL_NAME_W PROP_TAG( PT_UNICODE, 0x3D0A) +#define PR_SERVICE_DLL_NAME_A PROP_TAG( PT_STRING8, 0x3D0A) +#define PR_SERVICE_ENTRY_NAME PROP_TAG( PT_STRING8, 0x3D0B) +#define PR_SERVICE_UID PROP_TAG( PT_BINARY, 0x3D0C) +#define PR_SERVICE_EXTRA_UIDS PROP_TAG( PT_BINARY, 0x3D0D) +#define PR_SERVICES PROP_TAG( PT_BINARY, 0x3D0E) +#define PR_SERVICE_SUPPORT_FILES PROP_TAG( PT_MV_TSTRING, 0x3D0F) +#define PR_SERVICE_SUPPORT_FILES_W PROP_TAG( PT_MV_UNICODE, 0x3D0F) +#define PR_SERVICE_SUPPORT_FILES_A PROP_TAG( PT_MV_STRING8, 0x3D0F) +#define PR_SERVICE_DELETE_FILES PROP_TAG( PT_MV_TSTRING, 0x3D10) +#define PR_SERVICE_DELETE_FILES_W PROP_TAG( PT_MV_UNICODE, 0x3D10) +#define PR_SERVICE_DELETE_FILES_A PROP_TAG( PT_MV_STRING8, 0x3D10) +#define PR_AB_SEARCH_PATH_UPDATE PROP_TAG( PT_BINARY, 0x3D11) +#define PR_PROFILE_NAME PROP_TAG( PT_TSTRING, 0x3D12) +#define PR_PROFILE_NAME_A PROP_TAG( PT_STRING8, 0x3D12) +#define PR_PROFILE_NAME_W PROP_TAG( PT_UNICODE, 0x3D12) + +/* + * Status object properties + */ + +#define PR_IDENTITY_DISPLAY PROP_TAG( PT_TSTRING, 0x3E00) +#define PR_IDENTITY_DISPLAY_W PROP_TAG( PT_UNICODE, 0x3E00) +#define PR_IDENTITY_DISPLAY_A PROP_TAG( PT_STRING8, 0x3E00) +#define PR_IDENTITY_ENTRYID PROP_TAG( PT_BINARY, 0x3E01) +#define PR_RESOURCE_METHODS PROP_TAG( PT_LONG, 0x3E02) +#define PR_RESOURCE_TYPE PROP_TAG( PT_LONG, 0x3E03) +#define PR_STATUS_CODE PROP_TAG( PT_LONG, 0x3E04) +#define PR_IDENTITY_SEARCH_KEY PROP_TAG( PT_BINARY, 0x3E05) +#define PR_OWN_STORE_ENTRYID PROP_TAG( PT_BINARY, 0x3E06) +#define PR_RESOURCE_PATH PROP_TAG( PT_TSTRING, 0x3E07) +#define PR_RESOURCE_PATH_W PROP_TAG( PT_UNICODE, 0x3E07) +#define PR_RESOURCE_PATH_A PROP_TAG( PT_STRING8, 0x3E07) +#define PR_STATUS_STRING PROP_TAG( PT_TSTRING, 0x3E08) +#define PR_STATUS_STRING_W PROP_TAG( PT_UNICODE, 0x3E08) +#define PR_STATUS_STRING_A PROP_TAG( PT_STRING8, 0x3E08) +#define PR_X400_DEFERRED_DELIVERY_CANCEL PROP_TAG( PT_BOOLEAN, 0x3E09) +#define PR_HEADER_FOLDER_ENTRYID PROP_TAG( PT_BINARY, 0x3E0A) +#define PR_REMOTE_PROGRESS PROP_TAG( PT_LONG, 0x3E0B) +#define PR_REMOTE_PROGRESS_TEXT PROP_TAG( PT_TSTRING, 0x3E0C) +#define PR_REMOTE_PROGRESS_TEXT_W PROP_TAG( PT_UNICODE, 0x3E0C) +#define PR_REMOTE_PROGRESS_TEXT_A PROP_TAG( PT_STRING8, 0x3E0C) +#define PR_REMOTE_VALIDATE_OK PROP_TAG( PT_BOOLEAN, 0x3E0D) + +/* + * Display table properties + */ + +#define PR_CONTROL_FLAGS PROP_TAG( PT_LONG, 0x3F00) +#define PR_CONTROL_STRUCTURE PROP_TAG( PT_BINARY, 0x3F01) +#define PR_CONTROL_TYPE PROP_TAG( PT_LONG, 0x3F02) +#define PR_DELTAX PROP_TAG( PT_LONG, 0x3F03) +#define PR_DELTAY PROP_TAG( PT_LONG, 0x3F04) +#define PR_XPOS PROP_TAG( PT_LONG, 0x3F05) +#define PR_YPOS PROP_TAG( PT_LONG, 0x3F06) +#define PR_CONTROL_ID PROP_TAG( PT_BINARY, 0x3F07) +#define PR_INITIAL_DETAILS_PANE PROP_TAG( PT_LONG, 0x3F08) + +/* + * Secure property id range + */ + +#define PROP_ID_SECURE_MIN 0x67F0 +#define PROP_ID_SECURE_MAX 0x67FF + + +#endif /* MAPITAGS_H */ diff --git a/comm/mailnews/mapi/include/mapiutil.h b/comm/mailnews/mapi/include/mapiutil.h new file mode 100644 index 0000000000..a08634cbff --- /dev/null +++ b/comm/mailnews/mapi/include/mapiutil.h @@ -0,0 +1,889 @@ +/* + * M A P I U T I L . H + * + * Definitions and prototypes for utility functions provided by MAPI + * in MAPI[xx].DLL. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MAPIUTIL_H_ +#define _MAPIUTIL_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN64) && !defined (_WIN64) +#define _WIN64 +#endif + +/* + * Under Win64 systems Win32 is also defined for backwards compatibility. + */ + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAPIX_H +#include <mapix.h> +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + + +/* IMAPITable in memory */ + +/* ITableData Interface ---------------------------------------------------- */ + +DECLARE_MAPI_INTERFACE_PTR(ITableData, LPTABLEDATA); + +typedef void (STDAPICALLTYPE CALLERRELEASE)( + ULONG_PTR ulCallerData, + LPTABLEDATA lpTblData, + LPMAPITABLE lpVue +); + +#define MAPI_ITABLEDATA_METHODS(IPURE) \ + MAPIMETHOD(HrGetView) \ + (THIS_ LPSSortOrderSet lpSSortOrderSet, \ + CALLERRELEASE FAR * lpfCallerRelease, \ + ULONG_PTR ulCallerData, \ + LPMAPITABLE FAR * lppMAPITable) IPURE; \ + MAPIMETHOD(HrModifyRow) \ + (THIS_ LPSRow) IPURE; \ + MAPIMETHOD(HrDeleteRow) \ + (THIS_ LPSPropValue lpSPropValue) IPURE; \ + MAPIMETHOD(HrQueryRow) \ + (THIS_ LPSPropValue lpsPropValue, \ + LPSRow FAR * lppSRow, \ + ULONG FAR * lpuliRow) IPURE; \ + MAPIMETHOD(HrEnumRow) \ + (THIS_ ULONG ulRowNumber, \ + LPSRow FAR * lppSRow) IPURE; \ + MAPIMETHOD(HrNotify) \ + (THIS_ ULONG ulFlags, \ + ULONG cValues, \ + LPSPropValue lpSPropValue) IPURE; \ + MAPIMETHOD(HrInsertRow) \ + (THIS_ ULONG uliRow, \ + LPSRow lpSRow) IPURE; \ + MAPIMETHOD(HrModifyRows) \ + (THIS_ ULONG ulFlags, \ + LPSRowSet lpSRowSet) IPURE; \ + MAPIMETHOD(HrDeleteRows) \ + (THIS_ ULONG ulFlags, \ + LPSRowSet lprowsetToDelete, \ + ULONG FAR * cRowsDeleted) IPURE; \ + +#undef INTERFACE +#define INTERFACE ITableData +DECLARE_MAPI_INTERFACE_(ITableData, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_ITABLEDATA_METHODS(PURE) +}; + + +/* Entry Point for in memory ITable */ + + +/* CreateTable() + * Creates the internal memory structures and object handle + * to bring a new table into existence. + * + * lpInterface + * Interface ID of the TableData object (IID_IMAPITableData) + * + * lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer + * Function addresses are provided by the caller so that + * this DLL allocates/frees memory appropriately. + * lpvReserved + * Reserved. Should be NULL. + * ulTableType + * TBLTYPE_DYNAMIC, etc. Visible to the calling application + * as part of the GetStatus return data on its views + * ulPropTagIndexColumn + * Index column for use when changing the data + * lpSPropTagArrayColumns + * Column proptags for the minimum set of columns in the table + * lppTableData + * Address of the pointer which will receive the TableData object + */ + +STDAPI_(SCODE) +CreateTable( LPCIID lpInterface, + ALLOCATEBUFFER FAR * lpAllocateBuffer, + ALLOCATEMORE FAR * lpAllocateMore, + FREEBUFFER FAR * lpFreeBuffer, + LPVOID lpvReserved, + ULONG ulTableType, + ULONG ulPropTagIndexColumn, + LPSPropTagArray lpSPropTagArrayColumns, + LPTABLEDATA FAR * lppTableData ); + +/* HrGetView() + * This function obtains a new view on the underlying data + * which supports the IMAPITable interface. All rows and columns + * of the underlying table data are initially visible + * lpSSortOrderSet + * if specified, results in the view being sorted + * lpfCallerRelease + * pointer to a routine to be called when the view is released, or + * NULL. + * ulCallerData + * arbitrary data the caller wants saved with this view and returned in + * the Release callback. + */ + +/* HrModifyRows() + * Add or modify a set of rows in the table data + * ulFlags + * Must be zero + * lpSRowSet + * Each row in the row set contains all the properties for one row + * in the table. One of the properties must be the index column. Any + * row in the table with the same value for its index column is + * replaced, or if there is no current row with that value the + * row is added. + * Each row in LPSRowSet MUST have a unique Index column! + * If any views are open, the view is updated as well. + * The properties do not have to be in the same order as the + * columns in the current table + */ + +/* HrModifyRow() + * Add or modify one row in the table + * lpSRow + * This row contains all the properties for one row in the table. + * One of the properties must be the index column. Any row in + * the table with the same value for its index column is + * replaced, or if there is no current row with that value the + * row is added + * If any views are open, the view is updated as well. + * The properties do not have to be in the same order as the + * columns in the current table + */ + +/* HrDeleteRows() + * Delete a row in the table. + * ulFlags + * TAD_ALL_ROWS - Causes all rows in the table to be deleted + * lpSRowSet is ignored in this case. + * lpSRowSet + * Each row in the row set contains all the properties for one row + * in the table. One of the properties must be the index column. Any + * row in the table with the same value for its index column is + * deleted. + * Each row in LPSRowSet MUST have a unique Index column! + * If any views are open, the view is updated as well. + * The properties do not have to be in the same order as the + * columns in the current table + */ +#define TAD_ALL_ROWS 1 + +/* HrDeleteRow() + * Delete a row in the table. + * lpSPropValue + * This property value specifies the row which has this value + * for its index column + */ + +/* HrQueryRow() + * Returns the values of a specified row in the table + * lpSPropValue + * This property value specifies the row which has this value + * for its index column + * lppSRow + * Address of where to return a pointer to an SRow + * lpuliRow + * Address of where to return the row number. This can be NULL + * if the row number is not required. + * + */ + +/* HrEnumRow() + * Returns the values of a specific (numbered) row in the table + * ulRowNumber + * Indicates row number 0 to n-1 + * lppSRow + * Address of where to return a pointer to a SRow + */ + +/* HrInsertRow() + * Inserts a row into the table. + * uliRow + * The row number before which this row will be inserted into the table. + * Row numbers can be from 0 to n where o to n-1 result in row insertion + * a row number of n results in the row being appended to the table. + * lpSRow + * This row contains all the properties for one row in the table. + * One of the properties must be the index column. Any row in + * the table with the same value for its index column is + * replaced, or if there is no current row with that value the + * row is added + * If any views are open, the view is updated as well. + * The properties do not have to be in the same order as the + * columns in the current table + */ + + +/* IMAPIProp in memory */ + +/* IPropData Interface ---------------------------------------------------- */ + + +#define MAPI_IPROPDATA_METHODS(IPURE) \ + MAPIMETHOD(HrSetObjAccess) \ + (THIS_ ULONG ulAccess) IPURE; \ + MAPIMETHOD(HrSetPropAccess) \ + (THIS_ LPSPropTagArray lpPropTagArray, \ + ULONG FAR * rgulAccess) IPURE; \ + MAPIMETHOD(HrGetPropAccess) \ + (THIS_ LPSPropTagArray FAR * lppPropTagArray, \ + ULONG FAR * FAR * lprgulAccess) IPURE; \ + MAPIMETHOD(HrAddObjProps) \ + (THIS_ LPSPropTagArray lppPropTagArray, \ + LPSPropProblemArray FAR * lprgulAccess) IPURE; + + +#undef INTERFACE +#define INTERFACE IPropData +DECLARE_MAPI_INTERFACE_(IPropData, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IPROPDATA_METHODS(PURE) +}; + +DECLARE_MAPI_INTERFACE_PTR(IPropData, LPPROPDATA); + + +/* Entry Point for in memory IMAPIProp */ + + +/* CreateIProp() + * Creates the internal memory structures and object handle + * to bring a new property interface into existence. + * + * lpInterface + * Interface ID of the TableData object (IID_IMAPIPropData) + * + * lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer + * Function addresses are provided by the caller so that + * this DLL allocates/frees memory appropriately. + * lppPropData + * Address of the pointer which will receive the IPropData object + * lpvReserved + * Reserved. Should be NULL. + */ + +STDAPI_(SCODE) +CreateIProp( LPCIID lpInterface, + ALLOCATEBUFFER FAR * lpAllocateBuffer, + ALLOCATEMORE FAR * lpAllocateMore, + FREEBUFFER FAR * lpFreeBuffer, + LPVOID lpvReserved, + LPPROPDATA FAR * lppPropData ); + +/* + * Defines for prop/obj access + */ +#define IPROP_READONLY ((ULONG) 0x00000001) +#define IPROP_READWRITE ((ULONG) 0x00000002) +#define IPROP_CLEAN ((ULONG) 0x00010000) +#define IPROP_DIRTY ((ULONG) 0x00020000) + +/* + - HrSetPropAccess + - + * Sets access right attributes on a per-property basis. By default, + * all properties are read/write. + * + */ + +/* + - HrSetObjAccess + - + * Sets access rights for the object itself. By default, the object has + * read/write access. + * + */ + +#ifndef NOIDLEENGINE + +/* Idle time scheduler */ + +/* + * PRI + * + * Priority of an idle task. + * The idle engine sorts tasks by priority, and the one with the higher + * value runs first. Within a priority level, the functions are called + * round-robin. + */ + +#define PRILOWEST -32768 +#define PRIHIGHEST 32767 +#define PRIUSER 0 + +/* + * IRO + * + * Idle routine options. This is a combined bit mask consisting of + * individual firo's. Listed below are the possible bit flags. + * + * FIROWAIT and FIROINTERVAL are mutually exclusive. + * If neither of the flags are specified, the default action + * is to ignore the time parameter of the idle function and + * call it as often as possible if firoPerBlock is not set; + * otherwise call it one time only during the idle block + * once the time constraint has been set. FIROINTERVAL + * is also incompatible with FIROPERBLOCK. + * + * FIROWAIT - time given is minimum idle time before calling + * for the first time in the block of idle time, + * afterwhich call as often as possible. + * FIROINTERVAL - time given is minimum interval between each + * successive call + * FIROPERBLOCK - called only once per contiguous block of idle + * time + * FIRODISABLED - initially disabled when registered, the + * default is to enable the function when registered. + * FIROONCEONLY - called only one time by the scheduler and then + * deregistered automatically. + */ + +#define IRONULL ((USHORT) 0x0000) +#define FIROWAIT ((USHORT) 0x0001) +#define FIROINTERVAL ((USHORT) 0x0002) +#define FIROPERBLOCK ((USHORT) 0x0004) +#define FIRODISABLED ((USHORT) 0x0020) +#define FIROONCEONLY ((USHORT) 0x0040) + +/* + * IRC + * + * Idle routine change options. This is a combined bit mask consisting + * of individual firc's; each one identifies an aspect of the idle task + * that can be changed. + * + */ + +#define IRCNULL ((USHORT) 0x0000) +#define FIRCPFN ((USHORT) 0x0001) /* change function pointer */ +#define FIRCPV ((USHORT) 0x0002) /* change parameter block */ +#define FIRCPRI ((USHORT) 0x0004) /* change priority */ +#define FIRCCSEC ((USHORT) 0x0008) /* change time */ +#define FIRCIRO ((USHORT) 0x0010) /* change routine options */ + +/* + * Type definition for idle functions. An idle function takes one + * parameter, an PV, and returns a BOOL value. + */ + +typedef BOOL (STDAPICALLTYPE FNIDLE) (LPVOID); +typedef FNIDLE FAR *PFNIDLE; + +/* + * FTG + * + * Function Tag. Used to identify a registered idle function. + * + */ + +typedef void FAR *FTG; +typedef FTG FAR *PFTG; +#define FTGNULL ((FTG) NULL) + +/* + - MAPIInitIdle/MAPIDeinitIdle + - + * Purpose: + * Initialises the idle engine + * If the initialisation succeeded, returns 0, else returns -1 + * + * Arguments: + * lpvReserved Reserved, must be NULL. + */ + +STDAPI_(LONG) +MAPIInitIdle (LPVOID lpvReserved); + +STDAPI_(VOID) +MAPIDeinitIdle (VOID); + + +/* + * FtgRegisterIdleRoutine + * + * Registers the function pfn of type PFNIDLE, i.e., (BOOL (*)(LPVOID)) + * as an idle function. + * + * The idle function will be called with the parameter pv by the + * idle engine. The function has initial priority priIdle, + * associated time csecIdle, and options iroIdle. + */ + +STDAPI_(FTG) +FtgRegisterIdleRoutine (PFNIDLE lpfnIdle, LPVOID lpvIdleParam, + short priIdle, ULONG csecIdle, USHORT iroIdle); + +/* + * DeregisterIdleRoutine + * + * Removes the given routine from the list of idle routines. + * The routine will not be called again. It is the responsibility + * of the caller to clean up any data structures pointed to by the + * pvIdleParam parameter; this routine does not free the block. + */ + +STDAPI_(void) +DeregisterIdleRoutine (FTG ftg); + +/* + * EnableIdleRoutine + * + * Enables or disables an idle routine. + */ + +STDAPI_(void) +EnableIdleRoutine (FTG ftg, BOOL fEnable); + +/* + * ChangeIdleRoutine + * + * Changes some or all of the characteristics of the given idle + * function. The changes to make are indicated with flags in the + * ircIdle parameter. + */ + +STDAPI_(void) +ChangeIdleRoutine (FTG ftg, PFNIDLE lpfnIdle, LPVOID lpvIdleParam, + short priIdle, ULONG csecIdle, USHORT iroIdle, USHORT ircIdle); + + +#endif /* ! NOIDLEENGINE */ + + +/* IMalloc Utilities */ + +STDAPI_(LPMALLOC) MAPIGetDefaultMalloc(VOID); + + +/* StreamOnFile (SOF) */ + +/* + * Methods and #define's for implementing an OLE 2.0 storage stream + * (as defined in the OLE 2.0 specs) on top of a system file. + */ + +#define SOF_UNIQUEFILENAME ((ULONG) 0x80000000) + +STDMETHODIMP OpenStreamOnFile( + LPALLOCATEBUFFER lpAllocateBuffer, + LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, + __in LPCTSTR lpszFileName, + __in_opt LPCTSTR lpszPrefix, + LPSTREAM FAR * lppStream); + +typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENSTREAMONFILE) ( + LPALLOCATEBUFFER lpAllocateBuffer, + LPFREEBUFFER lpFreeBuffer, + ULONG ulFlags, + __in LPCTSTR lpszFileName, + __in_opt LPCTSTR lpszPrefix, + LPSTREAM FAR * lppStream); + +#if defined(_WIN64) || defined(_WIN32) +#define OPENSTREAMONFILE "OpenStreamOnFile" +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + + +/* Property interface utilities */ + +/* + * Copies a single SPropValue from Src to Dest. Handles all the various + * types of properties and will link its allocations given the master + * allocation object and an allocate more function. + */ +STDAPI_(SCODE) +PropCopyMore( LPSPropValue lpSPropValueDest, + LPSPropValue lpSPropValueSrc, + ALLOCATEMORE * lpfAllocMore, + LPVOID lpvObject ); + +/* + * Returns the size in bytes of structure at lpSPropValue, including the + * Value. + */ +STDAPI_(ULONG) +UlPropSize( LPSPropValue lpSPropValue ); + + +STDAPI_(BOOL) +FEqualNames( LPMAPINAMEID lpName1, LPMAPINAMEID lpName2 ); + +#if (defined(_WIN64) || defined(_WIN32)) && !defined(_WINNT) && !defined(_WIN95) && !defined(_MAC) +#define _WINNT +#endif + +STDAPI_(void) +GetInstance(LPSPropValue lpPropMv, LPSPropValue lpPropSv, ULONG uliInst); + +extern char rgchCsds[]; +extern char rgchCids[]; +extern char rgchCsdi[]; +extern char rgchCidi[]; + +STDAPI_(BOOL) +FPropContainsProp( LPSPropValue lpSPropValueDst, + LPSPropValue lpSPropValueSrc, + ULONG ulFuzzyLevel ); + +STDAPI_(BOOL) +FPropCompareProp( LPSPropValue lpSPropValue1, + ULONG ulRelOp, + LPSPropValue lpSPropValue2 ); + +STDAPI_(LONG) +LPropCompareProp( LPSPropValue lpSPropValueA, + LPSPropValue lpSPropValueB ); + +STDAPI_(HRESULT) +HrAddColumns( LPMAPITABLE lptbl, + LPSPropTagArray lpproptagColumnsNew, + LPALLOCATEBUFFER lpAllocateBuffer, + LPFREEBUFFER lpFreeBuffer); + +STDAPI_(HRESULT) +HrAddColumnsEx( LPMAPITABLE lptbl, + LPSPropTagArray lpproptagColumnsNew, + LPALLOCATEBUFFER lpAllocateBuffer, + LPFREEBUFFER lpFreeBuffer, + void (FAR *lpfnFilterColumns)(LPSPropTagArray ptaga)); + + +/* Notification utilities */ + +/* + * Function that creates an advise sink object given a notification + * callback function and context. + */ + +STDAPI +HrAllocAdviseSink( LPNOTIFCALLBACK lpfnCallback, + LPVOID lpvContext, + LPMAPIADVISESINK FAR *lppAdviseSink ); + + +/* + * Wraps an existing advise sink with another one which guarantees + * that the original advise sink will be called in the thread on + * which it was created. + */ + +STDAPI +HrThisThreadAdviseSink( LPMAPIADVISESINK lpAdviseSink, + LPMAPIADVISESINK FAR *lppAdviseSink); + + + +/* + * Allows a client and/or provider to force notifications + * which are currently queued in the MAPI notification engine + * to be dispatched without doing a message dispatch. + */ + +STDAPI HrDispatchNotifications (ULONG ulFlags); + + +/* Service Provider Utilities */ + +/* + * Structures and utility function for building a display table + * from resources. + */ + +typedef struct { + ULONG ulCtlType; /* DTCT_LABEL, etc. */ + ULONG ulCtlFlags; /* DT_REQUIRED, etc. */ + LPBYTE lpbNotif; /* pointer to notification data */ + ULONG cbNotif; /* count of bytes of notification data */ + LPTSTR lpszFilter; /* character filter for edit/combobox */ + ULONG ulItemID; /* to validate parallel dlg template entry */ + union { /* ulCtlType discriminates */ + LPVOID lpv; /* Initialize this to avoid warnings */ + LPDTBLLABEL lplabel; + LPDTBLEDIT lpedit; + LPDTBLLBX lplbx; + LPDTBLCOMBOBOX lpcombobox; + LPDTBLDDLBX lpddlbx; + LPDTBLCHECKBOX lpcheckbox; + LPDTBLGROUPBOX lpgroupbox; + LPDTBLBUTTON lpbutton; + LPDTBLRADIOBUTTON lpradiobutton; + LPDTBLMVLISTBOX lpmvlbx; + LPDTBLMVDDLBX lpmvddlbx; + LPDTBLPAGE lppage; + } ctl; +} DTCTL, FAR *LPDTCTL; + +typedef struct { + ULONG cctl; + LPTSTR lpszResourceName; /* as usual, may be an integer ID */ + union { /* as usual, may be an integer ID */ + LPTSTR lpszComponent; + ULONG ulItemID; + }; + LPDTCTL lpctl; +} DTPAGE, FAR *LPDTPAGE; + + + +STDAPI +BuildDisplayTable( LPALLOCATEBUFFER lpAllocateBuffer, + LPALLOCATEMORE lpAllocateMore, + LPFREEBUFFER lpFreeBuffer, + LPMALLOC lpMalloc, + HINSTANCE hInstance, + UINT cPages, + LPDTPAGE lpPage, + ULONG ulFlags, + LPMAPITABLE * lppTable, + LPTABLEDATA * lppTblData ); + + +/* MAPI structure validation/copy utilities */ + +/* + * Validate, copy, and adjust pointers in MAPI structures: + * notification + * property value array + * option data + */ + +STDAPI_(SCODE) +ScCountNotifications(int cNotifications, LPNOTIFICATION lpNotifications, + ULONG FAR *lpcb); + +STDAPI_(SCODE) +ScCopyNotifications(int cNotification, LPNOTIFICATION lpNotifications, + LPVOID lpvDst, ULONG FAR *lpcb); + +STDAPI_(SCODE) +ScRelocNotifications(int cNotification, LPNOTIFICATION lpNotifications, + LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb); + + +STDAPI_(SCODE) +ScCountProps(int cValues, LPSPropValue lpPropArray, ULONG FAR *lpcb); + +STDAPI_(LPSPropValue) +LpValFindProp(ULONG ulPropTag, ULONG cValues, LPSPropValue lpPropArray); + +STDAPI_(SCODE) +ScCopyProps(int cValues, LPSPropValue lpPropArray, LPVOID lpvDst, + ULONG FAR *lpcb); + +STDAPI_(SCODE) +ScRelocProps(int cValues, LPSPropValue lpPropArray, + LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb); + +STDAPI_(SCODE) +ScDupPropset(int cValues, LPSPropValue lpPropArray, + LPALLOCATEBUFFER lpAllocateBuffer, LPSPropValue FAR *lppPropArray); + + +/* General utility functions */ + +/* Related to the OLE Component object model */ + +STDAPI_(ULONG) UlAddRef(LPVOID lpunk); +STDAPI_(ULONG) UlRelease(LPVOID lpunk); + +/* Related to the MAPI interface */ + +STDAPI HrGetOneProp(LPMAPIPROP lpMapiProp, ULONG ulPropTag, + LPSPropValue FAR *lppProp); +STDAPI HrSetOneProp(LPMAPIPROP lpMapiProp, + LPSPropValue lpProp); +STDAPI_(BOOL) FPropExists(LPMAPIPROP lpMapiProp, ULONG ulPropTag); +STDAPI_(LPSPropValue) PpropFindProp(LPSPropValue lpPropArray, ULONG cValues, + ULONG ulPropTag); +STDAPI_(void) FreePadrlist(LPADRLIST lpAdrlist); +STDAPI_(void) FreeProws(LPSRowSet lpRows); +STDAPI HrQueryAllRows(LPMAPITABLE lpTable, + LPSPropTagArray lpPropTags, + LPSRestriction lpRestriction, + LPSSortOrderSet lpSortOrderSet, + LONG crowsMax, + LPSRowSet FAR *lppRows); + +/* Create or validate the IPM folder tree in a message store */ + +#define MAPI_FORCE_CREATE 1 +#define MAPI_FULL_IPM_TREE 2 + +STDAPI HrValidateIPMSubtree(LPMDB lpMDB, ULONG ulFlags, + ULONG FAR *lpcValues, LPSPropValue FAR *lppValues, + LPMAPIERROR FAR *lpperr); + +/* Encoding and decoding strings */ + +STDAPI_(BOOL) FBinFromHex(__in LPTSTR lpsz, LPBYTE lpb); +STDAPI_(SCODE) ScBinFromHexBounded(__in LPTSTR lpsz, LPBYTE lpb, ULONG cb); +STDAPI_(void) HexFromBin(LPBYTE lpb, int cb, __in LPTSTR lpsz); +STDAPI_(ULONG) UlFromSzHex(LPCTSTR lpsz); + +/* Encoding and decoding entry IDs */ +STDAPI HrEntryIDFromSz(__in LPTSTR lpsz, ULONG FAR *lpcb, + LPENTRYID FAR *lppEntryID); +STDAPI HrSzFromEntryID(ULONG cb, LPENTRYID lpEntryID, + __in LPTSTR FAR *lpsz); +STDAPI HrComposeEID(LPMAPISESSION lpSession, + ULONG cbStoreRecordKey, LPBYTE lpStoreRecordKey, + ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID, + ULONG FAR *lpcbEID, LPENTRYID FAR *lppEntryID); +STDAPI HrDecomposeEID(LPMAPISESSION lpSession, + ULONG cbEntryID, LPENTRYID lpEntryID, + ULONG FAR *lpcbStoreEntryID, + LPENTRYID FAR *lppStoreEntryID, + ULONG FAR *lpcbMsgEntryID, + LPENTRYID FAR *lppMsgEntryID); +STDAPI HrComposeMsgID(LPMAPISESSION lpSession, + ULONG cbStoreSearchKey, LPBYTE pStoreSearchKey, + ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID, + __in LPTSTR FAR *lpszMsgID); +STDAPI HrDecomposeMsgID(LPMAPISESSION lpSession, + __in LPTSTR lpszMsgID, + ULONG FAR *lpcbStoreEntryID, + LPENTRYID FAR *lppStoreEntryID, + ULONG FAR *lppcbMsgEntryID, + LPENTRYID FAR *lppMsgEntryID); + +/* C runtime substitutes */ + + +STDAPI_(LPTSTR) SzFindCh(LPCTSTR lpsz, USHORT ch); /* strchr */ +STDAPI_(LPTSTR) SzFindLastCh(LPCTSTR lpsz, USHORT ch); /* strrchr */ +STDAPI_(LPTSTR) SzFindSz(LPCTSTR lpsz, LPCTSTR lpszKey); /*strstr */ +STDAPI_(unsigned int) UFromSz(LPCTSTR lpsz); /* atoi */ + +STDAPI_(SCODE) ScUNCFromLocalPath(__in LPSTR lpszLocal, __in LPSTR lpszUNC, + UINT cchUNC); +STDAPI_(SCODE) ScLocalPathFromUNC(__in LPSTR lpszUNC, __in LPSTR lpszLocal, + UINT cchLocal); + +/* 64-bit arithmetic with times */ + +STDAPI_(FILETIME) FtAddFt(FILETIME ftAddend1, FILETIME ftAddend2); +STDAPI_(FILETIME) FtMulDwDw(DWORD ftMultiplicand, DWORD ftMultiplier); +STDAPI_(FILETIME) FtMulDw(DWORD ftMultiplier, FILETIME ftMultiplicand); +STDAPI_(FILETIME) FtSubFt(FILETIME ftMinuend, FILETIME ftSubtrahend); +STDAPI_(FILETIME) FtNegFt(FILETIME ft); + +/* Message composition */ + +STDAPI_(SCODE) ScCreateConversationIndex (ULONG cbParent, + LPBYTE lpbParent, + ULONG FAR * lpcbConvIndex, + LPBYTE FAR * lppbConvIndex); + +/* Store support */ + +STDAPI WrapStoreEntryID (ULONG ulFlags, __in LPTSTR lpszDLLName, ULONG cbOrigEntry, + LPENTRYID lpOrigEntry, ULONG *lpcbWrappedEntry, LPENTRYID *lppWrappedEntry); + +/* RTF Sync Utilities */ + +#define RTF_SYNC_RTF_CHANGED ((ULONG) 0x00000001) +#define RTF_SYNC_BODY_CHANGED ((ULONG) 0x00000002) + +STDAPI_(HRESULT) +RTFSync (LPMESSAGE lpMessage, ULONG ulFlags, __out BOOL FAR * lpfMessageUpdated); + + +/* Flags for WrapCompressedRTFStream() */ + +/****** MAPI_MODIFY ((ULONG) 0x00000001) mapidefs.h */ +/****** STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) mapidefs.h */ + +STDAPI_(HRESULT) +WrapCompressedRTFStream (__in LPSTREAM lpCompressedRTFStream, + ULONG ulFlags, __out LPSTREAM FAR * lpUncompressedRTFStream); + +/* Storage on Stream */ + +#if defined(_WIN64) || defined(_WIN32) || defined(WIN16) +STDAPI_(HRESULT) +HrIStorageFromStream (LPUNKNOWN lpUnkIn, + LPCIID lpInterface, ULONG ulFlags, LPSTORAGE FAR * lppStorageOut); +#endif + + +/* + * Setup and cleanup. + * + * Providers never need to make these calls. + * + * Test applications and the like which do not call MAPIInitialize + * may want to call them, so that the few utility functions which + * need MAPI allocators (and do not ask for them explicitly) + * will work. + */ + +/* All flags are reserved for ScInitMapiUtil. */ + +STDAPI_(SCODE) ScInitMapiUtil(ULONG ulFlags); +STDAPI_(VOID) DeinitMapiUtil(VOID); + + +/* + * Entry point names. + * + * These are for new entry points defined since MAPI first shipped + * in Windows 95. Using these names in a GetProcAddress call makes + * it easier to write code which uses them optionally. + */ + +#if defined (_WIN64) && defined(_AMD64_) +#define szHrDispatchNotifications "HrDispatchNotifications" +#elif defined (_WIN32) && defined (_X86_) +#define szHrDispatchNotifications "_HrDispatchNotifications@4" +#else +#error "Unknown Platform: MAPI is currently supported on Win32/X86 and Win64/AMD64" +#endif + +typedef HRESULT (STDAPICALLTYPE DISPATCHNOTIFICATIONS)(ULONG ulFlags); +typedef DISPATCHNOTIFICATIONS FAR * LPDISPATCHNOTIFICATIONS; + +#if defined (_WIN64) && defined (_AMD64_) +#define szScCreateConversationIndex "ScCreateConversationIndex" +#elif defined (_WIN32) && defined (_X86_) +#define szScCreateConversationIndex "_ScCreateConversationIndex@16" +#else +#error "Unknown Platform: MAPI is currently supported on Win32/X86 and Win64/AMD64" +#endif + +typedef SCODE (STDAPICALLTYPE CREATECONVERSATIONINDEX)(ULONG cbParent, + LPBYTE lpbParent, ULONG FAR *lpcbConvIndex, LPBYTE FAR *lppbConvIndex); +typedef CREATECONVERSATIONINDEX FAR *LPCREATECONVERSATIONINDEX; + +#ifdef __cplusplus +} +#endif + +#endif /* _MAPIUTIL_H_ */ diff --git a/comm/mailnews/mapi/include/mapival.h b/comm/mailnews/mapi/include/mapival.h new file mode 100644 index 0000000000..0e034100d5 --- /dev/null +++ b/comm/mailnews/mapi/include/mapival.h @@ -0,0 +1,1975 @@ +/* + * M A P I V A L . H + * + * Macros used to validate parameters on standard MAPI object methods. + * Used in conjunction with routines found in MAPIU.DLL. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _INC_VALIDATE +#define _INC_VALIDATE + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAPIUTIL_H +#include <mapiutil.h> +#endif +#include <stddef.h> +#include <stdarg.h> + + +#define MAKE_ENUM(Method, Interface) Interface##_##Method + +typedef enum _tagMethods +{ +/* IUnknown */ + MAKE_ENUM(QueryInterface, IUnknown) = 0, + MAKE_ENUM(AddRef, IUnknown), /* For completness */ + MAKE_ENUM(Release, IUnknown), /* For completness */ + +/* IMAPIProps */ + MAKE_ENUM(GetLastError, IMAPIProp), + MAKE_ENUM(SaveChanges, IMAPIProp), + MAKE_ENUM(GetProps, IMAPIProp), + MAKE_ENUM(GetPropList, IMAPIProp), + MAKE_ENUM(OpenProperty, IMAPIProp), + MAKE_ENUM(SetProps, IMAPIProp), + MAKE_ENUM(DeleteProps, IMAPIProp), + MAKE_ENUM(CopyTo, IMAPIProp), + MAKE_ENUM(CopyProps, IMAPIProp), + MAKE_ENUM(GetNamesFromIDs, IMAPIProp), + MAKE_ENUM(GetIDsFromNames, IMAPIProp), + +/* IMAPITable */ + MAKE_ENUM(GetLastError, IMAPITable), + MAKE_ENUM(Advise, IMAPITable), + MAKE_ENUM(Unadvise, IMAPITable), + MAKE_ENUM(GetStatus, IMAPITable), + MAKE_ENUM(SetColumns, IMAPITable), + MAKE_ENUM(QueryColumns, IMAPITable), + MAKE_ENUM(GetRowCount, IMAPITable), + MAKE_ENUM(SeekRow, IMAPITable), + MAKE_ENUM(SeekRowApprox, IMAPITable), + MAKE_ENUM(QueryPosition, IMAPITable), + MAKE_ENUM(FindRow, IMAPITable), + MAKE_ENUM(Restrict, IMAPITable), + MAKE_ENUM(CreateBookmark, IMAPITable), + MAKE_ENUM(FreeBookmark, IMAPITable), + MAKE_ENUM(SortTable, IMAPITable), + MAKE_ENUM(QuerySortOrder, IMAPITable), + MAKE_ENUM(QueryRows, IMAPITable), + MAKE_ENUM(Abort, IMAPITable), + MAKE_ENUM(ExpandRow, IMAPITable), + MAKE_ENUM(CollapseRow, IMAPITable), + MAKE_ENUM(WaitForCompletion, IMAPITable), + MAKE_ENUM(GetCollapseState, IMAPITable), + MAKE_ENUM(SetCollapseState, IMAPITable), + +/* IMAPIContainer */ + MAKE_ENUM(GetContentsTable, IMAPIContainer), + MAKE_ENUM(GetHierarchyTable, IMAPIContainer), + MAKE_ENUM(OpenEntry, IMAPIContainer), + MAKE_ENUM(SetSearchCriteria, IMAPIContainer), + MAKE_ENUM(GetSearchCriteria, IMAPIContainer), + +/* IABContainer */ + MAKE_ENUM(CreateEntry, IABContainer), + MAKE_ENUM(CopyEntries, IABContainer), + MAKE_ENUM(DeleteEntries, IABContainer), + MAKE_ENUM(ResolveNames, IABContainer), + +/* IDistList */ + MAKE_ENUM(CreateEntry, IDistList), + MAKE_ENUM(CopyEntries, IDistList), + MAKE_ENUM(DeleteEntries, IDistList), + MAKE_ENUM(ResolveNames, IDistList), + +/* IMAPIFolder */ + MAKE_ENUM(CreateMessage, IMAPIFolder), + MAKE_ENUM(CopyMessages, IMAPIFolder), + MAKE_ENUM(DeleteMessages, IMAPIFolder), + MAKE_ENUM(CreateFolder, IMAPIFolder), + MAKE_ENUM(CopyFolder, IMAPIFolder), + MAKE_ENUM(DeleteFolder, IMAPIFolder), + MAKE_ENUM(SetReadFlags, IMAPIFolder), + MAKE_ENUM(GetMessageStatus, IMAPIFolder), + MAKE_ENUM(SetMessageStatus, IMAPIFolder), + MAKE_ENUM(SaveContentsSort, IMAPIFolder), + MAKE_ENUM(EmptyFolder, IMAPIFolder), + +/* IMsgStore */ + MAKE_ENUM(Advise, IMsgStore), + MAKE_ENUM(Unadvise, IMsgStore), + MAKE_ENUM(CompareEntryIDs, IMsgStore), + MAKE_ENUM(OpenEntry, IMsgStore), + MAKE_ENUM(SetReceiveFolder, IMsgStore), + MAKE_ENUM(GetReceiveFolder, IMsgStore), + MAKE_ENUM(GetReceiveFolderTable, IMsgStore), + MAKE_ENUM(StoreLogoff, IMsgStore), + MAKE_ENUM(AbortSubmit, IMsgStore), + MAKE_ENUM(GetOutgoingQueue, IMsgStore), + MAKE_ENUM(SetLockState, IMsgStore), + MAKE_ENUM(FinishedMsg, IMsgStore), + MAKE_ENUM(NotifyNewMail, IMsgStore), + +/* IMessage */ + MAKE_ENUM(GetAttachmentTable, IMessage), + MAKE_ENUM(OpenAttach, IMessage), + MAKE_ENUM(CreateAttach, IMessage), + MAKE_ENUM(DeleteAttach, IMessage), + MAKE_ENUM(GetRecipientTable, IMessage), + MAKE_ENUM(ModifyRecipients, IMessage), + MAKE_ENUM(SubmitMessage, IMessage), + MAKE_ENUM(SetReadFlag, IMessage), + + +/* IABProvider */ + MAKE_ENUM(Shutdown, IABProvider), + MAKE_ENUM(Logon, IABProvider), + +/* IABLogon */ + MAKE_ENUM(GetLastError, IABLogon), + MAKE_ENUM(Logoff, IABLogon), + MAKE_ENUM(OpenEntry, IABLogon), + MAKE_ENUM(CompareEntryIDs, IABLogon), + MAKE_ENUM(Advise, IABLogon), + MAKE_ENUM(Unadvise, IABLogon), + MAKE_ENUM(OpenStatusEntry, IABLogon), + MAKE_ENUM(OpenTemplateID, IABLogon), + MAKE_ENUM(GetOneOffTable, IABLogon), + MAKE_ENUM(PrepareRecips, IABLogon), + +/* IXPProvider */ + MAKE_ENUM(Shutdown, IXPProvider), + MAKE_ENUM(TransportLogon, IXPProvider), + +/* IXPLogon */ + MAKE_ENUM(AddressTypes, IXPLogon), + MAKE_ENUM(RegisterOptions, IXPLogon), + MAKE_ENUM(TransportNotify, IXPLogon), + MAKE_ENUM(Idle, IXPLogon), + MAKE_ENUM(TransportLogoff, IXPLogon), + MAKE_ENUM(SubmitMessage, IXPLogon), + MAKE_ENUM(EndMessage, IXPLogon), + MAKE_ENUM(Poll, IXPLogon), + MAKE_ENUM(StartMessage, IXPLogon), + MAKE_ENUM(OpenStatusEntry, IXPLogon), + MAKE_ENUM(ValidateState, IXPLogon), + MAKE_ENUM(FlushQueues, IXPLogon), + +/* IMSProvider */ + MAKE_ENUM(Shutdown, IMSProvider), + MAKE_ENUM(Logon, IMSProvider), + MAKE_ENUM(SpoolerLogon, IMSProvider), + MAKE_ENUM(CompareStoreIDs, IMSProvider), + +/* IMSLogon */ + MAKE_ENUM(GetLastError, IMSLogon), + MAKE_ENUM(Logoff, IMSLogon), + MAKE_ENUM(OpenEntry, IMSLogon), + MAKE_ENUM(CompareEntryIDs, IMSLogon), + MAKE_ENUM(Advise, IMSLogon), + MAKE_ENUM(Unadvise, IMSLogon), + MAKE_ENUM(OpenStatusEntry, IMSLogon), + +/* IMAPIControl */ + MAKE_ENUM(GetLastError, IMAPIControl), + MAKE_ENUM(Activate, IMAPIControl), + MAKE_ENUM(GetState, IMAPIControl), + +/* IMAPIStatus */ + MAKE_ENUM(ValidateState, IMAPIStatus), + MAKE_ENUM(SettingsDialog, IMAPIStatus), + MAKE_ENUM(ChangePassword, IMAPIStatus), + MAKE_ENUM(FlushQueues, IMAPIStatus), + +/* IStream */ + MAKE_ENUM(_Read, IStream), + MAKE_ENUM(_Write, IStream), + MAKE_ENUM(Seek, IStream), + MAKE_ENUM(SetSize, IStream), + MAKE_ENUM(CopyTo, IStream), + MAKE_ENUM(Commit, IStream), + MAKE_ENUM(Revert, IStream), + MAKE_ENUM(LockRegion, IStream), + MAKE_ENUM(UnlockRegion, IStream), + MAKE_ENUM(Stat, IStream), + MAKE_ENUM(Clone, IStream), + +/* IMAPIAdviseSink */ + MAKE_ENUM(OnNotify, IMAPIAdviseSink), + +} METHODS; + + +/* Macro wrappers to hide the Validate function return handling */ +#if defined(_AMD64_) || defined(_X86_) +#ifdef __cplusplus + +/* C++ methods can't take the address of the This pointer, so we must + use the first parameter instead */ + +#define ValidateParameters(eMethod, First) \ + { HRESULT _hr_; \ + _hr_ = __CPPValidateParameters(eMethod, (LPVOID) &First); \ + if (HR_FAILED(_hr_)) return (_hr_); } + +#define UlValidateParameters(eMethod, First) \ + { HRESULT _hr_; \ + _hr_ = __CPPValidateParameters(eMethod, &First); \ + if (HR_FAILED(_hr_)) return (ULONG) (_hr_); } + +/* Methods called by MAPI should have correct parameters + - just assert in Debug to check */ +#define CheckParameters(eMethod, First) \ + AssertSz(HR_SUCCEEDED(__CPPValidateParameters(eMethod, &First)), "Parameter validation failed for method called by MAPI!") + + +#else /* __cplusplus */ + +/* For methods that will be called by clients + - validate always */ + +#define ValidateParameters(eMethod, ppThis) \ + { HRESULT _hr_; \ + _hr_ = __ValidateParameters(eMethod, ppThis); \ + if (HR_FAILED(_hr_)) return (_hr_); } + +#define UlValidateParameters(eMethod, ppThis) \ + { HRESULT _hr_; \ + _hr_ = __ValidateParameters(eMethod, ppThis); \ + if (HR_FAILED(_hr_)) return (ULONG) (_hr_); } + +/* Methods called by MAPI should have correct parameters + - just assert in Debug to check */ +#define CheckParameters(eMethod, ppThis) \ + AssertSz(HR_SUCCEEDED(__ValidateParameters(eMethod, ppThis)), "Parameter validation failed for method called by MAPI!") + +#endif /* __cplusplus */ +#endif /* _X86_ || _AMD64_ */ + +/* Prototypes for functions used to validate complex parameters. + */ +#define FBadPropVal( lpPropVal) (FAILED(ScCountProps( 1, lpPropVal, NULL))) + +#define FBadRgPropVal( lpPropVal, cValues) \ + (FAILED(ScCountProps( cValues, lpPropVal, NULL))) + +#define FBadAdrList( lpAdrList) \ + ( AssertSz( ( offsetof( ADRLIST, cEntries) \ + == offsetof( SRowSet, cRows)) \ + && ( offsetof( ADRLIST, aEntries) \ + == offsetof( SRowSet, aRow)) \ + && ( offsetof( ADRENTRY, cValues) \ + == offsetof( SRow, cValues)) \ + && ( offsetof( ADRENTRY, rgPropVals) \ + == offsetof( SRow, lpProps)) \ + , "ADRLIST doesn't match SRowSet") \ + || FBadRowSet( (LPSRowSet) lpAdrList)) + +STDAPI_(BOOL) +FBadRglpszW(__in LPWSTR FAR *lppszW, + ULONG cStrings); + +STDAPI_(BOOL) +FBadRowSet( LPSRowSet lpRowSet); + +STDAPI_(BOOL) +FBadRglpNameID( LPMAPINAMEID FAR * lppNameId, + ULONG cNames); + +STDAPI_(BOOL) +FBadEntryList( LPENTRYLIST lpEntryList); + + +/* BAD_STANDARD_OBJ + * + * This macro insures that the object is a writable object of the correct size + * and that this method belongs to the object. + * + * NOTES ON USE! + * This depends upon using the standard method of declaring the object + * interface. + * + * prefix is the method prefix you chose when declaring the object interface. + * method is the standard method name of the calling method. + * lpVtbl is the name of the lpVtbl element of your object. + */ +#define BAD_STANDARD_OBJ( lpObj, prefix, method, lpVtbl) \ + ( IsBadWritePtr( (lpObj), sizeof(*lpObj)) \ + || IsBadReadPtr( (void *) &(lpObj->lpVtbl->method), sizeof(LPVOID)) \ + ||( ( LPVOID) (lpObj->lpVtbl->method) != (LPVOID) (prefix##method))) + + +#define FBadUnknown( lpObj ) \ + ( IsBadReadPtr( (lpObj), sizeof(LPVOID) ) \ + || IsBadReadPtr( (lpObj)->lpVtbl, 3 * sizeof(LPUNKNOWN) ) \ + || IsBadCodePtr( (FARPROC)(lpObj)->lpVtbl->QueryInterface )) + +/* + * IUnknown + */ + + +/* + * QueryInterface + */ +#define FBadQueryInterface( lpObj, riid, ppvObj) \ + ( IsBadReadPtr( riid, sizeof(IID)) \ + || IsBadWritePtr( ppvObj, sizeof(LPVOID))) + + +/* + * AddRef + * No parameter validation required. + */ +#define FBadAddRef( lpObj) FALSE + + +/* + * Release + * No parameter validation required. + */ +#define FBadRelease( lpObj) FALSE + + +/* + * GetLastError + */ +#define FBadGetLastError( lpObj, hResult, ulFlags, lppMAPIError )\ + (IsBadWritePtr( lppMAPIError, sizeof(LPMAPIERROR))) + +/* + * IMAPIProp + */ + + +/* + * SaveChanges + * No parameter validation required. + */ +#define FBadSaveChanges( lpObj, ulFlags) FALSE + + +/* + * GetProps + */ +#define FBadGetProps( lpObj, lpPTagA, lpcValues, lppPropArray) \ + ( ( lpPTagA \ + && ( IsBadReadPtr( lpPTagA, sizeof(ULONG)) \ + || IsBadReadPtr( lpPTagA, (UINT)( (lpPTagA->cValues + 1) \ + * sizeof(ULONG))))) \ + || IsBadWritePtr( lpcValues, sizeof(ULONG)) \ + || IsBadWritePtr( lppPropArray, sizeof(LPSPropValue))) + + +/* + * GetPropList + */ +#define FBadGetPropList( lpObj, lppPTagA) \ + (IsBadWritePtr( lppPTagA, sizeof(LPSPropTagArray FAR *))) + + +/* + * OpenProperty + */ +#define FBadOpenProperty( lpObj, ulPropTag, lpiid, ulInterfaceOptions, ulFlags \ + , lppUnk) \ + ( IsBadReadPtr( lpiid, sizeof(IID)) \ + || IsBadWritePtr( lppUnk, sizeof (LPUNKNOWN FAR *))) + + +/* + * SetProps + */ +#define FBadSetProps( lpObj, cValues, lpPropArray, lppProblems) \ + ( FBadRgPropVal( lpPropArray, (UINT) cValues) \ + || ( lppProblems \ + && IsBadWritePtr( lppProblems, sizeof(LPSPropProblemArray)))) + + +/* + * DeleteProps + */ +#define FBadDeleteProps( lpObj, lpPTagA, lppProblems) \ + ( ( !lpPTagA \ + || ( IsBadReadPtr( lpPTagA, sizeof(ULONG)) \ + || IsBadReadPtr( lpPTagA, (UINT)( (lpPTagA->cValues + 1) \ + * sizeof(ULONG))))) \ + || ( lppProblems \ + && IsBadWritePtr( lppProblems, sizeof(LPSPropProblemArray)))) + + +/* + * CopyTo + */ +#define FBadCopyTo( lpIPDAT, ciidExclude, rgiidExclude, lpExcludeProps \ + , ulUIParam, lpProgress, lpInterface, lpDestObj \ + , ulFlags, lppProblems) \ + ( ( ciidExclude \ + && ( IsBadReadPtr( rgiidExclude, (UINT)(ciidExclude * sizeof(IID))))) \ + || ( lpExcludeProps \ + && ( IsBadReadPtr( lpExcludeProps, sizeof(ULONG)) \ + || IsBadReadPtr( lpExcludeProps \ + , (UINT)( (lpExcludeProps->cValues + 1) \ + * sizeof(ULONG))))) \ + || (lpProgress && FBadUnknown( lpProgress )) \ + || (lpInterface && IsBadReadPtr( lpInterface, sizeof(IID))) \ + || IsBadReadPtr( lpDestObj, sizeof(LPVOID)) \ + || ( lppProblems \ + && IsBadWritePtr( lppProblems, sizeof(LPSPropProblemArray)))) + + +/* + * CopyProps + */ +#define FBadCopyProps( lpIPDAT, lpPropTagArray \ + , ulUIParam, lpProgress, lpInterface, lpDestObj \ + , ulFlags, lppProblems) \ + ( ( lpPropTagArray \ + && ( IsBadReadPtr( lpPropTagArray, sizeof(ULONG)) \ + || IsBadReadPtr( lpPropTagArray \ + , (UINT)( (lpPropTagArray->cValues + 1) \ + * sizeof(ULONG))))) \ + || (lpProgress && FBadUnknown( lpProgress )) \ + || (lpInterface && IsBadReadPtr( lpInterface, sizeof(IID))) \ + || IsBadReadPtr( lpDestObj, sizeof(LPVOID)) \ + || ( lppProblems \ + && IsBadWritePtr( lppProblems, sizeof(LPSPropProblemArray)))) + + + +/* + * GetNamesFromIDs + */ +#define FBadGetNamesFromIDs( lpIPDAT, lppPropTags, lpPropSetGuid, ulFlags, \ + lpcPropNames, lpppPropNames) \ + ( IsBadReadPtr( lppPropTags, sizeof(LPSPropTagArray)) \ + || ( lpPropSetGuid && IsBadReadPtr( lpPropSetGuid, sizeof(GUID))) \ + || ( *lppPropTags \ + && ( IsBadReadPtr( *lppPropTags, sizeof(ULONG)) \ + || IsBadReadPtr( *lppPropTags \ + , (UINT)( ( ( *lppPropTags)->cValues + 1) \ + * sizeof(ULONG))))) \ + || IsBadWritePtr( lpcPropNames, sizeof (ULONG)) \ + || IsBadWritePtr( lpppPropNames, sizeof (LPVOID FAR *))) + + + +/* + * GetNamesFromIDs + */ +#define FBadGetIDsFromNames( lpIPDAT, cPropNames, lppPropNames, ulFlags \ + , lppPropTags) \ + ( (cPropNames && FBadRglpNameID( lppPropNames, cPropNames)) \ + || IsBadWritePtr( lppPropTags, sizeof(LPULONG FAR *))) + + +STDAPI_(ULONG) +FBadRestriction( LPSRestriction lpres ); + +STDAPI_(ULONG) +FBadPropTag( ULONG ulPropTag ); + +STDAPI_(ULONG) +FBadRow( LPSRow lprow ); + +STDAPI_(ULONG) +FBadProp( LPSPropValue lpprop ); + +STDAPI_(ULONG) +FBadSortOrderSet( LPSSortOrderSet lpsos ); + +STDAPI_(ULONG) +FBadColumnSet( LPSPropTagArray lpptaCols ); + +/* Validation function + + The eMethod parameter tells us which internal validation to perform. + + The ppThis parameter tells us where the stack is, so we can access the other + parameters. + + Becuase of this *magic* we MUST obtain the pointer to the This pointer in + the method function. + +*/ + +#if defined(_WIN64) || defined(_WIN32) +#define BASED_STACK +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +#if defined(_WIN64) || defined(_WIN32) +HRESULT STDAPICALLTYPE +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +__CPPValidateParameters(METHODS eMethod, const LPVOID ppFirst); + +#if defined(_WIN64) || defined(_WIN32) +HRESULT STDAPICALLTYPE +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif +__ValidateParameters(METHODS eMethod, LPVOID ppThis); + +#ifdef _MAC +#define STDAPIVCALLTYPE __cdecl +#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE +#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE +#endif /* _MAC */ + +/* Macro wrappers for platform independent validation */ + +#if defined(_AMD64_) || defined(_X86_) + +#define ArgShiftN (1 + (sizeof(DWORD_PTR)>>2)) +#define ArgSize(T) ((sizeof(T)+sizeof(DWORD_PTR)-1)>>ArgShiftN) + +#define MakeArg1(idx, a1) memcpy(__rgArgs+idx, &a1, ArgSize(a1)*sizeof(DWORD_PTR)) +#define MakeArg2(idx, a1, a2) MakeArg1(idx, a1); MakeArg1(idx+ArgSize(a1), a2) +#define MakeArg3(idx, a1, a2, a3) MakeArg1(idx, a1); MakeArg2(idx+ArgSize(a1), a2, a3) +#define MakeArg4(idx, a1, a2, a3, a4) MakeArg1(idx, a1); MakeArg3(idx+ArgSize(a1), a2, a3, a4) +#define MakeArg5(idx, a1, a2, a3, a4, a5) MakeArg1(idx, a1); MakeArg4(idx+ArgSize(a1), a2, a3, a4, a5) +#define MakeArg6(idx, a1, a2, a3, a4, a5, a6) MakeArg1(idx, a1); MakeArg5(idx+ArgSize(a1), a2, a3, a4, a5, a6) +#define MakeArg7(idx, a1, a2, a3, a4, a5, a6, a7) MakeArg1(idx, a1); MakeArg6(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7) +#define MakeArg8(idx, a1, a2, a3, a4, a5, a6, a7, a8) MakeArg1(idx, a1); MakeArg7(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8) +#define MakeArg9(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9) MakeArg1(idx, a1); MakeArg8(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9) +#define MakeArg10(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) MakeArg1(idx, a1); MakeArg9(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10) +#define MakeArg11(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) MakeArg1(idx, a1); MakeArg10(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) +#define MakeArg12(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) MakeArg1(idx, a1); MakeArg11(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) +#define MakeArg13(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) MakeArg1(idx, a1); MakeArg12(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) +#define MakeArg14(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) MakeArg1(idx, a1); MakeArg13(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) +#define MakeArg15(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) MakeArg1(idx, a1); MakeArg14(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) +#define MakeArg16(idx, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) MakeArg1(idx, a1); MakeArg15(idx+ArgSize(a1), a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) + +#define MakeArray1(a1) \ + DWORD_PTR __rgArgs[ArgSize(a1)]; \ + MakeArg1(0, a1) + +#define MakeArray2(a1, a2) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2)]; \ + MakeArg2(0, a1, a2) + +#define MakeArray3(a1, a2, a3) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3)]; \ + MakeArg3(0, a1, a2, a3) + +#define MakeArray4(a1, a2, a3, a4) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4)]; \ + MakeArg4(0, a1, a2, a3, a4) + +#define MakeArray5(a1, a2, a3, a4, a5) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5)]; \ + MakeArg5(0, a1, a2, a3, a4, a5) + +#define MakeArray6(a1, a2, a3, a4, a5, a6) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6)]; \ + MakeArg6(0, a1, a2, a3, a4, a5, a6) + +#define MakeArray7(a1, a2, a3, a4, a5, a6, a7) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7)]; \ + MakeArg7(0, a1, a2, a3, a4, a5, a6, a7) + +#define MakeArray8(a1, a2, a3, a4, a5, a6, a7, a8) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8)]; \ + MakeArg8(0, a1, a2, a3, a4, a5, a6, a7, a8) + +#define MakeArray9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9)]; \ + MakeArg9(0, a1, a2, a3, a4, a5, a6, a7, a8, a9) + +#define MakeArray10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10)]; \ + MakeArg10(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + +#define MakeArray11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11)]; \ + MakeArg11(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) + +#define MakeArray12(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11) + ArgSize(a12)]; \ + MakeArg12(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) + +#define MakeArray13(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11) + ArgSize(a12) + ArgSize(a13)]; \ + MakeArg13(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) + +#define MakeArray14(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11) + ArgSize(a12) + ArgSize(a13) + ArgSize(a14)]; \ + MakeArg14(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) + +#define MakeArray15(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11) + ArgSize(a12) + ArgSize(a13) + ArgSize(a14) + ArgSize(a15)]; \ + MakeArg15(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) + +#define MakeArray16(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) \ + DWORD_PTR __rgArgs[ArgSize(a1) + ArgSize(a2) + ArgSize(a3) + ArgSize(a4) + ArgSize(a5) + ArgSize(a6) + ArgSize(a7) + ArgSize(a8) + ArgSize(a9) + ArgSize(a10) + ArgSize(a11) + ArgSize(a12) + ArgSize(a13) + ArgSize(a14) + ArgSize(a15) + ArgSize(a16)]; \ + MakeArg16(0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) + + + +#define ValidateParameters1( m, a1 ) +#define ValidateParameters2( m, a1, a2 ) \ + { HRESULT _hr_; \ + MakeArray1(a2); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters3( m, a1, a2, a3 ) \ + { HRESULT _hr_; \ + MakeArray2(a2, a3); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters4( m, a1, a2, a3, a4 ) \ + { HRESULT _hr_; \ + MakeArray3(a2, a3, a4); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters5( m, a1, a2, a3, a4, a5 ) \ + { HRESULT _hr_; \ + MakeArray4(a2, a3, a4, a5); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + { HRESULT _hr_; \ + MakeArray5(a2, a3, a4, a5, a6); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + { HRESULT _hr_; \ + MakeArray6(a2, a3, a4, a5, a6, a7); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + { HRESULT _hr_; \ + MakeArray7(a2, a3, a4, a5, a6, a7, a8); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + { HRESULT _hr_; \ + MakeArray8(a2, a3, a4, a5, a6, a7, a8, a9); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + { HRESULT _hr_; \ + MakeArray9(a2, a3, a4, a5, a6, a7, a8, a9, a10); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + { HRESULT _hr_; \ + MakeArray10(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + { HRESULT _hr_; \ + MakeArray11(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + { HRESULT _hr_; \ + MakeArray12(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + { HRESULT _hr_; \ + MakeArray13(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + { HRESULT _hr_; \ + MakeArray14(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } +#define ValidateParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + { HRESULT _hr_; \ + MakeArray15(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return (_hr_); } + +#define UlValidateParameters1( m, a1 ) +#define UlValidateParameters2( m, a1, a2 ) \ + { HRESULT _hr_; \ + MakeArray1(a2); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters3( m, a1, a2, a3 ) \ + { HRESULT _hr_; \ + MakeArray2(a2, a3); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters4( m, a1, a2, a3, a4 ) \ + { HRESULT _hr_; \ + MakeArray3(a2, a3, a4); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters5( m, a1, a2, a3, a4, a5 ) \ + { HRESULT _hr_; \ + MakeArray4(a2, a3, a4, a5); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + { HRESULT _hr_; \ + MakeArray5(a2, a3, a4, a5, a6); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + { HRESULT _hr_; \ + MakeArray6(a2, a3, a4, a5, a6, a7); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + { HRESULT _hr_; \ + MakeArray7(a2, a3, a4, a5, a6, a7, a8); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + { HRESULT _hr_; \ + MakeArray8(a2, a3, a4, a5, a6, a7, a8, a9); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + { HRESULT _hr_; \ + MakeArray9(a2, a3, a4, a5, a6, a7, a8, a9, a10); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + { HRESULT _hr_; \ + MakeArray10(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + { HRESULT _hr_; \ + MakeArray11(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + { HRESULT _hr_; \ + MakeArray12(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + { HRESULT _hr_; \ + MakeArray13(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + { HRESULT _hr_; \ + MakeArray14(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } +#define UlValidateParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + { HRESULT _hr_; \ + MakeArray15(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); \ + _hr_ = HrValidateParameters(m, (void **)__rgArgs); if (HR_FAILED(_hr_)) return ((ULONG)_hr_); } + +#ifdef DEBUG +#define CheckParameters1( m, a1 ) +#define CheckParameters2( m, a1, a2 ) \ + { \ + MakeArray1(a2); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters3( m, a1, a2, a3 ) \ + { \ + MakeArray2(a2, a3); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters4( m, a1, a2, a3, a4 ) \ + { \ + MakeArray3(a2, a3, a4); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters5( m, a1, a2, a3, a4, a5 ) \ + { \ + MakeArray4(a2, a3, a4, a5); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + { \ + MakeArray5(a2, a3, a4, a5, a6); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + { \ + MakeArray6(a2, a3, a4, a5, a6, a7); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + { \ + MakeArray7(a2, a3, a4, a5, a6, a7, a8); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + { \ + MakeArray8(a2, a3, a4, a5, a6, a7, a8, a9); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + { \ + MakeArray9(a2, a3, a4, a5, a6, a7, a8, a9, a10); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + { \ + MakeArray10(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + { \ + MakeArray11(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + { \ + MakeArray12(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + { \ + MakeArray13(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + { \ + MakeArray14(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#define CheckParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + { \ + MakeArray15(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); \ + AssertSz(HR_SUCCEEDED( HrValidateParameters(m, (void **)__rgArgs)), "Parameter validation failed for method called by MAPI!"); } +#else /* DEBUG */ +#define CheckParameters1( m, a1 ) +#define CheckParameters2( m, a1, a2 ) +#define CheckParameters3( m, a1, a2, a3 ) +#define CheckParameters4( m, a1, a2, a3, a4 ) +#define CheckParameters5( m, a1, a2, a3, a4, a5 ) +#define CheckParameters6( m, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define CheckParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) +#define CheckParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) +#define CheckParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) +#define CheckParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) +#define CheckParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) +#define CheckParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) +#define CheckParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) +#define CheckParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) +#endif /* DEBUG */ +#else /* !_AMD64_ && !_X86_ */ +#define ValidateParms(x) { HRESULT _hr_ = HrValidateParametersV x; if (HR_FAILED(_hr_)) return (_hr_); } +#define UlValidateParms(x) { HRESULT _hr_ = HrValidateParametersV x; if (HR_FAILED(_hr_)) return (ULONG)(_hr_); } +#define CheckParms(x) AssertSz(HR_SUCCEEDED( HrValidateParametersV x ), "Parameter validation failed for method called by MAPI!") + +#define ValidateParameters1( m, a1 ) \ + ValidateParms( ( m, a1 ) ) +#define ValidateParameters2( m, a1, a2 ) \ + ValidateParms( ( m, a1, a2 )) +#define ValidateParameters3( m, a1, a2, a3 ) \ + ValidateParms( ( m, a1, a2, a3 )) +#define ValidateParameters4( m, a1, a2, a3, a4 ) \ + ValidateParms( ( m, a1, a2, a3, a4 )) +#define ValidateParameters5( m, a1, a2, a3, a4, a5 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5 )) +#define ValidateParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6 )) +#define ValidateParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7 )) +#define ValidateParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8 )) +#define ValidateParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) +#define ValidateParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 )) +#define ValidateParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 )) +#define ValidateParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 )) +#define ValidateParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )) +#define ValidateParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 )) +#define ValidateParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 )) +#define ValidateParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + ValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 )) + +#define UlValidateParameters1( m, a1 ) \ + UlValidateParms( ( m, a1 ) ) +#define UlValidateParameters2( m, a1, a2 ) \ + UlValidateParms( ( m, a1, a2 )) +#define UlValidateParameters3( m, a1, a2, a3 ) \ + UlValidateParms( ( m, a1, a2, a3 )) +#define UlValidateParameters4( m, a1, a2, a3, a4 ) \ + UlValidateParms( ( m, a1, a2, a3, a4 )) +#define UlValidateParameters5( m, a1, a2, a3, a4, a5 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5 )) +#define UlValidateParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6 )) +#define UlValidateParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7 )) +#define UlValidateParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8 )) +#define UlValidateParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) +#define UlValidateParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 )) +#define UlValidateParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 )) +#define UlValidateParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 )) +#define UlValidateParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )) +#define UlValidateParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 )) +#define UlValidateParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 )) +#define UlValidateParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + UlValidateParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 )) + +#define CheckParameters1( m, a1 ) \ + CheckParms( ( m, a1 ) ) +#define CheckParameters2( m, a1, a2 ) \ + CheckParms( ( m, a1, a2 )) +#define CheckParameters3( m, a1, a2, a3 ) \ + CheckParms( ( m, a1, a2, a3 )) +#define CheckParameters4( m, a1, a2, a3, a4 ) \ + CheckParms( ( m, a1, a2, a3, a4 )) +#define CheckParameters5( m, a1, a2, a3, a4, a5 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5 )) +#define CheckParameters6( m, a1, a2, a3, a4, a5, a6 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6 )) +#define CheckParameters7( m, a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7 )) +#define CheckParameters8( m, a1, a2, a3, a4, a5, a6, a7, a8 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8 )) +#define CheckParameters9( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) +#define CheckParameters10( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 )) +#define CheckParameters11( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 )) +#define CheckParameters12( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 )) +#define CheckParameters13( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )) +#define CheckParameters14( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 )) +#define CheckParameters15( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 )) +#define CheckParameters16( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) \ + CheckParms( ( m, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 )) + +#endif /* _AMD64_ || _X86_ */ + + +/* + * M A P I P A R A M E T E R V A L I D A T I O N M A C R O S + */ + + +/* IUnknown */ + +#define Validate_IUnknown_QueryInterface( a1, a2, a3 ) \ + ValidateParameters3( IUnknown_QueryInterface, a1, a2, a3 ) +#define UlValidate_IUnknown_QueryInterface( a1, a2, a3 ) \ + UlValidateParameters3( IUnknown_QueryInterface, a1, a2, a3 ) +#define CheckParameters_IUnknown_QueryInterface( a1, a2, a3 ) \ + CheckParameters3( IUnknown_QueryInterface, a1, a2, a3 ) + +#define Validate_IUnknown_AddRef( a1 ) \ + ValidateParameters1( IUnknown_AddRef, a1 ) +#define UlValidate_IUnknown_AddRef( a1 ) \ + UlValidateParameters1( IUnknown_AddRef, a1 ) +#define CheckParameters_IUnknown_AddRef( a1 ) \ + CheckParameters1( IUnknown_AddRef, a1 ) + +#define Validate_IUnknown_Release( a1 ) \ + ValidateParameters1( IUnknown_Release, a1 ) +#define UlValidate_IUnknown_Release( a1 ) \ + UlValidateParameters1( IUnknown_Release, a1 ) +#define CheckParameters_IUnknown_Release( a1 ) \ + CheckParameters1( IUnknown_Release, a1 ) + + +/* IMAPIProp */ + +#define Validate_IMAPIProp_GetLastError( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIProp_GetLastError, a1, a2, a3, a4 ) +#define UlValidate_IMAPIProp_GetLastError( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIProp_GetLastError, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIProp_GetLastError( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIProp_GetLastError, a1, a2, a3, a4 ) + +#define Validate_IMAPIProp_SaveChanges( a1, a2 ) \ + ValidateParameters2( IMAPIProp_SaveChanges, a1, a2 ) +#define UlValidate_IMAPIProp_SaveChanges( a1, a2 ) \ + UlValidateParameters2( IMAPIProp_SaveChanges, a1, a2 ) +#define CheckParameters_IMAPIProp_SaveChanges( a1, a2 ) \ + CheckParameters2( IMAPIProp_SaveChanges, a1, a2 ) + +#define Validate_IMAPIProp_GetProps( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIProp_GetProps, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIProp_GetProps( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIProp_GetProps, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIProp_GetProps( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIProp_GetProps, a1, a2, a3, a4, a5 ) + +#define Validate_IMAPIProp_GetPropList( a1, a2, a3 ) \ + ValidateParameters3( IMAPIProp_GetPropList, a1, a2, a3 ) +#define UlValidate_IMAPIProp_GetPropList( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIProp_GetPropList, a1, a2, a3 ) +#define CheckParameters_IMAPIProp_GetPropList( a1, a2, a3 ) \ + CheckParameters3( IMAPIProp_GetPropList, a1, a2, a3 ) + +#define Validate_IMAPIProp_OpenProperty( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMAPIProp_OpenProperty, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMAPIProp_OpenProperty( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMAPIProp_OpenProperty, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMAPIProp_OpenProperty( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMAPIProp_OpenProperty, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMAPIProp_SetProps( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIProp_SetProps, a1, a2, a3, a4 ) +#define UlValidate_IMAPIProp_SetProps( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIProp_SetProps, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIProp_SetProps( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIProp_SetProps, a1, a2, a3, a4 ) + +#define Validate_IMAPIProp_DeleteProps( a1, a2, a3 ) \ + ValidateParameters3( IMAPIProp_DeleteProps, a1, a2, a3 ) +#define UlValidate_IMAPIProp_DeleteProps( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIProp_DeleteProps, a1, a2, a3 ) +#define CheckParameters_IMAPIProp_DeleteProps( a1, a2, a3 ) \ + CheckParameters3( IMAPIProp_DeleteProps, a1, a2, a3 ) + +#define Validate_IMAPIProp_CopyTo( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + ValidateParameters10( IMAPIProp_CopyTo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) +#define UlValidate_IMAPIProp_CopyTo( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + UlValidateParameters10( IMAPIProp_CopyTo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) +#define CheckParameters_IMAPIProp_CopyTo( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) \ + CheckParameters10( IMAPIProp_CopyTo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) + +#define Validate_IMAPIProp_CopyProps( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + ValidateParameters8( IMAPIProp_CopyProps, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define UlValidate_IMAPIProp_CopyProps( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + UlValidateParameters8( IMAPIProp_CopyProps, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define CheckParameters_IMAPIProp_CopyProps( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + CheckParameters8( IMAPIProp_CopyProps, a1, a2, a3, a4, a5, a6, a7, a8 ) + +#define Validate_IMAPIProp_GetNamesFromIDs( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMAPIProp_GetNamesFromIDs, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMAPIProp_GetNamesFromIDs( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMAPIProp_GetNamesFromIDs, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMAPIProp_GetNamesFromIDs( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMAPIProp_GetNamesFromIDs, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMAPIProp_GetIDsFromNames( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIProp_GetIDsFromNames, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIProp_GetIDsFromNames( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIProp_GetIDsFromNames, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIProp_GetIDsFromNames( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIProp_GetIDsFromNames, a1, a2, a3, a4, a5 ) + + +/* IMAPITable */ + +#define Validate_IMAPITable_GetLastError( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_GetLastError, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_GetLastError( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_GetLastError, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_GetLastError( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_GetLastError, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_Advise( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_Advise, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_Advise( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_Advise, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_Advise( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_Advise, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_Unadvise( a1, a2 ) \ + ValidateParameters2( IMAPITable_Unadvise, a1, a2 ) +#define UlValidate_IMAPITable_Unadvise( a1, a2 ) \ + UlValidateParameters2( IMAPITable_Unadvise, a1, a2 ) +#define CheckParameters_IMAPITable_Unadvise( a1, a2 ) \ + CheckParameters2( IMAPITable_Unadvise, a1, a2 ) + +#define Validate_IMAPITable_GetStatus( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_GetStatus, a1, a2, a3 ) +#define UlValidate_IMAPITable_GetStatus( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_GetStatus, a1, a2, a3 ) +#define CheckParameters_IMAPITable_GetStatus( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_GetStatus, a1, a2, a3 ) + +#define Validate_IMAPITable_SetColumns( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_SetColumns, a1, a2, a3 ) +#define UlValidate_IMAPITable_SetColumns( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_SetColumns, a1, a2, a3 ) +#define CheckParameters_IMAPITable_SetColumns( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_SetColumns, a1, a2, a3 ) + +#define Validate_IMAPITable_QueryColumns( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_QueryColumns, a1, a2, a3 ) +#define UlValidate_IMAPITable_QueryColumns( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_QueryColumns, a1, a2, a3 ) +#define CheckParameters_IMAPITable_QueryColumns( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_QueryColumns, a1, a2, a3 ) + +#define Validate_IMAPITable_GetRowCount( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_GetRowCount, a1, a2, a3 ) +#define UlValidate_IMAPITable_GetRowCount( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_GetRowCount, a1, a2, a3 ) +#define CheckParameters_IMAPITable_GetRowCount( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_GetRowCount, a1, a2, a3 ) + +#define Validate_IMAPITable_SeekRow( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_SeekRow, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_SeekRow( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_SeekRow, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_SeekRow( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_SeekRow, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_SeekRowApprox( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_SeekRowApprox, a1, a2, a3 ) +#define UlValidate_IMAPITable_SeekRowApprox( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_SeekRowApprox, a1, a2, a3 ) +#define CheckParameters_IMAPITable_SeekRowApprox( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_SeekRowApprox, a1, a2, a3 ) + +#define Validate_IMAPITable_QueryPosition( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_QueryPosition, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_QueryPosition( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_QueryPosition, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_QueryPosition( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_QueryPosition, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_FindRow( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_FindRow, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_FindRow( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_FindRow, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_FindRow( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_FindRow, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_Restrict( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_Restrict, a1, a2, a3 ) +#define UlValidate_IMAPITable_Restrict( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_Restrict, a1, a2, a3 ) +#define CheckParameters_IMAPITable_Restrict( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_Restrict, a1, a2, a3 ) + +#define Validate_IMAPITable_CreateBookmark( a1, a2 ) \ + ValidateParameters2( IMAPITable_CreateBookmark, a1, a2 ) +#define UlValidate_IMAPITable_CreateBookmark( a1, a2 ) \ + UlValidateParameters2( IMAPITable_CreateBookmark, a1, a2 ) +#define CheckParameters_IMAPITable_CreateBookmark( a1, a2 ) \ + CheckParameters2( IMAPITable_CreateBookmark, a1, a2 ) + +#define Validate_IMAPITable_FreeBookmark( a1, a2 ) \ + ValidateParameters2( IMAPITable_FreeBookmark, a1, a2 ) +#define UlValidate_IMAPITable_FreeBookmark( a1, a2 ) \ + UlValidateParameters2( IMAPITable_FreeBookmark, a1, a2 ) +#define CheckParameters_IMAPITable_FreeBookmark( a1, a2 ) \ + CheckParameters2( IMAPITable_FreeBookmark, a1, a2 ) + +#define Validate_IMAPITable_SortTable( a1, a2, a3 ) \ + ValidateParameters3( IMAPITable_SortTable, a1, a2, a3 ) +#define UlValidate_IMAPITable_SortTable( a1, a2, a3 ) \ + UlValidateParameters3( IMAPITable_SortTable, a1, a2, a3 ) +#define CheckParameters_IMAPITable_SortTable( a1, a2, a3 ) \ + CheckParameters3( IMAPITable_SortTable, a1, a2, a3 ) + +#define Validate_IMAPITable_QuerySortOrder( a1, a2 ) \ + ValidateParameters2( IMAPITable_QuerySortOrder, a1, a2 ) +#define UlValidate_IMAPITable_QuerySortOrder( a1, a2 ) \ + UlValidateParameters2( IMAPITable_QuerySortOrder, a1, a2 ) +#define CheckParameters_IMAPITable_QuerySortOrder( a1, a2 ) \ + CheckParameters2( IMAPITable_QuerySortOrder, a1, a2 ) + +#define Validate_IMAPITable_QueryRows( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_QueryRows, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_QueryRows( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_QueryRows, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_QueryRows( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_QueryRows, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_Abort( a1 ) \ + ValidateParameters1( IMAPITable_Abort, a1 ) +#define UlValidate_IMAPITable_Abort( a1 ) \ + UlValidateParameters1( IMAPITable_Abort, a1 ) +#define CheckParameters_IMAPITable_Abort( a1 ) \ + CheckParameters1( IMAPITable_Abort, a1 ) + +#define Validate_IMAPITable_ExpandRow( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMAPITable_ExpandRow, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMAPITable_ExpandRow( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMAPITable_ExpandRow, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMAPITable_ExpandRow( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMAPITable_ExpandRow, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMAPITable_CollapseRow( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPITable_CollapseRow, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPITable_CollapseRow( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPITable_CollapseRow, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPITable_CollapseRow( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPITable_CollapseRow, a1, a2, a3, a4, a5 ) + +#define Validate_IMAPITable_WaitForCompletion( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPITable_WaitForCompletion, a1, a2, a3, a4 ) +#define UlValidate_IMAPITable_WaitForCompletion( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPITable_WaitForCompletion, a1, a2, a3, a4 ) +#define CheckParameters_IMAPITable_WaitForCompletion( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPITable_WaitForCompletion, a1, a2, a3, a4 ) + +#define Validate_IMAPITable_GetCollapseState( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMAPITable_GetCollapseState, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMAPITable_GetCollapseState( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMAPITable_GetCollapseState, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMAPITable_GetCollapseState( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMAPITable_GetCollapseState, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMAPITable_SetCollapseState( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPITable_SetCollapseState, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPITable_SetCollapseState( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPITable_SetCollapseState, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPITable_SetCollapseState( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPITable_SetCollapseState, a1, a2, a3, a4, a5 ) + + +/* IMAPIContainer */ + +#define Validate_IMAPIContainer_GetContentsTable( a1, a2, a3 ) \ + ValidateParameters3( IMAPIContainer_GetContentsTable, a1, a2, a3 ) +#define UlValidate_IMAPIContainer_GetContentsTable( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIContainer_GetContentsTable, a1, a2, a3 ) +#define CheckParameters_IMAPIContainer_GetContentsTable( a1, a2, a3 ) \ + CheckParameters3( IMAPIContainer_GetContentsTable, a1, a2, a3 ) + +#define Validate_IMAPIContainer_GetHierarchyTable( a1, a2, a3 ) \ + ValidateParameters3( IMAPIContainer_GetHierarchyTable, a1, a2, a3 ) +#define UlValidate_IMAPIContainer_GetHierarchyTable( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIContainer_GetHierarchyTable, a1, a2, a3 ) +#define CheckParameters_IMAPIContainer_GetHierarchyTable( a1, a2, a3 ) \ + CheckParameters3( IMAPIContainer_GetHierarchyTable, a1, a2, a3 ) + +#define Validate_IMAPIContainer_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMAPIContainer_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMAPIContainer_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMAPIContainer_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMAPIContainer_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMAPIContainer_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMAPIContainer_SetSearchCriteria( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIContainer_SetSearchCriteria, a1, a2, a3, a4 ) +#define UlValidate_IMAPIContainer_SetSearchCriteria( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIContainer_SetSearchCriteria, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIContainer_SetSearchCriteria( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIContainer_SetSearchCriteria, a1, a2, a3, a4 ) + +#define Validate_IMAPIContainer_GetSearchCriteria( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIContainer_GetSearchCriteria, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIContainer_GetSearchCriteria( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIContainer_GetSearchCriteria, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIContainer_GetSearchCriteria( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIContainer_GetSearchCriteria, a1, a2, a3, a4, a5 ) + + +/* IABContainer */ + +#define Validate_IABContainer_CreateEntry( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IABContainer_CreateEntry, a1, a2, a3, a4, a5 ) +#define UlValidate_IABContainer_CreateEntry( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IABContainer_CreateEntry, a1, a2, a3, a4, a5 ) +#define CheckParameters_IABContainer_CreateEntry( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IABContainer_CreateEntry, a1, a2, a3, a4, a5 ) + +#define Validate_IABContainer_CopyEntries( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IABContainer_CopyEntries, a1, a2, a3, a4, a5 ) +#define UlValidate_IABContainer_CopyEntries( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IABContainer_CopyEntries, a1, a2, a3, a4, a5 ) +#define CheckParameters_IABContainer_CopyEntries( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IABContainer_CopyEntries, a1, a2, a3, a4, a5 ) + +#define Validate_IABContainer_DeleteEntries( a1, a2, a3 ) \ + ValidateParameters3( IABContainer_DeleteEntries, a1, a2, a3 ) +#define UlValidate_IABContainer_DeleteEntries( a1, a2, a3 ) \ + UlValidateParameters3( IABContainer_DeleteEntries, a1, a2, a3 ) +#define CheckParameters_IABContainer_DeleteEntries( a1, a2, a3 ) \ + CheckParameters3( IABContainer_DeleteEntries, a1, a2, a3 ) + +#define Validate_IABContainer_ResolveNames( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IABContainer_ResolveNames, a1, a2, a3, a4, a5 ) +#define UlValidate_IABContainer_ResolveNames( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IABContainer_ResolveNames, a1, a2, a3, a4, a5 ) +#define CheckParameters_IABContainer_ResolveNames( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IABContainer_ResolveNames, a1, a2, a3, a4, a5 ) + + +/* IDistList */ + +#define Validate_IDistList_CreateEntry( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IDistList_CreateEntry, a1, a2, a3, a4, a5 ) +#define UlValidate_IDistList_CreateEntry( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IDistList_CreateEntry, a1, a2, a3, a4, a5 ) +#define CheckParameters_IDistList_CreateEntry( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IDistList_CreateEntry, a1, a2, a3, a4, a5 ) + +#define Validate_IDistList_CopyEntries( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IDistList_CopyEntries, a1, a2, a3, a4, a5 ) +#define UlValidate_IDistList_CopyEntries( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IDistList_CopyEntries, a1, a2, a3, a4, a5 ) +#define CheckParameters_IDistList_CopyEntries( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IDistList_CopyEntries, a1, a2, a3, a4, a5 ) + +#define Validate_IDistList_DeleteEntries( a1, a2, a3 ) \ + ValidateParameters3( IDistList_DeleteEntries, a1, a2, a3 ) +#define UlValidate_IDistList_DeleteEntries( a1, a2, a3 ) \ + UlValidateParameters3( IDistList_DeleteEntries, a1, a2, a3 ) +#define CheckParameters_IDistList_DeleteEntries( a1, a2, a3 ) \ + CheckParameters3( IDistList_DeleteEntries, a1, a2, a3 ) + +#define Validate_IDistList_ResolveNames( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IDistList_ResolveNames, a1, a2, a3, a4, a5 ) +#define UlValidate_IDistList_ResolveNames( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IDistList_ResolveNames, a1, a2, a3, a4, a5 ) +#define CheckParameters_IDistList_ResolveNames( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IDistList_ResolveNames, a1, a2, a3, a4, a5 ) + + +/* IMAPIFolder */ + +#define Validate_IMAPIFolder_CreateMessage( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIFolder_CreateMessage, a1, a2, a3, a4 ) +#define UlValidate_IMAPIFolder_CreateMessage( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIFolder_CreateMessage, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIFolder_CreateMessage( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIFolder_CreateMessage, a1, a2, a3, a4 ) + +#define Validate_IMAPIFolder_CopyMessages( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMAPIFolder_CopyMessages, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMAPIFolder_CopyMessages( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMAPIFolder_CopyMessages, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMAPIFolder_CopyMessages( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMAPIFolder_CopyMessages, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMAPIFolder_DeleteMessages( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIFolder_DeleteMessages, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIFolder_DeleteMessages( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIFolder_DeleteMessages, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIFolder_DeleteMessages( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIFolder_DeleteMessages, a1, a2, a3, a4, a5 ) + +#define Validate_IMAPIFolder_CreateFolder( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMAPIFolder_CreateFolder, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMAPIFolder_CreateFolder( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMAPIFolder_CreateFolder, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMAPIFolder_CreateFolder( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMAPIFolder_CreateFolder, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMAPIFolder_CopyFolder( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + ValidateParameters9( IMAPIFolder_CopyFolder, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) +#define UlValidate_IMAPIFolder_CopyFolder( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + UlValidateParameters9( IMAPIFolder_CopyFolder, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) +#define CheckParameters_IMAPIFolder_CopyFolder( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + CheckParameters9( IMAPIFolder_CopyFolder, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) + +#define Validate_IMAPIFolder_DeleteFolder( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMAPIFolder_DeleteFolder, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMAPIFolder_DeleteFolder( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMAPIFolder_DeleteFolder, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMAPIFolder_DeleteFolder( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMAPIFolder_DeleteFolder, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMAPIFolder_SetReadFlags( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIFolder_SetReadFlags, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIFolder_SetReadFlags( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIFolder_SetReadFlags, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIFolder_SetReadFlags( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIFolder_SetReadFlags, a1, a2, a3, a4, a5 ) + +#define Validate_IMAPIFolder_GetMessageStatus( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIFolder_GetMessageStatus, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIFolder_GetMessageStatus( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIFolder_GetMessageStatus, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIFolder_GetMessageStatus( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIFolder_GetMessageStatus, a1, a2, a3, a4, a5 ) + +#define Validate_IMAPIFolder_SetMessageStatus( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMAPIFolder_SetMessageStatus, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMAPIFolder_SetMessageStatus( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMAPIFolder_SetMessageStatus, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMAPIFolder_SetMessageStatus( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMAPIFolder_SetMessageStatus, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMAPIFolder_SaveContentsSort( a1, a2, a3 ) \ + ValidateParameters3( IMAPIFolder_SaveContentsSort, a1, a2, a3 ) +#define UlValidate_IMAPIFolder_SaveContentsSort( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIFolder_SaveContentsSort, a1, a2, a3 ) +#define CheckParameters_IMAPIFolder_SaveContentsSort( a1, a2, a3 ) \ + CheckParameters3( IMAPIFolder_SaveContentsSort, a1, a2, a3 ) + +#define Validate_IMAPIFolder_EmptyFolder( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIFolder_EmptyFolder, a1, a2, a3, a4 ) +#define UlValidate_IMAPIFolder_EmptyFolder( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIFolder_EmptyFolder, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIFolder_EmptyFolder( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIFolder_EmptyFolder, a1, a2, a3, a4 ) + + +/* IMsgStore */ + +#define Validate_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMsgStore_Unadvise( a1, a2 ) \ + ValidateParameters2( IMsgStore_Unadvise, a1, a2 ) +#define UlValidate_IMsgStore_Unadvise( a1, a2 ) \ + UlValidateParameters2( IMsgStore_Unadvise, a1, a2 ) +#define CheckParameters_IMsgStore_Unadvise( a1, a2 ) \ + CheckParameters2( IMsgStore_Unadvise, a1, a2 ) + +#define Validate_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 ) +#define UlValidate_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 ) + +#define Validate_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \ + ValidateParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 ) +#define UlValidate_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \ + UlValidateParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 ) +#define CheckParameters_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \ + CheckParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 ) + +#define Validate_IMsgStore_StoreLogoff( a1, a2 ) \ + ValidateParameters2( IMsgStore_StoreLogoff, a1, a2 ) +#define UlValidate_IMsgStore_StoreLogoff( a1, a2 ) \ + UlValidateParameters2( IMsgStore_StoreLogoff, a1, a2 ) +#define CheckParameters_IMsgStore_StoreLogoff( a1, a2 ) \ + CheckParameters2( IMsgStore_StoreLogoff, a1, a2 ) + +#define Validate_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \ + ValidateParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 ) +#define UlValidate_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 ) +#define CheckParameters_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \ + CheckParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 ) + +#define Validate_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \ + ValidateParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 ) +#define UlValidate_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \ + UlValidateParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 ) +#define CheckParameters_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \ + CheckParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 ) + +#define Validate_IMsgStore_SetLockState( a1, a2, a3 ) \ + ValidateParameters3( IMsgStore_SetLockState, a1, a2, a3 ) +#define UlValidate_IMsgStore_SetLockState( a1, a2, a3 ) \ + UlValidateParameters3( IMsgStore_SetLockState, a1, a2, a3 ) +#define CheckParameters_IMsgStore_SetLockState( a1, a2, a3 ) \ + CheckParameters3( IMsgStore_SetLockState, a1, a2, a3 ) + +#define Validate_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \ + ValidateParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 ) +#define UlValidate_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 ) +#define CheckParameters_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \ + CheckParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 ) + +#define Validate_IMsgStore_NotifyNewMail( a1, a2 ) \ + ValidateParameters2( IMsgStore_NotifyNewMail, a1, a2 ) +#define UlValidate_IMsgStore_NotifyNewMail( a1, a2 ) \ + UlValidateParameters2( IMsgStore_NotifyNewMail, a1, a2 ) +#define CheckParameters_IMsgStore_NotifyNewMail( a1, a2 ) \ + CheckParameters2( IMsgStore_NotifyNewMail, a1, a2 ) + + +/* IMessage */ + +#define Validate_IMessage_GetAttachmentTable( a1, a2, a3 ) \ + ValidateParameters3( IMessage_GetAttachmentTable, a1, a2, a3 ) +#define UlValidate_IMessage_GetAttachmentTable( a1, a2, a3 ) \ + UlValidateParameters3( IMessage_GetAttachmentTable, a1, a2, a3 ) +#define CheckParameters_IMessage_GetAttachmentTable( a1, a2, a3 ) \ + CheckParameters3( IMessage_GetAttachmentTable, a1, a2, a3 ) + +#define Validate_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 ) +#define UlValidate_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 ) + +#define Validate_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 ) +#define UlValidate_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 ) + +#define Validate_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 ) +#define UlValidate_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 ) + +#define Validate_IMessage_GetRecipientTable( a1, a2, a3 ) \ + ValidateParameters3( IMessage_GetRecipientTable, a1, a2, a3 ) +#define UlValidate_IMessage_GetRecipientTable( a1, a2, a3 ) \ + UlValidateParameters3( IMessage_GetRecipientTable, a1, a2, a3 ) +#define CheckParameters_IMessage_GetRecipientTable( a1, a2, a3 ) \ + CheckParameters3( IMessage_GetRecipientTable, a1, a2, a3 ) + +#define Validate_IMessage_ModifyRecipients( a1, a2, a3 ) \ + ValidateParameters3( IMessage_ModifyRecipients, a1, a2, a3 ) +#define UlValidate_IMessage_ModifyRecipients( a1, a2, a3 ) \ + UlValidateParameters3( IMessage_ModifyRecipients, a1, a2, a3 ) +#define CheckParameters_IMessage_ModifyRecipients( a1, a2, a3 ) \ + CheckParameters3( IMessage_ModifyRecipients, a1, a2, a3 ) + +#define Validate_IMessage_SubmitMessage( a1, a2 ) \ + ValidateParameters2( IMessage_SubmitMessage, a1, a2 ) +#define UlValidate_IMessage_SubmitMessage( a1, a2 ) \ + UlValidateParameters2( IMessage_SubmitMessage, a1, a2 ) +#define CheckParameters_IMessage_SubmitMessage( a1, a2 ) \ + CheckParameters2( IMessage_SubmitMessage, a1, a2 ) + +#define Validate_IMessage_SetReadFlag( a1, a2 ) \ + ValidateParameters2( IMessage_SetReadFlag, a1, a2 ) +#define UlValidate_IMessage_SetReadFlag( a1, a2 ) \ + UlValidateParameters2( IMessage_SetReadFlag, a1, a2 ) +#define CheckParameters_IMessage_SetReadFlag( a1, a2 ) \ + CheckParameters2( IMessage_SetReadFlag, a1, a2 ) + + +/* IABProvider */ + +#define Validate_IABProvider_Shutdown( a1, a2 ) \ + ValidateParameters2( IABProvider_Shutdown, a1, a2 ) +#define UlValidate_IABProvider_Shutdown( a1, a2 ) \ + UlValidateParameters2( IABProvider_Shutdown, a1, a2 ) +#define CheckParameters_IABProvider_Shutdown( a1, a2 ) \ + CheckParameters2( IABProvider_Shutdown, a1, a2 ) + +#define Validate_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + ValidateParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) +#define UlValidate_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + UlValidateParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) +#define CheckParameters_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \ + CheckParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) + + +/* IABLogon */ + +#define Validate_IABLogon_GetLastError( a1, a2, a3, a4 ) \ + ValidateParameters4( IABLogon_GetLastError, a1, a2, a3, a4 ) +#define UlValidate_IABLogon_GetLastError( a1, a2, a3, a4 ) \ + UlValidateParameters4( IABLogon_GetLastError, a1, a2, a3, a4 ) +#define CheckParameters_IABLogon_GetLastError( a1, a2, a3, a4 ) \ + CheckParameters4( IABLogon_GetLastError, a1, a2, a3, a4 ) + +#define Validate_IABLogon_Logoff( a1, a2 ) \ + ValidateParameters2( IABLogon_Logoff, a1, a2 ) +#define UlValidate_IABLogon_Logoff( a1, a2 ) \ + UlValidateParameters2( IABLogon_Logoff, a1, a2 ) +#define CheckParameters_IABLogon_Logoff( a1, a2 ) \ + CheckParameters2( IABLogon_Logoff, a1, a2 ) + +#define Validate_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IABLogon_Unadvise( a1, a2 ) \ + ValidateParameters2( IABLogon_Unadvise, a1, a2 ) +#define UlValidate_IABLogon_Unadvise( a1, a2 ) \ + UlValidateParameters2( IABLogon_Unadvise, a1, a2 ) +#define CheckParameters_IABLogon_Unadvise( a1, a2 ) \ + CheckParameters2( IABLogon_Unadvise, a1, a2 ) + +#define Validate_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define UlValidate_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define CheckParameters_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) + +#define Validate_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + ValidateParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define UlValidate_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + UlValidateParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define CheckParameters_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \ + CheckParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 ) + +#define Validate_IABLogon_GetOneOffTable( a1, a2, a3 ) \ + ValidateParameters3( IABLogon_GetOneOffTable, a1, a2, a3 ) +#define UlValidate_IABLogon_GetOneOffTable( a1, a2, a3 ) \ + UlValidateParameters3( IABLogon_GetOneOffTable, a1, a2, a3 ) +#define CheckParameters_IABLogon_GetOneOffTable( a1, a2, a3 ) \ + CheckParameters3( IABLogon_GetOneOffTable, a1, a2, a3 ) + +#define Validate_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \ + ValidateParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 ) +#define UlValidate_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \ + UlValidateParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 ) +#define CheckParameters_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \ + CheckParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 ) + + +/* IXPProvider */ + +#define Validate_IXPProvider_Shutdown( a1, a2 ) \ + ValidateParameters2( IXPProvider_Shutdown, a1, a2 ) +#define UlValidate_IXPProvider_Shutdown( a1, a2 ) \ + UlValidateParameters2( IXPProvider_Shutdown, a1, a2 ) +#define CheckParameters_IXPProvider_Shutdown( a1, a2 ) \ + CheckParameters2( IXPProvider_Shutdown, a1, a2 ) + +#define Validate_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 ) + + +/* IXPLogon */ + +#define Validate_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \ + ValidateParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 ) +#define UlValidate_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \ + UlValidateParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 ) +#define CheckParameters_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \ + CheckParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 ) + +#define Validate_IXPLogon_TransportNotify( a1, a2, a3 ) \ + ValidateParameters3( IXPLogon_TransportNotify, a1, a2, a3 ) +#define UlValidate_IXPLogon_TransportNotify( a1, a2, a3 ) \ + UlValidateParameters3( IXPLogon_TransportNotify, a1, a2, a3 ) +#define CheckParameters_IXPLogon_TransportNotify( a1, a2, a3 ) \ + CheckParameters3( IXPLogon_TransportNotify, a1, a2, a3 ) + +#define Validate_IXPLogon_Idle( a1, a2 ) \ + ValidateParameters2( IXPLogon_Idle, a1, a2 ) +#define UlValidate_IXPLogon_Idle( a1, a2 ) \ + UlValidateParameters2( IXPLogon_Idle, a1, a2 ) +#define CheckParameters_IXPLogon_Idle( a1, a2 ) \ + CheckParameters2( IXPLogon_Idle, a1, a2 ) + +#define Validate_IXPLogon_TransportLogoff( a1, a2 ) \ + ValidateParameters2( IXPLogon_TransportLogoff, a1, a2 ) +#define UlValidate_IXPLogon_TransportLogoff( a1, a2 ) \ + UlValidateParameters2( IXPLogon_TransportLogoff, a1, a2 ) +#define CheckParameters_IXPLogon_TransportLogoff( a1, a2 ) \ + CheckParameters2( IXPLogon_TransportLogoff, a1, a2 ) + +#define Validate_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 ) +#define UlValidate_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 ) +#define CheckParameters_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 ) + +#define Validate_IXPLogon_EndMessage( a1, a2, a3 ) \ + ValidateParameters3( IXPLogon_EndMessage, a1, a2, a3 ) +#define UlValidate_IXPLogon_EndMessage( a1, a2, a3 ) \ + UlValidateParameters3( IXPLogon_EndMessage, a1, a2, a3 ) +#define CheckParameters_IXPLogon_EndMessage( a1, a2, a3 ) \ + CheckParameters3( IXPLogon_EndMessage, a1, a2, a3 ) + +#define Validate_IXPLogon_Poll( a1, a2 ) \ + ValidateParameters2( IXPLogon_Poll, a1, a2 ) +#define UlValidate_IXPLogon_Poll( a1, a2 ) \ + UlValidateParameters2( IXPLogon_Poll, a1, a2 ) +#define CheckParameters_IXPLogon_Poll( a1, a2 ) \ + CheckParameters2( IXPLogon_Poll, a1, a2 ) + +#define Validate_IXPLogon_StartMessage( a1, a2, a3, a4 ) \ + ValidateParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 ) +#define UlValidate_IXPLogon_StartMessage( a1, a2, a3, a4 ) \ + UlValidateParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 ) +#define CheckParameters_IXPLogon_StartMessage( a1, a2, a3, a4 ) \ + CheckParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 ) + +#define Validate_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define UlValidate_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define CheckParameters_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) + +#define Validate_IXPLogon_ValidateState( a1, a2, a3 ) \ + ValidateParameters3( IXPLogon_ValidateState, a1, a2, a3 ) +#define UlValidate_IXPLogon_ValidateState( a1, a2, a3 ) \ + UlValidateParameters3( IXPLogon_ValidateState, a1, a2, a3 ) +#define CheckParameters_IXPLogon_ValidateState( a1, a2, a3 ) \ + CheckParameters3( IXPLogon_ValidateState, a1, a2, a3 ) + +#define Validate_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 ) +#define UlValidate_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 ) +#define CheckParameters_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 ) + + +/* IMSProvider */ + +#define Validate_IMSProvider_Shutdown( a1, a2 ) \ + ValidateParameters2( IMSProvider_Shutdown, a1, a2 ) +#define UlValidate_IMSProvider_Shutdown( a1, a2 ) \ + UlValidateParameters2( IMSProvider_Shutdown, a1, a2 ) +#define CheckParameters_IMSProvider_Shutdown( a1, a2 ) \ + CheckParameters2( IMSProvider_Shutdown, a1, a2 ) + +#define Validate_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + ValidateParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) +#define UlValidate_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + UlValidateParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) +#define CheckParameters_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + CheckParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) + +#define Validate_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + ValidateParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) +#define UlValidate_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + UlValidateParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) +#define CheckParameters_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \ + CheckParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) + +#define Validate_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 ) + + +/* IMSLogon */ + +#define Validate_IMSLogon_GetLastError( a1, a2, a3, a4 ) \ + ValidateParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 ) +#define UlValidate_IMSLogon_GetLastError( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 ) +#define CheckParameters_IMSLogon_GetLastError( a1, a2, a3, a4 ) \ + CheckParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 ) + +#define Validate_IMSLogon_Logoff( a1, a2 ) \ + ValidateParameters2( IMSLogon_Logoff, a1, a2 ) +#define UlValidate_IMSLogon_Logoff( a1, a2 ) \ + UlValidateParameters2( IMSLogon_Logoff, a1, a2 ) +#define CheckParameters_IMSLogon_Logoff( a1, a2 ) \ + CheckParameters2( IMSLogon_Logoff, a1, a2 ) + +#define Validate_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + ValidateParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define UlValidate_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + UlValidateParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) +#define CheckParameters_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \ + CheckParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 ) + +#define Validate_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + ValidateParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 ) +#define UlValidate_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + UlValidateParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 ) +#define CheckParameters_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \ + CheckParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 ) + +#define Validate_IMSLogon_Unadvise( a1, a2 ) \ + ValidateParameters2( IMSLogon_Unadvise, a1, a2 ) +#define UlValidate_IMSLogon_Unadvise( a1, a2 ) \ + UlValidateParameters2( IMSLogon_Unadvise, a1, a2 ) +#define CheckParameters_IMSLogon_Unadvise( a1, a2 ) \ + CheckParameters2( IMSLogon_Unadvise, a1, a2 ) + +#define Validate_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define UlValidate_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 ) + + +/* IMAPIControl */ + +#define Validate_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 ) +#define UlValidate_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 ) + +#define Validate_IMAPIControl_Activate( a1, a2, a3 ) \ + ValidateParameters3( IMAPIControl_Activate, a1, a2, a3 ) +#define UlValidate_IMAPIControl_Activate( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIControl_Activate, a1, a2, a3 ) +#define CheckParameters_IMAPIControl_Activate( a1, a2, a3 ) \ + CheckParameters3( IMAPIControl_Activate, a1, a2, a3 ) + +#define Validate_IMAPIControl_GetState( a1, a2, a3 ) \ + ValidateParameters3( IMAPIControl_GetState, a1, a2, a3 ) +#define UlValidate_IMAPIControl_GetState( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIControl_GetState, a1, a2, a3 ) +#define CheckParameters_IMAPIControl_GetState( a1, a2, a3 ) \ + CheckParameters3( IMAPIControl_GetState, a1, a2, a3 ) + + +/* IMAPIStatus */ + +#define Validate_IMAPIStatus_ValidateState( a1, a2, a3 ) \ + ValidateParameters3( IMAPIStatus_ValidateState, a1, a2, a3 ) +#define UlValidate_IMAPIStatus_ValidateState( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIStatus_ValidateState, a1, a2, a3 ) +#define CheckParameters_IMAPIStatus_ValidateState( a1, a2, a3 ) \ + CheckParameters3( IMAPIStatus_ValidateState, a1, a2, a3 ) + +#define Validate_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \ + ValidateParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 ) +#define UlValidate_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 ) +#define CheckParameters_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \ + CheckParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 ) + +#define Validate_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \ + ValidateParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 ) +#define UlValidate_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \ + UlValidateParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 ) +#define CheckParameters_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \ + CheckParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 ) + +#define Validate_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 ) +#define UlValidate_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 ) +#define CheckParameters_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 ) + + +/* IStream */ + +#define Validate_IStream_Read( a1, a2, a3, a4 ) \ + ValidateParameters4( IStream__Read, a1, a2, a3, a4 ) +#define UlValidate_IStream_Read( a1, a2, a3, a4 ) \ + UlValidateParameters4( IStream__Read, a1, a2, a3, a4 ) +#define CheckParameters_IStream_Read( a1, a2, a3, a4 ) \ + CheckParameters4( IStream__Read, a1, a2, a3, a4 ) + +#define Validate_IStream_Write( a1, a2, a3, a4 ) \ + ValidateParameters4( IStream__Write, a1, a2, a3, a4 ) +#define UlValidate_IStream_Write( a1, a2, a3, a4 ) \ + UlValidateParameters4( IStream__Write, a1, a2, a3, a4 ) +#define CheckParameters_IStream_Write( a1, a2, a3, a4 ) \ + CheckParameters4( IStream__Write, a1, a2, a3, a4 ) + +#define Validate_IStream_Seek( a1, a2, a3, a4 ) \ + ValidateParameters4( IStream_Seek, a1, a2, a3, a4 ) +#define UlValidate_IStream_Seek( a1, a2, a3, a4 ) \ + UlValidateParameters4( IStream_Seek, a1, a2, a3, a4 ) +#define CheckParameters_IStream_Seek( a1, a2, a3, a4 ) \ + CheckParameters4( IStream_Seek, a1, a2, a3, a4 ) + +#define Validate_IStream_SetSize( a1, a2 ) \ + ValidateParameters2( IStream_SetSize, a1, a2 ) +#define UlValidate_IStream_SetSize( a1, a2 ) \ + UlValidateParameters2( IStream_SetSize, a1, a2 ) +#define CheckParameters_IStream_SetSize( a1, a2 ) \ + CheckParameters2( IStream_SetSize, a1, a2 ) + +#define Validate_IStream_CopyTo( a1, a2, a3, a4, a5 ) \ + ValidateParameters5( IStream_CopyTo, a1, a2, a3, a4, a5 ) +#define UlValidate_IStream_CopyTo( a1, a2, a3, a4, a5 ) \ + UlValidateParameters5( IStream_CopyTo, a1, a2, a3, a4, a5 ) +#define CheckParameters_IStream_CopyTo( a1, a2, a3, a4, a5 ) \ + CheckParameters5( IStream_CopyTo, a1, a2, a3, a4, a5 ) + +#define Validate_IStream_Commit( a1, a2 ) \ + ValidateParameters2( IStream_Commit, a1, a2 ) +#define UlValidate_IStream_Commit( a1, a2 ) \ + UlValidateParameters2( IStream_Commit, a1, a2 ) +#define CheckParameters_IStream_Commit( a1, a2 ) \ + CheckParameters2( IStream_Commit, a1, a2 ) + +#define Validate_IStream_Revert( a1 ) \ + ValidateParameters1( IStream_Revert, a1 ) +#define UlValidate_IStream_Revert( a1 ) \ + UlValidateParameters1( IStream_Revert, a1 ) +#define CheckParameters_IStream_Revert( a1 ) \ + CheckParameters1( IStream_Revert, a1 ) + +#define Validate_IStream_LockRegion( a1, a2, a3, a4 ) \ + ValidateParameters4( IStream_LockRegion, a1, a2, a3, a4 ) +#define UlValidate_IStream_LockRegion( a1, a2, a3, a4 ) \ + UlValidateParameters4( IStream_LockRegion, a1, a2, a3, a4 ) +#define CheckParameters_IStream_LockRegion( a1, a2, a3, a4 ) \ + CheckParameters4( IStream_LockRegion, a1, a2, a3, a4 ) + +#define Validate_IStream_UnlockRegion( a1, a2, a3, a4 ) \ + ValidateParameters4( IStream_UnlockRegion, a1, a2, a3, a4 ) +#define UlValidate_IStream_UnlockRegion( a1, a2, a3, a4 ) \ + UlValidateParameters4( IStream_UnlockRegion, a1, a2, a3, a4 ) +#define CheckParameters_IStream_UnlockRegion( a1, a2, a3, a4 ) \ + CheckParameters4( IStream_UnlockRegion, a1, a2, a3, a4 ) + +#define Validate_IStream_Stat( a1, a2, a3 ) \ + ValidateParameters3( IStream_Stat, a1, a2, a3 ) +#define UlValidate_IStream_Stat( a1, a2, a3 ) \ + UlValidateParameters3( IStream_Stat, a1, a2, a3 ) +#define CheckParameters_IStream_Stat( a1, a2, a3 ) \ + CheckParameters3( IStream_Stat, a1, a2, a3 ) + +#define Validate_IStream_Clone( a1, a2 ) \ + ValidateParameters2( IStream_Clone, a1, a2 ) +#define UlValidate_IStream_Clone( a1, a2 ) \ + UlValidateParameters2( IStream_Clone, a1, a2 ) +#define CheckParameters_IStream_Clone( a1, a2 ) \ + CheckParameters2( IStream_Clone, a1, a2 ) + + +/* IMAPIAdviseSink */ + +#define Validate_IMAPIAdviseSink_OnNotify( a1, a2, a3 ) \ + ValidateParameters3( IMAPIAdviseSink_OnNotify, a1, a2, a3 ) +#define UlValidate_IMAPIAdviseSink_OnNotify( a1, a2, a3 ) \ + UlValidateParameters3( IMAPIAdviseSink_OnNotify, a1, a2, a3 ) +#define CheckParameters_IMAPIAdviseSink_OnNotify( a1, a2, a3 ) \ + CheckParameters3( IMAPIAdviseSink_OnNotify, a1, a2, a3 ) + +#if defined(_AMD64_) || defined(_X86_) +STDAPI HrValidateParameters( METHODS eMethod, LPVOID FAR *ppFirstArg ); +#elif defined(DOS) || defined(_MAC) +STDAPIV HrValidateParametersV( METHODS eMethod, ... ); +STDAPIV HrValidateParametersValist( METHODS eMethod, va_list arglist ); +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _INC_VALIDATE */ + + diff --git a/comm/mailnews/mapi/include/mapiwin.h b/comm/mailnews/mapi/include/mapiwin.h new file mode 100644 index 0000000000..6dc00c45ee --- /dev/null +++ b/comm/mailnews/mapi/include/mapiwin.h @@ -0,0 +1,274 @@ +/* + * M A P I W I N . H + * + * Definitions used by the MAPI Development Team to aid in + * developing single-source service providers that run on + * both WIN32 and WIN16 platforms. + * There are three sections. + * + * The first section defines how to call something that + * is available by different methods in WIN16 vs. WIN32. + * As such, they are totally new mechanisms. + * + * The second section establishes things that are available + * AS-IS in one environment but we have to define for the + * other environment. + * + * The third section simply defines a few conventions + * (simplifications) for common operations. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +/* + * Routines are included in the first section to manage per-instance + * global variables for DLLs. They assume that all of the DLL's + * per-instance global variables live in a single block of memory. + * Functions are provided to install and retrieve the correct block of + * memory for the current instance. + * + * There are only two functions: + * + * PvGetInstanceGlobals Call this to get the address of the + * per-instance globals structure. + * ScSetinstanceGlobals Call this to install the + * per-instance globals structure. It + * may fail if the number of instances + * exceeds a certain limit. + * + * The caller is free to choose the name, size, and allocation + * method of the per-instance global variables structure. + * + * The WIN32 implementation uses a pointer in the DLL's data + * segment. This assumes that the DLL gets a separate instance + * of the default data segment per calling process. + * + * The WIN16 implementation uses a fixed array of pointers and a + * matching fixed array of keys unique to the calling process. + */ + +/* + * The second section consists largely of Win32 file I/O functions + * that are not supported under Win16. These functions are + * implemented in mapiwin.c, using DOS calls. Most have limitations + * relative to their Win32 counterparts, which are spelled out in + * the comments to the source code. + */ + +#ifndef __MAPIWIN_H__ +#define __MAPIWIN_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#if defined (WIN32) && !defined (_WIN32) +#define _WIN32 +#endif + +#include "mapinls.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(_MAC) + +#define MULDIV(x,y,z) MulDiv(x,y,z) + +LPVOID FAR PASCAL PvGetInstanceGlobals(WORD wDataSet); +LONG FAR PASCAL ScSetInstanceGlobals(LPVOID pv, WORD wDataSet); +LONG FAR PASCAL ScSetVerifyInstanceGlobals(LPVOID pv, DWORD dwPid, + WORD wDataSet); +LPVOID FAR PASCAL PvGetVerifyInstanceGlobals(DWORD dwPid, DWORD wDataSet); +LPVOID FAR PASCAL PvSlowGetInstanceGlobals(DWORD dwPid, DWORD wDataSet); +BOOL FAR PASCAL FCleanupInstanceGlobals(WORD, DWORD); + +#elif defined(_WIN64) || defined(_WIN32) + +#define MULDIV(x,y,z) MulDiv(x,y,z) + +extern LPVOID pinstX; +#define PvGetInstanceGlobals() pinstX +#define ScSetInstanceGlobals(_pv) (pinstX = _pv, 0) +#define PvGetVerifyInstanceGlobals(_pid) pinstX +#define ScSetVerifyInstanceGlobals(_pv,_pid) (pinstX = _pv, 0) +#define PvSlowGetInstanceGlobals(_pid) pinstX + +#else +#error "Unknown Platform: MAPI is currently supported on Win32 and Win64" +#endif + +#if (defined(_WIN64) || defined(_WIN32)) && !defined(_MAC) +#define szMAPIDLLSuffix "32" +#elif defined(DOS) +#define szMAPIDLLSuffix "" +#elif defined(_MAC) +#define szMAPIDLLSuffix "M" +#else +#error "Don't know the suffix for DLLs on this platform" +#endif + +/********************************/ +/* Things missing from one */ +/* system-provided environment */ +/* or the other. */ +/********************************/ + +#if !defined(_WIN64) && !defined(_WIN32) +#define ZeroMemory(pb,cb) memset((pb),0,(cb)) +#define FillMemory(pb,cb,b) memset((pb),(b),(cb)) +#define CopyMemory(pbDst,pbSrc,cb) do \ + { \ + size_t _cb = (size_t)(cb); \ + if (_cb) \ + memcpy(pbDst,pbSrc,_cb);\ + } while (FALSE) +#define MoveMemory(pbDst,pbSrc,cb) memmove((pbDst),(pbSrc),(cb)) + +#define UNALIGNED + +#endif + +#if defined(_MAC) + +typedef int INT; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; +typedef double LONGLONG; +typedef double DWORDLONG; +typedef unsigned char UCHAR; +typedef unsigned char FAR* PUCHAR; +typedef int BOOL; + + +/* Synchronization */ +#define InterlockedIncrement(plong) (++(*(plong))) +#define InterlockedDecrement(plong) (--(*(plong))) + +#ifndef CreateMutex +#define CreateMutexA CreateMutex +#define CreateMutexW CreateMutex +#define CreateMutex(pv, bool, sz) (INVALID_HANDLE_VALUE) +#endif + +#define WaitForSingleObject(hObj, dw) ((void)0) +#define ReleaseMutex(hObj) ((BOOL)1) +#define CloseMutexHandle(hObj) TRUE + +#define CRITICAL_SECTION ULONG +#define InitializeCriticalSection(_pcs) ((void)0) +#define DeleteCriticalSection(_pcs) ((void)0) +#define EnterCriticalSection(_pcs) ((void)0) +#define LeaveCriticalSection(_pcs) ((void)0) + +#define MAX_PATH 260 + +#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000 + +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 + +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 + +#define FILE_FLAG_WRITE_THROUGH 0x80000000 +#define FILE_FLAG_RANDOM_ACCESS 0x10000000 + +#define TIME_ZONE_ID_UNKNOWN 0 +#define TIME_ZONE_ID_STANDARD 1 +#define TIME_ZONE_ID_DAYLIGHT 2 + + + +DWORD WINAPI GetLastError(void); +DWORD WINAPI GetFileAttributes(LPCSTR lpFileName); +DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh); +BOOL WINAPI GetFileTime(HANDLE hFile, FILETIME FAR *lpftCreation, + FILETIME FAR *lpftLastAccess, FILETIME FAR *lpftLastWrite); +BOOL WINAPI SetFileTime(HANDLE hFile, const FILETIME FAR *lpftCreation, + const FILETIME FAR *lpftLastAccess, + const FILETIME FAR *lpftLastWrite); +DWORD WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove, + LONG FAR *lpDistanceToMoveHigh, DWORD dwMoveMethod); +BOOL WINAPI SetEndOfFile(HANDLE hFile); +BOOL WINAPI CloseHandle(HANDLE hObject); +DWORD WINAPI GetTempPath(DWORD nBufferLength, LPSTR lpBuffer); +UINT WINAPI GetTempFileName32 (LPCSTR lpPathName, LPCSTR lpPrefixString, + UINT uUnique, LPSTR lpTempFileName); +BOOL WINAPI DeleteFile(LPCSTR lpFileName); +BOOL WINAPI RemoveDirectory(LPCSTR lpPathName); +BOOL WINAPI CopyFile(LPCSTR szSrc, LPCSTR szDst, BOOL fFailIfExists); +BOOL WINAPI MoveFile(LPCSTR lpExistingFileName, LPCSTR lpNewFileName); +HANDLE WINAPI FindFirstFile(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData); +BOOL WINAPI FindNextFile(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData); +BOOL WINAPI FindClose(HANDLE hFindFile); +DWORD WINAPI GetFullPathName(LPCSTR lpFileName, DWORD nBufferLength, + LPSTR lpBuffer, LPSTR *lpFilePart); +void WINAPI Sleep(DWORD dwMilliseconds); +LONG WINAPI CompareFileTime(const FILETIME FAR *, const FILETIME FAR *); +BOOL WINAPI LocalFileTimeToFileTime(const FILETIME FAR *, FILETIME FAR *); +BOOL WINAPI FileTimeToLocalFileTime(const FILETIME FAR *, FILETIME FAR *); +BOOL WINAPI FileTimeToSystemTime(const FILETIME FAR *, SYSTEMTIME FAR *); +BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME FAR *, FILETIME FAR *); +void WINAPI GetSystemTime(SYSTEMTIME FAR *); +void WINAPI GetLocalTime(SYSTEMTIME FAR *); +BOOL WINAPI FileTimeToDosDateTime(const FILETIME FAR * lpFileTime, + WORD FAR *lpFatDate, WORD FAR *lpFatTime); +BOOL WINAPI DosDateTimeToFileTime(WORD wFatDate, WORD wFatTime, + FILETIME FAR * lpFileTime); +DWORD WINAPI GetTimeZoneInformation( + LPTIME_ZONE_INFORMATION lpTimeZoneInformation); +BOOL WINAPI SetTimeZoneInformation( + const TIME_ZONE_INFORMATION FAR *lpTimeZoneInformation); + +DWORD WINAPI GetCurrentProcessId(void); +long WINAPI MulDiv32(long, long, long); + +#else /* _MAC */ + +/* Remaps GetTempFileName32() to the real 32bit version */ + +#define GetTempFileName32(_szPath,_szPfx,_n,_lpbuf) GetTempFileName(_szPath,_szPfx,_n,_lpbuf) + +#define CloseMutexHandle CloseHandle + +#endif /* _MAC */ + + +#ifdef _MAC +#define CRITICAL_SECTION ULONG +#define InitializeCriticalSection(_pcs) ((void)0) +#define DeleteCriticalSection(_pcs) ((void)0) +#define EnterCriticalSection(_pcs) ((void)0) +#define LeaveCriticalSection(_pcs) ((void)0) +#endif + +/********************************/ +/* Our private conventions */ +/* (common to WIN32/WIN64) */ +/********************************/ + +#define Cbtszsize(_a) ((lstrlen(_a)+1)*sizeof(TCHAR)) +#define CbtszsizeA(_a) ((lstrlenA(_a) + 1)) +#define CbtszsizeW(_a) ((lstrlenW(_a) + 1) * sizeof(WCHAR)) +#define HexCchOf(_s) (sizeof(_s)*2+1) +#define HexSizeOf(_s) (HexCchOf(_s)*sizeof(TCHAR)) + +BOOL WINAPI IsBadBoundedStringPtr(const void FAR* lpsz, UINT cchMax); + +#ifdef __cplusplus +} +#endif + +#endif /* __MAPIWIN_H__ */ diff --git a/comm/mailnews/mapi/include/mapiwz.h b/comm/mailnews/mapi/include/mapiwz.h new file mode 100644 index 0000000000..0ebe69fcbf --- /dev/null +++ b/comm/mailnews/mapi/include/mapiwz.h @@ -0,0 +1,73 @@ +/* + * M A P I W Z . H + * + * Definitions for the Profile Wizard. Includes all prototypes + * and constants required by the provider-wizard code consumers. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MAPIWZ_H +#define _MAPIWZ_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +#define WIZ_QUERYNUMPAGES (WM_USER +10) +#define WIZ_NEXT (WM_USER +11) +#define WIZ_PREV (WM_USER +12) +/* + * NOTE: Provider-Wizards should not use ids ranging between + * (WM_USER + 1) and (WM_USER +20) as these have been reserved for + * future releases. + */ + +/* Flags for LaunchWizard API */ + +#define MAPI_PW_FIRST_PROFILE 0x00000001 +#define MAPI_PW_LAUNCHED_BY_CONFIG 0x00000002 +#define MAPI_PW_ADD_SERVICE_ONLY 0x00000004 +#define MAPI_PW_PROVIDER_UI_ONLY 0x00000008 +#define MAPI_PW_HIDE_SERVICES_LIST 0x00000010 + +/* + * Provider should set this property to TRUE if it does not + * want the Profile Wizard to display the PST setup page. + */ +#define PR_WIZARD_NO_PST_PAGE PROP_TAG(PT_BOOLEAN, 0x6700) +#define PR_WIZARD_NO_PAB_PAGE PROP_TAG(PT_BOOLEAN, 0x6701) + +typedef HRESULT (STDAPICALLTYPE LAUNCHWIZARDENTRY) +( + HWND hParentWnd, + ULONG ulFlags, + LPCTSTR FAR * lppszServiceNameToAdd, + ULONG cbBufferMax, + LPTSTR lpszNewProfileName +); +typedef LAUNCHWIZARDENTRY FAR * LPLAUNCHWIZARDENTRY; + +typedef BOOL (STDAPICALLTYPE SERVICEWIZARDDLGPROC) +( + HWND hDlg, + UINT wMsgID, + WPARAM wParam, + LPARAM lParam +); +typedef SERVICEWIZARDDLGPROC FAR * LPSERVICEWIZARDDLGPROC; + +typedef ULONG (STDAPICALLTYPE WIZARDENTRY) +( + HINSTANCE hProviderDLLInstance, + LPTSTR FAR * lppcsResourceName, + DLGPROC FAR * lppDlgProc, + LPMAPIPROP lpMapiProp, + LPVOID lpMapiSupportObject +); +typedef WIZARDENTRY FAR * LPWIZARDENTRY; + +#define LAUNCHWIZARDENTRYNAME "LAUNCHWIZARD" + +#endif /* _MAPIWZ_H */ + diff --git a/comm/mailnews/mapi/include/mapix.h b/comm/mailnews/mapi/include/mapix.h new file mode 100644 index 0000000000..d9694bd565 --- /dev/null +++ b/comm/mailnews/mapi/include/mapix.h @@ -0,0 +1,545 @@ +/* + * M A P I X . H + * + * Definitions of objects/flags, etc used by Extended MAPI. + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef MAPIX_H +#define MAPIX_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +/* Include common MAPI header files if they haven't been already. */ +#ifndef MAPIDEFS_H +#include "mapidefs.h" +#endif +#ifndef MAPICODE_H +#include "mapicode.h" +#endif +#ifndef MAPIGUID_H +#include "mapiguid.h" +#endif +#ifndef MAPITAGS_H +#include "mapitags.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BEGIN_INTERFACE +#define BEGIN_INTERFACE +#endif + +/* Forward interface declarations */ + +DECLARE_MAPI_INTERFACE_PTR(IProfAdmin, LPPROFADMIN); +DECLARE_MAPI_INTERFACE_PTR(IMsgServiceAdmin, LPSERVICEADMIN); +DECLARE_MAPI_INTERFACE_PTR(IMAPISession, LPMAPISESSION); + +/* ------------------------------------------------------ */ +/* shared with simple mapi */ + +typedef ULONG FLAGS; + +/* MAPILogon() flags. */ + +#define MAPI_LOGON_UI 0x00000001 /* Display logon UI */ +#define MAPI_NEW_SESSION 0x00000002 /* Don't use shared session */ +#define MAPI_ALLOW_OTHERS 0x00000008 /* Make this a shared session */ +#define MAPI_EXPLICIT_PROFILE 0x00000010 /* Don't use default profile */ +#define MAPI_EXTENDED 0x00000020 /* Extended MAPI Logon */ +#define MAPI_FORCE_DOWNLOAD 0x00001000 /* Get new mail before return */ +#define MAPI_SERVICE_UI_ALWAYS 0x00002000 /* Do logon UI in all providers */ +#define MAPI_NO_MAIL 0x00008000 /* Do not activate transports */ +/* #define MAPI_NT_SERVICE 0x00010000 Allow logon from an NT service */ +#ifndef MAPI_PASSWORD_UI +#define MAPI_PASSWORD_UI 0x00020000 /* Display password UI only */ +#endif +#define MAPI_TIMEOUT_SHORT 0x00100000 /* Minimal wait for logon resources */ + +#define MAPI_SIMPLE_DEFAULT (MAPI_LOGON_UI | MAPI_FORCE_DOWNLOAD | MAPI_ALLOW_OTHERS) +#define MAPI_SIMPLE_EXPLICIT (MAPI_NEW_SESSION | MAPI_FORCE_DOWNLOAD | MAPI_EXPLICIT_PROFILE) + +/* Structure passed to MAPIInitialize(), and its ulFlags values */ + +typedef struct +{ + ULONG ulVersion; + ULONG ulFlags; +} MAPIINIT_0, FAR *LPMAPIINIT_0; + +typedef MAPIINIT_0 MAPIINIT; +typedef MAPIINIT FAR *LPMAPIINIT; + +#define MAPI_INIT_VERSION 0 + +#define MAPI_MULTITHREAD_NOTIFICATIONS 0x00000001 +/* Reserved for MAPI 0x40000000 */ +/* #define MAPI_NT_SERVICE 0x00010000 Use from NT service */ + +/* MAPI base functions */ + +typedef HRESULT (STDAPICALLTYPE MAPIINITIALIZE)( + LPVOID lpMapiInit +); +typedef MAPIINITIALIZE FAR *LPMAPIINITIALIZE; + +typedef void (STDAPICALLTYPE MAPIUNINITIALIZE)(void); +typedef MAPIUNINITIALIZE FAR *LPMAPIUNINITIALIZE; + +MAPIINITIALIZE MAPIInitialize; +MAPIUNINITIALIZE MAPIUninitialize; + + +/* Extended MAPI Logon function */ + + +typedef HRESULT (STDMETHODCALLTYPE MAPILOGONEX)( + ULONG_PTR ulUIParam, + /*OFFICEDEV add _opt*/ __in_opt LPTSTR lpszProfileName, + /*OFFICEDEV add _opt*/ __in_opt LPTSTR lpszPassword, + ULONG ulFlags, /* ulFlags takes all that SimpleMAPI does + MAPI_UNICODE */ + LPMAPISESSION FAR * lppSession +); +typedef MAPILOGONEX FAR *LPMAPILOGONEX; + +MAPILOGONEX MAPILogonEx; + + +typedef SCODE (STDMETHODCALLTYPE MAPIALLOCATEBUFFER)( + ULONG cbSize, + LPVOID FAR * lppBuffer +); + +typedef SCODE (STDMETHODCALLTYPE MAPIALLOCATEMORE)( + ULONG cbSize, + LPVOID lpObject, + LPVOID FAR * lppBuffer +); + +typedef ULONG (STDAPICALLTYPE MAPIFREEBUFFER)( + LPVOID lpBuffer +); + +typedef MAPIALLOCATEBUFFER FAR *LPMAPIALLOCATEBUFFER; +typedef MAPIALLOCATEMORE FAR *LPMAPIALLOCATEMORE; +typedef MAPIFREEBUFFER FAR *LPMAPIFREEBUFFER; + +MAPIALLOCATEBUFFER MAPIAllocateBuffer; +MAPIALLOCATEMORE MAPIAllocateMore; +MAPIFREEBUFFER MAPIFreeBuffer; + +typedef HRESULT (STDMETHODCALLTYPE MAPIADMINPROFILES)( + ULONG ulFlags, + LPPROFADMIN FAR *lppProfAdmin +); + +typedef MAPIADMINPROFILES FAR *LPMAPIADMINPROFILES; + +MAPIADMINPROFILES MAPIAdminProfiles; + +/* IMAPISession Interface -------------------------------------------------- */ + +/* Flags for OpenEntry and others */ + +/*#define MAPI_MODIFY ((ULONG) 0x00000001) */ + +/* Flags for Logoff */ + +#define MAPI_LOGOFF_SHARED 0x00000001 /* Close all shared sessions */ +#define MAPI_LOGOFF_UI 0x00000002 /* It's OK to present UI */ + +/* Flags for SetDefaultStore. They are mutually exclusive. */ + +#define MAPI_DEFAULT_STORE 0x00000001 /* for incoming messages */ +#define MAPI_SIMPLE_STORE_TEMPORARY 0x00000002 /* for simple MAPI and CMC */ +#define MAPI_SIMPLE_STORE_PERMANENT 0x00000003 /* for simple MAPI and CMC */ +#define MAPI_PRIMARY_STORE 0x00000004 /* Used by some clients */ +#define MAPI_SECONDARY_STORE 0x00000005 /* Used by some clients */ + +/* Flags for ShowForm. */ + +#define MAPI_POST_MESSAGE 0x00000001 /* Selects post/send semantics */ +#define MAPI_NEW_MESSAGE 0x00000002 /* Governs copying during submission */ + +/* MessageOptions */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* QueryDefaultMessageOpt */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +#define MAPI_IMAPISESSION_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetMsgStoresTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(OpenMsgStore) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPMDB FAR * lppMDB) IPURE; \ + MAPIMETHOD(OpenAddressBook) \ + (THIS_ ULONG_PTR ulUIParam, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPADRBOOK FAR * lppAdrBook) IPURE; \ + MAPIMETHOD(OpenProfileSection) \ + (THIS_ LPMAPIUID lpUID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPPROFSECT FAR * lppProfSect) IPURE; \ + MAPIMETHOD(GetStatusTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(MessageOptions) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPTSTR lpszAdrType, \ + LPMESSAGE lpMessage) IPURE; \ + MAPIMETHOD(QueryDefaultMessageOpt) \ + (THIS_ LPTSTR lpszAdrType, \ + ULONG ulFlags, \ + ULONG FAR * lpcValues, \ + LPSPropValue FAR * lppOptions) IPURE; \ + MAPIMETHOD(EnumAdrTypes) \ + (THIS_ ULONG ulFlags, \ + ULONG FAR * lpcAdrTypes, \ + LPTSTR FAR * FAR * lpppszAdrTypes) IPURE; \ + MAPIMETHOD(QueryIdentity) \ + (THIS_ ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID) IPURE; \ + MAPIMETHOD(Logoff) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + ULONG ulReserved) IPURE; \ + MAPIMETHOD(SetDefaultStore) \ + (THIS_ ULONG ulFlags, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(AdminServices) \ + (THIS_ ULONG ulFlags, \ + LPSERVICEADMIN FAR * lppServiceAdmin) IPURE; \ + MAPIMETHOD(ShowForm) \ + (THIS_ ULONG_PTR ulUIParam, \ + LPMDB lpMsgStore, \ + LPMAPIFOLDER lpParentFolder, \ + LPCIID lpInterface, \ + ULONG_PTR ulMessageToken, \ + LPMESSAGE lpMessageSent, \ + ULONG ulFlags, \ + ULONG ulMessageStatus, \ + ULONG ulMessageFlags, \ + ULONG ulAccess, \ + LPSTR lpszMessageClass) IPURE; \ + MAPIMETHOD(PrepareForm) \ + (THIS_ LPCIID lpInterface, \ + LPMESSAGE lpMessage, \ + ULONG_PTR FAR * lpulMessageToken) IPURE; \ + + +#undef INTERFACE +#define INTERFACE IMAPISession +DECLARE_MAPI_INTERFACE_(IMAPISession, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPISESSION_METHODS(PURE) +}; + +/*DECLARE_MAPI_INTERFACE_PTR(IMAPISession, LPMAPISESSION);*/ + +/* IAddrBook Interface ----------------------------------------------------- */ + +/* CreateOneOff */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ +/****** MAPI_SEND_NO_RICH_INFO ((ULONG) 0x00010000) */ + +/* RecipOptions */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* QueryDefaultRecipOpt */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* GetSearchPath */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + + +#define MAPI_IADDRBOOK_METHODS(IPURE) \ + MAPIMETHOD(OpenEntry) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + ULONG FAR * lpulObjType, \ + LPUNKNOWN FAR * lppUnk) IPURE; \ + MAPIMETHOD(CompareEntryIDs) \ + (THIS_ ULONG cbEntryID1, \ + LPENTRYID lpEntryID1, \ + ULONG cbEntryID2, \ + LPENTRYID lpEntryID2, \ + ULONG ulFlags, \ + ULONG FAR * lpulResult) IPURE; \ + MAPIMETHOD(Advise) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + ULONG ulEventMask, \ + LPMAPIADVISESINK lpAdviseSink, \ + ULONG_PTR FAR * lpulConnection) IPURE; \ + MAPIMETHOD(Unadvise) \ + (THIS_ ULONG_PTR ulConnection) IPURE; \ + MAPIMETHOD(CreateOneOff) \ + (THIS_ LPTSTR lpszName, \ + LPTSTR lpszAdrType, \ + LPTSTR lpszAddress, \ + ULONG ulFlags, \ + ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID) IPURE; \ + MAPIMETHOD(NewEntry) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + ULONG cbEIDContainer, \ + LPENTRYID lpEIDContainer, \ + ULONG cbEIDNewEntryTpl, \ + LPENTRYID lpEIDNewEntryTpl, \ + ULONG FAR * lpcbEIDNewEntry, \ + LPENTRYID FAR * lppEIDNewEntry) IPURE; \ + MAPIMETHOD(ResolveName) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPTSTR lpszNewEntryTitle, \ + LPADRLIST lpAdrList) IPURE; \ + MAPIMETHOD(Address) \ + (THIS_ ULONG_PTR FAR * lpulUIParam, \ + LPADRPARM lpAdrParms, \ + LPADRLIST FAR * lppAdrList) IPURE; \ + MAPIMETHOD(Details) \ + (THIS_ ULONG_PTR FAR * lpulUIParam, \ + LPFNDISMISS lpfnDismiss, \ + LPVOID lpvDismissContext, \ + ULONG cbEntryID, \ + LPENTRYID lpEntryID, \ + LPFNBUTTON lpfButtonCallback, \ + LPVOID lpvButtonContext, \ + LPTSTR lpszButtonText, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(RecipOptions) \ + (THIS_ ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPADRENTRY lpRecip) IPURE; \ + MAPIMETHOD(QueryDefaultRecipOpt) \ + (THIS_ LPTSTR lpszAdrType, \ + ULONG ulFlags, \ + ULONG FAR * lpcValues, \ + LPSPropValue FAR * lppOptions) IPURE; \ + MAPIMETHOD(GetPAB) \ + (THIS_ ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID) IPURE; \ + MAPIMETHOD(SetPAB) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(GetDefaultDir) \ + (THIS_ ULONG FAR * lpcbEntryID, \ + LPENTRYID FAR * lppEntryID) IPURE; \ + MAPIMETHOD(SetDefaultDir) \ + (THIS_ ULONG cbEntryID, \ + LPENTRYID lpEntryID) IPURE; \ + MAPIMETHOD(GetSearchPath) \ + (THIS_ ULONG ulFlags, \ + LPSRowSet FAR * lppSearchPath) IPURE; \ + MAPIMETHOD(SetSearchPath) \ + (THIS_ ULONG ulFlags, \ + LPSRowSet lpSearchPath) IPURE; \ + MAPIMETHOD(PrepareRecips) \ + (THIS_ ULONG ulFlags, \ + LPSPropTagArray lpPropTagArray, \ + LPADRLIST lpRecipList) IPURE; \ + +#undef INTERFACE +#define INTERFACE IAddrBook +DECLARE_MAPI_INTERFACE_(IAddrBook, IMAPIProp) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMAPIPROP_METHODS(PURE) + MAPI_IADDRBOOK_METHODS(PURE) +}; + +DECLARE_MAPI_INTERFACE_PTR(IAddrBook, LPADRBOOK); + +/* IProfAdmin Interface ---------------------------------------------------- */ + +/* Flags for CreateProfile */ +#define MAPI_DEFAULT_SERVICES 0x00000001 + +/* GetProfileTable */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +#define MAPI_IPROFADMIN_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetProfileTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(CreateProfile) \ + (THIS_ LPTSTR lpszProfileName, \ + LPTSTR lpszPassword, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteProfile) \ + (THIS_ LPTSTR lpszProfileName, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(ChangeProfilePassword) \ + (THIS_ LPTSTR lpszProfileName, \ + LPTSTR lpszOldPassword, \ + LPTSTR lpszNewPassword, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(CopyProfile) \ + (THIS_ LPTSTR lpszOldProfileName, \ + LPTSTR lpszOldPassword, \ + LPTSTR lpszNewProfileName, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(RenameProfile) \ + (THIS_ LPTSTR lpszOldProfileName, \ + LPTSTR lpszOldPassword, \ + LPTSTR lpszNewProfileName, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(SetDefaultProfile) \ + (THIS_ LPTSTR lpszProfileName, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(AdminServices) \ + (THIS_ LPTSTR lpszProfileName, \ + LPTSTR lpszPassword, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + LPSERVICEADMIN FAR * lppServiceAdmin) IPURE; \ + + +#undef INTERFACE +#define INTERFACE IProfAdmin +DECLARE_MAPI_INTERFACE_(IProfAdmin, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IPROFADMIN_METHODS(PURE) +}; + +/* IMsgServiceAdmin Interface ---------------------------------------------- */ + +/* Values for PR_RESOURCE_FLAGS in message service table */ + +#define SERVICE_DEFAULT_STORE 0x00000001 +#define SERVICE_SINGLE_COPY 0x00000002 +#define SERVICE_CREATE_WITH_STORE 0x00000004 +#define SERVICE_PRIMARY_IDENTITY 0x00000008 +#define SERVICE_NO_PRIMARY_IDENTITY 0x00000020 + +/* GetMsgServiceTable */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +/* GetProviderTable */ +/****** MAPI_UNICODE ((ULONG) 0x80000000) */ + +#define MAPI_IMSGSERVICEADMIN_METHODS(IPURE) \ + MAPIMETHOD(GetLastError) \ + (THIS_ HRESULT hResult, \ + ULONG ulFlags, \ + LPMAPIERROR FAR * lppMAPIError) IPURE; \ + MAPIMETHOD(GetMsgServiceTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + MAPIMETHOD(CreateMsgService) \ + (THIS_ LPTSTR lpszService, \ + LPTSTR lpszDisplayName, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(DeleteMsgService) \ + (THIS_ LPMAPIUID lpUID) IPURE; \ + MAPIMETHOD(CopyMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + LPTSTR lpszDisplayName, \ + LPCIID lpInterfaceToCopy, \ + LPCIID lpInterfaceDst, \ + LPVOID lpObjectDst, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(RenameMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags, \ + LPTSTR lpszDisplayName) IPURE; \ + MAPIMETHOD(ConfigureMsgService) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG_PTR ulUIParam, \ + ULONG ulFlags, \ + ULONG cValues, \ + LPSPropValue lpProps) IPURE; \ + MAPIMETHOD(OpenProfileSection) \ + (THIS_ LPMAPIUID lpUID, \ + LPCIID lpInterface, \ + ULONG ulFlags, \ + LPPROFSECT FAR * lppProfSect) IPURE; \ + MAPIMETHOD(MsgServiceTransportOrder) \ + (THIS_ ULONG cUID, \ + LPMAPIUID lpUIDList, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(AdminProviders) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags, \ + LPPROVIDERADMIN FAR * lppProviderAdmin) IPURE; \ + MAPIMETHOD(SetPrimaryIdentity) \ + (THIS_ LPMAPIUID lpUID, \ + ULONG ulFlags) IPURE; \ + MAPIMETHOD(GetProviderTable) \ + (THIS_ ULONG ulFlags, \ + LPMAPITABLE FAR * lppTable) IPURE; \ + + +#undef INTERFACE +#define INTERFACE IMsgServiceAdmin +DECLARE_MAPI_INTERFACE_(IMsgServiceAdmin, IUnknown) +{ + BEGIN_INTERFACE + MAPI_IUNKNOWN_METHODS(PURE) + MAPI_IMSGSERVICEADMIN_METHODS(PURE) +}; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* MAPIX_H */ diff --git a/comm/mailnews/mapi/include/mspst.h b/comm/mailnews/mapi/include/mspst.h new file mode 100644 index 0000000000..d063e25c58 --- /dev/null +++ b/comm/mailnews/mapi/include/mspst.h @@ -0,0 +1,99 @@ +/* + * M S P S T . H + * + * This file lists internal properties of the Microsoft Personal + * Information Store + * + * Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. + */ + +#ifndef _MSPST_H_ +#define _MSPST_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + + +/* The following is a list of properties that may be passed in + as the properties in the array of SPropValue structure on the + MsgServiceConfigure function. + + Creating a PST profile section through CreateMsgService. + The creation of the actual PST file is a two step process. First the + client should call CreateMsgService to setup the profile section and then + ConfigureMsgService to create the PST file. + The CreateMsgService call will setup the PR_DISPLAY_NAME property in the + profile section to be used on the PST when it is created. + + Configuring an PST file through ConfigureMsgService. + The configuration of an PST can take two forms, either configuring an + existing PST or creating a new PST. The Microsoft Personal Information + Store provider will try to find the necessary properties by first looking + in the array of SPropValue structures provided by the client and then in the + profile section, except for PR_PST_PW_SZ_OLD for which it will only look + in the array of properties. + + The Microsoft PST provider will try to open the file specified by the + PR_PST_PATH property, using the password given in the PR_PST_PW_SZ_OLD + property. If it finds a file and it recognizes it as a PST + file, it will start the configuration routine. Otherwise it will start the + creation routine. + + The configuration routine will look for the PR_DISPLAY_NAME_A and + PR_COMMENT_A properties and set them in the message store object. Then it + will look for the PR_PST_REMEMBER_PW property to decide if it should + remember the password in the profile. (If not found then it will defaut to + the current status of the profile password.) Then if it is supposed to + use UI, it will display the configuration property sheet to the user. After + all has succeeded, it will update the profile. + + The creation routine will follow one of two paths to get the PR_PST_PATH + property. If it is supposed to use UI it will always display the file open + dialog to confirm the path passed in or allow the user to change it. If + the user chooses an existing file and it recognizes it as an PST it will + drop back to the configuration routine. If the user chooses an existing + file and it is not recognized as an PST file, the user will be given the + option of choosing another file or creating a new PST in its place, in + which case is will continue with the create routine. If the user chooses + a new file it will continue with the create routine. If the routine is not + allowed to use UI, then the routine will create a file at the given path + even if another file exists there. + + Once it decides to continue with the creation process it will get the + PR_DISPLAY_NAME, PR_COMMENT, PR_PST_ENCRYPTION, and PR_PST_SZ_PW_NEW + properties. If it is supposed to use UI, it will use these to initialize + the creation dialog and get any changes the user want. Then it will create + a new file and update the profile. + + PR_DISPLAY_NAME_A display name for the PST service + PR_COMMENT_A comment to the place on the PST store object + PR_PST_PATH location the store to create or configure + PR_PST_REMEMBER_PW whether or not the remember the password in the profile + PR_PST_ENCRYPTION encryption level at which to create the file + PR_PST_PW_SZ_OLD password of the PST being configured + PR_PST_PW_SZ_NEW password to use for future access to the PST +*/ + +#define PST_EXTERN_PROPID_BASE (0x6700) +#define PR_PST_PATH PROP_TAG(PT_STRING8, PST_EXTERN_PROPID_BASE + 0) +#define PR_PST_REMEMBER_PW PROP_TAG(PT_BOOLEAN, PST_EXTERN_PROPID_BASE + 1) +#define PR_PST_ENCRYPTION PROP_TAG(PT_LONG, PST_EXTERN_PROPID_BASE + 2) +#define PR_PST_PW_SZ_OLD PROP_TAG(PT_STRING8, PST_EXTERN_PROPID_BASE + 3) +#define PR_PST_PW_SZ_NEW PROP_TAG(PT_STRING8, PST_EXTERN_PROPID_BASE + 4) + +#define PSTF_NO_ENCRYPTION ((DWORD)0x80000000) +#define PSTF_COMPRESSABLE_ENCRYPTION ((DWORD)0x40000000) +#define PSTF_BEST_ENCRYPTION ((DWORD)0x20000000) + +/* + * PR_MDB_PROVIDER is the GUID that represent the Microsoft Personal + * Information Store. This guid is available as a property in the stores + * table and on the message store and status objects. + */ +#define MSPST_UID_PROVIDER { 0x4e, 0x49, 0x54, 0x41, \ + 0xf9, 0xbf, 0xb8, 0x01, \ + 0x00, 0xaa, 0x00, 0x37, \ + 0xd9, 0x6e, 0x00, 0x00 } + +#endif /* _MSPST_H_ */ diff --git a/comm/mailnews/mapi/mapiDll/Makefile.in b/comm/mailnews/mapi/mapiDll/Makefile.in new file mode 100644 index 0000000000..b6769e3144 --- /dev/null +++ b/comm/mailnews/mapi/mapiDll/Makefile.in @@ -0,0 +1,6 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +EMBED_MANIFEST_AT = 2 diff --git a/comm/mailnews/mapi/mapiDll/Mapi32.def b/comm/mailnews/mapi/mapiDll/Mapi32.def new file mode 100644 index 0000000000..cc8dcef449 --- /dev/null +++ b/comm/mailnews/mapi/mapiDll/Mapi32.def @@ -0,0 +1,22 @@ +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. + +LIBRARY mozMapi32.dll + +EXPORTS + MAPILogon + MAPILogoff + MAPISendMail + MAPISendDocuments + MAPIFindNext + MAPIReadMail + MAPISaveMail + MAPIDeleteMail + MAPIAddress + MAPIDetails + MAPIResolveName + MAPIFreeBuffer + MAPISendMailW + GetMapiDllVersion + diff --git a/comm/mailnews/mapi/mapiDll/MapiDll.cpp b/comm/mailnews/mapi/mapiDll/MapiDll.cpp new file mode 100644 index 0000000000..027257a111 --- /dev/null +++ b/comm/mailnews/mapi/mapiDll/MapiDll.cpp @@ -0,0 +1,577 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#pragma warning(disable : 4996) // MAPILogoff is deprecated + +#include <windows.h> +#include <mapidefs.h> +#include <mapi.h> +#include "msgMapi.h" + +// Ensure that our COM structs match MS MAPI structs - thoroughly check each +// struct layout This needs that MAPI.h is not used from +// https://www.microsoft.com/en-us/download/details.aspx?id=12905 because the +// newer MAPI.h is the part of Windows SDK, and it includes MapiFileDescW and +// friends. + +static_assert(sizeof(nsMapiFileDesc) == sizeof(MapiFileDesc), "Size mismatch!"); +static_assert(offsetof(nsMapiFileDesc, ulReserved) == + offsetof(MapiFileDesc, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDesc, flFlags) == + offsetof(MapiFileDesc, flFlags), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDesc, nPosition_NotUsed) == + offsetof(MapiFileDesc, nPosition), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDesc, lpszPathName) == + offsetof(MapiFileDesc, lpszPathName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDesc, lpszFileName) == + offsetof(MapiFileDesc, lpszFileName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDesc, lpFileType_NotUsed) == + offsetof(MapiFileDesc, lpFileType), + "Member offset mismatch!"); + +static_assert(sizeof(nsMapiRecipDesc) == sizeof(MapiRecipDesc), + "Size mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, ulReserved) == + offsetof(MapiRecipDesc, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, ulRecipClass) == + offsetof(MapiRecipDesc, ulRecipClass), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, lpszName) == + offsetof(MapiRecipDesc, lpszName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, lpszAddress) == + offsetof(MapiRecipDesc, lpszAddress), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, ulEIDSize_NotUsed) == + offsetof(MapiRecipDesc, ulEIDSize), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDesc, lpEntryID_NotUsed) == + offsetof(MapiRecipDesc, lpEntryID), + "Member offset mismatch!"); + +static_assert(sizeof(nsMapiMessage) == sizeof(MapiMessage), "Size mismatch!"); +static_assert(offsetof(nsMapiMessage, ulReserved) == + offsetof(MapiMessage, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpszSubject) == + offsetof(MapiMessage, lpszSubject), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpszNoteText) == + offsetof(MapiMessage, lpszNoteText), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpszMessageType) == + offsetof(MapiMessage, lpszMessageType), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpszDateReceived) == + offsetof(MapiMessage, lpszDateReceived), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpszConversationID_NotUsed) == + offsetof(MapiMessage, lpszConversationID), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, flFlags) == + offsetof(MapiMessage, flFlags), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpOriginator) == + offsetof(MapiMessage, lpOriginator), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, nRecipCount) == + offsetof(MapiMessage, nRecipCount), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpRecips) == + offsetof(MapiMessage, lpRecips), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, nFileCount) == + offsetof(MapiMessage, nFileCount), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessage, lpFiles) == + offsetof(MapiMessage, lpFiles), + "Member offset mismatch!"); + +static_assert(sizeof(nsMapiFileDescW) == sizeof(MapiFileDescW), + "Size mismatch!"); +static_assert(offsetof(nsMapiFileDescW, ulReserved) == + offsetof(MapiFileDescW, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDescW, flFlags) == + offsetof(MapiFileDescW, flFlags), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDescW, nPosition_NotUsed) == + offsetof(MapiFileDescW, nPosition), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDescW, lpszPathName) == + offsetof(MapiFileDescW, lpszPathName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDescW, lpszFileName) == + offsetof(MapiFileDescW, lpszFileName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiFileDescW, lpFileType_NotUsed) == + offsetof(MapiFileDescW, lpFileType), + "Member offset mismatch!"); + +static_assert(sizeof(nsMapiRecipDescW) == sizeof(MapiRecipDescW), + "Size mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, ulReserved) == + offsetof(MapiRecipDescW, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, ulRecipClass) == + offsetof(MapiRecipDescW, ulRecipClass), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, lpszName) == + offsetof(MapiRecipDescW, lpszName), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, lpszAddress) == + offsetof(MapiRecipDescW, lpszAddress), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, ulEIDSize_NotUsed) == + offsetof(MapiRecipDescW, ulEIDSize), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiRecipDescW, lpEntryID_NotUsed) == + offsetof(MapiRecipDescW, lpEntryID), + "Member offset mismatch!"); + +static_assert(sizeof(nsMapiMessageW) == sizeof(MapiMessageW), "Size mismatch!"); +static_assert(offsetof(nsMapiMessageW, ulReserved) == + offsetof(MapiMessageW, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszSubject) == + offsetof(MapiMessageW, lpszSubject), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, ulReserved) == + offsetof(MapiMessageW, ulReserved), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszSubject) == + offsetof(MapiMessageW, lpszSubject), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszNoteText) == + offsetof(MapiMessageW, lpszNoteText), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszMessageType) == + offsetof(MapiMessageW, lpszMessageType), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszDateReceived) == + offsetof(MapiMessageW, lpszDateReceived), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpszConversationID_NotUsed) == + offsetof(MapiMessageW, lpszConversationID), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, flFlags) == + offsetof(MapiMessageW, flFlags), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpOriginator) == + offsetof(MapiMessageW, lpOriginator), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, nRecipCount) == + offsetof(MapiMessageW, nRecipCount), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpRecips) == + offsetof(MapiMessageW, lpRecips), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, nFileCount) == + offsetof(MapiMessageW, nFileCount), + "Member offset mismatch!"); +static_assert(offsetof(nsMapiMessageW, lpFiles) == + offsetof(MapiMessageW, lpFiles), + "Member offset mismatch!"); + +#define MAX_RECIPS 2000 +#define MAX_FILES 100 + +#define MAX_NAME_LEN 256 +#define MAX_PW_LEN 256 +#define MAX_MSGINFO_LEN 512 +#define MAX_POINTERS 32 + +const CLSID CLSID_CMapiImp = {0x29f458be, + 0x8866, + 0x11d5, + {0xa3, 0xdd, 0x0, 0xb0, 0xd0, 0xf3, 0xba, 0xa7}}; +const IID IID_nsIMapi = {0x6EDCD38E, + 0x8861, + 0x11d5, + {0xA3, 0xDD, 0x00, 0xB0, 0xD0, 0xF3, 0xBA, 0xA7}}; + +DWORD tId = 0; + +#define MAPI_MESSAGE_TYPE 0 +#define MAPI_RECIPIENT_TYPE 1 + +typedef struct { + LPVOID lpMem; + UCHAR memType; +} memTrackerType; + +// this can't be right. +memTrackerType memArray[MAX_POINTERS]; + +// +// For remembering memory...how ironic. +// +void SetPointerArray(LPVOID ptr, BYTE type) { + int i; + + for (i = 0; i < MAX_POINTERS; i++) { + if (memArray[i].lpMem == NULL) { + memArray[i].lpMem = ptr; + memArray[i].memType = type; + break; + } + } +} + +BOOL WINAPI DllMain(HINSTANCE aInstance, DWORD aReason, LPVOID aReserved) { + switch (aReason) { + case DLL_PROCESS_ATTACH: + tId = TlsAlloc(); + if (tId == 0xFFFFFFFF) return FALSE; + break; + + case DLL_PROCESS_DETACH: + TlsFree(tId); + break; + } + return TRUE; +} + +BOOL InitMozillaReference(nsIMapi** aRetValue) { + // Check whether this thread has a valid Interface + // by looking into thread-specific-data variable + + *aRetValue = (nsIMapi*)TlsGetValue(tId); + + // Check whether the pointer actually resolves to + // a valid method call; otherwise mozilla is not running + + if ((*aRetValue) && (*aRetValue)->IsValid() == S_OK) return TRUE; + + HRESULT hRes = ::CoInitialize(NULL); + + hRes = ::CoCreateInstance(CLSID_CMapiImp, NULL, CLSCTX_LOCAL_SERVER, + IID_nsIMapi, (LPVOID*)aRetValue); + + if (hRes == S_OK && (*aRetValue)->Initialize() == S_OK) + if (TlsSetValue(tId, (LPVOID)(*aRetValue))) return TRUE; + + // Either CoCreate or TlsSetValue failed; so return FALSE + + if ((*aRetValue)) (*aRetValue)->Release(); + + ::CoUninitialize(); + return FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// The MAPILogon function begins a Simple MAPI session, loading the default +// message store and address book providers +///////////////////////////////////////////////////////////////////////////// + +ULONG FAR PASCAL MAPILogon(ULONG aUIParam, LPSTR aProfileName, LPSTR aPassword, + FLAGS aFlags, ULONG aReserved, LPLHANDLE aSession) { + HRESULT hr = 0; + ULONG nSessionId = 0; + nsIMapi* pNsMapi = NULL; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + hr = pNsMapi->Login(aUIParam, aProfileName, aPassword, aFlags, &nSessionId); + if (hr == S_OK) + (*aSession) = (LHANDLE)nSessionId; + else + return nSessionId; + + return SUCCESS_SUCCESS; +} + +ULONG FAR PASCAL MAPILogoff(LHANDLE aSession, ULONG aUIParam, FLAGS aFlags, + ULONG aReserved) { + nsIMapi* pNsMapi = (nsIMapi*)TlsGetValue(tId); + if (pNsMapi != NULL) { + if (pNsMapi->Logoff((ULONG)aSession) == S_OK) pNsMapi->Release(); + pNsMapi = NULL; + } + + TlsSetValue(tId, NULL); + + ::CoUninitialize(); + + return SUCCESS_SUCCESS; +} + +ULONG FAR PASCAL MAPISendMail(LHANDLE lhSession, ULONG ulUIParam, + nsMapiMessage* lpMessage, FLAGS flFlags, + ULONG ulReserved) { + HRESULT hr = 0; + BOOL bTempSession = FALSE; + nsIMapi* pNsMapi = NULL; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + if (lpMessage->nRecipCount > MAX_RECIPS) return MAPI_E_TOO_MANY_RECIPIENTS; + + if (lpMessage->nFileCount > MAX_FILES) return MAPI_E_TOO_MANY_FILES; + + if ((!(flFlags & MAPI_DIALOG)) && (lpMessage->lpRecips == NULL)) + return MAPI_E_UNKNOWN_RECIPIENT; + + if (!lhSession || pNsMapi->IsValidSession(lhSession) != S_OK) { + FLAGS LoginFlag = flFlags & (MAPI_LOGON_UI | MAPI_NEW_SESSION); + hr = MAPILogon(ulUIParam, nullptr, nullptr, LoginFlag, 0, &lhSession); + if (hr != SUCCESS_SUCCESS) return MAPI_E_LOGIN_FAILURE; + bTempSession = TRUE; + } + + hr = pNsMapi->SendMail(lhSession, lpMessage, flFlags, ulReserved); + + // we are seeing a problem when using Word, although we return success from + // the MAPI support MS COM interface in mozilla, we are getting this error + // here. This is a temporary hack !! + if (hr == (HRESULT)0x800703e6) hr = SUCCESS_SUCCESS; + + if (bTempSession) MAPILogoff(lhSession, ulUIParam, 0, 0); + + return hr; +} + +ULONG FAR PASCAL MAPISendMailW(LHANDLE lhSession, ULONG ulUIParam, + nsMapiMessageW* lpMessage, FLAGS flFlags, + ULONG ulReserved) { + HRESULT hr = 0; + BOOL bTempSession = FALSE; + nsIMapi* pNsMapi = nullptr; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + if (lpMessage->nRecipCount > MAX_RECIPS) return MAPI_E_TOO_MANY_RECIPIENTS; + + if (lpMessage->nFileCount > MAX_FILES) return MAPI_E_TOO_MANY_FILES; + + if ((!(flFlags & MAPI_DIALOG)) && (lpMessage->lpRecips == nullptr)) + return MAPI_E_UNKNOWN_RECIPIENT; + + if (!lhSession || pNsMapi->IsValidSession(lhSession) != S_OK) { + FLAGS LoginFlag = flFlags & (MAPI_LOGON_UI | MAPI_NEW_SESSION); + hr = MAPILogon(ulUIParam, nullptr, nullptr, LoginFlag, 0, &lhSession); + if (hr != SUCCESS_SUCCESS) return MAPI_E_LOGIN_FAILURE; + bTempSession = TRUE; + } + + hr = pNsMapi->SendMailW(lhSession, lpMessage, flFlags, ulReserved); + + // we are seeing a problem when using Word, although we return success from + // the MAPI support MS COM interface in mozilla, we are getting this error + // here. This is a temporary hack !! + if (hr == (HRESULT)0x800703e6) hr = SUCCESS_SUCCESS; + + if (bTempSession) MAPILogoff(lhSession, ulUIParam, 0, 0); + + return hr; +} + +ULONG FAR PASCAL MAPISendDocuments(ULONG ulUIParam, LPSTR lpszDelimChar, + LPSTR lpszFilePaths, LPSTR lpszFileNames, + ULONG ulReserved) { + LHANDLE lhSession; + nsIMapi* pNsMapi = NULL; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + unsigned long result = + MAPILogon(ulUIParam, nullptr, nullptr, MAPI_LOGON_UI, 0, &lhSession); + if (result != SUCCESS_SUCCESS) return MAPI_E_LOGIN_FAILURE; + + HRESULT hr; + + hr = pNsMapi->SendDocuments(lhSession, lpszDelimChar, lpszFilePaths, + lpszFileNames, ulReserved); + + MAPILogoff(lhSession, ulUIParam, 0, 0); + + return hr; +} + +ULONG FAR PASCAL MAPIFindNext(LHANDLE lhSession, ULONG ulUIParam, + const LPSTR lpszMessageType, + const LPSTR lpszSeedMessageID, FLAGS flFlags, + ULONG ulReserved, + unsigned char lpszMessageID[64]) { + nsIMapi* pNsMapi = NULL; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + if (lhSession == 0) return MAPI_E_INVALID_SESSION; + + return pNsMapi->FindNext(lhSession, ulUIParam, lpszMessageType, + lpszSeedMessageID, flFlags, ulReserved, + lpszMessageID); +} + +ULONG FAR PASCAL MAPIReadMail(LHANDLE lhSession, ULONG ulUIParam, + LPSTR lpszMessageID, FLAGS flFlags, + ULONG ulReserved, nsMapiMessage** lppMessage) { + nsIMapi* pNsMapi = NULL; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + if (lhSession == 0) return MAPI_E_INVALID_SESSION; + + return pNsMapi->ReadMail(lhSession, ulUIParam, lpszMessageID, flFlags, + ulReserved, lppMessage); +} + +ULONG FAR PASCAL MAPISaveMail(LHANDLE lhSession, ULONG ulUIParam, + lpnsMapiMessage lpMessage, FLAGS flFlags, + ULONG ulReserved, LPSTR lpszMessageID) { + nsIMapi* pNsMapi = NULL; + + if (lhSession == 0) return MAPI_E_INVALID_SESSION; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + return MAPI_E_FAILURE; +} + +ULONG FAR PASCAL MAPIDeleteMail(LHANDLE lhSession, ULONG ulUIParam, + LPSTR lpszMessageID, FLAGS flFlags, + ULONG ulReserved) { + nsIMapi* pNsMapi = NULL; + + if (lhSession == 0) return MAPI_E_INVALID_SESSION; + + if (!InitMozillaReference(&pNsMapi)) return MAPI_E_FAILURE; + + return pNsMapi->DeleteMail(lhSession, ulUIParam, lpszMessageID, flFlags, + ulReserved); +} + +ULONG FAR PASCAL MAPIAddress(LHANDLE lhSession, ULONG ulUIParam, + LPSTR lpszCaption, ULONG nEditFields, + LPSTR lpszLabels, ULONG nRecips, + lpMapiRecipDesc lpRecips, FLAGS flFlags, + ULONG ulReserved, LPULONG lpnNewRecips, + lpMapiRecipDesc FAR* lppNewRecips) { + return MAPI_E_NOT_SUPPORTED; +} + +ULONG FAR PASCAL MAPIDetails(LHANDLE lhSession, ULONG ulUIParam, + lpMapiRecipDesc lpRecip, FLAGS flFlags, + ULONG ulReserved) { + return MAPI_E_NOT_SUPPORTED; +} + +ULONG FAR PASCAL MAPIResolveName(LHANDLE lhSession, ULONG ulUIParam, + LPSTR lpszName, FLAGS flFlags, + ULONG ulReserved, + lpMapiRecipDesc FAR* lppRecip) { + char* lpszRecipName = new char[(strlen((const char*)lpszName) + 1)]; + if (lpszRecipName == NULL) return MAPI_E_INSUFFICIENT_MEMORY; + char* lpszRecipAddress = new char[(strlen((const char*)lpszName) + 6)]; + if (!lpszRecipAddress) { + delete[] lpszRecipName; + return MAPI_E_INSUFFICIENT_MEMORY; + } + strcpy(lpszRecipName, (const char*)lpszName); + strcpy(lpszRecipAddress, (const char*)lpszName); + (*lppRecip) = (lpMapiRecipDesc FAR)malloc(sizeof(MapiRecipDesc)); + if (!(*lppRecip)) { + delete[] lpszRecipName; + delete[] lpszRecipAddress; + return MAPI_E_INSUFFICIENT_MEMORY; + } + (*lppRecip)->ulRecipClass = 1; + (*lppRecip)->lpszName = lpszRecipName; + (*lppRecip)->lpszAddress = lpszRecipAddress; + (*lppRecip)->ulEIDSize = 0; + (*lppRecip)->lpEntryID = 0; + return SUCCESS_SUCCESS; +} + +void FreeMAPIRecipient(lpMapiRecipDesc pv); +void FreeMAPIMessage(lpMapiMessage pv); + +ULONG FAR PASCAL MAPIFreeBuffer(LPVOID pv) { + int i; + + if (!pv) return S_OK; + + for (i = 0; i < MAX_POINTERS; i++) { + if (pv == memArray[i].lpMem) { + if (memArray[i].memType == MAPI_MESSAGE_TYPE) { + FreeMAPIMessage((MapiMessage*)pv); + memArray[i].lpMem = NULL; + } else if (memArray[i].memType == MAPI_RECIPIENT_TYPE) { + FreeMAPIRecipient((MapiRecipDesc*)pv); + memArray[i].lpMem = NULL; + } + } + } + + pv = NULL; + return S_OK; +} + +ULONG FAR PASCAL GetMapiDllVersion() { return 94; } + +void FreeMAPIFile(lpMapiFileDesc pv) { + if (!pv) return; + + if (pv->lpszPathName != NULL) free(pv->lpszPathName); + + if (pv->lpszFileName != NULL) free(pv->lpszFileName); +} + +void FreeMAPIMessage(lpMapiMessage pv) { + ULONG i; + + if (!pv) return; + + if (pv->lpszSubject != NULL) free(pv->lpszSubject); + + if (pv->lpszNoteText) free(pv->lpszNoteText); + + if (pv->lpszMessageType) free(pv->lpszMessageType); + + if (pv->lpszDateReceived) free(pv->lpszDateReceived); + + if (pv->lpszConversationID) free(pv->lpszConversationID); + + if (pv->lpOriginator) FreeMAPIRecipient(pv->lpOriginator); + + for (i = 0; i < pv->nRecipCount; i++) { + if (&(pv->lpRecips[i]) != NULL) { + FreeMAPIRecipient(&(pv->lpRecips[i])); + } + } + + if (pv->lpRecips != NULL) { + free(pv->lpRecips); + } + + for (i = 0; i < pv->nFileCount; i++) { + if (&(pv->lpFiles[i]) != NULL) { + FreeMAPIFile(&(pv->lpFiles[i])); + } + } + + if (pv->lpFiles != NULL) { + free(pv->lpFiles); + } + + free(pv); + pv = NULL; +} + +void FreeMAPIRecipient(lpMapiRecipDesc pv) { + if (!pv) return; + + if (pv->lpszName != NULL) free(pv->lpszName); + + if (pv->lpszAddress != NULL) free(pv->lpszAddress); + + if (pv->lpEntryID != NULL) free(pv->lpEntryID); +} diff --git a/comm/mailnews/mapi/mapiDll/module.ver b/comm/mailnews/mapi/mapiDll/module.ver new file mode 100644 index 0000000000..d62b9e99cb --- /dev/null +++ b/comm/mailnews/mapi/mapiDll/module.ver @@ -0,0 +1,7 @@ +WIN32_MODULE_FILEVERSION=0,8,0,0 +WIN32_MODULE_FILEVERSION_STRING=0.8 +WIN32_MODULE_COPYRIGHT=©Thunderbird and Mozilla Developers, according to the MPL 1.1/GPL 2.0/LGPL 2.1 licenses, as applicable. +WIN32_MODULE_COMPANYNAME=Mozilla.org +WIN32_MODULE_TRADEMARKS=Mozilla +WIN32_MODULE_COMMENT=Mozilla Thunderbird MAPI Dll + diff --git a/comm/mailnews/mapi/mapiDll/moz.build b/comm/mailnews/mapi/mapiDll/moz.build new file mode 100644 index 0000000000..a013feffec --- /dev/null +++ b/comm/mailnews/mapi/mapiDll/moz.build @@ -0,0 +1,24 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Statically link against the CRT, so that we don't go hunting around for it +# and not find it when we're loaded into explorer.exe or similar +SharedLibrary("mozMapi32") +USE_STATIC_LIBS = True + +LOCAL_INCLUDES += ["../include"] + +SOURCES += [ + "MapiDll.cpp", +] + +OS_LIBS += [ + "ole32", +] + +DEFINES["UNICODE"] = True +DEFINES["_UNICODE"] = True + +DEFFILE = "Mapi32.def" diff --git a/comm/mailnews/mapi/mapihook/build/MapiProxy.def b/comm/mailnews/mapi/mapihook/build/MapiProxy.def new file mode 100644 index 0000000000..4da08eb7d3 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/build/MapiProxy.def @@ -0,0 +1,13 @@ +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. + +LIBRARY MapiProxy.dll + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + GetProxyDllInfo PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + diff --git a/comm/mailnews/mapi/mapihook/build/module.ver b/comm/mailnews/mapi/mapihook/build/module.ver new file mode 100644 index 0000000000..7691020c26 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/build/module.ver @@ -0,0 +1,6 @@ +WIN32_MODULE_FILEVERSION=0,8,0,0 +WIN32_MODULE_FILEVERSION_STRING=0.8 +WIN32_MODULE_COPYRIGHT=©Thunderbird and Mozilla Developers, according to the MPL 1.1/GPL 2.0/LGPL 2.1 licenses, as applicable. +WIN32_MODULE_COMPANYNAME=Mozilla.org +WIN32_MODULE_TRADEMARKS=Mozilla +WIN32_MODULE_COMMENT=Mozilla Thunderbird Thunderbird MAPI Proxy Dll diff --git a/comm/mailnews/mapi/mapihook/build/moz.build b/comm/mailnews/mapi/mapihook/build/moz.build new file mode 100644 index 0000000000..9832a5cb05 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/build/moz.build @@ -0,0 +1,56 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +SharedLibrary("MapiProxy") + +OS_LIBS += [ + "rpcrt4", +] + +LOCAL_INCLUDES += ["/comm/mailnews/mapi/include"] + +SOURCES += ["!dlldata.c", "!msgMapi_i.c", "!msgMapi_p.c"] + +GeneratedFile( + "dlldata.c", + "msgMapi.h", + "msgMapi_i.c", + "msgMapi_p.c", + inputs=["msgMapi.idl"], + script="/build/midl.py", + entry_point="midl", + flags=[ + "-I", + SRCDIR, + "-I", + TOPSRCDIR + "/comm/mailnews/mapi/include", + ], +) + +EXPORTS += [ + "!msgMapi.h", + "!msgMapi_i.c", +] + +for var in ("REGISTER_PROXY_DLL", "UNICODE", "_UNICODE"): + DEFINES[var] = True + +DEFFILE = "MapiProxy.def" + +# The Windows MIDL code generator creates things like: +# +# #endif !_MIDL_USE_GUIDDEF_ +# +# which clang-cl complains about. MSVC doesn't, so turn this warning off. +if CONFIG["CC_TYPE"] == "clang-cl": + CFLAGS += ["-Wno-extra-tokens"] + +# clang-cl complains about these in generated code: +if CONFIG["CC_TYPE"] == "clang-cl": + CFLAGS += [ + "-Wno-extern-initializer", + "-Wno-missing-braces", + "-Wno-unused-const-variable", + ] diff --git a/comm/mailnews/mapi/mapihook/build/msgMapi.idl b/comm/mailnews/mapi/mapihook/build/msgMapi.idl new file mode 100644 index 0000000000..e2738ae8e1 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/build/msgMapi.idl @@ -0,0 +1,125 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// This idl will be compiled by MIDL. MS-COM is used +// as bridge between MAPI clients and the Mozilla. + +import "unknwn.idl"; + +typedef struct +{ + unsigned long ulReserved; + unsigned long flFlags; /* Flags */ + unsigned long nPosition_NotUsed; /* character in text to be replaced by attachment */ + LPSTR lpszPathName; /* Full path name including file name */ + LPSTR lpszFileName; /* Real (original) file name */ + unsigned char * lpFileType_NotUsed ; +} nsMapiFileDesc, * lpnsMapiFileDesc; + + +typedef struct +{ + unsigned long ulReserved; + unsigned long ulRecipClass; /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */ + LPSTR lpszName; /* Recipient name to display */ + LPSTR lpszAddress; /* Recipient email address */ + unsigned long ulEIDSize_NotUsed; + unsigned char * lpEntryID_NotUsed ; +} nsMapiRecipDesc, * lpnsMapiRecipDesc; + +typedef struct +{ + unsigned long ulReserved; + LPSTR lpszSubject; /* Message Subject */ + LPSTR lpszNoteText; /* Message Text */ + LPSTR lpszMessageType; + LPSTR lpszDateReceived; /* in YYYY/MM/DD HH:MM format */ + LPSTR lpszConversationID_NotUsed; /* conversation thread ID */ + unsigned long flFlags; /* unread,return receipt */ + lpnsMapiRecipDesc lpOriginator; /* Originator descriptor */ + unsigned long nRecipCount; /* Number of recipients */ + [size_is (nRecipCount)] lpnsMapiRecipDesc lpRecips; /* Recipient descriptors */ + unsigned long nFileCount; /* # of file attachments */ + [size_is (nFileCount)] lpnsMapiFileDesc lpFiles; /* Attachment descriptors */ +} nsMapiMessage, * lpnsMapiMessage; + +typedef struct +{ + unsigned long ulReserved; + unsigned long flFlags; /* Flags */ + unsigned long nPosition_NotUsed; /* character in text to be replaced by attachment */ + LPWSTR lpszPathName; /* Full path name including file name */ + LPWSTR lpszFileName; /* Real (original) file name */ + unsigned char* lpFileType_NotUsed; +} nsMapiFileDescW, *lpnsMapiFileDescW; + +typedef struct +{ + unsigned long ulReserved; + unsigned long ulRecipClass; /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */ + LPWSTR lpszName; /* Recipient name to display */ + LPWSTR lpszAddress; /* Recipient email address */ + unsigned long ulEIDSize_NotUsed; + unsigned char* lpEntryID_NotUsed; +} nsMapiRecipDescW, *lpnsMapiRecipDescW; + +typedef struct +{ + unsigned long ulReserved; + LPWSTR lpszSubject; /* Message Subject */ + LPWSTR lpszNoteText; /* Message Text */ + LPWSTR lpszMessageType; + LPWSTR lpszDateReceived; /* in YYYY/MM/DD HH:MM format */ + LPWSTR lpszConversationID_NotUsed; /* conversation thread ID */ + unsigned long flFlags; /* unread,return receipt */ + lpnsMapiRecipDescW lpOriginator; /* Originator descriptor */ + unsigned long nRecipCount; /* Number of recipients */ + [size_is (nRecipCount)] lpnsMapiRecipDescW lpRecips; /* Recipient descriptors */ + unsigned long nFileCount; /* # of file attachments */ + [size_is (nFileCount)] lpnsMapiFileDescW lpFiles; /* Attachment descriptors */ +} nsMapiMessageW, *lpnsMapiMessageW; + +[ + object, + uuid(6EDCD38E-8861-11d5-A3DD-00B0D0F3BAA7), + helpstring("nsIMapi Interface"), + pointer_default(unique) +] + +interface nsIMapi : IUnknown +{ + HRESULT Login([in] unsigned long aUIArg, [in, unique, max_is(256)] LPSTR aLogin, + [in, unique, max_is(256)] LPSTR aPassWord, [in] unsigned long aFlags, + [out] unsigned long *aSessionId); + + HRESULT Initialize(); + HRESULT IsValid(); + HRESULT IsValidSession([in] unsigned long aSession); + + HRESULT SendMail([in] unsigned long aSession, [in, unique] lpnsMapiMessage aMessage, + [in] unsigned long aFlags, [in] unsigned long aReserved) ; + + HRESULT SendDocuments([in] unsigned long aSession, + [in, unique] LPSTR aDelimChar, [in, unique] LPSTR aFilePaths, + [in, unique] LPSTR aFileNames, [in] ULONG aFlags); + + HRESULT FindNext([in] unsigned long aSession, [in] ULONG ulUIParam, [in, unique] const LPSTR lpszMessageType, + [in, unique] const LPSTR lpszSeedMessageID, [in] ULONG flFlags, [in] ULONG ulReserved, + [in] [out] char lpszMessageID[64] ) ; + + HRESULT ReadMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] LPSTR lpszMessageID, + [in] ULONG flFlags, [in] ULONG ulReserved, [out] lpnsMapiMessage *lppMessage); + + HRESULT DeleteMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] LPSTR lpszMessageID, + [in] ULONG flFlags, [in] ULONG ulReserved); + + HRESULT SaveMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] lpnsMapiMessage lppMessage, + [in] ULONG flFlags, [in] ULONG ulReserved, [in, unique] LPSTR lpszMessageID); + + HRESULT SendMailW([in] unsigned long aSession, [in, unique] lpnsMapiMessageW aMessage, + [in] unsigned long aFlags, [in] unsigned long aReserved); + + HRESULT Logoff(unsigned long aSession); + HRESULT CleanUp(); +}; diff --git a/comm/mailnews/mapi/mapihook/moz.build b/comm/mailnews/mapi/mapihook/moz.build new file mode 100644 index 0000000000..2160ce3345 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/moz.build @@ -0,0 +1,10 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DIRS += [ + "public", + "build", + "src", +] diff --git a/comm/mailnews/mapi/mapihook/public/moz.build b/comm/mailnews/mapi/mapihook/public/moz.build new file mode 100644 index 0000000000..12f8019242 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/public/moz.build @@ -0,0 +1,10 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + "nsIMapiSupport.idl", +] + +XPIDL_MODULE = "mapihook" diff --git a/comm/mailnews/mapi/mapihook/public/nsIMapiSupport.idl b/comm/mailnews/mapi/mapihook/public/nsIMapiSupport.idl new file mode 100644 index 0000000000..39a947ae7a --- /dev/null +++ b/comm/mailnews/mapi/mapihook/public/nsIMapiSupport.idl @@ -0,0 +1,42 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/** + * This interface provides support for registering Mozilla as a COM component + * for extending the use of Mail/News through Simple MAPI. + * + */ + +[uuid(2907B676-C4BD-49af-880A-E27A0616291E)] +interface nsIMapiSupport : nsISupports { + + /** Initiates MAPI support + */ + + void initializeMAPISupport(); + + /** Shuts down the MAPI support + */ + + void shutdownMAPISupport(); + + /** registerServer - register the mapi DLL with the desktop + * Typically called by the window shell service when we are + * made the default mail app + */ + void registerServer(); + + /** unRegisterServer - unregister the mapi DLL with the desktop + * Typically called by the window shell service when we are + * removed as the default mail app. + */ + void unRegisterServer(); +}; + +%{C++ +#define NS_IMAPISUPPORT_CONTRACTID "@mozilla.org/mapisupport;1" +#define NS_IMAPISUPPORT_CLASSNAME "Mozilla MAPI Support" +%} diff --git a/comm/mailnews/mapi/mapihook/src/Registry.cpp b/comm/mailnews/mapi/mapihook/src/Registry.cpp new file mode 100644 index 0000000000..bf57e31e57 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/Registry.cpp @@ -0,0 +1,249 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#undef _UNICODE +#undef UNICODE + +#include <objbase.h> +#include "nsString.h" +#include "Registry.h" + +#define MAPI_PROXY_DLL_NAME u"MapiProxy.dll" +#define MAPI_STARTUP_ARG L" /MAPIStartUp" +#define MAX_SIZE 2048 + +// Size of a CLSID as a string +const int CLSID_STRING_SIZE = 39; + +// Proxy/Stub Dll Routines + +typedef HRESULT(__stdcall ProxyServer)(); + +// Convert a CLSID to a WCHAR string. + +BOOL CLSIDtoWchar(const CLSID& clsid, WCHAR* szCLSID) { + // Get CLSID + HRESULT hr = StringFromCLSID(clsid, &szCLSID); + if (FAILED(hr)) return FALSE; + return TRUE; +} + +// Create a key and set its value. + +BOOL setKeyAndValue(nsAutoString keyName, const WCHAR* subKey, + const WCHAR* theValue) { + HKEY hKey; + BOOL retValue = TRUE; + + nsAutoString theKey(keyName); + if (subKey != NULL) { + theKey += L"\\"; + theKey += subKey; + } + + // Create and open key and subkey. + long lResult = RegCreateKeyExW(HKEY_CLASSES_ROOT, theKey.get(), 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, + &hKey, NULL); + if (lResult != ERROR_SUCCESS) return FALSE; + + // Set the Value. + if (theValue != NULL) { + lResult = RegSetValueExW(hKey, NULL, 0, REG_SZ, (BYTE*)theValue, + wcslen(theValue) + 1); + if (lResult != ERROR_SUCCESS) retValue = FALSE; + } + + RegCloseKey(hKey); + return retValue; +} + +// Delete a key and all of its descendents. + +LONG recursiveDeleteKey(HKEY hKeyParent, // Parent of key to delete + const WCHAR* lpszKeyChild) // Key to delete +{ + // Open the child. + HKEY hKeyChild; + LONG lRes = + RegOpenKeyExW(hKeyParent, lpszKeyChild, 0, KEY_ALL_ACCESS, &hKeyChild); + if (lRes != ERROR_SUCCESS) { + return lRes; + } + + // Enumerate all of the descendants of this child. + FILETIME time; + WCHAR szBuffer[MAX_SIZE]; + DWORD dwSize = MAX_SIZE; + while (RegEnumKeyExW(hKeyChild, 0, szBuffer, &dwSize, NULL, NULL, NULL, + &time) == S_OK) { + // Delete the descendants of this child. + lRes = recursiveDeleteKey(hKeyChild, szBuffer); + if (lRes != ERROR_SUCCESS) { + // Cleanup before exiting. + RegCloseKey(hKeyChild); + return lRes; + } + dwSize = MAX_SIZE; + } + + // Close the child. + RegCloseKey(hKeyChild); + + // Delete this child. + return RegDeleteKeyW(hKeyParent, lpszKeyChild); +} + +void RegisterProxy() { + HINSTANCE h = NULL; + ProxyServer* RegisterFunc = NULL; + + WCHAR szModule[MAX_SIZE]; + WCHAR* pTemp = NULL; + + HMODULE hModule = GetModuleHandleW(NULL); + DWORD dwResult = + ::GetModuleFileNameW(hModule, szModule, sizeof(szModule) / sizeof(WCHAR)); + if (dwResult == 0) return; + + pTemp = wcsrchr(szModule, L'\\'); + if (pTemp == NULL) return; + + *pTemp = '\0'; + nsAutoString proxyPath(szModule); + + proxyPath += u"\\"; + proxyPath += MAPI_PROXY_DLL_NAME; + + h = LoadLibraryW(proxyPath.get()); + if (h == NULL) return; + + RegisterFunc = (ProxyServer*)GetProcAddress(h, "DllRegisterServer"); + if (RegisterFunc) RegisterFunc(); + + FreeLibrary(h); +} + +void UnRegisterProxy() { + HINSTANCE h = NULL; + ProxyServer* UnRegisterFunc = NULL; + + WCHAR szModule[MAX_SIZE]; + WCHAR* pTemp = NULL; + + HMODULE hModule = GetModuleHandleW(NULL); + DWORD dwResult = + ::GetModuleFileNameW(hModule, szModule, sizeof(szModule) / sizeof(WCHAR)); + if (dwResult == 0) return; + + pTemp = wcsrchr(szModule, L'\\'); + if (pTemp == NULL) return; + + *pTemp = '\0'; + nsAutoString proxyPath(szModule); + + proxyPath += u"\\"; + proxyPath += MAPI_PROXY_DLL_NAME; + + h = LoadLibraryW(proxyPath.get()); + if (h == NULL) return; + + UnRegisterFunc = (ProxyServer*)GetProcAddress(h, "DllUnregisterServer"); + if (UnRegisterFunc) UnRegisterFunc(); + + FreeLibrary(h); +} + +// Register the component in the registry. + +HRESULT RegisterServer(const CLSID& clsid, // Class ID + const WCHAR* szFriendlyName, // Friendly Name + const WCHAR* szVerIndProgID, // Programmatic + const WCHAR* szProgID) // IDs +{ + HMODULE hModule = GetModuleHandleW(NULL); + WCHAR szModuleName[MAX_SIZE]; + WCHAR szCLSID[CLSID_STRING_SIZE]; + + nsAutoString independentProgId(szVerIndProgID); + nsAutoString progId(szProgID); + + DWORD dwResult = ::GetModuleFileNameW(hModule, szModuleName, + sizeof(szModuleName) / sizeof(WCHAR)); + + if (dwResult == 0) return S_FALSE; + + nsAutoString moduleName(szModuleName); + nsAutoString registryKey(L"CLSID\\"); + + moduleName += MAPI_STARTUP_ARG; + + // Convert the CLSID into a WCHAR. + if (!CLSIDtoWchar(clsid, szCLSID)) return S_FALSE; + registryKey += szCLSID; + + // Add the CLSID to the registry. + if (!setKeyAndValue(registryKey, NULL, szFriendlyName)) return S_FALSE; + + if (!setKeyAndValue(registryKey, L"LocalServer32", moduleName.get())) + return S_FALSE; + + // Add the ProgID subkey under the CLSID key. + if (!setKeyAndValue(registryKey, L"ProgID", szProgID)) return S_FALSE; + + // Add the version-independent ProgID subkey under CLSID key. + if (!setKeyAndValue(registryKey, L"VersionIndependentProgID", szVerIndProgID)) + return S_FALSE; + + // Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT. + if (!setKeyAndValue(independentProgId, NULL, szFriendlyName)) return S_FALSE; + if (!setKeyAndValue(independentProgId, L"CLSID", szCLSID)) return S_FALSE; + if (!setKeyAndValue(independentProgId, L"CurVer", szProgID)) return S_FALSE; + + // Add the versioned ProgID subkey under HKEY_CLASSES_ROOT. + if (!setKeyAndValue(progId, NULL, szFriendlyName)) return S_FALSE; + if (!setKeyAndValue(progId, L"CLSID", szCLSID)) return S_FALSE; + + RegisterProxy(); + + return S_OK; +} + +LONG UnregisterServer(const CLSID& clsid, // Class ID + const WCHAR* szVerIndProgID, // Programmatic + const WCHAR* szProgID) // IDs +{ + LONG lResult = S_OK; + + // Convert the CLSID into a char. + + WCHAR szCLSID[CLSID_STRING_SIZE]; + if (!CLSIDtoWchar(clsid, szCLSID)) return S_FALSE; + + UnRegisterProxy(); + + nsAutoString registryKey(L"CLSID\\"); + registryKey += szCLSID; + + lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get()); + if (lResult == ERROR_SUCCESS || lResult == ERROR_FILE_NOT_FOUND) + return lResult; + + registryKey += L"\\LocalServer32"; + + // Delete only the path for this server. + + lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get()); + if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND) + return lResult; + + // Delete the version-independent ProgID Key. + lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szVerIndProgID); + if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND) + return lResult; + + lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szProgID); + + return lResult; +} diff --git a/comm/mailnews/mapi/mapihook/src/Registry.h b/comm/mailnews/mapi/mapihook/src/Registry.h new file mode 100644 index 0000000000..7207694e55 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/Registry.h @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef _REGISTRY_H_ +#define _REGISTRY_H_ + +#include <objbase.h> + +// This function will register a component in the Registry. + +HRESULT RegisterServer(const CLSID& clsid, const WCHAR* szFriendlyName, + const WCHAR* szVerIndProgID, const WCHAR* szProgID); + +// This function will unregister a component. + +HRESULT UnregisterServer(const CLSID& clsid, const WCHAR* szVerIndProgID, + const WCHAR* szProgID); + +#endif diff --git a/comm/mailnews/mapi/mapihook/src/components.conf b/comm/mailnews/mapi/mapihook/src/components.conf new file mode 100644 index 0000000000..d69a1df0d5 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/components.conf @@ -0,0 +1,18 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + "cid": "{8967fed2-c8bb-11d5-a3e9-00b0d0f3baa7}", + "contract_ids": ["@mozilla.org/mapisupport;1"], + "type": "nsMapiSupport", + "headers": ["/comm/mailnews/mapi/mapihook/src/msgMapiSupport.h"], + } +] + +Categories = { + "app-startup": { + "Mapi Support": "@mozilla.org/mapisupport;1", + } +} diff --git a/comm/mailnews/mapi/mapihook/src/moz.build b/comm/mailnews/mapi/mapihook/src/moz.build new file mode 100644 index 0000000000..f2ef529008 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/moz.build @@ -0,0 +1,33 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +SOURCES += [ + "!../build/msgMapi_i.c", + "msgMapiFactory.cpp", + "msgMapiHook.cpp", + "msgMapiImp.cpp", + "msgMapiMain.cpp", + "msgMapiSupport.cpp", + "Registry.cpp", +] + +LOCAL_INCLUDES += ["/comm/mailnews/mapi/include"] + +FINAL_LIBRARY = "xul" + +OS_LIBS += [ + "ole32", +] + +DEFINES["UNICODE"] = True +DEFINES["_UNICODE"] = True + +# clang-cl rightly complains about switch on nsresult. +if CONFIG["CC_TYPE"] == "clang-cl": + CXXFLAGS += ["-Wno-switch"] + +XPCOM_MANIFESTS += [ + "components.conf", +] diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiFactory.cpp b/comm/mailnews/mapi/mapihook/src/msgMapiFactory.cpp new file mode 100644 index 0000000000..cb99fc04fd --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiFactory.cpp @@ -0,0 +1,64 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#undef UNICODE +#undef _UNICODE + +#include "msgMapiFactory.h" +#include "msgMapiImp.h" +#include "msgMapi.h" + +CMapiFactory ::CMapiFactory() : m_cRef(1) {} + +CMapiFactory::~CMapiFactory() {} + +STDMETHODIMP CMapiFactory::QueryInterface(const IID& aIid, void** aPpv) { + if ((aIid == IID_IUnknown) || (aIid == IID_IClassFactory)) { + *aPpv = static_cast<IClassFactory*>(this); + } else { + *aPpv = nullptr; + return E_NOINTERFACE; + } + reinterpret_cast<IUnknown*>(*aPpv)->AddRef(); + return S_OK; +} + +STDMETHODIMP_(ULONG) CMapiFactory::AddRef() { return ++m_cRef; } + +STDMETHODIMP_(ULONG) CMapiFactory::Release() { + int32_t temp = --m_cRef; + if (m_cRef == 0) { + delete this; + return 0; + } + + return temp; +} + +STDMETHODIMP CMapiFactory::CreateInstance(IUnknown* aUnknownOuter, + const IID& aIid, void** aPpv) { + // Cannot aggregate. + + if (aUnknownOuter != nullptr) { + return CLASS_E_NOAGGREGATION; + } + + // Create component. + + CMapiImp* pImp = new CMapiImp(); + if (pImp == nullptr) { + return E_OUTOFMEMORY; + } + + // Get the requested interface. + HRESULT hr = pImp->QueryInterface(aIid, aPpv); + + // Release the IUnknown pointer. + // (If QueryInterface failed, component will delete itself.) + + pImp->Release(); + return hr; +} + +STDMETHODIMP CMapiFactory::LockServer(BOOL aLock) { return S_OK; } diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiFactory.h b/comm/mailnews/mapi/mapihook/src/msgMapiFactory.h new file mode 100644 index 0000000000..3970b3fa99 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiFactory.h @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MSG_MAPI_FACTORY_H +#define MSG_MAPI_FACTORY_H + +#include <windows.h> +#include <objbase.h> +#include "nspr.h" +#include "nsISupportsImpl.h" // ThreadSafeAutoRefCnt +#include <stdint.h> + +class CMapiFactory : public IClassFactory { + public: + // IUnknown + + STDMETHODIMP QueryInterface(REFIID aIid, void** aPpv); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + + // IClassFactory + + STDMETHODIMP CreateInstance(LPUNKNOWN aUnkOuter, REFIID aIid, void** aPpv); + STDMETHODIMP LockServer(BOOL aLock); + + CMapiFactory(); + + private: + mozilla::ThreadSafeAutoRefCnt m_cRef; + + virtual ~CMapiFactory(); +}; + +#endif // MSG_MAPI_FACTORY_H diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiHook.cpp b/comm/mailnews/mapi/mapihook/src/msgMapiHook.cpp new file mode 100644 index 0000000000..eb8c9b9fe8 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiHook.cpp @@ -0,0 +1,934 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#define MAPI_STARTUP_ARG "/MAPIStartUp" + +#include <mapidefs.h> +#include <mapi.h> +#include <direct.h> +#include "nsCOMPtr.h" +#include "nsISupports.h" +#include "nsIPromptService.h" +#include "nsIAppShellService.h" +#include "mozIDOMWindow.h" +#include "nsIMsgAccountManager.h" +#include "nsIStringBundle.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" +#include "nsString.h" +#include "nsUnicharUtils.h" +#include "nsNativeCharsetUtils.h" +#include "nsIMsgAttachment.h" +#include "nsIMsgCompFields.h" +#include "nsIMsgComposeParams.h" +#include "nsIMsgCompose.h" +#include "nsIMsgSend.h" +#include "nsIMsgComposeService.h" +#include "nsDirectoryServiceDefs.h" +#include "nsDirectoryServiceUtils.h" +#include "msgMapi.h" +#include "msgMapiHook.h" +#include "msgMapiSupport.h" +#include "msgMapiMain.h" +#include "nsThreadUtils.h" +#include "nsMsgUtils.h" +#include "nsNetUtil.h" +#include "mozilla/dom/Promise.h" +#include "mozilla/ReentrantMonitor.h" +#include "mozilla/Components.h" +#include "nsEmbedCID.h" +#include "mozilla/Logging.h" +#include "mozilla/SpinEventLoopUntil.h" + +using namespace mozilla::dom; + +extern mozilla::LazyLogModule MAPI; // defined in msgMapiImp.cpp + +class MAPISendListener : public nsIMsgSendListener, + public mozilla::ReentrantMonitor { + public: + MAPISendListener() + : ReentrantMonitor("MAPISendListener monitor"), m_done(false) {} + + // nsISupports interface + NS_DECL_THREADSAFE_ISUPPORTS + + /* void OnStartSending (in string aMsgID, in uint32_t aMsgSize); */ + NS_IMETHOD OnStartSending(const char* aMsgID, uint32_t aMsgSize) { + return NS_OK; + } + + /* void OnProgress (in string aMsgID, in uint32_t aProgress, in uint32_t + * aProgressMax); */ + NS_IMETHOD OnProgress(const char* aMsgID, uint32_t aProgress, + uint32_t aProgressMax) { + return NS_OK; + } + + /* void OnStatus (in string aMsgID, in wstring aMsg); */ + NS_IMETHOD OnStatus(const char* aMsgID, const char16_t* aMsg) { + return NS_OK; + } + + /* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, + * in nsIFile returnFile); */ + NS_IMETHOD OnStopSending(const char* aMsgID, nsresult aStatus, + const char16_t* aMsg, nsIFile* returnFile) { + mozilla::ReentrantMonitorAutoEnter mon(*this); + m_done = true; + NotifyAll(); + return NS_OK; + } + + /* void OnTransportSecurityError( in string msgID, in nsresult status, in + * nsITransportSecurityInfo secInfo, in ACString location); */ + NS_IMETHOD OnTransportSecurityError(const char* msgID, nsresult status, + nsITransportSecurityInfo* secInfo, + nsACString const& location) { + return NS_OK; + } + + /* void OnSendNotPerformed */ + NS_IMETHOD OnSendNotPerformed(const char* aMsgID, nsresult aStatus) { + return OnStopSending(aMsgID, aStatus, nullptr, nullptr); + } + + /* void OnGetDraftFolderURI (); */ + NS_IMETHOD OnGetDraftFolderURI(const char* aMsgID, + const nsACString& aFolderURI) { + return NS_OK; + } + + bool IsDone() { return m_done; } + + private: + bool m_done; + virtual ~MAPISendListener() {} +}; + +/// Helper for setting up the hidden window for blind MAPI. +class MOZ_STACK_CLASS AutoHiddenWindow { + public: + explicit AutoHiddenWindow(nsresult& rv) + : mAppService(do_GetService("@mozilla.org/appshell/appShellService;1")) { + mCreatedHiddenWindow = false; + rv = mAppService->GetHiddenDOMWindow(getter_AddRefs(mHiddenWindow)); + if (rv == NS_ERROR_FAILURE) { + // Try to get a hidden window. If it doesn't exist, create a hidden + // window for us to use. + rv = mAppService->CreateHiddenWindow(); + NS_ENSURE_SUCCESS_VOID(rv); + mCreatedHiddenWindow = true; + rv = mAppService->GetHiddenDOMWindow(getter_AddRefs(mHiddenWindow)); + } + NS_ENSURE_SUCCESS_VOID(rv); + } + ~AutoHiddenWindow() { + if (mCreatedHiddenWindow) mAppService->DestroyHiddenWindow(); + } + mozIDOMWindowProxy* operator->() { return mHiddenWindow; } + operator mozIDOMWindowProxy*() { return mHiddenWindow; } + + private: + nsCOMPtr<nsIAppShellService> mAppService; + nsCOMPtr<mozIDOMWindowProxy> mHiddenWindow; + bool mCreatedHiddenWindow; +}; + +NS_IMPL_ISUPPORTS(MAPISendListener, nsIMsgSendListener) + +bool nsMapiHook::isMapiService = false; + +void nsMapiHook::CleanUp() { + // This routine will be fully implemented in future + // to cleanup mapi related stuff inside mozilla code. +} + +bool nsMapiHook::DisplayLoginDialog(bool aLogin, char16_t** aUsername, + char16_t** aPassword) { + nsresult rv; + bool btnResult = false; + + nsCOMPtr<nsIPromptService> dlgService( + do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv)); + if (NS_SUCCEEDED(rv) && dlgService) { + nsCOMPtr<nsIStringBundleService> bundleService = + mozilla::components::StringBundle::Service(); + if (!bundleService) return false; + + nsCOMPtr<nsIStringBundle> bundle; + rv = bundleService->CreateBundle(MAPI_PROPERTIES_CHROME, + getter_AddRefs(bundle)); + if (NS_FAILED(rv) || !bundle) return false; + + nsCOMPtr<nsIStringBundle> brandBundle; + rv = + bundleService->CreateBundle("chrome://branding/locale/brand.properties", + getter_AddRefs(brandBundle)); + if (NS_FAILED(rv)) return false; + + nsString brandName; + rv = brandBundle->GetStringFromName("brandFullName", brandName); + if (NS_FAILED(rv)) return false; + + nsString loginTitle; + AutoTArray<nsString, 1> brandStrings = {brandName}; + rv = bundle->FormatStringFromName("loginTitle", brandStrings, loginTitle); + if (NS_FAILED(rv)) return false; + + if (aLogin) { + nsString loginText; + rv = bundle->GetStringFromName("loginTextwithName", loginText); + if (NS_FAILED(rv) || loginText.IsEmpty()) return false; + + rv = dlgService->PromptUsernameAndPassword(nullptr, loginTitle.get(), + loginText.get(), aUsername, + aPassword, &btnResult); + } else { + // nsString loginString; + nsString loginText; + AutoTArray<nsString, 1> userNameStrings = {nsDependentString(*aUsername)}; + rv = + bundle->FormatStringFromName("loginText", userNameStrings, loginText); + if (NS_FAILED(rv)) return false; + + rv = dlgService->PromptPassword(nullptr, loginTitle.get(), + loginText.get(), aPassword, &btnResult); + } + } + + return btnResult; +} + +bool nsMapiHook::VerifyUserName(const nsCString& aUsername, nsCString& aIdKey) { + nsresult rv; + + if (aUsername.IsEmpty()) return false; + + nsCOMPtr<nsIMsgAccountManager> accountManager( + do_GetService("@mozilla.org/messenger/account-manager;1", &rv)); + if (NS_FAILED(rv)) return false; + nsTArray<RefPtr<nsIMsgIdentity>> identities; + rv = accountManager->GetAllIdentities(identities); + if (NS_FAILED(rv)) return false; + + for (auto thisIdentity : identities) { + if (thisIdentity) { + nsCString email; + rv = thisIdentity->GetEmail(email); + if (NS_FAILED(rv)) continue; + + // get the username from the email and compare with the username + int32_t index = email.FindChar('@'); + if (index != -1) email.SetLength(index); + + if (aUsername.Equals(email)) + return NS_SUCCEEDED(thisIdentity->GetKey(aIdKey)); + } + } + + return false; +} + +bool nsMapiHook::IsBlindSendAllowed() { + bool enabled = false; + bool warn = true; + nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { + prefBranch->GetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND, &warn); + prefBranch->GetBoolPref(PREF_MAPI_BLIND_SEND_ENABLED, &enabled); + } + if (!enabled) return false; + + if (!warn) return true; // Everything is okay. + + nsresult rv; + nsCOMPtr<nsIStringBundleService> bundleService = + mozilla::components::StringBundle::Service(); + if (!bundleService) return false; + + nsCOMPtr<nsIStringBundle> bundle; + rv = bundleService->CreateBundle(MAPI_PROPERTIES_CHROME, + getter_AddRefs(bundle)); + if (NS_FAILED(rv) || !bundle) return false; + + nsString warningMsg; + rv = bundle->GetStringFromName("mapiBlindSendWarning", warningMsg); + if (NS_FAILED(rv)) return false; + + nsString dontShowAgainMessage; + rv = bundle->GetStringFromName("mapiBlindSendDontShowAgain", + dontShowAgainMessage); + if (NS_FAILED(rv)) return false; + + nsCOMPtr<nsIPromptService> dlgService( + do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv)); + if (NS_FAILED(rv) || !dlgService) return false; + + bool continueToWarn = true; + bool okayToContinue = false; + dlgService->ConfirmCheck(nullptr, nullptr, warningMsg.get(), + dontShowAgainMessage.get(), &continueToWarn, + &okayToContinue); + + if (!continueToWarn && okayToContinue && prefBranch) + prefBranch->SetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND, false); + + return okayToContinue; +} + +// this is used for Send without UI +nsresult nsMapiHook::BlindSendMail(unsigned long aSession, + nsIMsgCompFields* aCompFields) { + nsresult rv = NS_OK; + + if (!IsBlindSendAllowed()) return NS_ERROR_FAILURE; + + // Get a hidden window to use for compose. + AutoHiddenWindow hiddenWindow(rv); + NS_ENSURE_SUCCESS(rv, rv); + + // smtp password and Logged in used IdKey from MapiConfig (session obj) + nsMAPIConfiguration* pMapiConfig = + nsMAPIConfiguration::GetMAPIConfiguration(); + if (!pMapiConfig) return NS_ERROR_FAILURE; // get the singleton obj + char16_t* password = pMapiConfig->GetPassword(aSession); + + // Id key + nsCString MsgIdKey; + pMapiConfig->GetIdKey(aSession, MsgIdKey); + + // get the MsgIdentity for the above key using AccountManager + nsCOMPtr<nsIMsgAccountManager> accountManager = + do_GetService("@mozilla.org/messenger/account-manager;1"); + if (NS_FAILED(rv) || (!accountManager)) return rv; + + nsCOMPtr<nsIMsgIdentity> pMsgId; + rv = accountManager->GetIdentity(MsgIdKey, getter_AddRefs(pMsgId)); + if (NS_FAILED(rv)) return rv; + + // create a send listener to get back the send status + RefPtr<MAPISendListener> sendListener = new MAPISendListener; + + // create the compose params object + nsCOMPtr<nsIMsgComposeParams> pMsgComposeParams( + do_CreateInstance("@mozilla.org/messengercompose/composeparams;1", &rv)); + if (NS_FAILED(rv) || (!pMsgComposeParams)) return rv; + + // populate the compose params + bool forcePlainText; + aCompFields->GetForcePlainText(&forcePlainText); + pMsgComposeParams->SetType(nsIMsgCompType::New); + pMsgComposeParams->SetFormat(forcePlainText ? nsIMsgCompFormat::PlainText + : nsIMsgCompFormat::HTML); + pMsgComposeParams->SetIdentity(pMsgId); + pMsgComposeParams->SetComposeFields(aCompFields); + pMsgComposeParams->SetSendListener(sendListener); + if (password) pMsgComposeParams->SetSmtpPassword(nsDependentString(password)); + + // create the nsIMsgCompose object to send the object + nsCOMPtr<nsIMsgCompose> pMsgCompose( + do_CreateInstance("@mozilla.org/messengercompose/compose;1", &rv)); + NS_ENSURE_SUCCESS(rv, rv); + rv = pMsgCompose->Initialize(pMsgComposeParams, hiddenWindow, nullptr); + NS_ENSURE_SUCCESS(rv, rv); + + // If we're in offline mode, we'll need to queue it for later. + RefPtr<Promise> promise; + rv = pMsgCompose->SendMsg(WeAreOffline() ? nsIMsgSend::nsMsgQueueForLater + : nsIMsgSend::nsMsgDeliverNow, + pMsgId, nullptr, nullptr, nullptr, + getter_AddRefs(promise)); + NS_ENSURE_SUCCESS(rv, rv); + + // When offline, the message is saved to Outbox and OnStopSending won't be + // called. + if (WeAreOffline()) return NS_OK; + + // Wait for OnStopSending to be called. + mozilla::SpinEventLoopUntil("nsIMsgCompose::SendMsg is async"_ns, + [=]() { return sendListener->IsDone(); }); + + return rv; +} + +nsresult nsMapiHook::HandleAttachments(nsIMsgCompFields* aCompFields, + int32_t aFileCount, + lpnsMapiFileDesc aFiles, bool aIsUTF8) { + nsresult rv = NS_OK; + // Do nothing if there are no files to process. + if (!aFiles || aFileCount <= 0) return NS_OK; + + nsAutoCString Attachments; + nsAutoCString TempFiles; + + nsCOMPtr<nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); + if (NS_FAILED(rv) || (!pFile)) return rv; + nsCOMPtr<nsIFile> pTempDir = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); + if (NS_FAILED(rv) || (!pTempDir)) return rv; + + for (int i = 0; i < aFileCount; i++) { + if (aFiles[i].lpszPathName) { + // check if attachment exists + if (!aIsUTF8) + pFile->InitWithNativePath(nsDependentCString(aFiles[i].lpszPathName)); + else + pFile->InitWithPath(NS_ConvertUTF8toUTF16(aFiles[i].lpszPathName)); + + bool bExist; + rv = pFile->Exists(&bExist); + MOZ_LOG( + MAPI, mozilla::LogLevel::Debug, + ("nsMapiHook::HandleAttachments: filename: %s path: %s exists = %s\n", + (const char*)aFiles[i].lpszFileName, + (const char*)aFiles[i].lpszPathName, bExist ? "true" : "false")); + if (NS_FAILED(rv) || (!bExist)) return NS_ERROR_FILE_NOT_FOUND; + + // Temp Directory + nsCOMPtr<nsIFile> pTempDir; + NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempDir)); + + // create a new sub directory called moz_mapi underneath the temp + // directory + pTempDir->AppendRelativePath(u"moz_mapi"_ns); + pTempDir->Exists(&bExist); + if (!bExist) { + rv = pTempDir->Create(nsIFile::DIRECTORY_TYPE, 777); + if (NS_FAILED(rv)) return rv; + } + + // rename or copy the existing temp file with the real file name + + nsAutoString leafName; + // convert to Unicode using Platform charset + // leafName already contains a unicode leafName from lpszPathName. If we + // were given a value for lpszFileName, use it. Otherwise stick with + // leafName + if (aFiles[i].lpszFileName) { + nsAutoString wholeFileName; + if (!aIsUTF8) + NS_CopyNativeToUnicode(nsDependentCString(aFiles[i].lpszFileName), + wholeFileName); + else + wholeFileName.Append(NS_ConvertUTF8toUTF16(aFiles[i].lpszFileName)); + // need to find the last '\' and find the leafname from that. + int32_t lastSlash = wholeFileName.RFindChar(char16_t('\\')); + if (lastSlash != kNotFound) + leafName.Assign(Substring(wholeFileName, lastSlash + 1)); + else + leafName.Assign(wholeFileName); + } else + pFile->GetLeafName(leafName); + + nsCOMPtr<nsIMsgAttachment> attachment = + do_CreateInstance("@mozilla.org/messengercompose/attachment;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + attachment->SetName(leafName); + + nsCOMPtr<nsIFile> pTempFile; + rv = pTempDir->Clone(getter_AddRefs(pTempFile)); + if (NS_FAILED(rv) || !pTempFile) return rv; + + pTempFile->Append(leafName); + pTempFile->Exists(&bExist); + if (bExist) { + rv = pTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0777); + NS_ENSURE_SUCCESS(rv, rv); + pTempFile->Remove(false); // remove so we can copy over it. + pTempFile->GetLeafName(leafName); + } + // copy the file to its new location and file name + pFile->CopyTo(pTempDir, leafName); + // point pFile to the new location of the attachment + pFile->InitWithFile(pTempDir); + pFile->Append(leafName); + + // create MsgCompose attachment object + attachment->SetTemporary( + true); // this one is a temp file so set the flag for MsgCompose + + // now set the attachment object + nsAutoCString pURL; + NS_GetURLSpecFromFile(pFile, pURL); + attachment->SetUrl(pURL); + + // set the file size + int64_t fileSize; + pFile->GetFileSize(&fileSize); + attachment->SetSize(fileSize); + + // add the attachment + rv = aCompFields->AddAttachment(attachment); + if (NS_FAILED(rv)) + MOZ_LOG( + MAPI, mozilla::LogLevel::Debug, + ("nsMapiHook::HandleAttachments: AddAttachment rv = %x\n", rv)); + } + } + return rv; +} + +nsresult nsMapiHook::HandleAttachmentsW(nsIMsgCompFields* aCompFields, + int32_t aFileCount, + lpnsMapiFileDescW aFiles) { + nsresult rv = NS_OK; + // Do nothing if there are no files to process. + if (!aFiles || aFileCount <= 0) return NS_OK; + + nsAutoCString Attachments; + nsAutoCString TempFiles; + + nsCOMPtr<nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); + if (NS_FAILED(rv) || (!pFile)) return rv; + nsCOMPtr<nsIFile> pTempDir = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); + if (NS_FAILED(rv) || (!pTempDir)) return rv; + + for (int i = 0; i < aFileCount; i++) { + if (aFiles[i].lpszPathName) { + // Check if attachment exists. + pFile->InitWithPath(nsDependentString(aFiles[i].lpszPathName)); + + bool bExist; + rv = pFile->Exists(&bExist); + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("nsMapiHook::HandleAttachmentsW: filename: %s path: %s exists = " + "%s \n", + NS_ConvertUTF16toUTF8(aFiles[i].lpszFileName).get(), + NS_ConvertUTF16toUTF8(aFiles[i].lpszPathName).get(), + bExist ? "true" : "false")); + if (NS_FAILED(rv) || (!bExist)) return NS_ERROR_FILE_NOT_FOUND; + + // Temp Directory. + nsCOMPtr<nsIFile> pTempDir; + NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempDir)); + + // Create a new sub directory called moz_mapi underneath the temp + // directory. + pTempDir->AppendRelativePath(u"moz_mapi"_ns); + pTempDir->Exists(&bExist); + if (!bExist) { + rv = pTempDir->Create(nsIFile::DIRECTORY_TYPE, 777); + if (NS_FAILED(rv)) return rv; + } + + // Rename or copy the existing temp file with the real file name. + + nsAutoString leafName; + // leafName already contains a unicode leafName from lpszPathName. If we + // were given a value for lpszFileName, use it. Otherwise stick with + // leafName. + if (aFiles[i].lpszFileName) { + nsAutoString wholeFileName(aFiles[i].lpszFileName); + // Need to find the last '\' and find the leafname from that. + int32_t lastSlash = wholeFileName.RFindChar(char16_t('\\')); + if (lastSlash != kNotFound) + leafName.Assign(Substring(wholeFileName, lastSlash + 1)); + else + leafName.Assign(wholeFileName); + } else + pFile->GetLeafName(leafName); + + nsCOMPtr<nsIMsgAttachment> attachment = + do_CreateInstance("@mozilla.org/messengercompose/attachment;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + attachment->SetName(leafName); + + nsCOMPtr<nsIFile> pTempFile; + rv = pTempDir->Clone(getter_AddRefs(pTempFile)); + if (NS_FAILED(rv) || !pTempFile) return rv; + + pTempFile->Append(leafName); + pTempFile->Exists(&bExist); + if (bExist) { + rv = pTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0777); + NS_ENSURE_SUCCESS(rv, rv); + pTempFile->Remove(false); // remove so we can copy over it. + pTempFile->GetLeafName(leafName); + } + // Copy the file to its new location and file name. + pFile->CopyTo(pTempDir, leafName); + // Point pFile to the new location of the attachment. + pFile->InitWithFile(pTempDir); + pFile->Append(leafName); + + // Create MsgCompose attachment object. + attachment->SetTemporary( + true); // this one is a temp file so set the flag for MsgCompose + + // Now set the attachment object. + nsAutoCString pURL; + NS_GetURLSpecFromFile(pFile, pURL); + attachment->SetUrl(pURL); + + // Set the file size. + int64_t fileSize; + pFile->GetFileSize(&fileSize); + attachment->SetSize(fileSize); + + // Add the attachment. + rv = aCompFields->AddAttachment(attachment); + if (NS_FAILED(rv)) + MOZ_LOG( + MAPI, mozilla::LogLevel::Debug, + ("nsMapiHook::HandleAttachmentsW: AddAttachment rv = %x\n", rv)); + } + } + return rv; +} + +// this is used to convert non Unicode data and then populate comp fields +nsresult nsMapiHook::PopulateCompFieldsWithConversion( + lpnsMapiMessage aMessage, nsIMsgCompFields* aCompFields) { + bool isUTF8 = aMessage->ulReserved == CP_UTF8; + + if (aMessage->lpOriginator && aMessage->lpOriginator->lpszAddress) { + nsAutoString From; + if (!isUTF8) + From.Append(NS_ConvertASCIItoUTF16(aMessage->lpOriginator->lpszAddress)); + else + From.Append(NS_ConvertUTF8toUTF16(aMessage->lpOriginator->lpszAddress)); + aCompFields->SetFrom(From); + } + + nsAutoString To; + nsAutoString Cc; + nsAutoString Bcc; + constexpr auto Comma = u","_ns; + if (aMessage->lpRecips) { + for (int i = 0; i < (int)aMessage->nRecipCount; i++) { + if (aMessage->lpRecips[i].lpszAddress || aMessage->lpRecips[i].lpszName) { + const char* addressWithoutType = (aMessage->lpRecips[i].lpszAddress) + ? aMessage->lpRecips[i].lpszAddress + : aMessage->lpRecips[i].lpszName; + if (!PL_strncasecmp(addressWithoutType, "SMTP:", 5)) + addressWithoutType += 5; + + switch (aMessage->lpRecips[i].ulRecipClass) { + case MAPI_TO: + if (!To.IsEmpty()) To += Comma; + if (!isUTF8) + To.Append(NS_ConvertASCIItoUTF16(addressWithoutType)); + else + To.Append(NS_ConvertUTF8toUTF16(addressWithoutType)); + break; + + case MAPI_CC: + if (!Cc.IsEmpty()) Cc += Comma; + if (!isUTF8) + Cc.Append(NS_ConvertASCIItoUTF16(addressWithoutType)); + else + Cc.Append(NS_ConvertUTF8toUTF16(addressWithoutType)); + break; + + case MAPI_BCC: + if (!Bcc.IsEmpty()) Bcc += Comma; + if (!isUTF8) + Bcc.Append(NS_ConvertASCIItoUTF16(addressWithoutType)); + else + Bcc.Append(NS_ConvertUTF8toUTF16(addressWithoutType)); + break; + } + } + } + } + + // set To, Cc, Bcc + aCompFields->SetTo(To); + aCompFields->SetCc(Cc); + aCompFields->SetBcc(Bcc); + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), + NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get())); + + // set subject + nsresult rv = NS_OK; + if (aMessage->lpszSubject) { + nsAutoString Subject; + if (!isUTF8) + rv = NS_CopyNativeToUnicode(nsDependentCString(aMessage->lpszSubject), + Subject); + else + Subject.Append(NS_ConvertUTF8toUTF16(aMessage->lpszSubject)); + if (NS_FAILED(rv)) return rv; + aCompFields->SetSubject(Subject); + } + + // handle attachments as File URL + rv = HandleAttachments(aCompFields, aMessage->nFileCount, aMessage->lpFiles, + isUTF8); + if (NS_FAILED(rv)) return rv; + + // set body + if (aMessage->lpszNoteText) { + nsAutoString Body; + if (!isUTF8) + rv = NS_CopyNativeToUnicode(nsDependentCString(aMessage->lpszNoteText), + Body); + else + Body.Append(NS_ConvertUTF8toUTF16(aMessage->lpszNoteText)); + if (NS_FAILED(rv)) return rv; + if (Body.IsEmpty() || Body.Last() != '\n') Body.AppendLiteral(CRLF); + + // This is needed when Simple MAPI is used without a compose window. + // See bug 1366196. + if (Body.Find(u"<html>") == kNotFound) aCompFields->SetForcePlainText(true); + + rv = aCompFields->SetBody(Body); + } else { + // No body: Assume that we can do plaintext. This will trigger the default + // compose format in ShowComposerWindow(). + aCompFields->SetForcePlainText(true); + } + +#ifdef RAJIV_DEBUG + // testing what all was set in CompFields + printf("To : %S \n", To.get()); + printf("CC : %S \n", Cc.get()); + printf("BCC : %S \n", Bcc.get()); +#endif + + return rv; +} + +// This is used to populate comp fields with UTF-16 data from MAPISendMailW +// function. +nsresult nsMapiHook::PopulateCompFieldsW(lpnsMapiMessageW aMessage, + nsIMsgCompFields* aCompFields) { + if (aMessage->lpOriginator && aMessage->lpOriginator->lpszAddress) + aCompFields->SetFrom( + nsDependentString(aMessage->lpOriginator->lpszAddress)); + + nsAutoString To; + nsAutoString Cc; + nsAutoString Bcc; + + constexpr auto Comma = u","_ns; + + if (aMessage->lpRecips) { + for (int i = 0; i < (int)aMessage->nRecipCount; i++) { + if (aMessage->lpRecips[i].lpszAddress || aMessage->lpRecips[i].lpszName) { + const wchar_t* addressWithoutType = + (aMessage->lpRecips[i].lpszAddress) + ? aMessage->lpRecips[i].lpszAddress + : aMessage->lpRecips[i].lpszName; + if (_wcsnicmp(addressWithoutType, L"SMTP:", 5) == 0) + addressWithoutType += 5; + switch (aMessage->lpRecips[i].ulRecipClass) { + case MAPI_TO: + if (!To.IsEmpty()) To += Comma; + To.Append(nsDependentString(addressWithoutType)); + break; + + case MAPI_CC: + if (!Cc.IsEmpty()) Cc += Comma; + Cc.Append(nsDependentString(addressWithoutType)); + break; + + case MAPI_BCC: + if (!Bcc.IsEmpty()) Bcc += Comma; + Bcc.Append(nsDependentString(addressWithoutType)); + break; + } + } + } + } + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), + NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get())); + // set To, Cc, Bcc + aCompFields->SetTo(To); + aCompFields->SetCc(Cc); + aCompFields->SetBcc(Bcc); + + // Set subject. + if (aMessage->lpszSubject) + aCompFields->SetSubject(nsDependentString(aMessage->lpszSubject)); + + // handle attachments as File URL + nsresult rv = + HandleAttachmentsW(aCompFields, aMessage->nFileCount, aMessage->lpFiles); + if (NS_FAILED(rv)) return rv; + + // Set body. + if (aMessage->lpszNoteText) { + nsString Body(aMessage->lpszNoteText); + if (Body.IsEmpty() || Body.Last() != '\n') Body.AppendLiteral(CRLF); + + // This is needed when Simple MAPI is used without a compose window. + // See bug 1366196. + if (Body.Find(u"<html>") == kNotFound) aCompFields->SetForcePlainText(true); + + rv = aCompFields->SetBody(Body); + } else { + // No body: Assume that we can do plaintext. This will trigger the default + // compose format in ShowComposerWindow(). + aCompFields->SetForcePlainText(true); + } + return rv; +} + +// this is used to populate the docs as attachments in the Comp fields for Send +// Documents +nsresult nsMapiHook::PopulateCompFieldsForSendDocs( + nsIMsgCompFields* aCompFields, ULONG aFlags, LPSTR aDelimChar, + LPSTR aFilePaths) { + nsAutoCString strDelimChars; + nsAutoCString strFilePaths; + nsresult rv = NS_OK; + bool bExist; + + if (aDelimChar) strDelimChars.Assign(aDelimChar); + if (aFilePaths) strFilePaths.Assign(aFilePaths); + + // check for comma in filename + if (strDelimChars.FindChar(',') == + kNotFound) // if comma is not in the delimiter specified by user + { + if (strFilePaths.FindChar(',') != + kNotFound) // if comma found in filenames return error + return NS_ERROR_FILE_INVALID_PATH; + } + + nsCString Attachments; + + // only 1 file is to be sent, no delim specified + if (strDelimChars.IsEmpty()) strDelimChars.Assign(';'); + + int32_t offset = 0; + int32_t FilePathsLen = strFilePaths.Length(); + if (FilePathsLen) { + nsAutoString Subject; + + // multiple files to be sent, delim specified + nsCOMPtr<nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); + if (NS_FAILED(rv) || (!pFile)) return rv; + + char* newFilePaths = (char*)strFilePaths.get(); + while (offset != kNotFound) { + // Temp Directory + nsCOMPtr<nsIFile> pTempDir; + NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempDir)); + + // if not already existing, create another temp dir for mapi within Win + // temp dir this is windows only so we can do "\\" + pTempDir->AppendRelativePath(u"moz_mapi"_ns); + pTempDir->Exists(&bExist); + if (!bExist) { + rv = pTempDir->Create(nsIFile::DIRECTORY_TYPE, 777); + if (NS_FAILED(rv)) return rv; + } + + nsAutoCString RemainingPaths; + RemainingPaths.Assign(newFilePaths); + offset = RemainingPaths.Find(strDelimChars); + if (offset != kNotFound) { + RemainingPaths.SetLength(offset); + if ((offset + (int32_t)strDelimChars.Length()) < FilePathsLen) + newFilePaths += offset + strDelimChars.Length(); + else + offset = kNotFound; + FilePathsLen -= offset + strDelimChars.Length(); + } + + if (RemainingPaths[1] != ':' && RemainingPaths[1] != '\\') { + char cwd[MAX_PATH]; + if (_getdcwd(_getdrive(), cwd, MAX_PATH)) { + nsAutoCString cwdStr; + cwdStr.Assign(cwd); + cwdStr.Append('\\'); + RemainingPaths.Insert(cwdStr, 0); + } + } + + pFile->InitWithNativePath(RemainingPaths); + + rv = pFile->Exists(&bExist); + if (NS_FAILED(rv) || (!bExist)) return NS_ERROR_FILE_NOT_FOUND; + + // filename of the file attachment + nsAutoString leafName; + pFile->GetLeafName(leafName); + if (NS_FAILED(rv) || leafName.IsEmpty()) return rv; + + if (!Subject.IsEmpty()) Subject.AppendLiteral(", "); + Subject += leafName; + + // create MsgCompose attachment object + nsCOMPtr<nsIMsgAttachment> attachment = + do_CreateInstance("@mozilla.org/messengercompose/attachment;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsDependentString fileNameNative(leafName.get()); + rv = pFile->CopyTo(pTempDir, fileNameNative); + if (NS_FAILED(rv)) return rv; + + // now turn pTempDir into a full file path to the temp file + pTempDir->Append(fileNameNative); + + // this one is a temp file so set the flag for MsgCompose + attachment->SetTemporary(true); + + // now set the attachment object + nsAutoCString pURL; + NS_GetURLSpecFromFile(pTempDir, pURL); + attachment->SetUrl(pURL); + + // set the file size + int64_t fileSize; + pFile->GetFileSize(&fileSize); + attachment->SetSize(fileSize); + + // add the attachment + rv = aCompFields->AddAttachment(attachment); + if (NS_FAILED(rv)) return rv; + } + + rv = aCompFields->SetBody(Subject); + } + + return rv; +} + +// this used for Send with UI +nsresult nsMapiHook::ShowComposerWindow(unsigned long aSession, + nsIMsgCompFields* aCompFields) { + nsresult rv = NS_OK; + + // create a send listener to get back the send status + RefPtr<MAPISendListener> sendListener = new MAPISendListener; + + // create the compose params object + nsCOMPtr<nsIMsgComposeParams> pMsgComposeParams( + do_CreateInstance("@mozilla.org/messengercompose/composeparams;1", &rv)); + if (NS_FAILED(rv) || (!pMsgComposeParams)) return rv; + + // If we found HTML, compose in HTML. + bool forcePlainText; + aCompFields->GetForcePlainText(&forcePlainText); + pMsgComposeParams->SetFormat(forcePlainText ? nsIMsgCompFormat::Default + : nsIMsgCompFormat::HTML); + + // populate the compose params + pMsgComposeParams->SetType(nsIMsgCompType::New); + + // Never force to plain text, the default format will take care of that. + // Undo the forcing that happened in + // PopulateCompFields/PopulateCompFieldsWithConversion. See bug 1095629 and + // bug 1366196. + aCompFields->SetForcePlainText(false); + pMsgComposeParams->SetComposeFields(aCompFields); + pMsgComposeParams->SetSendListener(sendListener); + + /** get the nsIMsgComposeService object to open the compose window **/ + nsCOMPtr<nsIMsgComposeService> compService = + do_GetService("@mozilla.org/messengercompose;1"); + if (NS_FAILED(rv) || (!compService)) return rv; + + rv = compService->OpenComposeWindowWithParams(nullptr, pMsgComposeParams); + if (NS_FAILED(rv)) return rv; + + return rv; +} diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiHook.h b/comm/mailnews/mapi/mapihook/src/msgMapiHook.h new file mode 100644 index 0000000000..aa6ad1d66f --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiHook.h @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MSG_MAPI_HOOK_H_ +#define MSG_MAPI_HOOK_H_ + +#include "prtypes.h" + +class nsMapiHook { + public: + static bool DisplayLoginDialog(bool aLogin, char16_t** aUsername, + char16_t** aPassword); + static bool VerifyUserName(const nsCString& aUsername, nsCString& aIdKey); + + static bool IsBlindSendAllowed(); + static nsresult BlindSendMail(unsigned long aSession, + nsIMsgCompFields* aCompFields); + static nsresult ShowComposerWindow(unsigned long aSession, + nsIMsgCompFields* aCompFields); + static nsresult PopulateCompFieldsWithConversion( + lpnsMapiMessage aMessage, nsIMsgCompFields* aCompFields); + static nsresult PopulateCompFieldsW(lpnsMapiMessageW aMessage, + nsIMsgCompFields* aCompFields); + static nsresult PopulateCompFieldsForSendDocs(nsIMsgCompFields* aCompFields, + ULONG aFlags, LPSTR aDelimChar, + LPSTR aFilePaths); + static nsresult HandleAttachments(nsIMsgCompFields* aCompFields, + int32_t aFileCount, lpnsMapiFileDesc aFiles, + bool aIsUTF8); + static nsresult HandleAttachmentsW(nsIMsgCompFields* aCompFields, + int32_t aFileCount, + lpnsMapiFileDescW aFiles); + static void CleanUp(); + + static bool isMapiService; +}; + +#endif // MSG_MAPI_HOOK_H_ diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiImp.cpp b/comm/mailnews/mapi/mapihook/src/msgMapiImp.cpp new file mode 100644 index 0000000000..62abed1f7b --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiImp.cpp @@ -0,0 +1,801 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <mapidefs.h> +#include <mapi.h> +#include <winstring.h> +#include "msgMapiImp.h" +#include "msgMapiFactory.h" +#include "msgMapiMain.h" + +#include "nsIMsgCompFields.h" +#include "msgMapiHook.h" +#include "nsString.h" +#include "nsCOMPtr.h" +#include "nsISupports.h" +#include "nsIMsgDatabase.h" +#include "nsMsgFolderFlags.h" +#include "nsIMsgHdr.h" +#include "MailNewsTypes.h" +#include "nsIMsgAccountManager.h" +#include "nsIMsgFolder.h" +#include "nsIMsgImapMailFolder.h" +#include <time.h> +#include "nsIInputStream.h" +#include "nsILineInputStream.h" +#include "nsISeekableStream.h" +#include "nsIFile.h" +#include "nsIFileStreams.h" +#include "nsNetCID.h" +#include "nsMsgMessageFlags.h" +#include "mozilla/mailnews/MimeHeaderParser.h" +#include "mozilla/Logging.h" + +using namespace mozilla::mailnews; + +mozilla::LazyLogModule MAPI("MAPI"); + +CMapiImp::CMapiImp() : m_cRef(1) { m_Lock = PR_NewLock(); } + +CMapiImp::~CMapiImp() { + if (m_Lock) PR_DestroyLock(m_Lock); +} + +STDMETHODIMP CMapiImp::QueryInterface(const IID& aIid, void** aPpv) { + if (aIid == IID_IUnknown) { + *aPpv = static_cast<nsIMapi*>(this); + } else if (aIid == IID_nsIMapi) { + *aPpv = static_cast<nsIMapi*>(this); + } else { + *aPpv = nullptr; + return E_NOINTERFACE; + } + + reinterpret_cast<IUnknown*>(*aPpv)->AddRef(); + return S_OK; +} + +STDMETHODIMP_(ULONG) CMapiImp::AddRef() { return ++m_cRef; } + +STDMETHODIMP_(ULONG) CMapiImp::Release() { + int32_t temp = --m_cRef; + if (m_cRef == 0) { + delete this; + return 0; + } + + return temp; +} + +STDMETHODIMP CMapiImp::IsValid() { return S_OK; } + +STDMETHODIMP CMapiImp::IsValidSession(unsigned long aSession) { + nsMAPIConfiguration* pConfig = nsMAPIConfiguration::GetMAPIConfiguration(); + if (pConfig && pConfig->IsSessionValid(aSession)) return S_OK; + + return E_FAIL; +} + +STDMETHODIMP CMapiImp::Initialize() { + HRESULT hr = E_FAIL; + + if (!m_Lock) return E_FAIL; + + PR_Lock(m_Lock); + + // Initialize MAPI Configuration + + nsMAPIConfiguration* pConfig = nsMAPIConfiguration::GetMAPIConfiguration(); + if (pConfig != nullptr) hr = S_OK; + + PR_Unlock(m_Lock); + + return hr; +} + +STDMETHODIMP CMapiImp::Login(unsigned long aUIArg, LPSTR aLogin, + LPSTR aPassWord, unsigned long aFlags, + unsigned long* aSessionId) { + HRESULT hr = E_FAIL; + bool bNewSession = false; + nsCString id_key; + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::Login using flags %lu", aFlags)); + if (aFlags & MAPI_NEW_SESSION) bNewSession = true; + + // Check For Profile Name + if (aLogin != nullptr && aLogin[0] != '\0') { + if (!nsMapiHook::VerifyUserName(nsDependentCString(aLogin), id_key)) { + *aSessionId = MAPI_E_LOGIN_FAILURE; + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::Login failed for username %s", aLogin)); + NS_ASSERTION(false, "failed verifying user name"); + return hr; + } + } else { + // get default account + nsresult rv; + nsCOMPtr<nsIMsgAccountManager> accountManager = + do_GetService("@mozilla.org/messenger/account-manager;1", &rv); + NS_ENSURE_SUCCESS(rv, MAPI_E_LOGIN_FAILURE); + + nsCOMPtr<nsIMsgAccount> account; + rv = accountManager->GetDefaultAccount(getter_AddRefs(account)); + NS_ENSURE_SUCCESS(rv, MAPI_E_LOGIN_FAILURE); + if (!account) return MAPI_E_LOGIN_FAILURE; + + nsCOMPtr<nsIMsgIdentity> identity; + rv = account->GetDefaultIdentity(getter_AddRefs(identity)); + NS_ENSURE_SUCCESS(rv, MAPI_E_LOGIN_FAILURE); + if (!identity) return MAPI_E_LOGIN_FAILURE; + identity->GetKey(id_key); + } + + // finally register(create) the session. + uint32_t nSession_Id; + int16_t nResult = 0; + + nsMAPIConfiguration* pConfig = nsMAPIConfiguration::GetMAPIConfiguration(); + if (pConfig != nullptr) + nResult = pConfig->RegisterSession( + aUIArg, aLogin ? nsDependentCString(aLogin) : EmptyCString(), + aPassWord ? nsDependentCString(aPassWord) : EmptyCString(), + (aFlags & MAPI_FORCE_DOWNLOAD), bNewSession, &nSession_Id, + id_key.get()); + switch (nResult) { + case -1: { + *aSessionId = MAPI_E_TOO_MANY_SESSIONS; + return hr; + } + case 0: { + *aSessionId = MAPI_E_INSUFFICIENT_MEMORY; + return hr; + } + default: { + *aSessionId = nSession_Id; + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::Login succeeded")); + break; + } + } + + return S_OK; +} + +STDMETHODIMP CMapiImp::SendMail(unsigned long aSession, + lpnsMapiMessage aMessage, unsigned long aFlags, + unsigned long aReserved) { + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::SendMail flags=%lx subject: %s sender: %s", aFlags, + (aMessage && aMessage->lpszSubject) ? aMessage->lpszSubject + : "(no subject)", + (aMessage && aMessage->lpOriginator && + aMessage->lpOriginator->lpszAddress) + ? aMessage->lpOriginator->lpszAddress + : "(no sender)")); + + /** create nsIMsgCompFields obj and populate it **/ + nsresult rv = NS_OK; + nsCOMPtr<nsIMsgCompFields> pCompFields = + do_CreateInstance("@mozilla.org/messengercompose/composefields;1", &rv); + if (NS_FAILED(rv) || (!pCompFields)) return MAPI_E_INSUFFICIENT_MEMORY; + + if (aMessage) + rv = nsMapiHook::PopulateCompFieldsWithConversion(aMessage, pCompFields); + + if (NS_SUCCEEDED(rv)) { + // see flag to see if UI needs to be brought up + if (!(aFlags & MAPI_DIALOG)) { + rv = nsMapiHook::BlindSendMail(aSession, pCompFields); + } else { + rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields); + } + } + + return nsMAPIConfiguration::GetMAPIErrorFromNSError(rv); +} + +STDMETHODIMP CMapiImp::SendMailW(unsigned long aSession, + lpnsMapiMessageW aMessage, + unsigned long aFlags, + unsigned long aReserved) { + MOZ_LOG( + MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::SendMailW flags=%lx subject: %s sender: %s", aFlags, + (aMessage && aMessage->lpszSubject) + ? NS_ConvertUTF16toUTF8(aMessage->lpszSubject).get() + : "(no subject)", + (aMessage && aMessage->lpOriginator && + aMessage->lpOriginator->lpszAddress) + ? NS_ConvertUTF16toUTF8(aMessage->lpOriginator->lpszAddress).get() + : "(no sender)")); + + // Create nsIMsgCompFields obj and populate it. + nsresult rv = NS_OK; + nsCOMPtr<nsIMsgCompFields> pCompFields = + do_CreateInstance("@mozilla.org/messengercompose/composefields;1", &rv); + if (NS_FAILED(rv) || !pCompFields) return MAPI_E_INSUFFICIENT_MEMORY; + + if (aMessage) rv = nsMapiHook::PopulateCompFieldsW(aMessage, pCompFields); + + if (NS_SUCCEEDED(rv)) { + // Check flag to see if UI needs to be brought up. + if (!(aFlags & MAPI_DIALOG)) { + rv = nsMapiHook::BlindSendMail(aSession, pCompFields); + } else { + rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields); + } + } + + return nsMAPIConfiguration::GetMAPIErrorFromNSError(rv); +} + +STDMETHODIMP CMapiImp::SendDocuments(unsigned long aSession, LPSTR aDelimChar, + LPSTR aFilePaths, LPSTR aFileNames, + ULONG aFlags) { + nsresult rv = NS_OK; + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::SendDocument using flags %lu", aFlags)); + /** create nsIMsgCompFields obj and populate it **/ + nsCOMPtr<nsIMsgCompFields> pCompFields = + do_CreateInstance("@mozilla.org/messengercompose/composefields;1", &rv); + if (NS_FAILED(rv) || (!pCompFields)) return MAPI_E_INSUFFICIENT_MEMORY; + + if (aFilePaths) { + rv = nsMapiHook::PopulateCompFieldsForSendDocs(pCompFields, aFlags, + aDelimChar, aFilePaths); + } + + if (NS_SUCCEEDED(rv)) + rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields); + else + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::SendDocument error rv = %x, paths = %s names = %s", rv, + aFilePaths, aFileNames)); + + return nsMAPIConfiguration::GetMAPIErrorFromNSError(rv); +} + +nsresult CMapiImp::GetDefaultInbox(nsIMsgFolder** inboxFolder) { + // get default account + nsresult rv; + nsCOMPtr<nsIMsgAccountManager> accountManager = + do_GetService("@mozilla.org/messenger/account-manager;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr<nsIMsgAccount> account; + rv = accountManager->GetDefaultAccount(getter_AddRefs(account)); + NS_ENSURE_SUCCESS(rv, rv); + if (!account) return NS_ERROR_FAILURE; + + // get incoming server + nsCOMPtr<nsIMsgIncomingServer> server; + rv = account->GetIncomingServer(getter_AddRefs(server)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCString type; + rv = server->GetType(type); + NS_ENSURE_SUCCESS(rv, rv); + + // we only care about imap and pop3 + if (type.EqualsLiteral("imap") || type.EqualsLiteral("pop3")) { + // imap and pop3 account should have an Inbox + nsCOMPtr<nsIMsgFolder> rootMsgFolder; + rv = server->GetRootMsgFolder(getter_AddRefs(rootMsgFolder)); + NS_ENSURE_SUCCESS(rv, rv); + + if (!rootMsgFolder) return NS_ERROR_FAILURE; + + rootMsgFolder->GetFolderWithFlags(nsMsgFolderFlags::Inbox, inboxFolder); + if (!*inboxFolder) return NS_ERROR_FAILURE; + } + return NS_OK; +} + +//***************************************************************************** +// Encapsulate the XP DB stuff required to enumerate messages + +class MsgMapiListContext { + public: + MsgMapiListContext() {} + ~MsgMapiListContext(); + + nsresult OpenDatabase(nsIMsgFolder* folder); + + nsMsgKey GetNext(); + nsresult MarkRead(nsMsgKey key, bool read); + + lpnsMapiMessage GetMessage(nsMsgKey, unsigned long flFlags); + bool IsIMAPHost(void); + bool DeleteMessage(nsMsgKey key); + + protected: + char* ConvertDateToMapiFormat(time_t); + char* ConvertBodyToMapiFormat(nsIMsgDBHdr* hdr); + void ConvertRecipientsToMapiFormat( + const nsCOMArray<msgIAddressObject>& ourRecips, + lpnsMapiRecipDesc mapiRecips, int mapiRecipClass); + + nsCOMPtr<nsIMsgFolder> m_folder; + nsCOMPtr<nsIMsgDatabase> m_db; + nsCOMPtr<nsIMsgEnumerator> m_msgEnumerator; +}; + +LONG CMapiImp::InitContext(unsigned long session, + MsgMapiListContext** listContext) { + nsMAPIConfiguration* pMapiConfig = + nsMAPIConfiguration::GetMAPIConfiguration(); + if (!pMapiConfig) return MAPI_E_FAILURE; // get the singleton obj + *listContext = (MsgMapiListContext*)pMapiConfig->GetMapiListContext(session); + // This is the first message + if (!*listContext) { + nsCOMPtr<nsIMsgFolder> inboxFolder; + nsresult rv = GetDefaultInbox(getter_AddRefs(inboxFolder)); + if (NS_FAILED(rv)) { + NS_ASSERTION(false, "in init context, no inbox"); + return (MAPI_E_NO_MESSAGES); + } + + *listContext = new MsgMapiListContext; + if (!*listContext) return MAPI_E_INSUFFICIENT_MEMORY; + + rv = (*listContext)->OpenDatabase(inboxFolder); + if (NS_FAILED(rv)) { + pMapiConfig->SetMapiListContext(session, NULL); + delete *listContext; + NS_ASSERTION(false, "in init context, unable to open db"); + return MAPI_E_NO_MESSAGES; + } else + pMapiConfig->SetMapiListContext(session, *listContext); + } + return SUCCESS_SUCCESS; +} + +STDMETHODIMP CMapiImp::FindNext(unsigned long aSession, unsigned long ulUIParam, + LPSTR lpszMessageType, LPSTR lpszSeedMessageID, + unsigned long flFlags, unsigned long ulReserved, + unsigned char lpszMessageID[64]) + +{ + // + // If this is true, then this is the first call to this FindNext function + // and we should start the enumeration operation. + // + + *lpszMessageID = '\0'; + nsMAPIConfiguration* pMapiConfig = + nsMAPIConfiguration::GetMAPIConfiguration(); + if (!pMapiConfig) { + NS_ASSERTION(false, "failed to get config in findnext"); + return MAPI_E_FAILURE; // get the singleton obj + } + MsgMapiListContext* listContext; + LONG ret = InitContext(aSession, &listContext); + if (ret != SUCCESS_SUCCESS) { + NS_ASSERTION(false, "init context failed"); + return ret; + } + NS_ASSERTION(listContext, "initContext returned null context"); + if (listContext) { + // NS_ASSERTION(false, "find next init context succeeded"); + nsMsgKey nextKey = listContext->GetNext(); + if (nextKey == nsMsgKey_None) { + pMapiConfig->SetMapiListContext(aSession, NULL); + delete listContext; + return (MAPI_E_NO_MESSAGES); + } + + // TRACE("MAPI: ProcessMAPIFindNext() Found message id = %d\n", nextKey); + + sprintf((char*)lpszMessageID, "%d", nextKey); + } + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::FindNext returning key %s", (char*)lpszMessageID)); + return (SUCCESS_SUCCESS); +} + +STDMETHODIMP CMapiImp::ReadMail(unsigned long aSession, unsigned long ulUIParam, + LPSTR lpszMessageID, unsigned long flFlags, + unsigned long ulReserved, + lpnsMapiMessage* lppMessage) { + nsresult irv; + nsAutoCString keyString((char*)lpszMessageID); + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("CMapiImp::ReadMail asking for key %s", (char*)lpszMessageID)); + nsMsgKey msgKey = keyString.ToInteger(&irv); + if (NS_FAILED(irv)) { + NS_ASSERTION(false, "invalid lpszMessageID"); + return MAPI_E_INVALID_MESSAGE; + } + MsgMapiListContext* listContext; + LONG ret = InitContext(aSession, &listContext); + if (ret != SUCCESS_SUCCESS) { + NS_ASSERTION(false, "init context failed in ReadMail"); + return ret; + } + *lppMessage = listContext->GetMessage(msgKey, flFlags); + NS_ASSERTION(*lppMessage, "get message failed"); + + return (*lppMessage) ? SUCCESS_SUCCESS : E_FAIL; +} + +STDMETHODIMP CMapiImp::DeleteMail(unsigned long aSession, + unsigned long ulUIParam, LPSTR lpszMessageID, + unsigned long flFlags, + unsigned long ulReserved) { + nsresult irv; + nsAutoCString keyString((char*)lpszMessageID); + nsMsgKey msgKey = keyString.ToInteger(&irv); + // XXX Why do we return success on failure? + if (NS_FAILED(irv)) return SUCCESS_SUCCESS; + MsgMapiListContext* listContext; + LONG ret = InitContext(aSession, &listContext); + if (ret != SUCCESS_SUCCESS) return ret; + return (listContext->DeleteMessage(msgKey)) ? SUCCESS_SUCCESS + : MAPI_E_INVALID_MESSAGE; +} + +STDMETHODIMP CMapiImp::SaveMail(unsigned long aSession, unsigned long ulUIParam, + lpnsMapiMessage lppMessage, + unsigned long flFlags, unsigned long ulReserved, + LPSTR lpszMessageID) { + MsgMapiListContext* listContext; + LONG ret = InitContext(aSession, &listContext); + if (ret != SUCCESS_SUCCESS) return ret; + return S_OK; +} + +STDMETHODIMP CMapiImp::Logoff(unsigned long aSession) { + nsMAPIConfiguration* pConfig = nsMAPIConfiguration::GetMAPIConfiguration(); + + if (pConfig->UnRegisterSession((uint32_t)aSession)) return S_OK; + + return E_FAIL; +} + +STDMETHODIMP CMapiImp::CleanUp() { + nsMapiHook::CleanUp(); + return S_OK; +} + +#define MAX_NAME_LEN 256 + +MsgMapiListContext::~MsgMapiListContext() { + if (m_db) m_db->Close(false); +} + +nsresult MsgMapiListContext::OpenDatabase(nsIMsgFolder* folder) { + nsresult dbErr = NS_ERROR_FAILURE; + if (folder) { + m_folder = folder; + dbErr = folder->GetMsgDatabase(getter_AddRefs(m_db)); + if (m_db) dbErr = m_db->EnumerateMessages(getter_AddRefs(m_msgEnumerator)); + } + return dbErr; +} + +bool MsgMapiListContext::IsIMAPHost(void) { + if (!m_folder) return FALSE; + nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_folder); + + return imapFolder != nullptr; +} + +nsMsgKey MsgMapiListContext::GetNext() { + nsMsgKey key = nsMsgKey_None; + bool keepTrying = TRUE; + + // NS_ASSERTION (m_msgEnumerator && m_db, "need enumerator and db"); + if (m_msgEnumerator && m_db) { + do { + keepTrying = FALSE; + nsCOMPtr<nsIMsgDBHdr> msgHdr; + if (NS_SUCCEEDED(m_msgEnumerator->GetNext(getter_AddRefs(msgHdr))) && + msgHdr) { + msgHdr->GetMessageKey(&key); + + // Check here for IMAP message...if not, just return... + if (!IsIMAPHost()) return key; + + // If this is an IMAP message, we have to make sure we have a valid + // body to work with. + uint32_t flags = 0; + + (void)msgHdr->GetFlags(&flags); + if (flags & nsMsgMessageFlags::Offline) return key; + + // Ok, if we get here, we have an IMAP message without a body! + // We need to keep trying by calling the GetNext member recursively... + keepTrying = TRUE; + } + } while (keepTrying); + } + + return key; +} + +nsresult MsgMapiListContext::MarkRead(nsMsgKey key, bool read) { + nsresult err = NS_ERROR_FAILURE; + NS_ASSERTION(m_db, "no db"); + if (m_db) err = m_db->MarkRead(key, read, nullptr); + return err; +} + +lpnsMapiMessage MsgMapiListContext::GetMessage(nsMsgKey key, + unsigned long flFlags) { + lpnsMapiMessage message = + (lpnsMapiMessage)CoTaskMemAlloc(sizeof(nsMapiMessage)); + memset(message, 0, sizeof(nsMapiMessage)); + if (message) { + nsCString subject; + nsCString author; + nsCOMPtr<nsIMsgDBHdr> msgHdr; + + m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr)); + if (msgHdr) { + msgHdr->GetSubject(subject); + message->lpszSubject = (char*)CoTaskMemAlloc(subject.Length() + 1); + strcpy((char*)message->lpszSubject, subject.get()); + uint32_t date; + (void)msgHdr->GetDateInSeconds(&date); + message->lpszDateReceived = ConvertDateToMapiFormat(date); + + // Pull out the flags info + // anything to do with MAPI_SENT? Since we're only reading the Inbox, I + // guess not + uint32_t ourFlags; + (void)msgHdr->GetFlags(&ourFlags); + if (!(ourFlags & nsMsgMessageFlags::Read)) + message->flFlags |= MAPI_UNREAD; + if (ourFlags & (nsMsgMessageFlags::MDNReportNeeded | + nsMsgMessageFlags::MDNReportSent)) + message->flFlags |= MAPI_RECEIPT_REQUESTED; + + // Pull out the author/originator info + message->lpOriginator = + (lpnsMapiRecipDesc)CoTaskMemAlloc(sizeof(nsMapiRecipDesc)); + memset(message->lpOriginator, 0, sizeof(nsMapiRecipDesc)); + if (message->lpOriginator) { + msgHdr->GetAuthor(getter_Copies(author)); + ConvertRecipientsToMapiFormat(EncodedHeader(author), + message->lpOriginator, MAPI_ORIG); + } + // Pull out the To/CC info + nsCString recipients, ccList; + msgHdr->GetRecipients(getter_Copies(recipients)); + msgHdr->GetCcList(getter_Copies(ccList)); + + nsCOMArray<msgIAddressObject> parsedToRecips = EncodedHeader(recipients); + nsCOMArray<msgIAddressObject> parsedCCRecips = EncodedHeader(ccList); + uint32_t numToRecips = parsedToRecips.Length(); + uint32_t numCCRecips = parsedCCRecips.Length(); + + message->lpRecips = (lpnsMapiRecipDesc)CoTaskMemAlloc( + (numToRecips + numCCRecips) * sizeof(MapiRecipDesc)); + memset(message->lpRecips, 0, + (numToRecips + numCCRecips) * sizeof(MapiRecipDesc)); + if (message->lpRecips) { + ConvertRecipientsToMapiFormat(parsedToRecips, message->lpRecips, + MAPI_TO); + ConvertRecipientsToMapiFormat(parsedCCRecips, + &message->lpRecips[numToRecips], MAPI_CC); + } + + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("MsgMapiListContext::GetMessage flags=%lu subject %s date %s " + "sender %s", + flFlags, (char*)message->lpszSubject, + (char*)message->lpszDateReceived, author.get())); + + // Convert any body text that we have locally + if (!(flFlags & MAPI_ENVELOPE_ONLY)) + message->lpszNoteText = (char*)ConvertBodyToMapiFormat(msgHdr); + } + if (!(flFlags & (MAPI_PEEK | MAPI_ENVELOPE_ONLY))) + m_db->MarkRead(key, true, nullptr); + } + return message; +} + +char* MsgMapiListContext::ConvertDateToMapiFormat(time_t ourTime) { + char* date = (char*)CoTaskMemAlloc(32); + if (date) { + // MAPI time format is YYYY/MM/DD HH:MM + // Note that we're not using XP_StrfTime because that localizes the time + // format, and the way I read the MAPI spec is that their format is + // canonical, not localized. + struct tm* local = localtime(&ourTime); + if (local) + strftime(date, 32, "%Y/%m/%d %I:%M", + local); // use %H if hours should be 24 hour format + } + return date; +} + +void MsgMapiListContext::ConvertRecipientsToMapiFormat( + const nsCOMArray<msgIAddressObject>& recipients, + lpnsMapiRecipDesc mapiRecips, int mapiRecipClass) { + nsTArray<nsCString> names, addresses; + ExtractAllAddresses(recipients, UTF16ArrayAdapter<>(names), + UTF16ArrayAdapter<>(addresses)); + + size_t numAddresses = names.Length(); + for (size_t i = 0; i < numAddresses; i++) { + if (!names[i].IsEmpty()) { + mapiRecips[i].lpszName = (char*)CoTaskMemAlloc(names[i].Length() + 1); + if (mapiRecips[i].lpszName) + strcpy((char*)mapiRecips[i].lpszName, names[i].get()); + } + if (!addresses[i].IsEmpty()) { + mapiRecips[i].lpszName = (char*)CoTaskMemAlloc(addresses[i].Length() + 1); + if (mapiRecips[i].lpszName) + strcpy((char*)mapiRecips[i].lpszName, addresses[i].get()); + } + mapiRecips[i].ulRecipClass = mapiRecipClass; + } +} + +char* MsgMapiListContext::ConvertBodyToMapiFormat(nsIMsgDBHdr* hdr) { + const int kBufLen = + 64000; // I guess we only return the first 64K of a message. +#define EMPTY_MESSAGE_LINE(buf) \ + (buf[0] == '\r' || buf[0] == '\n' || buf[0] == '\0') + + nsCOMPtr<nsIMsgFolder> folder; + hdr->GetFolder(getter_AddRefs(folder)); + if (!folder) return nullptr; + + nsCOMPtr<nsIFile> localFile; + folder->GetFilePath(getter_AddRefs(localFile)); + + nsresult rv; + nsCOMPtr<nsIFileInputStream> fileStream = + do_CreateInstance(NS_LOCALFILEINPUTSTREAM_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, nullptr); + + rv = fileStream->Init(localFile, PR_RDONLY, 0664, + false); // just have to read the messages + NS_ENSURE_SUCCESS(rv, nullptr); + + nsCOMPtr<nsILineInputStream> fileLineStream = do_QueryInterface(fileStream); + if (!fileLineStream) return nullptr; + + // ### really want to skip past headers... + uint64_t messageOffset; + uint32_t lineCount; + hdr->GetMessageOffset(&messageOffset); + hdr->GetLineCount(&lineCount); + nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(fileStream); + seekableStream->Seek(PR_SEEK_SET, messageOffset); + bool hasMore = true; + nsAutoCString curLine; + + while (hasMore) // advance past message headers + { + nsresult rv = fileLineStream->ReadLine(curLine, &hasMore); + if (NS_FAILED(rv) || EMPTY_MESSAGE_LINE(curLine)) break; + } + uint32_t msgSize; + hdr->GetMessageSize(&msgSize); + if (msgSize > kBufLen) msgSize = kBufLen - 1; + // this is too big, since it includes the msg hdr size...oh well + char* body = (char*)CoTaskMemAlloc(msgSize + 1); + + if (!body) return nullptr; + int32_t bytesCopied = 0; + for (hasMore = TRUE; lineCount > 0 && hasMore && NS_SUCCEEDED(rv); + lineCount--) { + rv = fileLineStream->ReadLine(curLine, &hasMore); + if (NS_FAILED(rv)) break; + curLine.Append(CRLF); + // make sure we have room left + if (bytesCopied + curLine.Length() < msgSize) { + strcpy(body + bytesCopied, curLine.get()); + bytesCopied += curLine.Length(); + } + } + MOZ_LOG(MAPI, mozilla::LogLevel::Debug, + ("ConvertBodyToMapiFormat size=%x allocated size %x body = %100.100s", + bytesCopied, msgSize + 1, (char*)body)); + body[bytesCopied] = '\0'; // rhp - fix last line garbage... + return body; +} + +//***************************************************************************** +// MSGMAPI API implementation + +static void msg_FreeMAPIFile(lpMapiFileDesc f) { + if (f) { + CoTaskMemFree(f->lpszPathName); + CoTaskMemFree(f->lpszFileName); + } +} + +static void msg_FreeMAPIRecipient(lpMapiRecipDesc rd) { + if (rd) { + if (rd->lpszName) CoTaskMemFree(rd->lpszName); + if (rd->lpszAddress) CoTaskMemFree(rd->lpszAddress); + // CoTaskMemFree(rd->lpEntryID); + } +} + +extern "C" void MSG_FreeMapiMessage(lpMapiMessage msg) { + ULONG i; + + if (msg) { + CoTaskMemFree(msg->lpszSubject); + CoTaskMemFree(msg->lpszNoteText); + CoTaskMemFree(msg->lpszMessageType); + CoTaskMemFree(msg->lpszDateReceived); + CoTaskMemFree(msg->lpszConversationID); + + if (msg->lpOriginator) msg_FreeMAPIRecipient(msg->lpOriginator); + + for (i = 0; i < msg->nRecipCount; i++) + if (&(msg->lpRecips[i]) != nullptr) + msg_FreeMAPIRecipient(&(msg->lpRecips[i])); + + CoTaskMemFree(msg->lpRecips); + + for (i = 0; i < msg->nFileCount; i++) + if (&(msg->lpFiles[i]) != nullptr) msg_FreeMAPIFile(&(msg->lpFiles[i])); + + CoTaskMemFree(msg->lpFiles); + + CoTaskMemFree(msg); + } +} + +extern "C" bool MsgMarkMapiMessageRead(nsIMsgFolder* folder, nsMsgKey key, + bool read) { + bool success = FALSE; + MsgMapiListContext* context = new MsgMapiListContext(); + if (context) { + if (NS_SUCCEEDED(context->OpenDatabase(folder))) { + if (NS_SUCCEEDED(context->MarkRead(key, read))) success = TRUE; + } + delete context; + } + return success; +} + +bool MsgMapiListContext::DeleteMessage(nsMsgKey key) { + if (!m_db) return FALSE; + + if (!IsIMAPHost()) { + nsTArray<nsMsgKey> doomed({key}); + return NS_SUCCEEDED((m_db->DeleteMessages(doomed, nullptr))); + } +#if 0 + else if ( m_folder->GetIMAPFolderInfoMail() ) + { + AutoTArray<nsMsgKey, 1> messageKeys; + messageKeys.AppendElement(key); + + (m_folder->GetIMAPFolderInfoMail())->DeleteSpecifiedMessages(pane, messageKeys, nsMsgKey_None); + m_db->DeleteMessage(key, nullptr, FALSE); + return TRUE; + } +#endif + else { + return FALSE; + } +} + +/* Return TRUE on success, FALSE on failure */ +extern "C" bool MSG_DeleteMapiMessage(nsIMsgFolder* folder, nsMsgKey key) { + bool success = FALSE; + MsgMapiListContext* context = new MsgMapiListContext(); + if (context) { + if (NS_SUCCEEDED(context->OpenDatabase(folder))) { + success = context->DeleteMessage(key); + } + + delete context; + } + + return success; +} diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiImp.h b/comm/mailnews/mapi/mapihook/src/msgMapiImp.h new file mode 100644 index 0000000000..b83f0566a0 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiImp.h @@ -0,0 +1,79 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MSG_MAPI_IMP_H +#define MSG_MAPI_IMP_H + +#include "msgMapi.h" +#include "nspr.h" +#include "nscore.h" +#include "nsISupportsImpl.h" // ThreadSafeAutoRefCnt + +class nsIMsgFolder; +class MsgMapiListContext; + +const CLSID CLSID_CMapiImp = {0x29f458be, + 0x8866, + 0x11d5, + {0xa3, 0xdd, 0x0, 0xb0, 0xd0, 0xf3, 0xba, 0xa7}}; + +// this class implements the MS COM interface nsIMapi that provides the methods +// called by mapi32.dll to perform the mail operations as specified by MAPI. +// These class methods in turn use the Mozilla Mail XPCOM interfaces to do so. +class CMapiImp : public nsIMapi { + public: + // IUnknown + + STDMETHODIMP QueryInterface(const IID& aIid, void** aPpv); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // Interface INsMapi + + STDMETHODIMP Login(unsigned long aUIArg, LPSTR aLogin, LPSTR aPassWord, + unsigned long aFlags, unsigned long* aSessionId); + + STDMETHODIMP SendMail(unsigned long aSession, lpnsMapiMessage aMessage, + unsigned long aFlags, unsigned long aReserved); + + STDMETHODIMP SendDocuments(unsigned long aSession, LPSTR aDelimChar, + LPSTR aFilePaths, LPSTR aFileNames, ULONG aFlags); + + STDMETHODIMP FindNext(unsigned long aSession, unsigned long ulUIParam, + LPSTR lpszMessageType, LPSTR lpszSeedMessageID, + unsigned long flFlags, unsigned long ulReserved, + unsigned char lpszMessageID[64]); + + STDMETHODIMP ReadMail(unsigned long lhSession, unsigned long ulUIParam, + LPSTR lpszMessageID, unsigned long flFlags, + unsigned long ulReserved, lpnsMapiMessage* lppMessage); + STDMETHODIMP DeleteMail(unsigned long lhSession, unsigned long ulUIParam, + LPSTR lpszMessageID, unsigned long flFlags, + unsigned long ulReserved); + STDMETHODIMP SaveMail(unsigned long lhSession, unsigned long ulUIParam, + lpnsMapiMessage lppMessage, unsigned long flFlags, + unsigned long ulReserved, LPSTR lpszMessageID); + + STDMETHODIMP Initialize(); + STDMETHODIMP IsValid(); + STDMETHODIMP IsValidSession(unsigned long aSession); + + STDMETHODIMP SendMailW(unsigned long aSession, lpnsMapiMessageW aMessage, + unsigned long aFlags, unsigned long aReserved); + + STDMETHODIMP Logoff(unsigned long aSession); + STDMETHODIMP CleanUp(); + + CMapiImp(); + virtual ~CMapiImp(); + + LONG InitContext(unsigned long session, MsgMapiListContext** listContext); + nsresult GetDefaultInbox(nsIMsgFolder** inboxFolder); + + private: + PRLock* m_Lock; + mozilla::ThreadSafeAutoRefCnt m_cRef; +}; + +#endif // MSG_MAPI_IMP_H diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiMain.cpp b/comm/mailnews/mapi/mapihook/src/msgMapiMain.cpp new file mode 100644 index 0000000000..0e8d4cacac --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiMain.cpp @@ -0,0 +1,248 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <mapidefs.h> +#include <mapi.h> + +#include "msgCore.h" +#include "nsComposeStrings.h" +#include "msgMapiMain.h" +#include "nsCOMPtr.h" + +nsMAPIConfiguration* nsMAPIConfiguration::m_pSelfRef = nullptr; +uint32_t nsMAPIConfiguration::session_generator = 0; +uint32_t nsMAPIConfiguration::sessionCount = 0; + +nsMAPIConfiguration* nsMAPIConfiguration::GetMAPIConfiguration() { + if (m_pSelfRef == nullptr) m_pSelfRef = new nsMAPIConfiguration(); + + return m_pSelfRef; +} + +nsMAPIConfiguration::nsMAPIConfiguration() : m_nMaxSessions(MAX_SESSIONS) { + m_Lock = PR_NewLock(); +} + +nsMAPIConfiguration::~nsMAPIConfiguration() { + if (m_Lock) PR_DestroyLock(m_Lock); +} + +void nsMAPIConfiguration::OpenConfiguration() { + // No. of max. sessions is set to MAX_SESSIONS. In future + // if it is decided to have configuration (registry) + // parameter, this function can be used to set the + // max sessions; + + return; +} + +int16_t nsMAPIConfiguration::RegisterSession( + uint32_t aHwnd, const nsCString& aUserName, const nsCString& aPassword, + bool aForceDownLoad, bool aNewSession, uint32_t* aSession, + const char* aIdKey) { + int16_t nResult = 0; + uint32_t n_SessionId = 0; + + PR_Lock(m_Lock); + + // Check whether max sessions is exceeded + + if (sessionCount >= m_nMaxSessions) { + PR_Unlock(m_Lock); + return -1; + } + + if (!aUserName.IsEmpty()) n_SessionId = m_ProfileMap.Get(aUserName); + + // try to share a session; if not create a session + if (n_SessionId > 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(n_SessionId, &pTemp); + if (pTemp != nullptr) { + pTemp->IncrementSession(); + *aSession = n_SessionId; + nResult = 1; + } + } else if (aNewSession || + n_SessionId == 0) // checking for n_SessionId is a concession + { + // create a new session; if new session is specified OR there is no session + session_generator++; + + // I don't think there will be (2 power 32) sessions alive + // in a cycle. This is an assumption. + if (session_generator == 0) session_generator++; + m_SessionMap.InsertOrUpdate( + session_generator, + mozilla::MakeUnique<nsMAPISession>(aHwnd, aUserName, aPassword, + aForceDownLoad, aIdKey)); + if (!aUserName.IsEmpty()) + m_ProfileMap.InsertOrUpdate(aUserName, session_generator); + *aSession = session_generator; + sessionCount++; + nResult = 1; + } + + PR_Unlock(m_Lock); + return nResult; +} + +bool nsMAPIConfiguration::UnRegisterSession(uint32_t aSessionID) { + bool bResult = false; + + PR_Lock(m_Lock); + + if (aSessionID != 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(aSessionID, &pTemp); + + if (pTemp != nullptr) { + if (pTemp->DecrementSession() == 0) { + if (pTemp->m_pProfileName.get() != nullptr) + m_ProfileMap.Remove(pTemp->m_pProfileName); + m_SessionMap.Remove(aSessionID); + sessionCount--; + bResult = true; + } + } + } + + PR_Unlock(m_Lock); + return bResult; +} + +bool nsMAPIConfiguration::IsSessionValid(uint32_t aSessionID) { + if (aSessionID == 0) return false; + bool retValue = false; + PR_Lock(m_Lock); + retValue = m_SessionMap.Get(aSessionID, NULL); + PR_Unlock(m_Lock); + return retValue; +} + +char16_t* nsMAPIConfiguration::GetPassword(uint32_t aSessionID) { + char16_t* pResult = nullptr; + + PR_Lock(m_Lock); + + if (aSessionID != 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(aSessionID, &pTemp); + + if (pTemp) pResult = pTemp->GetPassword(); + } + PR_Unlock(m_Lock); + return pResult; +} + +void* nsMAPIConfiguration::GetMapiListContext(uint32_t aSessionID) { + void* pResult = nullptr; + + PR_Lock(m_Lock); + + if (aSessionID != 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(aSessionID, &pTemp); + if (pTemp) pResult = pTemp->GetMapiListContext(); + } + + PR_Unlock(m_Lock); + return pResult; +} + +void nsMAPIConfiguration::SetMapiListContext(uint32_t aSessionID, + void* mapiListContext) { + PR_Lock(m_Lock); + + if (aSessionID != 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(aSessionID, &pTemp); + if (pTemp) pTemp->SetMapiListContext(mapiListContext); + } + + PR_Unlock(m_Lock); +} + +void nsMAPIConfiguration::GetIdKey(uint32_t aSessionID, nsCString& aKey) { + PR_Lock(m_Lock); + if (aSessionID != 0) { + nsMAPISession* pTemp = nullptr; + m_SessionMap.Get(aSessionID, &pTemp); + if (pTemp) pTemp->GetIdKey(aKey); + } + PR_Unlock(m_Lock); + return; +} + +// util func +HRESULT nsMAPIConfiguration::GetMAPIErrorFromNSError(nsresult res) { + HRESULT hr = SUCCESS_SUCCESS; + + if (NS_SUCCEEDED(res)) return hr; + + // if failure return the related MAPI failure code + switch (res) { + case NS_MSG_NO_RECIPIENTS: + hr = MAPI_E_BAD_RECIPTYPE; + break; + case NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS: + case NS_ERROR_COULD_NOT_GET_SENDERS_IDENTITY: + // Something went wrong with the sender. There's no error we can map to + // so we use a general error, see: + // https://msdn.microsoft.com/en-us/library/hh802867(v=vs.85).aspx + hr = MAPI_E_FAILURE; + break; + case NS_ERROR_SMTP_AUTH_FAILURE: + case NS_ERROR_SMTP_AUTH_GSSAPI: + case NS_ERROR_SMTP_AUTH_MECH_NOT_SUPPORTED: + case NS_ERROR_SMTP_AUTH_CHANGE_ENCRYPT_TO_PLAIN_NO_SSL: + case NS_ERROR_SMTP_AUTH_CHANGE_ENCRYPT_TO_PLAIN_SSL: + case NS_ERROR_SMTP_AUTH_CHANGE_PLAIN_TO_ENCRYPT: + hr = MAPI_E_LOGIN_FAILURE; + break; + case NS_MSG_UNABLE_TO_OPEN_FILE: + case NS_MSG_UNABLE_TO_OPEN_TMP_FILE: + case NS_MSG_COULDNT_OPEN_FCC_FOLDER: + case NS_ERROR_FILE_INVALID_PATH: + hr = MAPI_E_ATTACHMENT_OPEN_FAILURE; + break; + case NS_ERROR_FILE_NOT_FOUND: + hr = MAPI_E_ATTACHMENT_NOT_FOUND; + break; + case NS_MSG_ERROR_WRITING_FILE: + case NS_MSG_UNABLE_TO_SAVE_TEMPLATE: + case NS_MSG_UNABLE_TO_SAVE_DRAFT: + hr = MAPI_E_ATTACHMENT_WRITE_FAILURE; + break; + default: + hr = MAPI_E_FAILURE; + break; + } + + return hr; +} + +nsMAPISession::nsMAPISession(uint32_t aHwnd, const nsCString& aUserName, + const nsCString& aPassword, bool aForceDownLoad, + const char* aKey) + : m_nShared(1), m_pIdKey(aKey) { + m_listContext = NULL; + m_pProfileName = aUserName; + m_pPassword = aPassword; +} + +nsMAPISession::~nsMAPISession() {} + +uint32_t nsMAPISession::IncrementSession() { return ++m_nShared; } + +uint32_t nsMAPISession::DecrementSession() { return --m_nShared; } + +uint32_t nsMAPISession::GetSessionCount() { return m_nShared; } + +char16_t* nsMAPISession::GetPassword() { return (char16_t*)m_pPassword.get(); } + +void nsMAPISession::GetIdKey(nsCString& aKey) { + aKey = m_pIdKey; + return; +} diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiMain.h b/comm/mailnews/mapi/mapihook/src/msgMapiMain.h new file mode 100644 index 0000000000..fcca6ca541 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiMain.h @@ -0,0 +1,80 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MSG_MAPI_MAIN_H_ +#define MSG_MAPI_MAIN_H_ + +#define MAX_NAME_LEN 256 +#define MAX_PW_LEN 256 +#define MAX_SESSIONS 50 +#define MAPI_SENDCOMPLETE_EVENT "SendCompletionEvent" + +#define MAPI_PROPERTIES_CHROME "chrome://messenger-mapi/locale/mapi.properties" +#define PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND "mapi.blind-send.warn" +#define PREF_MAPI_BLIND_SEND_ENABLED "mapi.blind-send.enabled" + +#include "nspr.h" +#include "nsTHashMap.h" +#include "nsClassHashtable.h" +#include "nsString.h" + +class nsMAPISession; + +class nsMAPIConfiguration { + private: + static uint32_t session_generator; + static uint32_t sessionCount; + static nsMAPIConfiguration* m_pSelfRef; + PRLock* m_Lock; + uint32_t m_nMaxSessions; + + nsTHashMap<nsCStringHashKey, uint32_t> m_ProfileMap; + nsClassHashtable<nsUint32HashKey, nsMAPISession> m_SessionMap; + nsMAPIConfiguration(); + ~nsMAPIConfiguration(); + + public: + static nsMAPIConfiguration* GetMAPIConfiguration(); + void OpenConfiguration(); + int16_t RegisterSession(uint32_t aHwnd, const nsCString& aUserName, + const nsCString& aPassword, bool aForceDownLoad, + bool aNewSession, uint32_t* aSession, + const char* aIdKey); + bool IsSessionValid(uint32_t aSessionID); + bool UnRegisterSession(uint32_t aSessionID); + char16_t* GetPassword(uint32_t aSessionID); + void GetIdKey(uint32_t aSessionID, nsCString& aKey); + void* GetMapiListContext(uint32_t aSessionID); + void SetMapiListContext(uint32_t aSessionID, void* mapiListContext); + + // a util func + static HRESULT GetMAPIErrorFromNSError(nsresult res); +}; + +class nsMAPISession { + friend class nsMAPIConfiguration; + + private: + uint32_t m_nShared; + nsCString m_pIdKey; + nsCString m_pProfileName; + nsCString m_pPassword; + void* m_listContext; // used by findNext + + public: + nsMAPISession(uint32_t aHwnd, const nsCString& aUserName, + const nsCString& aPassword, bool aForceDownLoad, + const char* aKey); + uint32_t IncrementSession(); + uint32_t DecrementSession(); + uint32_t GetSessionCount(); + char16_t* GetPassword(); + void GetIdKey(nsCString& aKey); + ~nsMAPISession(); + // For enumerating Messages... + void SetMapiListContext(void* listContext) { m_listContext = listContext; } + void* GetMapiListContext() { return m_listContext; } +}; + +#endif // MSG_MAPI_MAIN_H_ diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiSupport.cpp b/comm/mailnews/mapi/mapihook/src/msgMapiSupport.cpp new file mode 100644 index 0000000000..9fd1655526 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiSupport.cpp @@ -0,0 +1,101 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "nsCOMPtr.h" +#include "objbase.h" +#include "nsISupports.h" + +#include "mozilla/ModuleUtils.h" +#include "mozilla/Services.h" +#include "nsIObserverService.h" +#include "Registry.h" +#include "msgMapiSupport.h" + +#include "msgMapiImp.h" + +/** Implementation of the nsIMapiSupport interface. + * Use standard implementation of nsISupports stuff. + */ + +NS_IMPL_ISUPPORTS(nsMapiSupport, nsIMapiSupport, nsIObserver) + +NS_IMETHODIMP +nsMapiSupport::Observe(nsISupports* aSubject, const char* aTopic, + const char16_t* aData) { + nsresult rv = NS_OK; + + if (!strcmp(aTopic, "profile-after-change")) return InitializeMAPISupport(); + + if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) + return ShutdownMAPISupport(); + + nsCOMPtr<nsIObserverService> observerService = + mozilla::services::GetObserverService(); + NS_ENSURE_TRUE(observerService, NS_ERROR_UNEXPECTED); + + rv = observerService->AddObserver(this, "profile-after-change", false); + if (NS_FAILED(rv)) return rv; + + rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); + if (NS_FAILED(rv)) return rv; + + return rv; +} + +nsMapiSupport::nsMapiSupport() : m_dwRegister(0), m_nsMapiFactory(nullptr) {} + +nsMapiSupport::~nsMapiSupport() {} + +NS_IMETHODIMP +nsMapiSupport::InitializeMAPISupport() { + ::OleInitialize(nullptr); + + if (m_nsMapiFactory == + nullptr) // No Registering if already done. Sanity Check!! + { + m_nsMapiFactory = new CMapiFactory(); + + if (m_nsMapiFactory != nullptr) { + HRESULT hr = ::CoRegisterClassObject(CLSID_CMapiImp, m_nsMapiFactory, + CLSCTX_LOCAL_SERVER, + REGCLS_MULTIPLEUSE, &m_dwRegister); + + if (FAILED(hr)) { + m_nsMapiFactory->Release(); + m_nsMapiFactory = nullptr; + return NS_ERROR_FAILURE; + } + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsMapiSupport::ShutdownMAPISupport() { + if (m_dwRegister != 0) ::CoRevokeClassObject(m_dwRegister); + + if (m_nsMapiFactory != nullptr) { + m_nsMapiFactory->Release(); + m_nsMapiFactory = nullptr; + } + + ::OleUninitialize(); + + return NS_OK; +} + +NS_IMETHODIMP +nsMapiSupport::RegisterServer() { + // TODO: Figure out what kind of error propagation to pass back + ::RegisterServer(CLSID_CMapiImp, L"Mozilla MAPI", L"MozillaMapi", + L"MozillaMapi.1"); + return NS_OK; +} + +NS_IMETHODIMP +nsMapiSupport::UnRegisterServer() { + // TODO: Figure out what kind of error propagation to pass back + ::UnregisterServer(CLSID_CMapiImp, L"MozillaMapi", L"MozillaMapi.1"); + return NS_OK; +} diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiSupport.h b/comm/mailnews/mapi/mapihook/src/msgMapiSupport.h new file mode 100644 index 0000000000..af17ea637c --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiSupport.h @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MSG_MAPI_SUPPORT_H_ +#define MSG_MAPI_SUPPORT_H_ + +#include "nsIObserver.h" +#include "nsIMapiSupport.h" +#include "msgMapiFactory.h" + +#define NS_IMAPISUPPORT_CID \ + { \ + 0x8967fed2, 0xc8bb, 0x11d5, { \ + 0xa3, 0xe9, 0x00, 0xb0, 0xd0, 0xf3, 0xba, 0xa7 \ + } \ + } + +class nsMapiSupport : public nsIMapiSupport, public nsIObserver { + public: + nsMapiSupport(); + + // Declare all interface methods we must implement. + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSIOBSERVER + NS_DECL_NSIMAPISUPPORT + + private: + virtual ~nsMapiSupport(); + + DWORD m_dwRegister; + CMapiFactory* m_nsMapiFactory; +}; + +#endif // MSG_MAPI_SUPPORT_H_ diff --git a/comm/mailnews/mapi/test/moz.build b/comm/mailnews/mapi/test/moz.build new file mode 100644 index 0000000000..6b37fdbe09 --- /dev/null +++ b/comm/mailnews/mapi/test/moz.build @@ -0,0 +1,6 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPCSHELL_TESTS_MANIFESTS += ["unit/xpcshell.ini"] diff --git a/comm/mailnews/mapi/test/unit/head_mapi.js b/comm/mailnews/mapi/test/unit/head_mapi.js new file mode 100644 index 0000000000..d80b7da173 --- /dev/null +++ b/comm/mailnews/mapi/test/unit/head_mapi.js @@ -0,0 +1,243 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var { MailServices } = ChromeUtils.import( + "resource:///modules/MailServices.jsm" +); +var { ctypes } = ChromeUtils.importESModule( + "resource://gre/modules/ctypes.sys.mjs" +); +var { localAccountUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/LocalAccountUtils.jsm" +); + +// Ensure the profile directory is set up. +do_get_profile(); + +// Import fakeserver +var { nsMailServer } = ChromeUtils.import( + "resource://testing-common/mailnews/Maild.jsm" +); +var { SmtpDaemon, SMTP_RFC2821_handler } = ChromeUtils.import( + "resource://testing-common/mailnews/Smtpd.jsm" +); + +var SMTP_PORT = 1024 + 120; +var POP3_PORT = 1024 + 121; + +// Setup the daemon and server +function setupServerDaemon(handler) { + if (!handler) { + handler = function (d) { + return new SMTP_RFC2821_handler(d); + }; + } + let daemon = new SmtpDaemon(); + let server = new nsMailServer(handler, daemon); + return [daemon, server]; +} + +function getBasicSmtpServer() { + // We need to have a default account for MAPI. + localAccountUtils.loadLocalMailAccount(); + let incoming = localAccountUtils.create_incoming_server( + "pop3", + POP3_PORT, + "user", + "password" + ); + let server = localAccountUtils.create_outgoing_server( + SMTP_PORT, + "user", + "password" + ); + // We also need to have a working identity, including an email address. + let account = MailServices.accounts.FindAccountForServer(incoming); + localAccountUtils.associate_servers(account, server, true); + let identity = account.defaultIdentity; + identity.email = "tinderbox@tinderbox.invalid"; + MailServices.accounts.defaultAccount = account; + + return server; +} + +/** + * Returns a structure allowing access to all of the Simple MAPI functions. + * The functions do not have the MAPI prefix on the variables. Also added are + * the three structures needed for MAPI. + */ +function loadMAPILibrary() { + // This is a hack to load the MAPI support in the current environment, as the + // profile-after-change event is never sent out. + var gMapiSupport = Cc["@mozilla.org/mapisupport;1"].getService( + Ci.nsIObserver + ); + gMapiSupport.observe(null, "profile-after-change", null); + // Set some preferences to make MAPI (particularly blind MAPI, aka work + // without a dialog box) work properly. + Services.prefs.setBoolPref("mapi.blind-send.enabled", true); + Services.prefs.setBoolPref("mapi.blind-send.warn", false); + + // The macros that are used in the definitions + let WINAPI = ctypes.winapi_abi; + let ULONG = ctypes.unsigned_long; + let LHANDLE = ULONG.ptr; + let LPSTR = ctypes.char.ptr; + let LPVOID = ctypes.voidptr_t; + let FLAGS = ctypes.unsigned_long; + + // Define all of the MAPI structs we need to use. + let functionData = {}; + functionData.MapiRecipDesc = new ctypes.StructType("gMapi.MapiRecipDesc", [ + { ulReserved: ULONG }, + { ulRecipClass: ULONG }, + { lpszName: LPSTR }, + { lpszAddress: LPSTR }, + { ulEIDSize: ULONG }, + { lpEntryID: LPVOID }, + ]); + let lpMapiRecipDesc = functionData.MapiRecipDesc.ptr; + + functionData.MapiFileDesc = new ctypes.StructType("gMapi.MapiFileDesc", [ + { ulReserved: ULONG }, + { flFlags: ULONG }, + { nPosition: ULONG }, + { lpszPathName: LPSTR }, + { lpszFileName: LPSTR }, + { lpFileType: LPVOID }, + ]); + let lpMapiFileDesc = functionData.MapiFileDesc.ptr; + + functionData.MapiMessage = new ctypes.StructType("gMapi.MapiMessage", [ + { ulReserved: ULONG }, + { lpszSubject: LPSTR }, + { lpszNoteText: LPSTR }, + { lpszMessageType: LPSTR }, + { lpszDateReceived: LPSTR }, + { lpszConversationID: LPSTR }, + { flFlags: FLAGS }, + { lpOriginator: lpMapiRecipDesc }, + { nRecipCount: ULONG }, + { lpRecips: lpMapiRecipDesc }, + { nFileCount: ULONG }, + { lpFiles: lpMapiFileDesc }, + ]); + let lpMapiMessage = functionData.MapiMessage.ptr; + + // Load the MAPI library. We're using our definition instead of the global + // MAPI definition. + let mapi = ctypes.open("mozMapi32.dll"); + + // Load the MAPI functions, + // see https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Declaring_types + // for details. The first three parameters of the declaration are name, API flag and output value. + // This is followed by input parameters. + + // MAPIAddress is not supported. + + functionData.DeleteMail = mapi.declare( + "MAPIDeleteMail", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + LPSTR, // lpszMessageID + FLAGS, // flFlags + ULONG + ); // ulReserved + + // MAPIDetails is not supported. + + functionData.FindNext = mapi.declare( + "MAPIFindNext", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + LPSTR, // lpszMessageType + LPSTR, // lpszSeedMessageID + FLAGS, // flFlags + ULONG, // ulReserved + LPSTR + ); // lpszMessageID + + functionData.FreeBuffer = mapi.declare( + "MAPIFreeBuffer", + WINAPI, + ULONG, + LPVOID + ); // pv + + functionData.Logoff = mapi.declare( + "MAPILogoff", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + FLAGS, // flFlags + ULONG + ); // ulReserved + + functionData.Logon = mapi.declare( + "MAPILogon", + WINAPI, + ULONG, + ULONG.ptr, // ulUIParam + LPSTR, // lpszProfileName + LPSTR, // lpszPassword + FLAGS, // flFlags + ULONG, // ulReserved + LHANDLE.ptr + ); // lplhSession + + functionData.ReadMail = mapi.declare( + "MAPIReadMail", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + LPSTR, // lpszMessageID + FLAGS, // flFlags + ULONG, // ulReserved + lpMapiMessage.ptr + ); // *lppMessage + + functionData.ResolveName = mapi.declare( + "MAPIResolveName", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + LPSTR, // lpszName + FLAGS, // flFlags + ULONG, // ulReserved + lpMapiRecipDesc.ptr + ); // *lppRecip + + // MAPISaveMail is not supported. + + functionData.SendDocuments = mapi.declare( + "MAPISendDocuments", + WINAPI, + ULONG, + ULONG.ptr, // ulUIParam + LPSTR, // lpszDelimChar + LPSTR, // lpszFilePaths + LPSTR, // lpszFileNames + ULONG + ); // ulReserved + + functionData.SendMail = mapi.declare( + "MAPISendMail", + WINAPI, + ULONG, + LHANDLE, // lhSession + ULONG.ptr, // ulUIParam + lpMapiMessage, // lpMessage + FLAGS, // flFlags + ULONG + ); // ulReserved + + return functionData; +} diff --git a/comm/mailnews/mapi/test/unit/tail_mapi.js b/comm/mailnews/mapi/test/unit/tail_mapi.js new file mode 100644 index 0000000000..f64ae61317 --- /dev/null +++ b/comm/mailnews/mapi/test/unit/tail_mapi.js @@ -0,0 +1 @@ +load("../../../resources/mailShutdown.js"); diff --git a/comm/mailnews/mapi/test/unit/test_mapisendmail.js b/comm/mailnews/mapi/test/unit/test_mapisendmail.js new file mode 100644 index 0000000000..5dc480af9e --- /dev/null +++ b/comm/mailnews/mapi/test/unit/test_mapisendmail.js @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var { ctypes } = ChromeUtils.importESModule( + "resource://gre/modules/ctypes.sys.mjs" +); +var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm"); +var { mailTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/MailTestUtils.jsm" +); + +// Set up an SMTP server and the MAPI daemon. +getBasicSmtpServer(); +let [daemon, server] = setupServerDaemon(); +server.start(SMTP_PORT); +let mapi = loadMAPILibrary(); + +registerCleanupFunction(() => { + server.stop(); +}); + +/** + * Construct a MapiMessage, then send through MAPI. + * + * @param {boolean} offline - Switch to offline mode if true. + */ +function testMapiSendMail(offline) { + Services.io.offline = offline; + + // Build a message using the MAPI interface. + let message = new mapi.MapiMessage(); + message.lpszSubject = ctypes.char.array()(`Hello, MAPI offline=${offline}!`); + message.lpszNoteText = ctypes.char.array()("I successfully sent a message!"); + message.lpszMessageType = ctypes.char.array()(""); + + let file = do_get_file("../../../compose/test/unit/data/message1.eml"); + let attachment = new mapi.MapiFileDesc(); + attachment.lpszFileName = ctypes.char.array()(file.leafName); + attachment.lpszPathName = ctypes.char.array()(file.path); + message.nFileCount = 1; + message.lpFiles = attachment.address(); + + let recipient = new mapi.MapiRecipDesc(); + recipient.ulRecipClass = 1; /* MAPI_TO */ + recipient.lpszName = ctypes.char.array()("John Doe"); + recipient.lpszAddress = ctypes.char.array()("SMTP:john.doe@example.com"); + message.nRecipCount = 1; + message.lpRecips = recipient.address(); + + // Use MAPISendMail to send this message. + mapi.SendMail( + null /* No session */, + null /* No HWND */, + message.address(), + 0x2 /* MAPI_NEW_SESSION */, + 0 + ); +} + +/** + * Test that when we're online, the message can be sent correctly to the SMTP + * server. + */ +add_task(function mapiSendMailOnline() { + server.resetTest(); + testMapiSendMail(false); + + // Check that the post has the correct information. + let [headers, body] = MimeParser.extractHeadersAndBody(daemon.post); + Assert.equal(headers.get("from")[0].email, "tinderbox@tinderbox.invalid"); + Assert.equal(headers.get("to")[0].email, "john.doe@example.com"); + Assert.equal(headers.get("subject"), "Hello, MAPI offline=false!"); + Assert.ok(body.includes("I successfully sent a message!")); + Assert.ok(body.includes("this email is in dos format")); +}); + +/** + * Test that when we're offline, the message can be saved correctly to the Outbox. + */ +add_task(function mapiSendMailOffline() { + server.resetTest(); + testMapiSendMail(true); + + let outbox = localAccountUtils.rootFolder.getChildNamed("Outbox"); + let msgData = mailTestUtils.loadMessageToString( + outbox, + mailTestUtils.firstMsgHdr(outbox) + ); + // Check that the post has the correct information. + let [headers, body] = MimeParser.extractHeadersAndBody(msgData); + Assert.equal(headers.get("from")[0].email, "tinderbox@tinderbox.invalid"); + Assert.equal(headers.get("to")[0].email, "john.doe@example.com"); + Assert.equal(headers.get("subject"), "Hello, MAPI offline=true!"); + Assert.ok(body.includes("I successfully sent a message!")); + Assert.ok(body.includes("this email is in dos format")); +}); diff --git a/comm/mailnews/mapi/test/unit/xpcshell.ini b/comm/mailnews/mapi/test/unit/xpcshell.ini new file mode 100644 index 0000000000..8d4fe504ab --- /dev/null +++ b/comm/mailnews/mapi/test/unit/xpcshell.ini @@ -0,0 +1,7 @@ +[DEFAULT] +head = head_mapi.js +tail = tail_mapi.js +run-sequentially = Need to use well-known port for SMTP. + +[test_mapisendmail.js] +skip-if = true # Not yet enabled, see bug 1526807. |