Share via


CmCspGetResource (Compact 2013)

3/26/2014

This function is called by Connection Manager to obtain resources required to establish a connection.

Syntax

CM_RESULT CmCspGetResource(
    __in_bcount(CM_CONNECTION_NAME_LENGTH) WCHAR* szConnection,
    __out_bcount(*pcbResourceId) RM_RESOURCE_ID* pResourceId,
    __out DWORD* pcbResourceId,
    __out RM_RESOURCE_HANDLE* phResource
);

Parameters

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

    [out] A pointer to a variable length array of one or more RM_RESOURCE_ID objects.

  • [in,out] pcbResourceId
    [in] The number of bytes in the pResourceId storage area.

    [out] A pointer to the number of bytes required for pResourceId, if the input parameter was not big enough.

  • [out] phResource
    [in] A storage area to hold the output.

    [out] A pointer to the resource handle.

Return Value

The following table shows the possible return values.

Value

Description

CMRE_SUCCESS

The call succeeded.

CMRE_INVALID_CONNECTION

The connection does not exist.

CMRE_INVALID_PARAMETER

One of the input parameters is invalid.

CMRE_INSUFFICIENT_BUFFER

pcbResourceId was not large enough to contain the pResourceId. The output value of pcbResourceId is a pointer to the minimum size for pResourceId.

CMRE_UNEXPECTED

An unexpected failure occurred.

Remarks

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

This function returns various sets of values depending on the following conditions:

  1. The connection requires a single resource, in which case it returns the resource ID in pResourceId, and sets pcbResourceId to the size of RM_RESOURCE_ID.
  2. The connection can use any one of N resources (R_1 or R_2 or ... R_N), in which case it populates array of RM_RESOURCE_ID pointed by pResourceId with the possible resources, and sets pcbResourceId to N * the size of RM_RESOURCE_ID.
  3. If the connection has the same connection type specific information as another connection that is currently connected, then the CSP should set phResource to the resource handle associated with the other currently connected connection.

The resource handle is later required by CmCspConnect.

Requirements

Header

cmcsp.h

See Also

Reference

Connection Service Provider Functions
CmCspConnect
CmCspDisconnect
CmCspGetConnectionInfo
RM_RESOURCE_ID

Other Resources

Connection Service Provider Reference