' ########################################################################################
' Microsoft Windows
' File: MAPISPI.inc
' Contents: Defines the calls and structures exchanged between MAPI or the spooler and the
' MAPI service providers.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_MAPISPI_PBI)
#DEFINE PBX_MAPISPI_PBI
%EQUATE `MAPISPI_INC = 1
#INCLUDE ONCE "Legacy/System/MAPIX.inc"
'/* 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.
' */
%EQUATE `CURRENT_SPI_VERSION = &H00010010&
'/* 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.
' */
%EQUATE `PDK1_SPI_VERSION = &H00010000& ' /* 0.1.0 MAPI PDK1 Spring 1993 */
%EQUATE `PDK2_SPI_VERSION = &H00010008& ' /* 0.1.8 MAPI PDK2 Spring 1994 */
%EQUATE `PDK3_SPI_VERSION = &H00010010& ' /* 0.1.16 MAPI PDK3 Fall 1994 */
'/*
' * Forward declaration of interface pointers specific to the service
' * provider interface.
' */
'/* IMAPISupport Interface -------------------------------------------------- */
'/* Notification key structure for the MAPI notification engine */
' // Size = 8 bytes
TYPE NOTIFKEY DWORD
 cb AS DWORD ' ULONG /* How big the key is */
 ab(%MAPI_DIM - 1) AS BYTE ' BYTE /* Key contents */ [variable-length array]
END TYPE
'/* For Subscribe() */
%EQUATE `NOTIFY_SYNC = &H40000000
'/* For Notify() */
%EQUATE `NOTIFY_CANCELED = &H80000000
'/* From the Notification Callback function (well, this is really a ulResult) */
%EQUATE `CALLBACK_DISCONTINUE = &H80000000
'/* For Transport's SpoolerNotify() */
%EQUATE `NOTIFY_NEWMAIL = &H00000001
%EQUATE `NOTIFY_READYTOSEND = &H00000002
%EQUATE `NOTIFY_SENTDEFERRED = &H00000004
%EQUATE `NOTIFY_CRITSEC = &H00001000
%EQUATE `NOTIFY_NONCRIT = &H00002000
%EQUATE `NOTIFY_CONFIG_CHANGE = &H00004000
%EQUATE `NOTIFY_CRITICAL_ERROR = &H10000000
'/* For Message Store's SpoolerNotify() */
%EQUATE `NOTIFY_NEWMAIL_RECEIVED = &H20000000
'/* For ModifyStatusRow() */
%EQUATE `STATUSROW_UPDATE = &H10000000
'/* For IStorageFromStream() */
%EQUATE `STGSTRM_RESET = &H00000000
%EQUATE `STGSTRM_CURRENT = &H10000000
%EQUATE `STGSTRM_MODIFY = &H00000002
%EQUATE `STGSTRM_CREATE = &H00001000
'/* For GetOneOffTable() */
'/****** MAPI_UNICODE ((ULONG) 0x80000000) */
'/* For CreateOneOff() */
'/****** MAPI_UNICODE ((ULONG) 0x80000000) */
'/****** MAPI_SEND_NO_RICH_INFO ((ULONG) 0x00010000) */
'/* For ReadReceipt() */
%EQUATE `MAPI_NON_READ = &H00000001
'/* For DoConfigPropSheet() */
'/****** MAPI_UNICODE ((ULONG) 0x80000000) */
'/* Preprocessor calls: */
'/* PreprocessMessage, first ordinal in RegisterPreprocessor(). */
DECLARE FUNCTION PreprocessMessage LIB "mapi32.dll" ALIAS "PreprocessMessage" ( BYVAL lpvSession AS IUnknown , BYVAL lpMessage AS IMessage , BYVAL lpAdrBook AS IAddrBook , BYVAL lpFolder AS IMAPIFolder , BYVAL AllocateBuffer AS QUAD , BYVAL AllocateMore AS QUAD , BYVAL FreeBuffer AS QUAD , BYREF lpcOutbound AS QUAD , BYREF lpppMessage AS IMessage , BYREF lppRecipList AS QUAD ) AS LONG
'/* RemovePreprocessInfo, second ordinal in RegisterPreprocessor(). */
DECLARE FUNCTION RemovePreprocessInfo LIB "mapi32.dll" ALIAS "RemovePreprocessInfo" ( BYVAL lpMessage AS IMessage ) AS LONG
'/* Function pointer for GetReleaseInfo */
' ========================================================================================
' IMAPISupport interface
' $IID_IMAPISupport = GUID$("{0002030F-0000-0000-C000-000000000046}")
' The IMAPISupport interface provides implementations for tasks that are commonly
' performed by service providers and message service entry point functions. Service
' providers receive a pointer to their support object when MAPI calls their provider
' object's logon method; message services receive their support object pointer in the call
' to their entry point function.
' ========================================================================================
INTERFACE IMAPISupport $IID_IMAPISupport
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetLastError ( ' VTable offset = 12
 BYVAL hResult AS LONG
 , BYVAL ulFlags AS DWORD
 , BYREF lppMAPIError AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetMemAllocRoutines ( ' VTable offset = 16
 BYREF lpAllocateBuffer AS DWORD
 , BYREF lpAllocateMore AS DWORD
 , BYREF lpFreeBuffer AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Subscribe ( ' VTable offset = 20
 BYVAL lpKey AS DWORD
 , BYVAL ulEventMask AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYVAL lpAdviseSink AS IMAPIAdviseSink
 , BYREF lpulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Unsubscribe ( ' VTable offset = 24
 BYVAL ulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Notify ( ' VTable offset = 28
 BYVAL lpKey AS NOTIFKEY PTR
 , BYVAL cNotification AS DWORD
 , BYREF lpNotifications AS NOTIFICATION
 , BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ModifyStatusRow ( ' VTable offset = 32
 BYVAL cValues AS DWORD
 , BYVAL lpColumnVals AS SPropValue PTR
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenProfileSection ( ' VTable offset = 36
 BYREF lpUid AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lppProfileObj AS IProfSect
 ) AS LONG
 ' =====================================================================================
 METHOD RegisterPreprocessor ( ' VTable offset = 40
 BYREF lpMuid AS GUID
 , BYREF lpszAdrType AS ASCIIZ
 , BYREF lpszDLLName AS ASCIIZ
 , BYREF lpszPreprocess AS ASCIIZ
 , BYREF lpszRemovePreprocessInfo AS ASCIIZ
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD NewUID ( ' VTable offset = 44
 BYREF lpMuid AS GUID
 ) AS LONG
 ' =====================================================================================
 METHOD MakeInvalid ( ' VTable offset = 48
 BYVAL ulFlags AS DWORD
 , BYVAL lpObject AS DWORD
 , BYVAL ulRefCount AS DWORD
 , BYVAL cMethods AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SpoolerYield ( ' VTable offset = 52
 BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SpoolerNotify ( ' VTable offset = 56
 BYVAL ulFlags AS DWORD
 , BYVAL lpvData AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CreateOneOff ( ' VTable offset = 60
 BYREF lpszName AS ASCIIZ
 , BYREF lpszAdrType AS ASCIIZ
 , BYREF lpszAddress AS ASCIIZ
 , BYVAL ulFlags AS DWORD
 , BYREF lpcbEntryID AS DWORD
 , BYREF lppEntryID AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetProviderUID ( ' VTable offset = 64
 BYREF lpProviderID AS GUID
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CompareEntryIDs ( ' VTable offset = 68
 BYVAL cbEntryID1 AS DWORD
 , BYVAL lpEntryID1 AS ENTRYID PTR
 , BYVAL cbEntryID2 AS DWORD
 , BYVAL lpEntryID2 AS ENTRYID PTR
 , BYVAL ulCompareFlags AS DWORD
 , BYREF lpulResult AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenTemplateID ( ' VTable offset = 72
 BYVAL cbTemplateID AS DWORD
 , BYVAL lpTemplateID AS ENTRYID PTR
 , BYVAL ulTemplateFlags AS DWORD
 , BYVAL lpMAPIPropData AS IUnknown
 , BYREF lpInterface AS GUID
 , BYREF lppMAPIPropNew AS IMAPIProp
 , BYVAL lpMAPIPropSibling AS IMAPIProp
 ) AS LONG
 ' =====================================================================================
 METHOD OpenEntry ( ' VTable offset = 76
 BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYREF lpInterface AS GUID
 , BYVAL ulOpenFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppUnk AS IUnknown
 ) AS LONG
 ' =====================================================================================
 METHOD GetOneOffTable ( ' VTable offset = 80
 BYVAL ulFlags AS DWORD
 , BYREF lppTable AS IMAPITable
 ) AS LONG
 ' =====================================================================================
 METHOD Address ( ' VTable offset = 84
 BYREF lpulUIParam AS DWORD
 , BYREF lpAdrParms AS ADRPARM
 , BYVAL lppAdrList AS ADRLIST PTR
 ) AS LONG
 ' =====================================================================================
 METHOD Details ( ' VTable offset = 88
 BYREF lpulUIParam AS DWORD
 , BYVAL lpfnDismiss AS DWORD
 , BYVAL lpvDismissContext AS DWORD
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYVAL lpfButtonCallback AS DWORD
 , BYVAL lpvButtonContext AS DWORD
 , BYVAL lpszButtonText AS DWORD
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD NewEntry ( ' VTable offset = 92
 BYVAL ulUIParam AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYVAL cbEIDContainer AS DWORD
 , BYVAL lpEIDContainer AS ENTRYID PTR
 , BYVAL cbEIDNewEntryTpl AS DWORD
 , BYVAL lpEIDNewEntryTpl AS ENTRYID PTR
 , BYREF lpcbEIDNewEntry AS DWORD
 , BYREF lppEIDNewEntry AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD DoConfigPropsheet ( ' VTable offset = 96
 BYVAL ulUIParam AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYREF lpszTitle AS ASCIIZ
 , BYVAL lpDisplayTable AS IMAPITable
 , BYVAL lpConfigData AS IMAPIProp
 , BYVAL ulTopPage AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CopyMessages ( ' VTable offset = 100
 BYREF lpSrcInterface AS GUID
 , BYVAL lpSrcFolder AS DWORD
 , BYVAL lpMsgList AS ENTRYLIST PTR
 , BYREF lpDestInterface AS GUID
 , BYVAL lpDestFolder AS DWORD
 , BYVAL ulUIParam AS DWORD
 , BYVAL lpProgress AS IMAPIProgress
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CopyFolder ( ' VTable offset = 104
 BYREF lpSrcInterface AS GUID
 , BYVAL lpSrcFolder AS DWORD
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYREF lpDestInterface AS GUID
 , BYVAL lpDestFolder AS DWORD
 , BYREF lszNewFolderName AS ASCIIZ
 , BYVAL ulUIParam AS DWORD
 , BYVAL lpProgress AS IMAPIProgress
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD DoCopyTo ( ' VTable offset = 108
 BYREF lpSrcInterface AS GUID
 , BYVAL lpSrcObj AS DWORD
 , BYVAL ciidExclude AS DWORD
 , BYREF rgiidExclude AS GUID
 , BYVAL lpExcludeProps AS SPropTagArray PTR
 , BYVAL ulUIParam AS DWORD
 , BYVAL lpProgress AS IMAPIProgress
 , BYREF lpDestInterface AS GUID
 , BYVAL lpDestObj AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYREF lppProblems AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD DoCopyProps ( ' VTable offset = 112
 BYREF lpSrcInterface AS GUID
 , BYVAL lpSrcObj AS DWORD
 , BYVAL lpIncludeProps AS SPropTagArray PTR
 , BYVAL ulUIParam AS DWORD
 , BYVAL lpProgress AS IMAPIProgress
 , BYREF lpDestInterface AS GUID
 , BYVAL lpDestObj AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYVAL lppProblems AS SPropProblemArray PTR
 ) AS LONG
 ' =====================================================================================
 METHOD DoProgressDialog ( ' VTable offset = 116
 BYVAL ulUIParam AS DWORD
 , BYVAL ulFlags AS DWORD
 , BYREF lppProgress AS IMAPIProgress
 ) AS LONG
 ' =====================================================================================
 METHOD ReadReceipt ( ' VTable offset = 120
 BYVAL ulFlags AS DWORD
 , BYVAL lpReadMessage AS IMessage
 , BYREF lppEmptyMessage AS IMessage
 ) AS LONG
 ' =====================================================================================
 METHOD PrepareSubmit ( ' VTable offset = 124
 BYVAL lpMessage AS IMessage
 , BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ExpandRecips ( ' VTable offset = 128
 BYVAL lpMessage AS IMessage
 , BYREF lpulFLags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD UpdatePAB ( ' VTable offset = 132
 BYVAL ulFlags AS DWORD
 , BYVAL lpMessage AS IMessage
 ) AS LONG
 ' =====================================================================================
 METHOD DoSentMail ( ' VTable offset = 136
 BYVAL ulFlags AS DWORD
 , BYVAL lpMessage AS IMessage
 ) AS LONG
 ' =====================================================================================
 METHOD OpenAddressBook ( ' VTable offset = 140
 BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lppAdrBook AS IAddrBook
 ) AS LONG
 ' =====================================================================================
 METHOD Preprocess ( ' VTable offset = 144
 BYVAL ulFlags AS DWORD
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 ) AS LONG
 ' =====================================================================================
 METHOD CompleteMsg ( ' VTable offset = 148
 BYVAL ulFlags AS DWORD
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 ) AS LONG
 ' =====================================================================================
 METHOD StoreLogoffTransports ( ' VTable offset = 152
 BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD StatusRecips ( ' VTable offset = 156
 BYVAL lpMessage AS IMessage
 , BYVAL lpRecipList AS ADRLIST PTR
 ) AS LONG
 ' =====================================================================================
 METHOD WrapStoreEntryID ( ' VTable offset = 160
 BYVAL cbOrigEntry AS DWORD
 , BYVAL lpOrigEntry AS ENTRYID PTR
 , BYREF lpcbWrappedEntry AS DWORD
 , BYREF lppWrappedEntry AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ModifyProfile ( ' VTable offset = 164
 BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD IStorageFromStream ( ' VTable offset = 168
 BYVAL lpUnkIn AS DWORD
 , BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lppStorageOut AS IStorage
 ) AS LONG
 ' =====================================================================================
 METHOD GetSvcConfigSupportObj ( ' VTable offset = 172
 BYVAL ulFlags AS DWORD
 , BYREF lppSvcSupport AS IMAPISupport
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/********************************************************************/
'/* */
'/* ADDRESS BOOK SPI */
'/* */
'/********************************************************************/
'/* Address Book Provider ------------------------------------------------- */
'/* OpenTemplateID() */
%EQUATE `FILL_ENTRY = &H00000001
'/* For Logon() */
'/*#define AB_NO_DIALOG ((ULONG) 0x00000001) in mapidefs.h */
'/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */
' ========================================================================================
' IABProvider interface
' $IID_IABProvider = GUID$("{00020311-0000-0000-C000-000000000046}")
' The IABProvider interface provides a method to log on to an address book provider object
' and a method to invalidate an address book provider object.
' ========================================================================================
INTERFACE IABProvider $IID_IABProvider
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Shutdown ( ' VTable offset = 12
 BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Logon ( ' VTable offset = 16
 BYVAL lpMAPISup AS IMAPISupport
 , BYVAL ulUIParam AS DWORD
 , BYREF lpszProfileName AS ASCIIZ
 , BYVAL ulFlags AS DWORD
 , BYREF lpulcbSecurity AS DWORD
 , BYVAL lppbSecurity AS BYTE PTR
 , BYREF lppMAPIError AS DWORD
 , BYREF lppABLogon AS IABLogon
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* For GetOneOffTable() */
'/****** MAPI_UNICODE ((ULONG) 0x80000000) */
' ========================================================================================
' IABLogon interface
' $IID_IABLogon = GUID$("{00020314-0000-0000-C000-000000000046}")
' The IABLogon interface is used to access resources in an address book provider.
' ========================================================================================
INTERFACE IABLogon $IID_IABLogon
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetLastError ( ' VTable offset = 12
 BYVAL hResult AS LONG
 , BYVAL ulFlags AS DWORD
 , BYREF lppMAPIError AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Logoff ( ' VTable offset = 16
 BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenEntry ( ' VTable offset = 20
 BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppUnk AS IUnknown
 ) AS LONG
 ' =====================================================================================
 METHOD CompareEntryIDs ( ' VTable offset = 24
 BYVAL cbEntryID1 AS DWORD
 , BYVAL lpEntryID1 AS ENTRYID PTR
 , BYVAL cbEntryID2 AS DWORD
 , BYVAL lpEntryID2 AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 , BYREF lpulResult AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Advise ( ' VTable offset = 28
 BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYVAL ulEventMask AS DWORD
 , BYVAL lpAdviseSink AS IMAPIAdviseSink
 , BYREF lpulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Unadvise ( ' VTable offset = 32
 BYVAL ulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenStatusEntry ( ' VTable offset = 36
 BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppMAPIStatus AS IMAPIStatus
 ) AS LONG
 ' =====================================================================================
 METHOD OpenTemplateID ( ' VTable offset = 40
 BYVAL cbTemplateID AS DWORD
 , BYVAL lpTemplateID AS DWORD
 , BYVAL ulTemplateFlags AS DWORD
 , BYVAL lpMAPIPropData AS IMAPIProp
 , BYREF lpInterface AS GUID
 , BYREF lppMAPIPropNew AS IMAPIProp
 , BYVAL lpMAPIPropSibling AS IMAPIProp
 ) AS LONG
 ' =====================================================================================
 METHOD GetOneOffTable ( ' VTable offset = 44
 BYVAL ulFlags AS DWORD
 , BYREF lppTable AS IMAPITable
 ) AS LONG
 ' =====================================================================================
 METHOD PrepareRecips ( ' VTable offset = 48
 BYVAL ulFlags AS DWORD
 , BYVAL lpPropTagArray AS DWORD
 , BYVAL lpRecipList AS ADRLIST PTR
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'typedef HRESULT (STDMAPIINITCALLTYPE ABPROVIDERINIT)(
' HINSTANCE hInstance,
' LPMALLOC lpMalloc,
' LPALLOCATEBUFFER lpAllocateBuffer,
' LPALLOCATEMORE lpAllocateMore,
' LPFREEBUFFER lpFreeBuffer,
' ULONG ulFlags,
' ULONG ulMAPIVer,
' ULONG * lpulProviderVer,
' LPABPROVIDER * lppABProvider
');
'/********************************************************************/
'/* */
'/* TRANSPORT SPI */
'/* */
'/********************************************************************/
'/* For DeinitTransport */
%EQUATE `DEINIT_NORMAL = &H00000001
%EQUATE `DEINIT_HURRY = &H80000000
'/* For TransportLogon */
'/* Flags that the Spooler may pass to the transport: */
%EQUATE `LOGON_NO_DIALOG = &H00000001
%EQUATE `LOGON_NO_CONNECT = &H00000004
%EQUATE `LOGON_NO_INBOUND = &H00000008
%EQUATE `LOGON_NO_OUTBOUND = &H00000010
'/*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */
'/* Flags that the transport may pass to the Spooler: */
%EQUATE `LOGON_SP_IDLE = &H00010000
%EQUATE `LOGON_SP_POLL = &H00020000
%EQUATE `LOGON_SP_RESOLVE = &H00040000
' ========================================================================================
' IXPProvider interface
' $IID_IXPProvider = GUID$("{00020312-0000-0000-C000-000000000046}")
' The IXPProvider interface is used to initialize a transport provider object and to shut
' down the object when it is no longer needed.
' ========================================================================================
INTERFACE IXPProvider $IID_IXPProvider
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Shutdown ( ' VTable offset = 12
 BYVAL lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD TransportLogon ( ' VTable offset = 16
 BYVAL lpMAPISup AS DWORD
 , BYVAL ulUIParam AS DWORD
 , BYREF lpszProfileName AS ASCIIZ
 , BYREF lpulFlags AS DWORD
 , BYREF lppMAPIError AS DWORD
 , BYREF lppXPLogon AS IXPLogon
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* OptionData returned from call to RegisterOptions */
%EQUATE `OPTION_TYPE_RECIPIENT = &H00000001
%EQUATE `OPTION_TYPE_MESSAGE = &H00000002
' // Size = 36 bytes
TYPE OPTIONDATA DWORD
 ulFlags AS DWORD ' ULONG /* MAPI_RECIPIENT, MAPI_MESSAGE */
 lpRecipGUID AS GUID PTR ' LPGUID /* Same as returned by AddressTypes() */
 lpszAdrType AS ASCIIZ PTR ' LPTSTR /* Same as returned by AddressTypes() */
 lpszDLLName AS ASCIIZ PTR ' LPTSTR /* Options DLL */
 ulOrdinal AS DWORD ' ULONG /* Ordinal in that DLL */
 cbOptionsData AS DWORD ' ULONG /* Count of bytes in lpbOptionsData */
 lpbOptionsData AS BYTE PTR ' LPBYTE /* Providers per [recip|message] option data */
 cOptionsProps AS DWORD ' ULONG /* Count of Options default prop values */
 lpOptionsProps AS SPropValue PTR ' LPSPropValue /* Default Options property values */
END TYPE
'typedef SCODE (STDMAPIINITCALLTYPE OPTIONCALLBACK)(
' HINSTANCE hInst,
' LPMALLOC lpMalloc,
' ULONG ulFlags,
' ULONG cbOptionData,
' LPBYTE lpbOptionData,
' LPMAPISUP lpMAPISup,
' LPMAPIPROP lpDataSource,
' LPMAPIPROP * lppWrappedSource,
' LPMAPIERROR * 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 */
%EQUATE `NOTIFY_ABORT_DEFERRED = &H40000000
%EQUATE `NOTIFY_CANCEL_MESSAGE = &H80000000
%EQUATE `NOTIFY_BEGIN_INBOUND = &H00000001
%EQUATE `NOTIFY_END_INBOUND = &H00010000
%EQUATE `NOTIFY_BEGIN_OUTBOUND = &H00000002
%EQUATE `NOTIFY_END_OUTBOUND = &H00020000
%EQUATE `NOTIFY_BEGIN_INBOUND_FLUSH = &H00000004
%EQUATE `NOTIFY_END_INBOUND_FLUSH = &H00040000
%EQUATE `NOTIFY_BEGIN_OUTBOUND_FLUSH = &H00000008
%EQUATE `NOTIFY_END_OUTBOUND_FLUSH = &H00080000
'/* For TransportLogoff */
%EQUATE `LOGOFF_NORMAL = &H00000001
%EQUATE `LOGOFF_HURRY = &H80000000
'/* For SubmitMessage */
%EQUATE `BEGIN_DEFERRED = &H00000001
'/* For EndMessage */
'/* Flags that the Spooler may pass to the Transport: */
'/* Flags that the transport may pass to the Spooler: */
%EQUATE `END_RESEND_NOW = &H00010000
%EQUATE `END_RESEND_LATER = &H00020000
%EQUATE `END_DONT_RESEND = &H00040000
' ========================================================================================
' IXPLogon interface
' $IID_IXPLogon = GUID$("{00020315-0000-0000-C000-000000000046}")
' The IXPLogon interface is used to give the MAPI spooler access to a transport provider.
' ========================================================================================
INTERFACE IXPLogon $IID_IXPLogon
 INHERIT IUnknown
 ' =====================================================================================
 METHOD AddressTypes ( ' VTable offset = 12
 BYREF lpulFlags AS DWORD
 , BYREF lpcAdrType AS DWORD
 , BYREF lpppAdrTypeArray AS DWORD
 , BYREF lpcMAPIUID AS DWORD
 , BYREF lpppUIDArray AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RegisterOptions ( ' VTable offset = 16
 BYREF lpulFlags AS DWORD
 , BYREF lpcOptions AS DWORD
 , BYREF lppOptions AS OPTIONDATA
 ) AS LONG
 ' =====================================================================================
 METHOD TransportNotify ( ' VTable offset = 20
 BYREF lpulFlags AS DWORD
 , BYREF lppvData AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Idle ( ' VTable offset = 24
 BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD TransportLogoff ( ' VTable offset = 28
 BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SubmitMessage ( ' VTable offset = 32
 BYVAL ulFlags AS DWORD
 , BYVAL lpMessage AS IMessage
 , BYREF lpulMsgRef AS DWORD
 , BYREF lpulReturnParm AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD EndMessage ( ' VTable offset = 36
 BYVAL ulMsgRef AS DWORD
 , BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Poll ( ' VTable offset = 40
 BYREF lpulIncoming AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD StartMessage ( ' VTable offset = 44
 BYVAL ulFlags AS DWORD
 , BYVAL lpMessage AS IMessage
 , BYREF lpulMsgRef AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenStatusEntry ( ' VTable offset = 48
 BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppEntry AS IMAPIStatus
 ) AS LONG
 ' =====================================================================================
 METHOD ValidateState ( ' VTable offset = 52
 BYVAL ulUIParam AS DWORD
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD FlushQueues ( ' VTable offset = 56
 BYVAL ulUIParam AS DWORD
 , BYVAL cbTargetTransport AS DWORD
 , BYVAL lpTargetTransport AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* Transport Provider Entry Point */
' ========================================================================================
' XPProviderInit
' The XPProviderInit function initializes a transport provider for operation.
' ========================================================================================
DECLARE FUNCTION XPProviderInit LIB "mapi32.dll" ALIAS "XPProviderInit" ( BYVAL hInstance AS QUAD , BYVAL lpMalloc AS IMalloc , BYVAL lpAllocateBuffer AS QUAD , BYVAL lpAllocateMore AS QUAD , BYVAL lpFreeBuffer AS QUAD , BYVAL ulFlags AS QUAD , BYVAL ulMAPIVer AS QUAD , BYREF lpulProviderVer AS QUAD , BYREF lppXPProvider AS IXPProvider ) AS LONG
' ========================================================================================
'/********************************************************************/
'/* */
'/* 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 */
%EQUATE `LOGON_SP_TRANSPORT = &H00000001
%EQUATE `LOGON_SP_PROMPT = &H00000002
%EQUATE `LOGON_SP_NEWPW = &H00000004
%EQUATE `LOGON_CHANGED = &H00000008
'/* DoMCDialog */
%EQUATE `DIALOG_FOLDER = &H00000001
%EQUATE `DIALOG_MESSAGE = &H00000002
%EQUATE `DIALOG_PROP = &H00000004
%EQUATE `DIALOG_ATTACH = &H00000008
%EQUATE `DIALOG_MOVE = &H00000010
%EQUATE `DIALOG_COPY = &H00000020
%EQUATE `DIALOG_DELETE = &H00000040
%EQUATE `DIALOG_ALLOW_CANCEL = &H00000080
%EQUATE `DIALOG_CONFIRM_CANCEL = &H00000100
'/* ExpandRecips */
%EQUATE `NEEDS_PREPROCESSING = &H00000001
%EQUATE `NEEDS_SPOOLER = &H00000002
'/* PrepareSubmit */
%EQUATE `CHECK_SENDER = &H00000001
%EQUATE `NON_STANDARD = &H00010000
'/* Message Store Provider Interface (IMSPROVIDER) */
' ========================================================================================
' IMSProvider interface
' $IID_IMSProvider = GUID$("{00020310-0000-0000-C000-000000000046}")
' The IMSProvider interface provides access to a message store provider through a message
' store provider object. This message store provider object is returned at provider logon
' by the message store provider's MSProviderInit entry point function. The message store
' provider object is primarily used by client applications and the MAPI spooler to open
' message stores.
' ========================================================================================
INTERFACE IMSProvider $IID_IMSProvider
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Shutdown ( ' VTable offset = 12
 BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Logon ( ' VTable offset = 16
 BYVAL lpMAPISup AS IMAPISupport
 , BYVAL ulUIParam AS DWORD
 , BYREF lpszProfileName AS ASCIIZ
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 , BYREF lpInterface AS GUID
 , BYREF lpcbSpoolSecurity AS DWORD
 , BYREF lppbSpoolSecurity AS DWORD
 , BYREF lppMAPIError AS DWORD
 , BYREF lppMSLogon AS IMSLogon
 , BYREF lppMDB AS IMsgStore
 ) AS LONG
 ' =====================================================================================
 METHOD SpoolerLogon ( ' VTable offset = 20
 BYVAL lpMAPISup AS IMAPISupport
 , BYVAL ulUIParam AS DWORD
 , BYREF lpszProfileName AS ASCIIZ
 , BYVAL cbEntryID AS DWORD
 , BYVAL lpEntrhyID AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 , BYREF lpInterface AS GUID
 , BYVAL cbSpoolSecurity AS DWORD
 , BYVAL lpbSpoolSecurity AS BYTE PTR
 , BYREF lppMAPIError AS DWORD
 , BYREF lppMSLogon AS IMSLogon
 , BYREF lppMDB AS IMsgStore
 ) AS LONG
 ' =====================================================================================
 METHOD CompareStoreIDs ( ' VTable offset = 24
 BYVAL cbEntryID1 AS DWORD
 , BYVAL lpEntryID1 AS ENTRYID PTR
 , BYVAL cbEntryID2 AS DWORD
 , BYVAL lpEntryID2 AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 , BYREF lpulResult AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* The MSLOGON object is returned by the Logon() method of the
' * MSPROVIDER interface. This object is for use by MAPIX.DLL.
' */
' ========================================================================================
' IMSLogon interface
' $IID_IMSLogon = GUID$("{00020313-0000-0000-C000-000000000046}")
' The IMSLogon interface is used to access resources in a message store logon object.
' ========================================================================================
INTERFACE IMSLogon $IID_IMSLogon
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetLastError ( ' VTable offset = 12
 BYVAL hResult AS LONG
 , BYVAL ulFlags AS DWORD
 , BYREF lppMAPIError AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Logoff ( ' VTable offset = 16
 BYREF lpulFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenEntry ( ' VTable offset = 20
 BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppUnk AS IUnknown
 ) AS LONG
 ' =====================================================================================
 METHOD CompareEntryIDs ( ' VTable offset = 24
 BYVAL cbEntryID1 AS DWORD
 , BYVAL lpEntryID1 AS ENTRYID PTR
 , BYVAL cbEntryID2 AS DWORD
 , BYVAL lpEntryID2 AS ENTRYID PTR
 , BYVAL ulFlags AS DWORD
 , BYREF lpulResult AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Advise ( ' VTable offset = 28
 BYVAL cbEntryID AS DWORD
 , BYVAL lpEntryID AS ENTRYID PTR
 , BYVAL ulEventMask AS DWORD
 , BYVAL lpAdviseSink AS IMAPIAdviseSink
 , BYREF lpulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Unadvise ( ' VTable offset = 32
 BYVAL ulConnection AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OpenStatusEntry ( ' VTable offset = 36
 BYREF lpInterface AS GUID
 , BYVAL ulFlags AS DWORD
 , BYREF lpulObjType AS DWORD
 , BYREF lppEntry AS IUnknown
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* Message Store Provider Entry Point */
DECLARE FUNCTION MSProviderInit LIB "mapi32.dll" ALIAS "MSProviderInit" ( BYVAL hInstance AS QUAD , BYVAL lpMalloc AS IMalloc , BYVAL lpAllocateBuffer AS QUAD , BYVAL lpAllocateMore AS QUAD , BYVAL lpFreeBuffer AS QUAD , BYVAL ulFlags AS QUAD , BYVAL ulMAPIVer AS QUAD , BYREF lpulProviderVer AS QUAD , BYREF lppMSProvider AS IMSProvider ) AS LONG
'/********************************************************************/
'/* */
'/* MESSAGE SERVICE CONFIGURATION */
'/* */
'/********************************************************************/
'/* Flags for service configuration entry point */
'/* #define MAPI_UNICODE 0x80000000 */
'/* #define SERVICE_UI_ALWAYS 0x00000002 */
'/* #define SERVICE_UI_ALLOWED 0x00000010 */
%EQUATE `MSG_SERVICE_UI_READ_ONLY = &H00000008 ' /* display parameters only */
%EQUATE `SERVICE_LOGON_FAILED = &H00000020 ' /* reconfigure provider */
'/* Contexts for service configuration entry point */
%EQUATE `MSG_SERVICE_INSTALL = &H00000001
%EQUATE `MSG_SERVICE_CREATE = &H00000002
%EQUATE `MSG_SERVICE_CONFIGURE = &H00000003
%EQUATE `MSG_SERVICE_DELETE = &H00000004
%EQUATE `MSG_SERVICE_UNINSTALL = &H00000005
%EQUATE `MSG_SERVICE_PROVIDER_CREATE = &H00000006
%EQUATE `MSG_SERVICE_PROVIDER_DELETE = &H00000007
'/* Prototype for service configuration entry point */
'typedef HRESULT (STDAPICALLTYPE MSGSERVICEENTRY)(
' HINSTANCE hInstance,
' LPMALLOC lpMalloc,
' LPMAPISUP lpMAPISup,
' ULONG ulUIParam,
' ULONG ulFlags,
' ULONG ulContext,
' ULONG cValues,
' LPSPropValue lpProps,
' LPPROVIDERADMIN lpProviderAdmin,
' LPMAPIERROR *lppMapiError
');
#ENDIF
