Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : REG.ZIP
Filename : REG.DOC

 
Output of file : REG.DOC contained in archive : REG.ZIP
























Reg

Copyright (C)1991, David Monheit All Rights Reserved






For IBM PCs XTs ATs and PS2s or 100% Compatibles





















Clipper is a trademark of the Nantucket Corp
MS-DOS/MS C are trademarks of Microsoft



















Table of Contents

Chapter 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Recommendation . . . . . . . . . . . . . . . . . . 3
1.2 In the beginning... . . . . . . . . . . . . . . . . 3
1.3 Program Requirements . . . . . . . . . . . . . . . 3
1.4 Languages Supported . . . . . . . . . . . . . . . . 3
1.5 Models Supported . . . . . . . . . . . . . . . . . 4

Chapter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Registration Benefits . . . . . . . . . . . . . . . 5

Chapter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . 6
License . . . . . . . . . . . . . . . . . . . . . . . . 6

Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Warranty . . . . . . . . . . . . . . . . . . . . . . . . 7

Chapter 5 . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5.1 How It Works . . . . . . . . . . . . . . . . . . . 8
5.2 Using Reg . . . . . . . . . . . . . . . . . . . . . 8
5.3 Linking Reg in Your Applications . . . . . . . . . 9
5.4 Reg Return Values . . . . . . . . . . . . . . . . 10

Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . 11
Registering Users . . . . . . . . . . . . . . . . . . 11

Chapter 7 . . . . . . . . . . . . . . . . . . . . . . . . . 13
Conclusion . . . . . . . . . . . . . . . . . . . . . . 13

Appendix . . . . . . . . . . . . . . . . . . . . . . . . . 14




































3

Chapter 1

Introduction

1.1 Recommendation


A lot of information about Reg is contained in this manual. If
you don't want to read everything you should AT LEAST read the
entire section entitled 'Using Reg'. Pay close attention to the
instructions for linking Reg into your applications. You should
also read the license because by using Reg you are bound by the
terms in the license agreement.


1.2 In the beginning...

Reg was originally designed to provide an easy to use method of
registering software via a facsimile or telephone. It allows for
the enabling or disabling of any desired function in your code.
This is really usefull if you do not desire to maintain different
versions of your code ( for registered and un-registered users ).
Once a user registers, it becomes simply a matter of a few key
strokes to unleash all your program's features, without the
hastle of mailing disks or downloading from a BBS. Reg will also
keep a historical log of all the serial number and user
information entered to date.


1.3 Program Requirements


Reg should work properly with most system setups. The main
requirement is that DOS version 2.0 or above is needed for proper
operation.


1.4 Languages Supported


The current version of Reg supports C and Clipper applications.
There are two LIB files included that support the different
languages as follows:

o REG.LIB - Reg for C.

o REG_CLP.LIB - Reg for Summer '87 and Clipper 5.0.

Be sure to link the right library file for the language you're
using or Reg will not work properly!
















4

1.5 Models Supported


