win_lm_login

Log in and return a unique token

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows

 

 

int WINAPI win_lm_login(char  *producer, char  *application, int check, int seat,
           int *token, int *syserr)

Arguments

producer

The producer code for your company. This is a null‑terminated 8‑bit ANSI string. (This code was assigned to your company by Synergex when you requested the License Key Generator.)

application

The code that you created to refer to the application. This is a null‑terminated 8‑bit ANSI string and can be up to six characters long.

check

An int32 set to one of the following values:

0 = Log in the license if it is available.

1 = Check whether the license is available.

2 = Check whether the license is configured.

3 = Log in the license if it is configured.

Passing anything other than 0, 1, 2, or 3 is the same as passing 1. An available license indicates either that the license is configured or that the 14‑day evaluation period is in effect. When check is 1 or 2, License Manager only checks on the license; it does not request a log‑in slot and so the concurrent number of users is not incremented. See the Discussion for details. (n)

seat

An int32 set to 0 (zero) or the value designated as representing the seat.

token

An int32 pointer returned with the log‑in token, which is a key that is maintained in License Manager.

syserr

An int32 pointer returned with a system error code when the return status is other than 0.

Discussion

The win_lm_login function requests a log‑in “slot” from License Manager for the specified application or performs a license check.

When check is 0, the call to win_lm_login returns a token if the license is configured and a slot is available. If the license is not configured, but the 14‑day evaluation period is in effect, the call returns success (0) and a token of 0. In this case, no license is consumed, and so a log‑out is not required. If the 14‑day evaluation period has expired (and the license has not been configured), the call returns failure (1).

When check is 1, if the license is configured or if the 14‑day evaluation period is in effect, the call to win_lm_login returns success (0) and a token of 0. If the 14‑day evaluation period has expired, the call returns failure (1).

When check is 2, if the license is configured, the call to win_lm_login returns success (0) and a token of 0. Any other condition returns failure (1).

When check is 3, the call to win_lm_login returns a token if the license is configured and a slot is available, but if the 14‑day evaluation period is in effect, the call returns failure (1).

The token returned by win_lm_login should be saved by your application and used in the call to win_lm_logout. License Manager will only recognize log‑outs with a matching token. You need to retain the token only while the license is logged in, as a token has meaning only for the application log‑in for which it was obtained.

When using the seat argument, the value you should pass depends on the type of application:

The win_lm_login function returns a status value. The most common ones are listed below; see the Licensing Toolkit Error Codes table for additional codes that could be returned.

0 = Success.

1 = Product has not been configured.

2 = Concurrent user maximum reached.

7 = Product demo has expired.

These values are for checking success or providing application‑related license error messages; they have no effect on your application. You must write code to handle the returned status. For example, if win_lm_login returns 2 (concurrent user maximum reached), you may want to deny the user access to your application and present an error message stating the problem.

Examples

See lmdltest.c in Licensing_TK_Examples.zip, available from Synergy CodeExchange in the Resource Center on the Synergex website.