Share via


Shutting Down a Service Provider

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

When a client calls the IMAPISession::Logoff method to end the session and shut down all active service providers, MAPI in turn calls the following methods:

These methods have similar implementations. The main tasks that a logoff method performs are as follows:

  • Releasing all open objects, including subobjects and status objects.

  • Calling the support object's IUnknown::Release method to decrement its reference count.

  • Removing all of your provider's registered MAPIUID structures.

  • Removing your provider's row in the status table.

  • Performing any tasks that relate to cleaning up resources, such as the following:

    • Terminating a connection with a remote server.

    • Decrementing the reference count on the logon object.

    • Removing the logon object from the list of logon objects that your provider stores.

    • In debug mode, issuing traces to locate objects that have leaked memory.

When your logoff method returns, MAPI calls the following:

  • Your logon object's IUnknown::Release method.

  • Your provider object's Shutdown method to perform any final cleanup tasks. Depending on the type of your provider, one of the following methods is called:

  • Your provider object's IUnknown::Release method.

If your provider is a message store, a client call to IMsgStore::StoreLogoff will also initiate the shutdown process. StoreLogoff shuts down one particular message store provider and has no effect on the session. Only a message store provider can be shut down with this method; there is no explicit way to shut down a particular address book or transport provider. For information about how to respond to a StoreLogoff call, see Shutting Down a Message Store Provider.

Your provider's DLL will be unloaded when MAPI calls the Win32 API function FreeLibrary, a call that is made after the last active client has called MAPIUninitialize. By this time, your service provider will have finished shutting down.

See Also

Concepts

MAPI Service Providers