Share via


CmCspConnect (Compact 7)

3/12/2014

Called to establish a connection after Connection Manager successfully allocates the required resources.

Syntax

CM_RESULT CmCspConnect(
    __in_bcount(CM_CONNECTION_NAME_LENGTH) WCHAR* szConnection,
    __in RM_RESOURCE_HANDLE hResource,
    __out_bcount(cbAdapter) WCHAR* szAdapter,
    __in DWORD cbAdapter
);

Parameters

  • [in] szConnection
    The connection name.
  • [in,out] szAdapter
    [in] A pointer to a storage area to place the output.

    [out] The name of the physical network adapter.

  • [in] cbAdapter
    [in] The number of bytes in the szAdapter storage area.

Return Value

The function returns the following values:

Value Description

CMRE_SUCCESS

The call succeeded.

CMRE_CONNECTION_ALREADY_ACQUIRED

The connection has already been connected.

CMRE_CONNECTION_ACQUIRE_FAILED

The connection could not be connected.

CMRE_CONNECTION_DOES_NOT_EXIST

A connection name matching szConnection could not be found.

CMRE_INVALID_CONNECTION

The connection does not exist.

CMRE_INVALID_PARAMETER

One of the input parameters is invalid.

CMRE_UNEXPECTED

An unexpected failure occurred.

Remarks

This function is called by the Connection Manager and processed by the Connection Service Provider.

This function must not return until the connection attempt has succeeded or failed. Asynchronous processing of the connection attempt is not supported.

Before calling this function, the Connection Manager changes the CM_CONNECTION_STATE to CMCS_CONNECTING. When this function returns CMRE_SUCCESS, the Connection Manager changes the CM_CONNECTION_STATE to CMCS_CONNECTED; otherwise to CMCS_DISCONNECTED.

It is important that this function return as soon as possible, as delays will be apparent to other applications and to users.

The Connection Manager serializes calls to CmCspConnect, CmCspDisconnect and

CmCspGetConnectionInfo.

Requirements

Header

cmcsp.h

See Also

Reference

Connection Service Provider Functions
CM_CONNECTION_STATE
CmCspConnect
CmCspDisconnect
CmCspGetConnectionInfo
CmCspGetResource

Other Resources

Connection Service Provider Reference