DLLs

DLLS

SmartLicMan(64).dll

In essence, the SmartLicMan(64).dll encapsulates the Datasnap interface, eliminating the need to embed Datasnap libraries into the project, as they are only available in Delphi Enterprise or higher versions.

ILicenseAccess

  ILicenseAccess = interface    ['{9CBCF2F4-6207-4CD7-BE89-27CAA1486CBD}']    function ValidLicense(ASystemUser, ASystemPassword: PChar; AHost: PChar; APort: Integer;       APathInfo: PChar; AUserName, ALicenseKey, AWorkplaceID, AClientUser, AClientIP: PChar;       AAnswer: ILicenseAnswer; ASSL: Boolean; AProxySettings: IProxySettings = nil): TLicenseResultCode;    function DisconnectClient(ASystemUser, ASystemPassword: PChar; AHost: PChar; APort: Integer;       APathInfo: PChar; ASSL: Boolean; ASessionID: PChar; AProxySettings: IProxySettings = nil): Boolean;  end;

ValidLicense Function 

This function likely deals with validating a user license on a server. Here's a breakdown of the parameters:

In simpler terms: This function is called to validate a user's license on a server. It takes various details about the user, license, and machine and checks them against the server's records. The AAnswer object likely provides the result of the validation and potentially additional information.

ILicenseAnwer

ILicenseAnswer is an interface that is populated by the ValidLicense function and becomes available with updated data after calling ValidLicense:


  ILicenseAnswer = interface    ['{E9868003-838B-4A1D-ACFC-E138D651B9BD}']    // getter, setter...    // getter, setter...    property DaysLeft: Integer read GetDaysLeft write SetDaysLeft;    property &Message: PChar read GetMessage write SetMessage;    property Product: PChar read GetProduct write SetProduct;    property NextClientCheckDate: Integer read GetNextClientCheckDate write SetNextClientCheckDate;    property SessionId: PChar read GetSessionId write SetSessionId;    property MaximumExceeded: Boolean read GetMaximumExceeded write SetMaximumExceeded;    property MaxCount: Integer read GetMaxCount write SetMaxCount;    property LicenseModel: Integer read GetLicenseModel write SetLicenseModel;    property LicenseIsEnding: Boolean read GetLicenseIsEnding write SetLicenseIsEnding; // real license end    property ServerLicenseExpired: Boolean read GetServerLicenseExpired write SetServerLicenseExpired;    procedure Clear;  end;

Feel free to query all properties of this object and personalize your license validation accordingly.

Here is a more detailed explanation of the code:

The Clear procedure clears all of the properties of the class.

To use the ILicenseAnswer class, you would first call the ValidLicense function to populate the class with data. You can then access the properties of the class to get information about the license.

IProxySettings

The AProxySettings: IProxySettings parameter from ValidLicense is currently not used extensively. It can currently be simply ignored.

DisconnectClient Function 

This function seems to be responsible for disconnecting a client from the server. Here's a breakdown of the parameters:

In simpler terms: This function is used to terminate a client's session on the server. It takes authentication details for the server and the ID of the client to be disconnected.


The SmartClientReg(64).dll: Convenient Encapsulation of Client-Side Functions

The SmartClientReg(64).dll provides a convenient way to encapsulate client-side functionality for license management and offline operation. It handles the functionality of not having to go online every time, as indicated by the "latest online sync date" and "Client online check interval" fields.

To achieve this, the DLL stores data in the registry under a key that you can choose when using the DLL. The data is encrypted to ensure security.

Data Stored in the Registry:

The values that end with "Hash" are encrypted using a hardware ID in this case, so that any modification or distribution of the keys is "noticed". This can be controlled through functions from the DLL via the ILocalLicense interface.

Hints

The ExpireDate field is populated through two methods:

a) Either by the online interval, e.g., 14 days. b) Or by the "true" expiration date. In this case, LicenseIsEnding is true!

