Instant KeyCheck API Function

The InstantProtection function is the instant function that needs only one parameter, which is the System Image file (.SIF). The function performs all tasks to protect the application, including detecting the Key, displaying registration dialog boxes, enforcing the license, etc.

 

note NOTE: The InstantProtection function provides software copy protection and license enforcement to the application. However, it does not provide code protection as in the case of the shell protection (via ElecKey Integrator), such as encrypting code sections, protecting against debugging.

 

note NOTE: It is recommended to use the API functions SetKeyValue and GetKeyValue along with the InstantProtection function. These functions allow you to create a series of random challenge/response between the application and the Key that can help to protect your application against cracking and emulating DLL. Please see the provided code examples how to use SetKeyValue/GetKeyValue with the InstantProtection function.

Usage Example

The following examples demonstrate how to interface the InstantProtection function to protect a Hello World program.

C#

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Ekc;

 

namespace HelloWorld

{

    public partial class FormMain : Form

    {

        InstantKeyCheck Kc;

        public FormMain()

        {

            Kc = new InstantKeyCheck();

            Kc.KeyID = 1111111111;  // Key ID

            Kc.ProgramID = 0;       // Program ID

            Kc.ModuleID = 0;        // Module ID

            Kc.AppPath = Application.ExecutablePath;

            Kc.SystemImageFile = Application.StartupPath + @"\Prg0.sif";    // System Image file

            InitializeComponent();

        }

 

        private void FormMain_Load(object sender, EventArgs e)

        {

            if (!Kc.InstantProtection(Handle))

            {

                if(Kc.ErrStr != "")

                    MessageBox.Show(Kc.ErrStr, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Close();

                return;

            }

        }

    }

}

 

VB.NET

Public Class FormMain

    Public Kc As InstantKeyCheck

   

    Sub New()

        Kc = New InstantKeyCheck

        Kc.KeyID = 1111111111   ' Key ID

        Kc.ProgramID = 0        ' Program ID

        Kc.ModuleID = 0         ' Module ID

        Kc.AppPath = Application.ExecutablePath

        Kc.SystemImageFile = Application.StartupPath + "\Prg0.sif" ' System Image File

 

        InitializeComponent()

    End Sub

 

    Private Sub FormMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Not Kc.InstantProtection(Handle) Then

            If (Kc.ErrStr <> "") Then

                MessageBox.Show(Kc.ErrStr, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

            End If

            Close()       

        End If

    End Sub

 

End Class

 

Delphi

unit Main;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, InstantKeyCheck;

 

type

  TFormMain = class(TForm)

    Label1: TLabel;

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  FormMain: TFormMain;

  Kc: TInstantKeyCheck;

 

implementation

 

{$R *.dfm}

 

procedure TFormMain.FormCreate(Sender: TObject);

begin

    Kc := TInstantKeyCheck.Create();

    Kc.KeyID := 1111111111;  // Key ID

    Kc.ProgramID := 0;       // Program ID

    Kc.ModuleID := 0;        // Module ID

    Kc.AppPath := Application.ExeName;       

    Kc.SystemImageFile := ExtractFileDir(Application.ExeName) + '\Prg0.sif'; // System Image File

    if not Kc.InstantProtection(Handle) then

    begin

        if Kc.ErrStr <> '' then

            MessageDlg(Kc.ErrStr, mtError, [mbCancel], 0);

        Application.Terminate();

        Exit;   

    end;

end;

 

end.

See Also

·         System Image File