Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Implementing a Service Provider Entry Point Function

Last modified: July 23, 2011

Applies to: Outlook

Every service provider DLL has an entry point function that MAPI calls to load it. Be aware that this entry point function is not the same as DllMain, the Win32 DLL entry point function.

Depending on the type of your provider, your provider entry point function conforms to a different prototype. MAPI defines different entry point function prototypes for service providers.


Entry point function prototype

Message store providers


Transport providers


Address book providers


Much of the functionality in these prototypes is the same for all service provider types.

Address book, message store, and transport providers perform the following two main tasks in their entry point functions:

  1. Check the version of the service provider interface (SPI) to be sure that MAPI is using a version that is compatible with the version that your service provider is using. Use the lpulMAPIVer parameter, which contains the MAPI SPI version, and the lpulProviderVer parameter, which contains your SPI version, to perform the check. These parameters are 32-bit unsigned integers composed of three parts:

    • Bits 24 through 31 represent the major version.

    • Bits 16 through 23 represent the minor version.

    • Bits 0 through 15 represent the update identifier. Although the major version number rarely changes, the minor version number changes whenever MAPI is released and the SPI has changed. The update identifier is the Microsoft internal build version; it is used to track changes during the development process. MAPI defines the CURRENT_SPI_VERSION constant, documented in the Mapispi.h header file, to indicate the present SPI version. Fail your check with the error MAPI_E_VERSION if you are using a version of the SPI that is newer than the version that MAPI is using.

  2. Create an instance of a provider object. Because your provider can be started and initialized multiple times, you should create a new instance each time this occurs. Providers are started multiple times when they appear in multiple profiles that are in use simultaneously by one or more clients, or when they appear multiple times in a single profile. Just as the entry point function prototype differs depending on the type of your provider, so does the type of provider object.

    If you are writing an address book provider, implement IABProvider : IUnknown. If you are writing a message store provider, implement IMSProvider : IUnknown. For more information, see Loading Message Store Providers.

    If you are writing a transport provider, implement IXPProvider : IUnknown. For more information, see Initializing the Transport Provider.

© 2015 Microsoft