If LicenseIsEnding is false and ExpireDate is greater than Date, then the "real" license has not expired, but you should still notify the user (as a reason) that they need to go online to synchronize with the server.

Please note

You are not obliged to use the DLL. It offers convenient integration for expected functionality.

Delphi Examples

Several Delphi examples are provided to demonstrate the access and interaction of the system. You can of course use the code from these examples and adapt it to your own needs.

ILocalLicense Interface:

The ILocalLicense interface is structured as follows:

type  TCryptEvent = function(Sender: TObject; ACryptString: PChar): PChar of object;
  ILocalLicense = interface    ['{D39A0BD7-9F33-4842-9B78-42DFB4F04259}']    // Properties    function GetSalt: PChar;    procedure SetSalt(const Value: PChar);    property Salt: PChar read GetSalt write SetSalt;
    function GetUserName: PChar;    procedure SetUserName(const Value: PChar);    property UserName: PChar read GetUserName write SetUserName;
    function GetKeyCode: PChar;    procedure SetKeyCode(const Value: PChar);    property KeyCode: PChar read GetKeyCode write SetKeyCode;
    function GetRegistryPath: PChar;    procedure SetRegistryPath(const Value: PChar);    property RegistryPath: PChar read GetRegistryPath write SetRegistryPath;
    function GetProduct: PChar;    procedure SetProduct(const Value: PChar);    property Product: PChar read GetProduct write SetProduct;
    function GetExpireDate: TDate;    procedure SetExpireDate(Value: TDate);    property ExpireDate: TDate read GetExpireDate write SetExpireDate;
    function GetLicenseIsEnding: Boolean;    procedure SetLicenseIsEnding(Value: Boolean);    property LicenseIsEnding: Boolean read GetLicenseIsEnding write SetLicenseIsEnding;
    // Functions    function InternetConnected: Boolean;    function DateManipulated: Boolean;    function NeedOnlineCheck: Boolean;    function ProductManipulated: Boolean;    function LicenseIsEndingManipulated: Boolean;    function OfflineLicenseManipulated: Boolean;    function Manipulated: Boolean;
    // System    function GetWorkplaceID: PChar;    function Encrypt(AValue: PChar): PChar;    function Decrypt(AValue: PChar): PChar;    function GetIPAddress: PChar;    function GetWUserName: PChar;
    ///  If you set the OnEncryption and OnDecryption events    ///  from the Delphi interface ILocalLicense and thus    ///  overwrite the original encryption algorithm from the DLL,    ///  you must also manually adjust the password in the generated    ///  settings file afterwards, since the SmartConfigurator    ///  naturally does not know your own algorithm.
    function GetEncryption: TCryptEvent;    procedure SetEncryption(const Value: TCryptEvent);    property OnEncryption: TCryptEvent read GetEncryption write SetEncryption;
    function GetDecryption: TCryptEvent;    procedure SetDecryption(const Value: TCryptEvent);    property OnDecryption: TCryptEvent read GetDecryption write SetDecryption;  end;

Properties of the ILocalLicense Interface:

Salt:

UserName:

RegistryPath:

Product:

ExpireDate:

LicenseIsEnding:

Functions:

InternetConnected:

DateManipulated:

NeedOnlineCheck:

ProductManipulated:

LicenseIsEndingManipulated:

OfflineLicenseManipulated:

Manipulated:

System Functions:

GetWorkplaceID:

Encrypt:

Decrypt:

GetIPAddress:

GetWUserName:

Optional Events:

OnEncryption:

OnDecryption:

Please note

If you set the OnEncryption and OnDecryption events from the Delphi interface ILocalLicense and thus overwrite the original encryption algorithm from the DLL, you must also manually adjust the password in the generated settings file afterwards, since the SmartConfigurator naturally does not know your own algorithm.

Registry

When you use the SmartClientReg(64).dll and its functions through the interface, the registry key looks as follows: