Uninstalling License from the License Manager
Declare Variables/Constants
#define CONTACT_SERVER "localhost"
/* Replace the empty string below with the license string to be uninstalled from LM */
#define LICENSE_STRING ""
char *strLicense = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<uninstallData>\
<license>"LICENSE_STRING"</license>\
<licenseHash></licenseHash>\
</uninstallData>";
char *pcOutBuffer = NULL;
sntl_licensing_attr_t *pAttrAppContext = NULL;
sntl_licensing_app_context_t *pAppContext = NULL;
int iRetCode
= SNTL_SUCCESS;
API Calls
To uninstall a license, execute the APIs in the specified sequential order only:
sntl_licensing_attr_new(&pAttrAppContext);
sntl_licensing_attr_set_appcontext_contact_server (pAttrAppContext, CONTACT_SERVER);
NOTE If, instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.
sntl_licensing_app_context_new(0, pAttrAppContext, &pAppContext);
iRetCode = sntl_licensing_uninstall(pAppContext, strLicense, &pcOutBuffer);
On success, the license string specified in the macro LICENSE_STRING gets deleted from the license manager and license file. The parameter pcOutBuffer contains the license hash and license string of the uninstalled license in XML format.
Note
You may refer to the sntl_tool sample (installed in the Sentinel RMS SDK) for further understanding of the usage of sntl_licensing_unistall or any of the above-mentioned unified API.