LlmGetClientProvider Function  
 
DWORD WINAPI LlmGetClientProvider(
  HCLIENT hClient,  
  LPCTSTR lpszBaseUrl,  
  INT nMaxLength  
);

The LlmGetClientProvider function returns the provider associated with the specified client session and, optionally, the base URL used for requests.

Parameters

hClient
A handle to the client session.
lpszBaseUrl
A pointer to a buffer that receives the base URL used by the client session when making requests to the provider. This parameter may be NULL if the base URL is not required.
nMaxLength
The size of the buffer specified by the lpszBaseUrl parameter, in characters. If lpszBaseUrl is NULL, this value should be zero. If a buffer is provided, it must be large enough to store the complete URL, including the terminating null character.

Return Value

If the function succeeds, the return value is the provider ID. If the function fails, the return value is LLM_PROVIDER_UNKNOWN. To get extended error information, call LlmGetLastError.

Remarks

The LlmGetClientProvider function can be used to determine which provider is currently associated with a client session. This is useful when an application supports multiple providers and needs to adjust its behavior based on the active provider.

If the lpszBaseUrl parameter is specified, the function also returns the base URL used by the client when communicating with the provider. This may be a default URL defined by the library or a custom URL specified when the session was created or connected.

The base URL is returned as a null-terminated string. If the buffer is not large enough to receive the entire string, the function fails and sets the error code to ST_ERROR_BUFFER_TOO_SMALL. We recommend a buffer size of at least 256 characters when retrieving the base URL.

To determine the default endpoint URL used by a specific service provider, use the LlmGetProviderUrl function.

Example

TCHAR szBaseUrl[256] = {0};

DWORD dwProviderId = LlmGetClientProvider(hClient, szBaseUrl, _countof(szBaseUrl));

if (dwProviderId != LLM_PROVIDER_UNKNOWN)
{
    _tprintf(_T("Provider ID: %lu\n"), dwProviderId);
    _tprintf(_T("Base URL: %s\n"), szBaseUrl);
}
else
{
    DWORD dwError = LlmGetLastError();
    _tprintf(_T("Unable to get provider information, error 0x%08lx\n"), dwError);
}

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

LlmGetProviderFlags, LlmGetProviderId, LlmGetProviderInfo, LlmGetProviderName, LlmGetProviderUrl