Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #8109

Re: Licensing a COM DLL

From "Jamal Assaf" <someone@example.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Licensing a COM DLL
Date 2015-05-14 08:58 -0400
Organization albasani.net
Message-ID <mj266a$bhd$1@news.albasani.net> (permalink)
References <mivs68$21n$1@news.albasani.net> <42443524-b792-4523-9632-8df72d0a365f@googlegroups.com>

Show all headers | View raw


Hi Johan,

Good idea. Thanks!

Jamal

"Johan Nel"  wrote in message 
news:42443524-b792-4523-9632-8df72d0a365f@googlegroups.com...

Hi Jamal,

What I normally do is to have a .ini file with something like:

[MyProduct]
company=Northwind
licensekey=12345

Then in my program/class or what I want to restrict:

METHOD License() AS LOGIC
LOCAL nKey AS DWORD
LOCAL sCompany AS STRING // Read company from ini file
LOCAL lLicensed AS LOGIC

lLicensed := EncryptS2N(sCompany) == licensekey_from_ini
RETURN lLicensed  // Call this method during Init() and throw an error if it 
fails.

FUNCTION EncryptS2N(s AS STRING) AS DWORD
// Simple function to convert a string to a numeric
LOCAL sGarbage := "@#$@%LKlaskjfs;lasklj@#$@##@" AS STRING
LOCAL nEncrypt := 0 AS DWORD
LOCAL nSLen, nELen, nC AS INT
nSLen := SLen(s)
nELen := SLen(sGarbage)

nEncrypt := SLen(sGarbage)
FOR nC := 1 UPTO nSLen
  nEncrypt += Asc(SubStr(s, nC, 1))
NEXT
nEncrypt *= nELen
FOR nC := 1 UPTO nELen
  nEncrypt += Asc(SubStr(sGarbage, nC, 1))
NEXT
nEncrypt *= nSLen
RETURN nEncrypt

You can implement the EncryptS2N as complicated as you want.  Write your own 
little application that will populate the license key based on your 
encryption and distribute the .ini file to licensed users.

HTH,

Johan Nel
Vulcan VIP
Durban, South Africa. 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Licensing a COM DLL "Jamal Assaf" <someone@example.com> - 2015-05-13 11:55 -0400
  Re: Licensing a COM DLL Johan Nel <johan.nel@xsinet.co.za> - 2015-05-14 00:44 -0700
    Re: Licensing a COM DLL "Jamal Assaf" <someone@example.com> - 2015-05-14 08:58 -0400

csiph-web