About Loading and Dispatching Calls to a Specified Version of MAPI

About Loading and Dispatching Calls to a Specified Version of MAPI

MAPI supports dispatching MAPI calls for the default mail client to a custom DLL that exports simple MAPI and MAPI calls.

Generally, the MAPI stub library uses registry values under the HKLM\Software\Clients\Mail key of the default mail client to find out how to dispatch simple MAPI and MAPI calls. The MAPI stub library uses the following registry values.

Registry Key Type Description
DLLPath REG_SZ Full path to the simple MAPI provider DLL.
DLLPathEx REG_SZ Full path to the MAPI provider DLL. Provider DLLs that support both simple MAPI and MAPI must have both the DLLPath and DLLPathEx keys set.
MSIComponentID REG_DWORD A Windows Installer PublishComponent category ID (GUID) that identifies the DLL that exports simple MAPI or MAPI calls. If set, this key takes precedence over the DLLPath or DLLPathEx key.

Depending on the type of MAPI call received, the stub library loads the appropriate DLL as defined by the registry keys and values for the default mail client, and then dispatches the call. If the MSIComponentID registry key is listed under the mail client key, the stub library installs the component on demand using the MSI, loads the DLL, and dispatches the calls. If the MSIComponentID registry key is not listed, the stub library dispatches simple MAPI calls to the DLL pointed to by DLLPath, and dispatches MAPI calls to the DLL pointed to by DLLPathEx. For more information about how registry settings determine how the MAPI stub library dispatches MAPI calls, see Mapi32.dll Stub Registry Settings.

The MAPI stub library, mapistub.dll, exports the FGetComponentPath function, which returns the path to a custom version of Mapi32.dll that is specified by the MSIComponentID registry key.

Microsoft Office Outlook also uses the MSIComponentID registry key to specify the version of MAPI it wants to use. Versions of Outlook previous to Outlook 2007 specify a component ID for Mapisvc.inf; Outlook 2007 does not install Mapisvc.inf and therefore specifies a different component ID. To reliably find out which version of MAPI Outlook uses on a computer, you should read from the registry the value of MSIComponentID and pass it to FGetComponentPath.

See Also

How to: Get the Path of a Specific Version of MAPI for the Default Mail Client