Implementing a Service Provider Entry Point Function

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 DllEntryPoint, the Win32 DLL entry point function. For information about Win32 DLL entry point functions, see the Win32 Programmer's Reference.

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

Address book providers ABProviderInit
Message store providers MSProviderInit
Transport providers XPProviderInit
Messaging hook providers HPProviderInit

Much of the functionality in these prototypes is the same for all service provider types. Messaging hook providers do not implement the same functionality as the other providers. Whereas the other providers instantiate provider and logon objects, messaging hook providers instantiate spooler hook objects, or objects that implement the ISpoolerHook interface.

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

  1. Check the version of the service provider interface (SPI) to make sure 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:

  1. Instantiate a provider object. Because your provider can be started and initialized multiple times, you should instantiate a separate object 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.

    If you are writing a message store provider, implement IMSProvider. See Loading Message Store Providers.

    If you are writing a transport provider, implement IXPProvider. See Initializing the Transport Provider.