Reg was designed to support all of the standard memory models.
The Clipper version must always be in the large model ( due to
the extend system's requirements ) thus the large model is
included. The C shareware version, on the other hand, only
supports the SMALL memory model. To get Reg working with another
model you will need to register in order to get the source code.

The models supported by the shareware version of Reg are:

Language Shareware Model
-------- ---------------
C - SMALL model.
Clipper - LARGE model.

(Registered users can assemble the C version of Reg to any
desired memory model providing you have MSC 5 or above).















































5

Chapter 2


Registering Reg


Shareware is software that can be freely copied and shared with
others. Although the software may be freely distributed in
UNMODIFIED form it is still copyrighted software which the author
supports.

Shareware provides you a way to test software before spending
your money. This helps you get more for your dollar by allowing
you to test the software before paying.

The cost of registering Reg is $25.00. The registration form is
in the file called REG.REG.


2.1 Registration Benefits


Registering Reg provides the following benefits:

o You will receive a disk containing the C source
code for Reg. (MSC 5.0 or above required to compile
the source). This is important as you may then
personalize the password used in encryption algorithm,
change the .EXE file checked by Reg and you will also
be able to compile Reg for C in a different memory
model.

o No royalty fees.

o Once you've registered Reg you are free to use it with
any future executable applications you develop.

o The registered version does not display the
introductory screen during execution.



























6

Chapter 3

License


Your are being offered a license to use Reg on a TRIAL BASIS.
Unregistered versions may be used to write programs which will
only be used by yourself. Distribution of programs developed
with an UNREGISTERED version of Reg is a direct violation of this
license agreement.

Registered versions of Reg may be used by the REGISTERED
OWNER to develop programs that may be given away or sold without
additional license or fees.

The source code for Reg is provided to registered users to
allow development of specialized functions that suit your needs.
As a registered owner you have the right to edit or modify the
source code for YOUR OWN USE, but you may not give it away or
sell it in source or object form (this includes object
libraries). You may incorporate the code into your EXECUTABLE
programs (which may be given away or sold), as long as your
programs do not compete (directly or indirectly) with Reg.
Distribution of Reg or a derivative of Reg in object or
object library format requires prior written consent from the
author (a special license/price agreement can be made to allow
you to distribute Reg in object/object library format.
Please write if you're interested in this special license).

Businesses, government institutions, and other commercial users
of Reg MUST register.

If Reg is used in a commercial application the documentation must
give the author (David Monheit) credit for the development of
Reg.































7

Chapter 4

Warranty

With respect to the physical diskette sent to registered owners,
the author warrants the same to be free from defects in materials
and workmanship for a period of 60 days from the date
ofregistration. In the event of notification within the warranty
period of defects in material or workmanship the author will
replace the defective diskette. The remedy for breach of this
warranty shall be limited to replacement and shall not encompass
any other damages, including but not limited to loss of profit,
and special, incidental, consequential, or other similar claims.

The author specifically disclaims all other warranties, expressed
or implied, including but not limited to implied warranties of
merchantability and fitness for a particular purpose and the
program license granted herein in particular, and without
limiting operation of the program license with respect to any
particular application, use, or purpose. In no event shall the
author be liable for any loss of profit or any other commercial
damage resulting from the use (or inability to use) Reg, even if
the author has been advised ahead of time that the possibility
for damage exists.










































8

Chapter 5

Using Reg


This chapter covers how to use Reg. The next chapter will cover
the usage of the utility programs ( key and house ). Once you
understand how to incorporate Reg into your software, I will
then explain to you how to actually register your users.


5.1 How It Works


Reg works by performing a simple check just as your program gets
under way. It checks the KEY.EXE file for a serial number and a
key. Reg will then use the serial number and an in-built passord
( which you may change if you have the source code ) to compute a
string using Vigenere cipher derivative. If the string matches
the key read earlier from KEY.EXE, Reg will return true. If the
strings do not match, then Reg will obviously return false.


5.2 Using Reg


The prototype for Reg is as follows:

You will notice that the function names for the various flavors
are DIFFERENT! Please call the right one for the language you
are using.


** For the C Version ** int reg( void );

** For the Clipper Version ** REG_CLP()


Examples:

C

int Registered;

Registered = reg();

/* Registered will now be either 1 (good) or 0 (no good) */



















9

Clipper

PUBLIC Registered

Registered = reg_clp()

* Registered will now be either 1 ( good ) or 0 ( no good )

5.3 Linking Reg in Your Applications

Reg is distributed as a library file. The library file can be
linked to applications you develop allowing Reg to be called as a
function. As mentioned several times throughout this document
there are several versions of Reg. The first version that is
intended for use in programs written in C and it is called
REG.LIB. The second version for Clipper ( Summer '87 and Clipper
5.0 ) is called REG_CLP.LIB.

To link the files in with your application you simply include the
proper library name for the language you are using on the link
line. For example to link REG.LIB to a C application the command
line might look like:

link RC.OBJ,,,REG.LIB
^ ^
| |
| This is the Reg library.
|
This would be the first compiled C module for the
program you are writing!


An example link for the Clipper version of Reg might look
like:

plink86 fi RC lib clipper,extend,reg_clp
^ ^
| |
| This is the Reg
| library for Clipper.
|
This is the first compiled Clipper module!
























10

5.4 Reg Return Values


for C:

Return
Value Description
------ -----------
0 This copy of key.exe does not contain a proper
serial/key combination.

1 The combination is correct. Thus the program is
registered.


for Clipper:

Return
Value Description
------ -----------
F This copy of key.exe does not contain a proper
serial/key combination.

T The combination is correct. Thus the program is
registered.









































11

Chapter 6

Registering Users

It is KEY.EXE that actually contains the key/serial number
conbination used by Reg. These should, under normal
circumstances, be set to 0 prior to distribution. When Reg is
called, it actually opens the KEY.EXE file for binary input, and
moves the file pointer to the end of the file. There it finds
two numbers: The first is the serial number ( 00000000 ) and the
second is the key ( 00000000 ). It then closes KEY.EXE and
evaluates the combination for validity. If there is a match it
returns true, false otherwise.

THEREFORE, YOU MUST INCLUDE A COPY OF KEY.EXE ALONG
WITH YOUR PROGRAMS FILES.

When the user calls to register, you should get his personal
information ( name, address, company etc... ) and payment (
credit card for phone registrations or check etc... for mail ).
You then invoke the HOUSE.EXE program and fill in that
information along with your next serial number. HOUSE.EXE will
then generate the key that belongs to the serial number. You then
tell the user ( or mail him ) his serial number and key. He then
invokes KEY.EXE and "brands" his program. The next time that Reg
is invoked, it will obtain a valid serial/key pair and return
true!

For both KEY.EXE and HOUSE.EXE you move the cursor by using
the cursor keys. To move between fields, use the TAB key. To
quit without saving changes use the ESCAPE key. Finally, to save
your entry in HOUSE.EXE or to "brand" the KEY.EXE program use the
F10 key.

Note that by obtaining the source code for Reg, you will be
able to not only change the password used by Reg but also change,
if so desired, which file ( .EXE ) actually contains the
serial/key bytes.

It is important ot note that once an executable file is
linked, its size in bytes is written to its header. Thus any
bytes appended after this magic number are basically ignored by
the program. Thus, KEY.EXE is "padded" with some extra bytes
wich in turn contain the serial/key numbers. If you decide to
change the key file from KEY.EXE you will have to pad the new
executable file with about 30 bytes after linking is complete.




















12

This can easily be done as follows:

Assumptions:
a. Your .EXE is called test.exe.
b. Your dummy file is called dummy.

1. Create a dummy ASCII file of about 30 bytes in length.
2. At the DOS prompt type:

copy /b test.exe + dummy test.exe

This command will append dummy to test.exe, making it have an
extra 30 bytes after the "official" end of file.

You will also have to edit and recompile both KEY.C (the branding
program) and FILE_XXX.C (where XXX is either C or CLP) source
files to read and write the new .EXE file.

















































13

Chapter 7

Conclusion

There are various methods to prevent unathourized usage of a
program. Reg provides for an user transparent approach for such
protection. It can definitely be enhanced. The source code can
and should be used as the basis from which to start your own
protection scheme.

Have Fun.























































14

Appendix

As an additional example, the following lines of code will show
you how to limit the number of records a user can add to
"protected" database using Reg.

PUBLIC Registered && declare Registered public so it can
&& be accessed in any module

Registered = reg_clp() && check to see if this key.exe is okay.

SELECT 1
USE TEMP INDEX TEMP && use some dummy database
.
Your code here
.

* Now it is time to append a new record to the database

If Registered

Do Update && Reg returned okay. So we
&& append a record and fill it in.
else && Reg returned false. So this
&& program is not registered!
if reccount() <= 10

Do Update

else

clear
@ 10 ,10 SAY "Sorry, but only 10 records are " ;
"allowed in this"
@ 11, 10 SAY "unregistered demo program."

endif

endif

procedure Update

append blank
replace ...
replace ...
replace ...

return













  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : REG.ZIP
Filename : REG.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/