<< Click to Display Table of Contents >>
Navigation: WinLicense > WinLicense SDK > Generators Functions >
The WLGenTrialExtensionRegistryKey function generates a trial extension key to extend the current trial period in a specific application. The generated extension key should be directly copied into a .reg file. When a user clicks on the .reg file, the trial extension information will be inserted in a custom registry key to register an specific application.
Public Declare Function WLGenTrialExtensionRegistryKey Lib "WinLicenseSDK.dll"(
ByVal pTrialHash As String,
ByVal Level As Integer,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal GlobalMinutes As Integer,
ByVal Runtime As Integer,
ByVal pKeyName As String,
ByVal pKeyValueName As String,
ByVal pBufferOut As String
) As Integer
[DllImport( "WinlicenseSDK.dll", EntryPoint="GenerateLicenseFileKey", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenTrialExtensionRegistryKey(
ref SystemTime pNewDate,
[in] Pointer to a null-terminated string that specifies the unique Trial hash to generate specific trial extension keys for an application.
[in] Trial extension key level.
The trial is extended by levels to allow developers a full control of the extended keys that they generate. When a user asks for an extension key, the first level should be zero. If the same user asks again for an extension key, only extension keys with levels greater than zero will work. In general, to allow a trial period extension, only extended keys with a Level greater than a previous one will work. This will avoid being cheated by users re-asking for a trial extension key.
[in] Number of days to extend the trial period.
[in] Number of executions to extend the trial period.
[in] Pointer to a SYSTEMTIME struct that holds the new trial expiration date.
If this parameter is zero, the generated license key will not have date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[in] Number of minutes to extend the Global time trial.
[in] Number of runtime minutes to extend the trial.
[in] Pointer to a string that holds the registry key name where the trial extension key is stored.
[in] Pointer to a string that holds the registry key value name where the trial extension key is stored.
[out] Pointer to a buffer that will hold the generated trial extension key.
This buffer should be copied directly into a .reg file, making it the extension key that will extend the trial when a user clicks on this .reg file.
If the function succeeds, the return value is the number of bytes in the generated trial extension key.
If the function fails, the return value is 0.
Only the trial restriction fields that were included in the protection time can be extended. For example, if an application has a trial restriction of 21 days, ONLY the number of expiration days can be extended. Any attempt to extend any other trial restriction not included in the protection time will be ignored.