home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
install
/
rkline
/
rkplus
/
rkplus.doc
< prev
next >
Wrap
Text File
|
1991-02-07
|
37KB
|
1,048 lines
RkPlus 2.0 (c) 1991 Serious Cybernetics
Turbo Pascal(tm) Registration Key Unit
by C. Scott Davis
-------------------------------------------------------------------------------
RkPlus is an enhanced version of the rKey Registration Key Unit. It is a Turbo
Pascal (tm) Unit designed to allow programmers to easily handle registration
keys in their software. All of the key encryption, checking and key file
routines are handled in RkPlus, requiring little effort on the part of the
programmer. It can allow anything from simple registration messages to
multiple registration levels and limited use demo keys.
There are two versions of RkPlus included here. RKPLUS.TPU runs under Turbo
Pascal (tm) 5.5 and RK6PLUS.TPU runs under Turbo Pascal (tm) 6.0. If you don't
feel that you need all of the enhanced features of RkPlus, you should obtain a
copy of rKey. The latest version of rKey and RkPlus (as well as other Serious
Cybernetics software) are always available for download and Fido file request
from Phoenix StarFighter BBS (see phone number and Fido address below).
All of the sample programs use RKPLUS.TPU. If you are using Turbo Pascal (tm)
6.0 and need the sample programs to use RK6PLUS.TPU, simply change :
Uses
RkPlus;
to
Uses
Rk6Plus;
The various sample programs demonstrate 2 methods of handling keys :
Method 1 : Distribute your program (for example, RKPDEMO.EXE) and use
a key file generation program (like RKPGFILE.EXE), which you
do NOT distribute, to create a key file for each user who
registers. You then send the user the key file.
Method 2 : Distribute your program (for example, RKPDEMO.EXE) and a
branding program (like RKPBRAND.EXE). You then use a key
generation program (like RKPGKEY.EXE), which you do NOT
distribute, to create a a key number for each user who
registers. You then send the user the key number, which
he/she enters into the brand program to create a key file.
-------------------------------------------------------------------------------
The following Types are defined in RkPlus :
Type
RegStatType = (
NotRegistered,
Registered,
ExpiredKey,
InvalidKey,
FileError,
NullOwnerCode,
NullProgramCode,
InvalidFile
);
RegRec = Record
Status : RegStatType;
KeyPath : String[79];
ID : String[36];
Name1 : String[36];
Name2 : String[36];
Name3 : String[36];
Message : String[36];
Level : Byte;
ExpYear : Word;
ExpMonth : Word;
Key : String[12];
End;
The following Constants are defined in RkPlus :
RkPlusVer = '2.0'; { contains the current version of RkPlus }
The following Variables are defined in RkPlus :
OwnerCode : String[20];
ProgramCode : String[16];
KeyFile : String[8];
BadSystemDate : Boolean;
Reg : RegRec;
The following Procedures and Functions are defined in RkPlus :
Function MakeKey(s1,s2,s3 : String;l : Byte;ey,em : Word) : String;
Function ValidKey(s1,s2,s3 : String;l : Byte;k : String) : Boolean;
Procedure SetRegInfo(t,s1,s2,s3,m : String;l : Byte;ey,em : Word;k : String);
Procedure CreateKey;
Procedure VerifyKey;
Procedure GetRegInfo;
Procedure SaveRegInfo;
-------------------------------------------------------------------------------
OwnerCode : String[20];
This variable is initialized by RkPlus to '' and must be assigned a value
before calling any of the RkPlus procedures or functions. It is used (along
with ProgramCode) to generate the registration keys. This variable should
probably be the same for all software written by a single person/company.
Since is it used to cause your keys to be different from those of other
programmers who are also using RkPlus, the more cryptic this variable is,
the more secure your keys will be.
Examples :
OwnerCode := 'TrendSoft, Inc.';
{
If the name of your company is 'TrendSoft, Inc.', this is probably NOT a good
OwnerCode. It would be easy for someone who knows the name of the company
to use the RkPlus unit to write a program that will generate keys for your
software.
}
OwnerCode := 'Trend&&Soft/Inc@';
{
This is better. It still uses the name of the company, but it is somewhat
masked by the insertion of other characters and would be harder for another
programmer to guess.
}
OwnerCode := 'Read$Make@Into';
{
This is MUCH better. It uses totally unrelated words that would be extremely
unlikely to be used by another programmer/company.
}
OwnerCode := 'EkQW3#m,-%\uSaXo^Ej7';
{
This is most likely the best, since it uses totally random symbols.
}
IMPORTANT : You should NOT use any of the actual examples used here or in
the sample programs included with RkPlus. If you do, anyone else
who uses the same example will have IDENTICAL keys!
-------------------------------------------------------------------------------
ProgramCode : String[16];
This variable is initialized by RkPlus to '' and must be assigned a value
before calling any of the RkPlus procedures or functions. It is used (along
with OwnerCode) to generate the registration keys. Unlike OwnerCode, it
doesn't neep to be particularly cryptic. There are several approaches to the
use of ProgramCode :
(1) If ProgramCode is set to the same value for several programs
written by a person/company, keys for one piece of software will
work on another piece of software. Using this approach, you
could have a single key for several programs.
(2) If each program has a different ProgramCode and the ProgramCode is
not changed when the program changes, keys for one version of the
program will work for all versions of the same program.
(3) If each program has a differenct ProgramCode and the ProgramCode is
changed when the program is changed, a different key will be
required for each version of the program.
Examples :
ProgramCode := 'RkStuff';
{
If you wrote a program called RkSample and a program called RkUtils and
you defined the ProgramCode as 'RkStuff' in both programs, a key for one
program would work for the other.
}
ProgramCode := 'RkSample';
{
If you wrote a program called RkSample and a program called RkUtils and
you defined the ProgramCode as 'RkSample' in RkSample and used a different
ProgramCode in RkUtils, a key for one would NOT work for the other.
}
ProgramCode := 'RkSample One';
{
If you wrote a program called RkSample and you defined the ProgramCode as
'RkSample One' in versions 1.1, 1.2 and 1.3 and then changed the
ProgramCode to 'RkSample Two' for version 2.0, the same key would work for
versions 1.1, 1.2 and 1.3 but would NOT work for version 2.0.
}
-------------------------------------------------------------------------------
KeyFile : String[8];
This variable is initialized by RkPlus to the name of the program (without path
or extension). If the name of the key file is to be different than the name of
the program, this variable should be assigned a value before calling any of the
RkPlus procedures or functions. It is the name of the keyfile that is read by
GetRegInfo and written to by SaveRegInfo. The extension will be '.REG'.
Examples :
KeyFile := 'RKSAMPLE';
{
The key file will be 'RKSAMPLE.REG'. Key files are always created and read
from the same directory that the program is in. This is true even if the
program is not in the current directory.
}
-------------------------------------------------------------------------------
BadSystemDate : Boolean;
This variable is initialized by RkPlus to TRUE, if the current system date
is 1-Jan-1980 (which usually indicates that the date was not set) or FALSE,
if the current system date is anything other than 1-Jan-1980.
The main purpose for this variable is for use with limited keys (with embedded
expiration dates). By testing BadSystemDate, your program can handle
situations where the system date was not set (therefore, causing expiration
dates to be meaningless).
Example :
If BadSystemDate then Begin
WriteLn('The system date must be set!');
Halt(1);
End;
{
If the system date was not set (BadSystemDate = True) then display a message
and exit with an ErrorLevel of 1.
}
-------------------------------------------------------------------------------
Reg.Status : RegStatType;
This field of the Reg record is initialized by RkPlus to NotRegistered. It is
set by CreateKey, VerifyKey, GetRegInfo and SaveRegInfo to the procedure
result.
The following are possible values for Reg.Status :
NotRegistered Program is not registered
Registered Program is registered
ExpiredKey Key has expired
InvalidKey Key is invalid
FileError .REG file is corrupt
NullOwnerCode OwnerCode has not been assigned a value
NullProgramCode ProgramCode has not been assigned a value
InvalidFile .REG file format error
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
If (Reg.Status = InvalidKey) then
WriteLn('The key file has been altered!')
Else If (Reg.Status = FileError) or (Reg.Status = InvalidFile) then
WriteLn('The key file is corrupt!');
{
This will call GetRegInfo. If the key contained in 'RKDEMO.REG' is invalid,
the message 'The key file has been altered!' will be displayed. Otherwise,
if the file is corrupt or has a format error, the message 'The key file is
corrupt!' will be displayed.
}
KeyFile := 'RKDEMO';
GetRegInfo;
Write('RkDemo 1.5');
If (Reg.Status = NotRegistered) then
WriteLn('[unregistered]')
Else If (Reg.Status = Registered) then
WriteLn('[registered]')
Else If (Reg.Status = ExpiredKey) then
WriteLn('[expired key]')
Else
WriteLn('[invalid key]');
{
This will call GetRegInfo. If the program is not registered, the message
'RkDemo 1.5 [unregistered]' will be displayed. If the program is registered,
the message 'RkDemo 1.5 [registered]' will be displayed. If the key has
expired, the message 'RkDemo 1.5 [expired key]' will be displayed. Otherwise,
the message 'RkDemo 1.5 [invalid key]' will be displayed.
}
-------------------------------------------------------------------------------
Reg.KeyPath : String[79];
This variable is initialized by RkPlus to ''. GetRegInfo and Register will set
Reg.KeyPath to the full directory, filename and extension of the key file. If
no key file was found, Reg.KeyPath will be set to ''.
Examples :
KeyFile := 'RKSAMPLE';
GetRegInfo;
If Reg.KeyPath <> '' then
WriteLn('Key file is ' + Reg.KeyPath);
{
The key file will be 'RKSAMPLE.REG'. After GetRegInfo is called, Reg.KeyPath
will contain the full pathname of the the key file, which is displayed (if it
is not '').
}
-------------------------------------------------------------------------------
Reg.ID : String[36];
This variable is initialized by RkPlus to ''. Reg.ID is not used by RkPlus,
and has no effect on key encryption. However, it is read from the .REG file by
GetRegInfo and written to the .REG file by SaveRegInfo. This will allow you to
ID your key files, so that your program can distinguish its own key files from
those of other programs.
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
Write('RkInfo v6.1');
If (Reg.ID <> 'RkInfo') then
WriteLn('Error! This is NOT an RkInfo key file!');
{
This will call GetRegInfo. If Reg.ID doesn't equal 'RkInfo', then the
message 'Error! This is NOT an RkInfo key file!' will be displayed.
}
-------------------------------------------------------------------------------
Reg.Name1 : String;
This variable is initialized by RkPlus to ''. It is used (along with Reg.Name2
and Reg.Name3) in the encryption of the registration key, by CreateKey,
VerifyKey and SaveRegInfo (which also writes it to the .REG file). It is read
from the .REG file, by GetRegInfo. This will normally contain the name of the
person that the software is registered to.
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
Write('RkDemo 1.5');
If (Reg.Status = NotRegistered) then
WriteLn('[unregistered]');
Else If (Reg.Status = Registered) then
WriteLn('[registered to ' + Reg.Name1 + ']')
Else
WriteLn('[invalid key]')
{
This will call GetRegInfo. If the program is not registered, the message
'RkDemo 1.5 [unregistered]' will be displayed. If the program is registered,
the message 'RkDemo 1.5 [registered to NAME]' will be displayed (with 'NAME'
replaced by the name of the person that the software is registered to).
Otherwise, the message 'RkDemo 1.5 [invalid key]' will be displayed. }
-------------------------------------------------------------------------------
Reg.Name2 : String;
This variable is initialized by RkPlus to ''. It is used (along with Reg.Name1
and Reg.Name3) in the encryption of the registration key, by CreateKey,
VerifyKey and SaveRegInfo (which also writes it to the .REG file). It is read
from the .REG file, by GetRegInfo. This may contain a company name, a BBS
name, or any additional information that you want to use in key encryption.
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
WriteLn('RkDemo 1.5');
WriteLn;
If (Reg.Status = NotRegistered) then
WriteLn('Remember to Register!');
Else If (Reg.Status = Registered) then Begin
WriteLn('Registered to ' + Reg.Name1 + '.');
WriteLn('For use at ' + Reg.Name2 + '.');
End Else
WriteLn('Invalid key!')
{
This will call GetRegInfo. If the program is not registered, the message
'Remember to Register!' will be displayed. If the program is registered, the
messages 'Registered to NAME' will be displayed (with 'NAME' replaced by the
name of the person that the software is registered to) and 'For use at
LOCATION' will be displayed (with 'LOCATION' replaced by the the value of
Reg.Name2). Other person that the software is registered to) and. Otherwise,
the message 'Invalid key!' will be displayed.
}
-------------------------------------------------------------------------------
Reg.Name3 : String;
This variable is initialized by RkPlus to ''. It is used (along with Reg.Name1
and Reg.Name2) in the encryption of the registration key, by CreateKey,
VerifyKey and SaveRegInfo (which also writes it to the .REG file). It is read
from the .REG file, by GetRegInfo. This may contain a customer number,
address, or any additional information that you want to use in key encryption.
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
WriteLn('RkDemo 1.5');
WriteLn;
If (Reg.Status = NotRegistered) then
WriteLn('Remember to Register!');
Else If (Reg.Status = Registered) then Begin
WriteLn('Registered to ' + Reg.Name1 + '.');
WriteLn(' ' + Reg.Name2 + '.');
WriteLn(' ' + Reg.Name3 + '.');
End Else
WriteLn('Invalid key!')
{
This will call GetRegInfo. If the program is not registered, the message
'Remember to Register!' will be displayed. If the program is registered, the
message 'Registered to NAME' will be displayed (with 'NAME' replaced by the
name of the person that the software is registered to), followed by a 2 line
address (from Reg.Name2 and Reg.Name3). Otherwise, the message 'Invalid key!'
will be displayed.
}
-------------------------------------------------------------------------------
Reg.Message : String[36];
This variable is initialized by RkPlus to ''. Reg.Message is not used by
RkPlus, and has no effect on key encryption. However, it is read from the .REG
file by GetRegInfo and written to the .REG file by SaveRegInfo. This will
allow you to ID your key files, so that your program can distinguish your key
files from those of other programers/companies.
Examples :
KeyFile := 'RKDEMO';
GetRegInfo;
Write('RkInfo v6.1');
If (Reg.ID <> 'TrendSoft, Inc.') then
WriteLn('Error! This is NOT a TrendSoft key file!');
{
This will call GetRegInfo. If Reg.Message doesn't equal 'RkInfo', then the
message 'Error! This is NOT a TrendSoft key file!' will be displayed.
}
Note : You should NEVER set Reg.Message equal to OwnerCode! This would cause
the value of OwnerCode to be written to your .REG files, and would
threaten the security of your registration keys.
-------------------------------------------------------------------------------
Reg.Level : BYTE;
This variable is initialized by RkPlus to 0. It is used in the encryption of
the registration key, by CreateKey, VerifyKey and SaveRegInfo (which also
writes it to the .REG file). It is read from the .REG file, by GetRegInfo.
If you don't wish to use registration levels, Reg.Level should always be 0.
Examples :
KeyFile := 'RKMISC';
GetRegInfo;
WriteLn('RkMisc 2.1 Menu');
WriteLn;
WriteLn('[D]isplay demos');
If (Reg.Status = Registered) then Begin
WriteLn('[E]nter data');
WriteLn('[P]rint reports');
If Reg.Level > 0 then
WriteLn('[G]raphs');
If Reg.Level > 1 then
WriteLn('[O]ther functions');
End;
{
This will call GetRegInfo. If the software is unregistered, registered with
and expired key, or registered with an invalid key, the following menu will be
displayed :
RkMisc 2.1 Menu
[D]isplay demos
If the software is registered at level zero (say for a $5 registration), the
following menu items would be available :
RkMisc 2.1 Menu
[D]isplay demos
[E]nter data
[P]rint reports
If the software is registered at level one (say for a $10 registration), the
following menu items would be available :
RkMisc 2.1 Menu
[D]isplay demos
[E]nter data
[P]rint reports
[G]raphs
If the software is registered at level two or higher (say for a $20 or more
registration), the following menu items would be available :
RkMisc 2.1 Menu
[D]isplay demos
[E]nter data
[P]rint reports
[G]raphs
[O]ther functions
In this way you can allow different levels of registration to allow the
program to provide different functions, WITHOUT having distribute different
programs for each registration level.
}
Note : Unlike the expiration date, which is binary encoded into the key
(and therefore can be extracted from any given key number), the
registration level is only used for the encryption of the key
and is stored in the key file (but can not be extracted from a
key number itself). Therefore, if you use registration levels,
you will need to make sure that the brand program or key file
creation program knows the registration level, because it can
NOT be determined from the key number alone (see RkpBrand for
more examples).
-------------------------------------------------------------------------------
Reg.ExpYear : Word;
Reg.ExpMonth : Word;
These variables are initialized by RkPlus to 0. They are binary-encoded into
the registration key, by CreateKey and SaveRegInfo. They are decoded from the
registration key by VerifyKey and GetRegInfo. writes it to the .REG file).
Valid values for Reg.ExpYear are 0 (No expiration) or 1991 to 2330. Valid
values for Reg.ExpMonth are 0 (No expiration) or 1 to 12. If you don't wish to
use expiration dates, Reg.ExpYear and Reg.ExpMonth should always be 0.
Examples :
Const
Months : Array[1..12] of String[3] =
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
KeyFile := 'RKPROG';
GetRegInfo;
If (Reg.Status = ExpiredKey) then
WriteLn('Your key expired 1-',Months(Reg.ExpMonth),'-',Reg.ExpYear)
Else If (Reg.Status = Registered) then
WriteLn('Your key will expire 1-',Months(Reg.ExpMonth),'-',Reg.ExpYear);
{
This will call GetRegInfo. If the key has expired, the message 'Your key
expired 1-MONTH-YEAR' will be displayed (with 'MONTH' replaced by Reg.ExpMonth
and 'YEAR' replaced by Reg.ExpYear). If the software is registered, the
message 'Your key will expire 1-MONTH-YEAR' will be displayed (with 'MONTH'
replaced by Reg.ExpMonth and 'YEAR' replaced by Reg.ExpYear).
}
-------------------------------------------------------------------------------
Reg.Key : String[12];
This variable is initialized by RkPlus to '000000000000'. It is set by
CreateKey and GetRegInfo. It is used by VerifyKey and SaveRegInfo. This
contains the 12 digit alphanumeric registration key as a string.
Examples :
KeyFile := 'RKMORE';
GetRegInfo;
If (Reg.Status <> Registered) then Begin
WriteLn('This version of RkMore is not registered.');
WriteLn('Please read the READ.ME file for more info.');
End Else
WriteLn('This version of RkMore is registered to ' + Reg.Name1 + '.');
WriteLn('Registration key is ' + Reg.Key + '.');
End;
{
This will call GetRegInfo. If the key contained in 'RKMORE.REG' is invalid
or the program is not registered, a message will be displayed telling the
user how to register the program. Otherwise, the name of the person that
that the program is registered to and the registration key will be
displayed.
}
-------------------------------------------------------------------------------
Function MakeKey(Name1,Name2,Name3 : String;
Level : Byte;
ExpYear,ExpMonth : Word) : String;
The function MakeKey will return a string containing the 12 digit registration
registration key for Names and Level (using the pre-defined values of OwnerCode
and ProgramCode) specified, with an encoded expiration date of ExpYear and
ExpMonth. If you do not wish to use registration levels, simply pass a 0 as
the Level parameter. If you do not wish to use expiration dates, simply pass 0
as the ExpYear and ExpMonth parameters. Unlike the higher-level CreateKey
procedure, this function does NOT use or change the values of the Reg record.
Examples :
OwnerCode := 'AZ771N91P03DJSS447';
ProgramCode := 'RkProg';
WriteLn('Registration Key Maker for RkProg');
WriteLn;
WriteLn('FOR INTERNAL USE ONLY!');
WriteLn;
Write('Enter name : ');
ReadLn(n);
Write('Enter company : ');
ReadLn(c);
Write('Enter phone number (XXX) XXX-XXXX : ');
ReadLn(p);
k := MakeKey(n,c,p,0,0,0); { registration levels and expiration dates
are not being used }
WriteLn;
WriteLn('Registration key is '+k);
{
This will display a warning message and then prompt for a name, company name
and phone number. MakeKey is then passed the name, company name and phone
number, a 0 for the registration level and 0 for expiration year and month.
It will return the key in the variable k, which is then displayed.
It is usually preferable to use the higher-level CreateKey procedure,
instead of MakeKey. MakeKey is included to allow for situations where
you may need to make a key and don't want to affect the values contained
in the Reg record.
}
-------------------------------------------------------------------------------
Function ValidKey(Name1,Name2,Name3 : String;
Level : Byte;
Key : String) : Boolean;
ValidKey will return TRUE, if Key is valid for Name1, Name2, Name3 and Level
(using the pre-defined values of OwnerCode and ProgramCode). If you do not
wish to use registration levels (and levels weren't used when the key was
generated), simply pass 0 as the Level parameter. If ValidKey returns FALSE,
the key is not valid. Unlike the higher-level procedure VerifyKey, this
function does NOT use or change the values of the Reg record.
Examples :
OwnerCode := 'dfk89ew32zg0imm02';
ProgramCode := 'RkProg One';
WriteLn('RkProg 1.3');
WriteLn;
Write('Enter your name : ');
ReadLn(n);
Write('Enter your BBS name : ');
ReadLn(b);
Write('Enter your FidoNet address : ');
ReadLn(f);
Write('Enter your registration key : ');
ReadLn(k);
If Not ValidKey(n,b,f,0,k) then Begin { registration levels are not used }
WriteLn('Invalid key!');
Halt(1);
End;
{
This program will prompt the user to enter a name, BBS name, FidoNet address
and a registration key. If the registration key is not valid, the program
will display 'Invalid key!' and Halt with an errorlevel of 1.
It is usually preferable to use the higher-level VerifyKey procedure,
instead of ValidKey. ValidKey is included to allow for situations where
you may need to validate a key and don't want to affect the values contained
in the Reg record.
}
-------------------------------------------------------------------------------
Procedure CreateKey;
The procedure CreateKey will use the pre-defined values of OwnerCode and
ProgramCode to generate a key, encrypted from Reg.Name1, Reg.Name2, Reg.Name3,
Reg.Level, Reg.ExpYear and Reg.ExpMonth, with and embedded expiration date,
returning the resulting key in Reg.Key. If you don't wish to use registration
levels, simply set Reg.Level to 0, before calling CreateKey. If you don't
wish to use expiration dates, simply set Reg.ExpYear and Reg.ExpMonth to 0,
before calling CreateKey.
CreateKey returns the following result codes in Reg.Status :
NullProgramCode OwnerCode was not set
NullOwnerCode ProgramCode was not set
Registered Key created successfully
Examples :
OwnerCode := 'AZ771N91P03DJSS447';
ProgramCode := 'RkProg';
WriteLn('Registration Key Maker for RkProg');
WriteLn;
WriteLn('FOR INTERNAL USE ONLY!');
WriteLn;
Write('Enter name : ');
ReadLn(Reg.Name1);
Write('Enter company : ');
ReadLn(Reg.Name2);
Write('Enter phone number (XXX) XXX-XXXX : ');
ReadLn(Reg.Name3);
Reg.Level := 0; { registration levels are not being used }
Reg.ExpYear := 0; { expiration dates are not being used }
Reg.ExpMonth := 0;
CreateKey;
WriteLn;
WriteLn('Registration key is '+Reg.Key);
{
This will display a warning message and then prompt for a name, company name
and phone number. CreateKey is called and the key is returned in Reg.Key,
which is displayed.
}
Note : It is possible to use CreateKey create keys and then to store the
contents of the Reg record into your own configuration file (instead
of using SaveRegInfo) and then read the information into your program
and use VerifyKey to verify that the key is valid (rather than using
GetRegInfo). This way you can keep registration information in your
own configuration file with other program information, rather than in
its own .REG file. If using this method, its important that you save
Reg.Name1, Reg.Name2, Reg.Name3, Reg.Level, Reg.ExpYear and
Reg.ExpMonth, so that keys will be built correctly. You should NEVER
save OwnerCode to a file of any kind, as this will compromise the
security of your keys.
-------------------------------------------------------------------------------
Procedure VerifyKey;
The procedure VerifyKey will use the pre-defined values of OwnerCode and
ProgramCode to generate a key, encrypted from Reg.Name1, Reg.Name2, Reg.Name3,
and Reg.Level, compare the resulting key to Reg.Key, returning the result in
Reg.Status and setting Reg.ExpYear and RegExpDate to the expiration date
encoded in the key. If you don't wish to use registration levels, simply set
Reg.Level to 0, before calling CreateKey.
VerifyKey returns the following result codes in Reg.Status :
NullProgramCode OwnerCode was not set
NullOwnerCode ProgramCode was not set
Registered Key is valid
InvalidKey Key is not valid
Examples :
OwnerCode := 'dfk89ew32zg0imm02';
ProgramCode := 'RkProg One';
WriteLn('RkProg 1.3');
WriteLn;
Write('Enter your name : ');
ReadLn(Reg.Name1);
Write('Enter your BBS name : ');
ReadLn(Reg.Name2);
Write('Enter your FidoNet address : ');
ReadLn(Reg.Name3);
Write('Enter your registration key : ');
ReadLn(Reg.Key);
Reg.Level := 0; { registration levels are not used }
VerifyKey;
If (Reg.Status <> Registered) then Begin
WriteLn('Invalid key!');
Halt(1);
End;
{
This program will prompt the user to enter a name, BBS name, FidoNet address
and a registration key. If the registration key is not valid, the program
will display 'Invalid key!' and Halt with an errorlevel of 1.
}
-------------------------------------------------------------------------------
Procedure GetRegInfo;
GetRegInfo will read the key file (if it exists) and set the value of the
following variables :
Reg.Name1 { set to the primary registration name }
Reg.Name2 { set to the secondary registration name }
Reg.Name3 { set to the third registration name }
Reg.Level { set to the registration level (0 if not used) }
Reg.ExpYear { set to the expiration year (0 if not used) }
Reg.ExpMonth { set to the expiration month (0 if not used)}
Reg.Key { set to the 12 digit alphanumeric registration key }
GetRegInfo would generally be called near the beginning of a program (after
OwnerCode, ProgramCode and KeyFile are defined).
GetRegInfo returns the following result codes in Reg.Status :
NotRegistered Program is not registered
Registered Program is registered with a valid key
ExpiredKey Registration key has expired
InvalidKey Program is registered with an invalid key
FileError File is corrupt
NullProgramCode OwnerCode was not set
NullOwnerCode ProgramCode was not set
InvalidFile File is not a RkPlus registration key file
Examples :
OwnerCode := '&,<;(##@["+|~~**=#))';
ProgramCode := 'RkTest';
KeyFile := 'RKTEST';
GetRegInfo;
If (Reg.Status = Registered) then
WriteLn('Registered to ' + Reg.Name1);
{
GetRegInfo will read 'RKTEST.REG'. If the program is registered, Reg.Status
will be set to Registered and the program will display the name of the person
that the program is registered to.
}
-------------------------------------------------------------------------------
Procedure SaveRegInfo;
The procedure SaveRegInfo will use the pre-defined values of OwnerCode and
ProgramCode to generate a key, encrypted from Reg.Name1, Reg.Name2, Reg.Name3,
Reg.Level, Reg.ExpYear and Reg.ExpMonth, with and embedded expiration date,
compare the resulting key with Reg.Key and writing the contents of the Reg
record to the keyfile, returning the result in Reg.Status. If you don't wish
to use registration levels, simply set Reg.Level to 0, before calling
SaveRegInfo. If you don't wish to use expiration dates, simply set Reg.ExpYear
and Reg.ExpMonth to 0, before calling SaveRegInfo.
SaveRegInfo returns the following result codes in Reg.Status :
Registered Key file was written successfully
InvalidKey Key is not valid
FileError Unable to write key file
NullProgramCode OwnerCode was not set
NullOwnerCode ProgramCode was not set
Examples :
OwnerCode := 'Keyboard*Sytem=Load';
ProgramCode := 'RkProg';
KeyFile := 'RKPROG';
WriteLn('RkProg Install Program');
WriteLn;
Write('Enter your name : ');
ReadLn(Reg.Name1);
Write('Enter your company name : ');
ReadLn(Reg.Name2);
Write('Enter your registration key : ');
ReadLn(Reg.Key);
Reg.Level := 0; { registration levels not used }
Reg.ExpYear := 0; { expiration dates not used }
Reg.ExpMonth := 0;
SaveRegInfo;
If (Reg.Status <> Registered) then
WriteLn('Invalid Key. Program not installed.');
{
This program will prompt the user for a name, company name and a registration
key. SaveRegInfo will then be called. If RegStatus does not equal Registered,
then an error occured and no key file was written (the program displays
'Invalid Key. Program not installed.'). Otherwise, RKPROG.REG is written).
-------------------------------------------------------------------------------
For more information on using RkPlus, see the sample Turbo Pascal (tm) programs
that are distributed with RkPlus, or contact me at any of the locations listed
below.
-------------------------------------------------------------------------------
RkPlus is shareware. You may copy and distribute RKPLUS20.ZIP freely. All I
ask is that you include all of the original files, unmodified, and that you do
not charge for the distribution of RkPlus itself. You may use RkPlus for
development of programs for your own use, to give away or to sell.
If you like RkPlus and use it to develop software, a registration fee of $20
or more toward the continued development of this unit and others like it
would be appreciated. See REGISTER.FRM for registration information.
All registrations of RkPlus ($20 or more) register both RkPlus AND rKey
(available as RKEY14.ZIP), allowing you to develop and distribute programs
using either one, or both. Everyone registering RkPlus with a registration fee
of $20 or more, will be entitled to have one piece of software (written using
RkPlus/rKey) listed, along with an address or phone number, in an application
list that will be included with all future versions of RkPlus/rKey.
Registrations in excess of $20 will allow multiple applications to be listed.
There are no royalties for the distribution of programs that are written
with RkPlus. A single registration fee entitles you to write and distribute
any number of programs using RkPlus and rKey.
If you have written an application using RkPlus, and wish to have it listed
in the APPLIST.TXT file that is distributed with RkPlus/rKey, please send the
following information via E/Mail, NetMail or US Mail :
Name of Application
Programmer's Name (optional)
Copyright Notice
Address or Phone Number
System Requirements
Cost of Program (optional)
Any Additional Information (optional)
Questions, comments, and suggestions are welcome.
Send E/Mail to Scott Davis
Phoenix StarFighter BBS [3/12/24/HST]
Phone (404) 869-3410
FidoNet Node 1:3616/20
Send US Mail to Scott Davis
Rt. 2 Box 95
County Line Drive
Lula, GA 30554
-------------------------------------------------------------------------------
I'd like to thank Danny Sosebee (Sysop of Phoenix StarFighter BBS) for
allowing me to use his BBS as a way to receive suggestions and comments
regarding RkPlus. Also, I'd like to thank Ed Ivey (Sysop of Ed's Place
BBS - 404/532-1978 - FidoNet Node 1:3616/1) for his continued support
and assistance in distributing my little software "projects".
-------------------------------------------------------------------------------
Turbo Pascal (tm) units available from Serious Cybernetics :
StrLib 1.2 TP 5.5 String Functions Library Unit
rKey 1.4 TP 5.5/6.0 Registration Key Unit
RkPlus 2.0 TP 5.5/6.0 Registration Key Unit (enhanced)
------------------------------------------------------------------------------
RkPlus (c) 1991 Serious Cybernetics
rKey, StrLib (c) 1990, 1991 Serious Cybernetics
Turbo Pascal (c) 1983, 1989 Borland International