Contents - Index


4.2.3.30 Request Licence

HRESULT SLS_Request(
                                      LPCSTR pszProductID,
                                      LPCTSTR pszUserName,
                                      SLS_REQUEST *pRequest,
                                      SLS_PERMIT *pPermit,
                                      SLS_HANDLE *plLicenceHandle,
                                      SLS_CHALLENGE *pChallenge)

Parameters

pszProductID

Points to a string that uniquely identifies the application's Product ID.

pszUserName

Points to a string that uniquely identify the user's name.

NB. The user name passed to the CSheriff constructor, or the SLS_Request function cannot be longer than 31 characters (32 including the null-terminator).

pRequest

Points to a request structure.

pPermit

Points to a permit structure to receive permission granted by the licence system.

plLicenseHandle

Points to an SLS_HANDLE in which a handle to the licensing context is returned.

Challenge

Points to a challenge structure. The challenge response will also be returned in this structure.

Return Values

SLS_SUCCESS if the function is successful. Otherwise an error status code is returned to indicate the cause of the error.

The typical error status codes are:

SLS_E_LICENCE_UNREGISTERED
SLS_E_LICENCE_UNDEFINED
SLS_E_LICENCE_EXCEEDED
SLS_E_LICENCE_EXHAUSTED
SLS_E_LICENCE_EXPIRED
SLS_E_LICENCE_INVALID

Remarks

Use the SLS_Request function to request the licensing system to grant permission to the identified product to execute. If a valid licence is found, the challenge response is computed and SLS_SUCCESS is returned. A licence handle is also returned by the licence system to identify licensing resources allocated to the user. The application must call SLS_Release to free the licensing resources.

A challenge response is not returned unless the licensing request completes successfully. If SLS_Request fails, the licence handle is set to 0, therefore there is no need to call SLS_Release.

The input parameter for computing challenge is the Request structure; the output parameter for computing challenge is the pPermit structure.