Share via


TSPI_providerInit

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function initializes the service provider and gives it parameters required for subsequent operation.

Syntax

LONG TSPIAPI TSPI_providerInit(
  DWORD dwTSPIVersion, 
  DWORD dwPermanentProviderID, 
  DWORD dwLineDeviceIDBase, 
  DWORD dwPhoneDeviceIDBase, 
  DWORD_PTR dwNumLines, 
  DWORD_PTR dwNumPhones, 
  ASYNC_COMPLETION lpfnCompletionProc,  
  LPDWORD lpdwTSPIOptions 
);

Parameters

  • dwTSPIVersion
    Version of the TSPI definition under which this function must operate. The caller can use the TSPI_lineNegotiateTSPIVersion function with the special dwDeviceID INITIALIZE_NEGOTIATION to negotiate a version that is guaranteed to be acceptable to the service provider.
  • dwPermanentProviderID
    Permanent identifier, unique within the service providers on this system, of the service provider being initialized.
  • dwLineDeviceIDBase
    Lowest device identifier for the line devices supported by this service provider.
  • dwPhoneDeviceIDBase
    Lowest device identifier for the phone devices supported by this service provider.
  • dwNumLines
    Number of line devices this service provider supports. The value returned is the number of line devices reported in the TSPI_providerEnumDevicesfunction.
  • dwNumPhones
    Number of phone devices this service provider supports. The value returned is the number of phone devices reported in TSPI_providerEnumDevices.
  • lpfnCompletionProc
    Procedure the service provider calls to report completion of all asynchronously operating procedures on line and phone devices.
  • lpdwTSPIOptions
    Pointer to a DWORD-sized memory location, into which the service provider can write a value specifying LINETSPIOPTIONS_ values. This parameter allows the service provider to return bits indicating optional behaviors desired of TAPI. TAPI sets the options DWORD to zero before calling the TSPI_providerInit function, so if the service provider does not want any of these options, it can just leave the DWORD set to zero.

    At this time, only one bit is defined to be returned through this pointer: LINETSPIOPTION_NONREENTRANT. The service provider sets this bit if it is not designed for fully pre-emptive, multithreaded, multitasking, multiprocessor operation (for example, updating of global data protected by mutexes). When this bit is set, TAPI only makes one call at a time to the service provider; it does not call any other entry point, nor that entry point again, until the service provider returns from the original function call. Without this bit set, TAPI may call into multiple service provider entry points, including multiple times to the same entry point, simultaneously (actually simultaneously in a multiprocessor system).

    Note

    It must be emphasized that setting this bit degrades performance. It is strongly recommended that this be used only for development but not a shipped production service provider.

Return Value

Returns zero if the function succeeds or an error number if an error occurs The following table shows the return values for this method.

Value Description

LINEERR_INCOMPATIBLEAPIVERSION

The API version is incompatible.

LINEERR_OPERATIONFAILED

The operation failed.

LINEERR_NOMEM

Not enough memory is available.

LINEERR_RESOURCEUNAVAIL

The resource is unavailable.

LINEERR_INIFILECORRUPT

The INI file is corrupted.

LINEERR_NOMULTIPLEINSTANCE

Multiple instances of this service provider are not allowed.

Remarks

This function is guaranteed to be called before any of the other functions prefixed with TSPI_line or TSPI_phone except TSPI_lineNegotiateTSPIVersion. It is strictly paired with a subsequent call to the TSPI_providerShutdown function. These pairs may overlap, for example, when the Telephony Control Panel utility supplied with Windows Telephony in versions 1.4 and earlier is used while telephony operations are in progress. The call to this function must be ignored (returning success) if there is already an outstanding pair.

A service provider should perform as many consistency checks as is practical at the time. TSPI_providerInit is called to ensure that it is ready to run. Some consistency or installation errors, however, cannot be detected until the operation is attempted. The error LINEERR_NODRIVER can be used to report such nonspecific errors at the time they are detected.

There is no directly corresponding function at the TAPI level. At that level, multiple different usage instances can be outstanding, with an "application handle" returned to identify the instance in subsequent operations. At TSPI level, the interface architecture supports only a single usage instance for each distinct service provider.

Requirements

Header tapicomn.h
Library coredll.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

TSPI_lineNegotiateTSPIVersion