Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Fri Mar 16, 2012 8:39 am Post subject: INFO: Retrieving additional information about license validation failures. |
|
|
License validation can fail due to any number of reasons. For example, any license settings which require communication with the license service (for example, Max Activations) will fail if the license service is not reachable. To determine the underlying cause of the validation failure, use the CCryptoLicense.GetStatusExceptionMessage() method. This method can be used as follows:
Code: |
CString CAppLicensingDlg::GetStatusAsString(int status)
{
CString str;
switch (status)
{
case LS_ActivationFailed:
str = _T("ActivationFailed");
break;
case LS_CumulativeRunTimeExceeded:
str = _T("CumulativeRunTimeExceeded");
break;
case LS_DateRollbackDetected:
str = _T("DateRollbackDetected");
break;
case LS_Deactivated:
str = _T("Deactivated");
break;
case LS_DebuggerDetected:
str = _T("DebuggerDetected");
break;
case LS_EvaluationExpired:
str = _T("EvaluationExpired");
break;
case LS_ExecutionsExceeded:
str = _T("ExecutionsExceeded");
break;
case LS_Expired:
str = _T("Expired");
break;
case LS_GenericFailure:
str = _T("GenericFailure");
break;
case LS_InstancesExceeded:
str = _T("InstancesExceeded");
break;
case LS_LicenseServerMachineCodeInvalid:
str = _T("LicenseServerMachineCodeInvalid");
break;
case LS_LocalTimeInvalid:
str = _T("LocalTimeInvalid");
break;
case LS_MachineCodeInvalid:
str = _T("MachineCodeInvalid");
break;
case LS_RemoteSessionDetected:
str = _T("RemoteSessionDetected");
break;
case LS_RunTimeExceeded:
str = _T("RunTimeExceeded");
break;
case LS_SerialCodeInvalid:
str = _T("SerialCodeInvalid");
break;
case LS_ServiceNotificationFailed:
str = _T("ServiceNotificationFailed");
break;
case LS_SignatureInvalid:
str = _T("SignatureInvalid");
break;
case LS_UniqueUsageDaysExceeded:
str = _T("UniqueUsageDaysExceeded");
break;
case LS_UsageDaysExceeded:
str = _T("UsageDaysExceeded");
break;
case LS_UsageModeInvalid:
str = _T("UsageModeInvalid");
break;
}
return str;
}
CString CAppLicensingDlg::GetAllStatusExceptionsAsString(CCryptoLicense* license)
{
CString ret;
int status;
status = 1;
while(status < LS_LicenseServerMachineCodeInvalid) // highest possible status code
{
CString tmp;
tmp = license->GetStatusExceptionMessage(status);
if (tmp.GetLength() > 0) // Additional info available for the status
{
if (ret.GetLength() > 0)
ret = ret + _T("\r\n");
ret = ret + GetStatusAsString(status) + ": " + tmp;
}
status = status * 2; // next status code
}
return ret;
} |
|
|