KeyGen API - Keygen structures and constants

Keygen structures and constants


 

Constants
Error codes returned by GenerateTextKey and GenerateKeyFile.

Constant
Value
Meaning
KEYGEN_OK
0
The key is generated successfully
ERR_DLL_INIT_ERROR
1
The keygen dll initializtion fails
ERR_NO_USERNAME
2
lpUserName is NULL or the length of string it point to is 0
ERR_NO_ORDERID
3
lpOrderID is NULL or the length of string it point to is 0
ERR_INVALID_EXP_DATE
4
Expiration date lpExpDate point to is invalid
ERR_INSUFFICIENT_BUFFER
5
The data area passed to GenerateTextKey, where key string will be copied to,is too small.
ERR_CANNOT_CREATE_FILE
6
The specified keyfile can not be created.
ERR_WRITEFILE_FAILED
7
The specified keyfile can not be written.


Structures
     C\C++
typedef struct { char *lpUserName; // Pointer to user name string char *lpOrderID; // Pointer to order ID string char *lpHardwareID; // Pointer to hardware ID string char *lpExpVersion; // Pointer to expiration version string SYSTEMTIME *lpExpDate; // Pointer to expiration date ( SYSTEMTIME structure) } KEY_DATA;



Delphi:
TKeyData = packed record
lpUserName : PChar; // Pointer to user name string
lpOrderID : PChar; // Pointer to order ID string
lpHardwareID : PChar; // Pointer to hardware ID string
lpExpVersion : PChar; // Pointer to expiration version string
lpExpDate : PSystemTime; // Pointer to expiration date ( SYSTEMTIME structure)
end;

Remarks
You must completely initialize the structure before passing it to one of the keygen functions, unused members should be set to NULL.

The length of the user name strings pointed to by lpUserName is limited to 36 characters (including the terminating null-character).

The length of the order ID strings pointed to by lpOrderID is limited to 24 characters (including the terminating null-character).

The length of the hardware ID strings pointed to by lpHardwareID is limited to 32 characters (including the terminating null-character).

The correct format of the version number strings pointed to by lpExpVersion should be X.X, X.XX, X.XXX, X.XXXX, which may only contain decimal digits.
Example
Sample application is located in \Examples\Delphi\KeyGen\ and \Examples\VC\KeyGen\ directory.
 
CopyRight(C) 2003 SDProtector.com All Rights Reserved