REGISTER 0.9 for Clipper Summer '87
Copyright (c) 1991 by Rick Dexter
REGISTER is a utility for Clipper Summer '87 that allows you to
distribute unregistered shareware applications, and provide the
user a method to register his or her copy without the need to send
special registered disks or have an external registration program.
All the code to register the application is built into the application
itself. Using simple tests, the programmer can determine whether or
not the copy of the program is registered, and take appropriate
action based upon the result.
To register an application, the user would need to type: REGISTER
And he would be presented with a screen in which he could fill in
his name and registration key, at which time the program would become
a registered copy if he entered the proper information.
This program is in beta form, and is being released for the sole
purpose of gathering bug reports and feedback from other programmers.
I retain all rights to the application, object code, source code,
documentation, and everything associated with the program. The first
few beta users who report bugs and give other helpful comments will
receive the non-beta version free of charge, at which time I will ask
for a registration fee for all other users.
In the meantime, this beta version may be used for the sole purpose
of testing the application. You may not distribute ANY APPLICATIONS
WHATSOEVER with this version of the program. If you check it out
with your application, test the heck out of it, and report the results
to me, I will make the non-beta version available to you (for a limited
number of users only)
The crypt/decrypt algorithms are not very complex, and REGISTER could
probably be broken by an experienced programmer. I believe sufficient
security exists, however, to prevent most users from being able to
bypass the registration keys.
I assume NO LIABILITY for any damage caused by REGISTER, including loss
of data, money, or anything else. You use REGISTER at your own risk.
The files included with this package are as follows:
REGISTER.OBJ Object code to link with your application
GENKEY.OBJ Link this to generate registration keys
TEST.PRG Sample source code on the use of REGISTER
TEST.LNK Plink86 linker file for the test source code
REGISTER.DOC This documentation file
The first think you have to do is link GENKEY.OBJ with your Clipper '87
libraries (CLIPPER.LIB and EXTEND.LIB) to create GENKEY.EXE, the program
which will generate registration keys. I didn't include the .EXE file
because I wanted to make the package as small as possible, and it is easy
enough to link using Plink. The syntax for GENKEY.EXE is as follows:
The program code will be explained in more detail later, but for now we
will consider it your unique code that you will embed in your application
that is used to check the user key to make sure it is valid. You will
use GENKEY each time a user registers the product, and it will generate
a six digit alpha-numeric "key" based upon an algorithm which will not
be discussed for maintaining as much security as possible.
Using REGISTER in your source code
Study the sample file, TEST.PRG to give you a better idea of how to use
REGISTER in your source file. I will go over each required line of the
source code here in some detail, so bear with me.
--> parameters p1
The PARAMETERS statement must be the first line in your main source code
file. It is used simply to determine if the user entered the "REGISTER"
parameter to your source code file. If you need to check for parameters
on the command line as well, you will need to make sure that you test
the first parameter for the word "REGISTER" before branching to your
routine that decodes the parameters.
--> public REG_KEY
This PUBLIC statement MUST be the second line in your source code file,
and the variable name MUST NOT BE CHANGED.
--> REG_KEY = 'Ad8jfKUNREGISTERED VERSION'
With this statement, you are simply assigning a value to the public
variable you defined above. The first six characters of this value
contains your unique registration key code, and you can change it to
any PRINTABLE character you wish, except a space. I have tested it
with dollar signed, parenthesis, and all kinds of things, but I wouldn't
get too crazy with non-alphanumeric characters. You must use the same
six character registration key in each distributed copy of the same
application. Refrain from changing it as much as possible, or tracking
which versions of which application contain which key can be a real mess!
The last part of the key contains the text "UNREGISTERED VERSION". DO NOT
misspell, change, or in any way alter this text. REGISTER will NOT WORK
if you change this string.
for example, you could change the key to:
REG_KEY = 'Ji8SdfUNREGISTERED VERSION'
but not to:
REG_KEY = 'Ji8SdfNOT REGISTERED'
--> if type('P1') = 'C'
--> if upper(P1) = 'REGISTER'
--> do REGISTER with PROCNAME()
These lines of code simply check for a user entered parameter, "REGISTER".
If the variable "P1" exists, and it is the word "REGISTER", it branches
to the register procedure in REGISTER.OBJ passing the name of the .EXE
file as a parameter. PROCNAME() should always contain the name of the
.EXE file as long as these lines are at the top of your main source file.
This ends the description of the only REQUIRED lines of code in your source
code file. Don't forget, these lines MUST BE the first several lines of your
application, before anything else.
Testing for Registered Application
There are several things available to you at any point in your application
where you wish to put them:
To display the registration name, use the following:
? 'Registered to ' + SUBSTR(REG_KEY,7,20)
To check if the program is registered, use the following code:
if REG_KEY = 'Ad8jfK'
? 'This program is not registered.'
REGISTERED = .f.
if CheckKey('Ad8jfK', substr(REG_KEY,1,6), substr(REG_KEY,7,20))
? 'This program is registered properly'
REGISTERED = .t.
? 'An attempt was made to change the EXE file'
The main thing to note here is that your six character registration key
is a constant in the tests. DO NOT PUT IT INTO A VARIABLE!! REGISTER
will NOT function properly if you do. What I normally do is to put this
test at the top of the program file, and set a logical variable to true
if the program is registered and false if it is not. Then I can use this
logical variable throughout the program at will, eliminating the need to
check a constant each time. You can then use this logical variable to
"lock out" features of the program, for example:
if .not. REGISTERED .and. reccount() >= 20
? 'You can only have 20 records in an unregistered version'
Compiling Your Application
When you compile your application, simply link REGISTER.OBJ into your
application with your other OBJ files. You DO NOT need to link in the
Using the TEST Sample
To see what register can do, compile and link TEST.PRG using the sample
LNK file included. Then type TEST by itself with no parameters.
You should see the following:
Registered to: UNREGISTERED VERSION
This program is not registered.
Then use the GENKEY application to find your user key:
GENKEY will then return a six character key. Write it down. Then type
A data entry screen will appear. Enter your first and last names EXACTLY
as you entered them in the GENKEY line, and then put in the six character
code it returned EXACTLY as it was displayed, and case is significant.
If you entered everything properly, you should see:
Program has been registered to
If you execute TEST again with no parameters, you should see the following:
This program is registered properly.
As I said before, REGISTER is being released in BETA version for test
purposes only. If you find any problems, bugs, or have any suggestions,
please write to me at PO Box 361472, Milpitas, CA 95035. I can also be
reached via the Saratoga Clone BBS at (408) 395-1402, or my Channel 1
account. I do not yet have a Compuserve ID, but one will be forthcoming.
Thanks for trying REGISTER!