<< Click to Display Table of Contents >> Navigation: WinLicense > WinLicense SDK > Generators Functions > WLGenLicenseSmartKey |
The WLGenLicenseSmartKey function generates a license key that will work in a specific application. The generated SmartActivate® key should be passed as a parameter to the function WLRegInstallSmartKeyToFile or WLRegInstallSmartKeyToRegistry to register a specific application.
int WLGenLicenseSmartKey( char* pLicenseHash, char* pUserName, char* pOrganization, char* pCustomData, char* pMachineID, int NumDays, int NumExec, SYSTEMTIME* pExpirationDate, char* pBufferOut );
int WLGenLicenseSmartKeyW( wchar_t* pLicenseHash, wchar_t* pUserName, wchar_t* pOrganization, wchar_t* pCustomData, wchar_t* pMachineID, int NumDays, int NumExec, SYSTEMTIME* pExpirationDate, wchar_t* pBufferOut ); |
function WLGenLicenseSmartKey( pLicenseHash:PAnsiChar; pUserName:PAnsiChar; pOrganization:PAnsiChar; pCustomData:PAnsiChar; pMachineID:PAnsiChar; NumDays:Integer; NumExec:Integer; var pExpirationDate:SYSTEMTIME; pBufferOut:PAnsiChar ):Integer; stdcall;
function WLGenLicenseSmartKeyW( pLicenseHash:PWideChar; pUserName:PWideChar; pOrganization:PWideChar; pCustomData:PWideChar; pMachineID:PWideChar; NumDays:Integer; NumExec:Integer; var pExpirationDate:SYSTEMTIME; pBufferOut:PWideChar ):Integer; stdcall; |
Public Declare Function WLGenLicenseSmartKey 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 pBufferOut As String ) As Integer |
class WinlicenseSDK { [DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseSmartKey", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseSmartKey( string pLicenseHash, string pUserName, string pOrganization, string pCustomData, string pMachineID, int NumDays, int NumExec, SystemTime pExpirationDate, StringBuilder pBufferOut); }
class WinlicenseSDK { [DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode, EntryPoint="WLGenLicenseSmartKeyW", CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseSmartKeyW( string pLicenseHash, string pUserName, string pOrganization, string pCustomData, string pMachineID, int NumDays, int NumExec, SystemTime pExpirationDate, StringBuilder 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. There is an internal limit of 255 days to keep the SmartKey size as short as possible. Dynamic SmartKeys or other keys do not contain this restriction.
If this parameter is zero, the generated license key will not have a days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key. There is an internal limit of 255 executions to keep the SmartKey size as short as possible. Dynamic SmartKeys or other keys do not contain this restriction.
If this parameter is zero, the generated license key will not have an 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 a date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
|
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.
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.
Remarks
The "NumDays" and "NumExec" parameter has an internal limit of 255 to keep the SmartKey size as short as possible. Dynamic SmartKeys or other type of keys do not contain this restriction.
This function is also implemented as UNICODE: WLGenLicenseSmartKeyW
See Also
WLRegSmartKeyInstallToFile, WLRegSmartKeyInstallToRegistry, WLRegSmartKeyCheck, WLGenLicenseRegistryKey, WLGenLicenseFileKey