Platform SDK: MAPI

Invalidating an Object

As part of your provider's shutdown process, you might want to invalidate an object. Invalidating an object involves replacing its vtable with a vtable containing implementations for the three IUnknown methods: AddRef, Release, and QueryInterface. Invalidate an object by calling IMAPISupport::MakeInvalid, a method that is included in the support object of each of the three common provider types. Providers typically make this call in the implementation of their logon object's Logoff method.

Invalidating an object gives MAPI the ultimate responsibility for freeing the memory associated with an object. You can free all of the resources connected with an object and then call MakeInvalid to invalidate all of the methods in its inherited interfaces. Calls to any of these methods will return MAPI_E_INVALID_OBJECT. Using MakeInvalid is an option that many service providers choose to ignore.