<< Click to Display Table of Contents >> Navigation: WinLicense > WinLicense SDK > Generators Functions > WLGenLicenseRegistryKey |
The WLGenLicenseRegistryKey function generates a license key that will work in a specific application. The generated license key should be directly copied into a .reg file. When a user clicks on the .reg file, the license information will be inserted in a custom registry key to register an specific application.
int WLGenLicenseRegistryKey( char* pLicenseHash, char* pUserName, char* pOrganization, char* pCustomData, char* pMachineID, int NumDays, int NumExec, SYSTEMTIME* pExpirationDate, int CountryId, int Runtime, int GlobalTime, char* pKeyName, char* pKeyValueName, char* pBufferOut );
int WLGenLicenseRegistryKeyW( wchar_t* pLicenseHash, wchar_t* pUserName, wchar_t* pOrganization, wchar_t* pCustomData, wchar_t* pMachineID, int NumDays, int NumExec, SYSTEMTIME* pExpirationDate, int CountryId, int Runtime, int GlobalTime, wchar_t* pKeyName, wchar_t* pKeyValueName, char* pBufferOut ); |
function WLGenLicenseRegistryKey( pLicenseHash:PAnsiChar; pUserName:PAnsiChar; pOrganization:PAnsiChar; pCustomData:PAnsiChar; pMachineID:PAnsiChar; NumDays:Integer; NumExec:Integer; var pExpirationDate:SYSTEMTIME; CountryId:Integer; Runtime:Integer; GlobalTime:Integer; pKeyName:PAnsiChar; pKeyValueName:PAnsiChar; pBufferOut:PAnsiChar ):Integer; stdcall;
function WLGenLicenseRegistryKeyW( pLicenseHash:PWideChar; pUserName:PWideChar; pOrganization:PWideChar; pCustomData:PWideChar; pMachineID:PWideChar; NumDays:Integer; NumExec:Integer; var pExpirationDate:SYSTEMTIME; CountryId:Integer; Runtime:Integer; GlobalTime:Integer; pKeyName:PWideChar; pKeyValueName:PWideChar; pBufferOut:PChar ):Integer; stdcall; |
Public Declare Function WLGenLicenseRegistryKey Lib "WinLicenseSDK.dll" ( ByVal pLicenseHash As String, ByVal pUserName As String, ByVal pOrganization As String, ByVal pCustomData As String, ByVal pMachineID As String, ByVal NumDays As Integer, ByVal NumExec As Integer, pExpirationDate As Any, ByVal CountryId As Integer, ByVal Runtime As Integer, ByVal GlobalTime As Integer, ByVal pKeyName As String, ByVal pKeyValueName As String, ByVal pBufferOut As String ) As Integer |
class WinlicenseSDK { [DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseRegistryKey", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKey( string pLicenseHash, string pUserName, string pOrganization, string pCustomData, string pMachineID, int NumDays, int NumExec, SystemTime pExpirationDate, int CountryId, int Runtime, int GlobalTime, string pKeyName, string pKeyValueName, byte[] pBufferOut); }
class WinlicenseSDK { [DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode, EntryPoint="WLGenLicenseRegistryKeyW", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKeyW( string pLicenseHash, string pUserName, string pOrganization, string pCustomData, string pMachineID, int NumDays, int NumExec, SystemTime pExpirationDate, int CountryId, int Runtime, int GlobalTime, string pKeyName, string pKeyValueName, byte[] pBufferOut); } |
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
NumDays
[in] Number of days to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have executions restrictions.
pExpirationDate
[in] Pointer to a SYSTEMTIME struct that holds the expiration date for the generated license key.
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:
|
CountryId
[in] Country ID value to restrict the generated license key to a specific country.
If this parameter is zero, the generated license key will work in every country.
Runtime
[in] Runtime restriction in minutes for the generated license key. The registered application will only run Runtime minutes in every instance in memory.
If this parameter is zero, the generated license key will not have a runtime restriction.
GlobalTime
[in] Global time restriction in minutes for the generated license key. The registered application cannot be executed more than GlobalTime minutes in general.
If this parameter is zero, the generated license key will not have a global time restriction.
pKeyName
[in] Pointer to a string that holds the registry key name where the license key is stored.
pKeyValueName
[in] Pointer to a string that holds the registry key value name where the license key is stored.
pBufferOut
[out] Pointer to a buffer that will hold the generated license key. If this parameter is NULL, the function returns the required buffer size.
This buffer should be copied directly into a .reg file, making it the license key that will activate 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 license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseFileKey, WLGenLicenseTextKey, WLGenLicenseSmartKey