<< Click to Display Table of Contents >> Navigation: WinLicense > WinLicense SDK > Generators Functions > WLGenTrialExtensionRegistryKey |
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.
int WLGenTrialExtensionRegistryKey( char* pTrialHash, int Level, int NumDays, int NumExec, SYSTEMTIME* pNewDate, int GlobalMinutes, int Runtime, char* pKeyName, char* pKeyValueName, char* pBufferOut ); |
function WLGenTrialExtensionRegistryKey( pTrialHash:PAnsiChar; Level:Integer; NumDays:Integer; NumExec:Integer; var pNewDate:SYSTEMTIME; GlobalMinutes:Integer; Runtime:Integer; pKeyName: PAnsiChar; pKeyValueName: PAnsiChar; pBufferOut:PAnsiChar ):Integer; stdcall; |
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 |
class WinlicenseSDK { [DllImport( "WinlicenseSDK.dll", EntryPoint="GenerateLicenseFileKey", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenTrialExtensionRegistryKey( string pTrialHash, int Level, int NumDays, int NumExec, ref SystemTime pNewDate, int GlobalMinutes, int Runtime, string pKeyName, string pKeyValueName, byte[] pBufferOut); } |
Parameters
pTrialHash
[in] Pointer to a null-terminated string that specifies the unique Trial hash to generate specific trial extension keys for an application.
Level
[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.
NumDays
[in] Number of days to extend the trial period.
NumExec
[in] Number of executions to extend the trial period.
pNewDate
[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:
|
GlobalTime
[in] Number of minutes to extend the Global time trial.
Runtime
[in] Number of runtime minutes to extend the trial.
pKeyName
[in] Pointer to a string that holds the registry key name where the trial extension key is stored.
pKeyValueName
[in] Pointer to a string that holds the registry key value name where the trial extension key is stored.
pBufferOut
[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.
Return Values
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.
Remarks
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.
See Also