Export (0) Print
Expand All
Expand Minimize

XPProviderInit

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.

Initializes a transport provider for operation.

Header file:

Mapispi.h

Implemented by:

Transport providers

Called by:

MAPI

HRESULT XPProviderInit(
  HINSTANCE hInstance,
  LPMALLOC lpMalloc,
  LPALLOCATEBUFFER lpAllocateBuffer,
  LPALLOCATEMORE lpAllocateMore,
  LPFREEBUFFER lpFreeBuffer,
  ULONG ulFlags,
  ULONG ulMAPIVer,
  ULONG FAR * lpulProviderVer,
  LPXPPROVIDER FAR * lppXPProvider
);

hInstance

[in] The instance of the transport provider's dynamic-link library (DLL) that MAPI used when it loaded the DLL.

lpMalloc

[in] Pointer to a memory allocator object exposing the OLE IMalloc interface. The transport provider may need to use this allocation method when working with certain interfaces such as IStream.

lpAllocateBuffer

[in] Pointer to the MAPIAllocateBuffer function, to be used to allocate memory.

lpAllocateMore

[in] Pointer to the MAPIAllocateMore function, to be used to allocate additional memory.

lpFreeBuffer

[in] Pointer to the MAPIFreeBuffer function, to be used to free memory.

ulFlags

[in] Bitmask of flags. The following flag can be set:

MAPI_NT_SERVICE

The provider is being loaded in the context of a Windows service, a special type of process without access to any user interface.

ulMAPIVer

[in] Version number of the service provider interface (SPI) that Mapi.dll uses. For the current version number, see the Mapispi.h header file.

lpulProviderVer

[out] Pointer to the version number of the SPI that this transport provider uses.

lppXPProvider

[out] Pointer to a pointer to the initialized transport provider object.

S_OK

The call succeeded and has returned the expected value or values.

MAPI_E_VERSION

The SPI version being used by MAPI is not compatible with the SPI being used by this provider.

MAPI calls the entry point function XPProviderInit to initialize a transport provider following a client logon. XPProviderInit is called once for each transport provider specified in the client's profile.

A transport provider must implement XPProviderInit as an entry point function in the provider's DLL. The implementation must be based on the XPPROVIDERINIT function prototype, also specified in Mapispi.h. MAPI defines XPPROVIDERINIT to use the standard MAPI initialization call type, STDMAPIINITCALLTYPE, which causes XPProviderInit to follow the CDECL calling convention. An advantage of CDECL is that calls can be attempted even if the number of calling parameters does not match the number of defined parameters.

A provider can be initialized multiple times as a result of appearing in several profiles in simultaneous use or of appearing more than once in the same profile. Because the provider object contains context, XPProviderInit must return a different provider object in lppXPProvider for each initialization, even for multiple initializations in the same process.

The transport provider should use the functions pointed to by lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer for most memory allocation and deallocation. In particular, the provider must use these functions to allocate memory for use by client applications when calling object interfaces such as IMAPIProp::GetProps and IMAPITable::QueryRows. If the provider also expects to use the OLE memory allocator, it should call the IUnknown::AddRef method of the allocator object pointed to by the lpMalloc parameter.

For more information about writing XPProviderInit, see Initializing the Transport Provider. For more information about entry point functions, see Implementing a Service Provider Entry Point Function.

Show:
© 2014 Microsoft